Package de.xima.fc.plugin.lifecycle
Class PluginLifecycleEventManager
- java.lang.Object
-
- de.xima.fc.plugin.lifecycle.PluginLifecycleEventManager
-
public class PluginLifecycleEventManager extends Object
Manages the events listeners for the portal runtime. Provides methods for registering and deregistering listeners, as well as a method to call the listeners in case an plugin event occurred.- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <TPlugin extends IFCPlugin>
voidderegisterListener(EPluginLifecycleEvent event, Class<TPlugin> pluginType, IPluginLifecycleListener<TPlugin> listener)
Deregisters a listener for a plugin event and a certain plugin type.static void
deregisterListeners()
Deregisters all listeners.static void
deregisterListeners(EPluginLifecycleEvent event)
Deregisters all listeners for a plugin event.static void
deregisterListeners(EPluginLifecycleEvent event, Class<? extends IFCPlugin> pluginType)
Deregisters all listeners for a plugin event and a certain plugin type.static void
fireEvent(EPluginLifecycleEvent event, PluginRuntime pluginRuntime, IFCPlugin plugin)
Calls all registered events listeners for the given event.static <TPlugin extends IFCPlugin>
voidregisterListener(EPluginLifecycleEvent event, Class<TPlugin> pluginType, IPluginLifecycleListener<TPlugin> listener)
Registers a listener for a plugin event.
-
-
-
Method Detail
-
deregisterListener
public static <TPlugin extends IFCPlugin> void deregisterListener(EPluginLifecycleEvent event, Class<TPlugin> pluginType, IPluginLifecycleListener<TPlugin> listener)
Deregisters a listener for a plugin event and a certain plugin type.- Type Parameters:
TPlugin
- Type of the plugin to which the listener is limited.- Parameters:
event
- Type of event for which to register a listener.pluginType
- Type of plugins for which the listener is called.listener
- The listener that should be removed.
-
deregisterListeners
public static void deregisterListeners()
Deregisters all listeners.
-
deregisterListeners
public static void deregisterListeners(EPluginLifecycleEvent event)
Deregisters all listeners for a plugin event.- Parameters:
event
- Type of event for which to register a listener.
-
deregisterListeners
public static void deregisterListeners(EPluginLifecycleEvent event, Class<? extends IFCPlugin> pluginType)
Deregisters all listeners for a plugin event and a certain plugin type.- Parameters:
event
- Type of event for which to register a listener.pluginType
- Type of plugins for which the listener is called.
-
fireEvent
public static void fireEvent(EPluginLifecycleEvent event, PluginRuntime pluginRuntime, IFCPlugin plugin) throws FCPluginException
Calls all registered events listeners for the given event.- Parameters:
event
- The event that occurred.pluginRuntime
- The current plugin runtime.plugin
- The current plugin.- Throws:
FCPluginException
- When any of the registered listeners throws.
-
registerListener
public static <TPlugin extends IFCPlugin> void registerListener(EPluginLifecycleEvent event, Class<TPlugin> pluginType, IPluginLifecycleListener<TPlugin> listener)
Registers a listener for a plugin event. Each listener is registered for a certain type of event, such as after the plugin was installed or before it is shut down. Also, you may limit the listener to plugins of a specific type by passing that plugin interface class. In case you want to listen to all plugins, pass the genericIFCPlugin
class.It is possible to register multiple listeners for the same event and the same plugin type. Note however, that you cannot register the same listener twice. Whether two listeners are the same is determined by their
Object.equals(Object)
andObject.hashCode()
methods.- Type Parameters:
TPlugin
- Type of the plugin to which the listener is limited.- Parameters:
event
- Type of event for which to register a listener.pluginType
- Type of plugins for which the listener will be called. To listen to all plugins, pass theIFCPlugin
class.listener
- The listener which will be called.
-
-