Package org.java.plugin.standard
Class PluginLifecycleHandler
java.lang.Object
org.java.plugin.standard.PluginLifecycleHandler
- Direct Known Subclasses:
StandardPluginLifecycleHandler
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidafterPluginStop(Plugin plugin) This method will be called byPluginManagerjust after stopping plug-in.protected abstract voidbeforePluginStart(Plugin plugin) This method will be called byPluginManagerjust before starting plug-in.protected abstract voidconfigure(ExtendedProperties config) Configures this handler instance.protected abstract PluginClassLoaderThis method should create new instance of class loader for given plug-in.protected abstract PluginThis method should create new instance of plug-in class.protected abstract voiddispose()Should dispose all resources allocated by this handler instance.protected PluginManagerprotected voidinit(PluginManager aManager) Initializes this handler instance.
-
Constructor Details
-
PluginLifecycleHandler
public PluginLifecycleHandler()
-
-
Method Details
-
init
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
- Returns:
- instance of plug-in manager, this handler is "connected" to
-
configure
Configures this handler instance. Note that this method should be called once beforeinit(PluginManager), usually this is done inobject factoryimplementation.- Parameters:
config- handler configuration data
-
createPluginClassLoader
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., methodPluginDescriptor.getPluginClassName()returns blank string ornull.- 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
This method will be called byPluginManagerjust 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
This method will be called byPluginManagerjust 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.
-