Package org.java.plugin.standard
Class PluginLifecycleHandler
- java.lang.Object
-
- org.java.plugin.standard.PluginLifecycleHandler
-
- Direct Known Subclasses:
StandardPluginLifecycleHandler
public abstract class PluginLifecycleHandler extends java.lang.ObjectManager 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 Constructor Description PluginLifecycleHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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 PluginClassLoadercreatePluginClassLoader(PluginDescriptor descr)This method should create new instance of class loader for given plug-in.protected abstract PlugincreatePluginInstance(PluginDescriptor descr)This method should create new instance of plug-in class.protected abstract voiddispose()Should dispose all resources allocated by this handler instance.protected PluginManagergetPluginManager()protected voidinit(PluginManager aManager)Initializes this handler instance.
-
-
-
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 beforeinit(PluginManager), usually this is done inobject factoryimplementation.- 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., 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
protected abstract void beforePluginStart(Plugin plugin) throws PluginLifecycleException
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
protected abstract void afterPluginStop(Plugin plugin) throws PluginLifecycleException
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.
-
-