Class 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 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 generic IFCPlugin 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) and Object.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 the IFCPlugin class.
        listener - The listener which will be called.