|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.gadgets.publisher.internal.PluginGadgetFinder
public class PluginGadgetFinder
Notifies a series of PluginGadgetSpecEventListener
implementations when gadget specs are enabled and disabled
by plugins. When the constructor completes, all of the specified event listeners will have been notified of the
currently-enabled plugin gadget specs, by calling each listener's PluginGadgetSpecEventListener.pluginGadgetSpecEnabled(PluginGadgetSpec)
method for each enabled PluginGadgetSpec
retrieved from pluginAccessor
. Subsequently, for the entire
lifespan of this object, each listener will be notified as plugin gadget specs are enabled by calling its pluginGadgetSpecEnabled(PluginGadgetSpec)
method for each enabled gadget spec, and as plugin gadget specs are
disabled by calling its PluginGadgetSpecEventListener.pluginGadgetSpecDisabled(PluginGadgetSpec)
method for
each disabled gadget spec. These calls may happen on multiple threads, so all PluginGadgetSpecEventListener
implementations must be thread-safe.
pluginGadgetSpecEnabled
calls for the same
gadget spec without an intervening pluginGadgetSpecDisabled
call, as well as pluginGadgetSpecDisabled
called with a gadget spec that was not previously passed to a pluginGadgetSpecEnabled
call.
This class will never pass a null
argument to listener methods.
The eventListeners
iterable is not copied, and is considered "live" in the sense that listeners can be added
or removed from the underlying collection in order to register and unregister listeners to be notified. The iterable
must be thread-safe and support concurrent iteration and modification without ever throwing ConcurrentModificationException
, and without requiring explicit synchronization or locking by the caller.
Any Iterator
returned must support the contract of Iterator
. Specifically,
if Iterator.hasNext()
is called at any time and returns true
, the next call to Iterator.next()
, whenever it occurs, must return a non-null
PluginGadgetSpecEventListener
, and must not throw NoSuchElementException
or any
other exception. The returned PluginGadgetSpecEventListener
may, however, refuse to handle
further events by throwing a RuntimeException
implementation of its choosing. This will not affect the
notification of other listeners.
The intent is that eventListeners
will be an OSGi service collection injected by Spring Dynamic Modules,
which guarantees the behavior documented above.
Constructor Summary | |
---|---|
PluginGadgetFinder(com.atlassian.plugin.PluginAccessor pluginAccessor,
com.atlassian.plugin.event.PluginEventManager pluginEventManager,
Iterable<PluginGadgetSpecEventListener> eventListeners)
Creates a new PublishedGadgetFinder . |
Method Summary | |
---|---|
void |
pluginModuleDisabled(com.atlassian.plugin.event.events.PluginModuleDisabledEvent event)
Called by the plugin framework when plugin modules are disabled. |
void |
pluginModuleEnabled(com.atlassian.plugin.event.events.PluginModuleEnabledEvent event)
Called by the plugin framework when plugin modules are enabled. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PluginGadgetFinder(com.atlassian.plugin.PluginAccessor pluginAccessor, com.atlassian.plugin.event.PluginEventManager pluginEventManager, Iterable<PluginGadgetSpecEventListener> eventListeners)
PublishedGadgetFinder
.
pluginAccessor
- the PluginAccessor
for the host application, used to get the list of currently
enabled plugin modules. Must not be null
, or a NullPointerException
will be thrown.pluginEventManager
- the PluginEventManager
of the host application, used to register this PublishedGadgetFinder
to receive events when plugin modules are enabled and disabled.
Must not be null
, or a NullPointerException
will be thrown.eventListeners
- the event listeners that will be notified when gadget specs are enabled or disabled.
Must not be null
, or a NullPointerException
will be thrown. Must be
safe for concurrent iteration and modification, and all elements returned by iterating
over it must be thread-safe.
NullPointerException
- if any argument is null
Method Detail |
---|
public void pluginModuleEnabled(com.atlassian.plugin.event.events.PluginModuleEnabledEvent event)
event
- the event fired because a plugin module has been enabled. Must not be null
, or a NullPointerException
will be thrown.
NullPointerException
- if event
is null
.public void pluginModuleDisabled(com.atlassian.plugin.event.events.PluginModuleDisabledEvent event)
event
- the event fired because a plugin module has been disabled. Must not be null
, or a NullPointerException
will be thrown.
NullPointerException
- if event
is null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |