Class PluginLifecycleHandler

  • Direct Known Subclasses:
    StandardPluginLifecycleHandler

    public abstract class PluginLifecycleHandler
    extends java.lang.Object
    Manager class that handles plug-in life cycle related logic. This class is part of standard implementation of plug-in manager, other implementations may not use it at all. The main purpose of this class is to simplify customization of plug-in manager behavior.
    Version:
    $Id$
    • Constructor Detail

      • PluginLifecycleHandler

        public PluginLifecycleHandler()
    • Method Detail

      • init

        protected void init​(PluginManager aManager)
        Initializes this handler instance. This method called once during this handler instance life cycle.
        Parameters:
        aManager - a plug-in manager, this handler is "connected" to
      • getPluginManager

        protected PluginManager getPluginManager()
        Returns:
        instance of plug-in manager, this handler is "connected" to
      • configure

        protected abstract void configure​(ExtendedProperties config)
        Configures this handler instance. Note that this method should be called once before init(PluginManager), usually this is done in object factory implementation.
        Parameters:
        config - handler configuration data
      • createPluginClassLoader

        protected abstract PluginClassLoader createPluginClassLoader​(PluginDescriptor descr)
        This method should create new instance of class loader for given plug-in.
        Parameters:
        descr - plug-in descriptor
        Returns:
        class loader instance for given plug-in
      • createPluginInstance

        protected abstract Plugin createPluginInstance​(PluginDescriptor descr)
                                                throws PluginLifecycleException
        This method should create new instance of plug-in class. No initializing logic should be executed in new class instance during this method call.
        Note that this method will NOT be called for those plug-ins that have NO class declared in plug-in descriptor i.e., method PluginDescriptor.getPluginClassName() returns blank string or null.
        Parameters:
        descr - plug-in descriptor
        Returns:
        new not initialized instance of plug-in class
        Throws:
        PluginLifecycleException - if plug-in class can't be instantiated for some reason
      • beforePluginStart

        protected abstract void beforePluginStart​(Plugin plugin)
                                           throws PluginLifecycleException
        This method will be called by PluginManager just before starting plug-in. Put here any "initializing" logic that should be executed before plug-in start.
        Parameters:
        plugin - plug-in being starting
        Throws:
        PluginLifecycleException - if plug-in can't be "initialized"
      • afterPluginStop

        protected abstract void afterPluginStop​(Plugin plugin)
                                         throws PluginLifecycleException
        This method will be called by PluginManager just after stopping plug-in. Put here any "un-initializing" logic that should be executed after plug-in stop.
        Parameters:
        plugin - plug-in being stopping
        Throws:
        PluginLifecycleException - if plug-in can't be "un-initialized"
      • dispose

        protected abstract void dispose()
        Should dispose all resources allocated by this handler instance. No methods will be called for this class instance after executing this method.