Extension: Difference between Singleton and Describable/Descriptor pattern
265 views
Skip to first unread message
rishabhb...@gmail.com
unread,
Jul 24, 2020, 5:56:41 AM7/24/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Jenkins Developers
Hi all,
In the documentation, it says that for an extension point where "users should be able to configure zero or more instances of some things you define", Describable/Descriptor pattern is preferred over Singleton pattern.
From a design point of view, which pattern is better when implementing an extension point where one or more instance might try to send the same thing?
Also, I've seen that mostly the Descriptor pattern has been used with extensions linked to the UI. Is it a necessary condition?
Thanks, Rishabh Budhouliya
Jesse Glick
unread,
Jul 24, 2020, 8:20:15 AM7/24/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Jenkins Dev
An `ExtensionPoint` is implemented by classes marked `@Extension`,
which are singletons contributed by plugins, sometimes known as a
service registry pattern. This is the fundamental mechanism by which
Jenkins plugins add functionality. An admin does not configure the
_set_ of extensions, though a particular extension may have
configurable properties (typically as a `GlobalConfguration`).
Extensions need not have any presence in the UI whatsoever. They are
found via `ExtensionList`.
A `Descriptor` is a special kind of extension which registers an
implementation class of associated `Describable`, sometimes also
serving as a factory. `Describable` instances are defined by an admin
or other user via the GUI or configuration-as-code, use
`@DataBoundConstructor` & `@DataBoundSetter`, are intended to be
persisted using XStream, and are typically values of a property or
elements of a list defined in turn by something else—a job property, a
build step, a piece of global configuration, some other `Describable`,
etc.
I am not sure exactly which documentation you are referring to but
perhaps it needs to be patched.
rishabhb...@gmail.com
unread,
Jul 24, 2020, 9:15:35 AM7/24/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jenkin...@googlegroups.com
Thanks for the description Jesse, thats probably the clearest I have seen it explained so far :)
-mike
——
“What makes us unhappy is to want. Yet if we would learn to cut our wants to nothing, the smallest thing we’d get would be a true gift.”
― Carlos Castaneda, Separate Reality: Conversations With Don Juan
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to jenkin...@googlegroups.com
I'd love to see more info about this. I had similar difficulty
understanding the difference back when I was working on the secret
textarea UI widget, and I had wanted to do some research to write a
blog post about it, but that was well over a year ago by now.
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.