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 void
afterPluginStop
(Plugin plugin) This method will be called byPluginManager
just after stopping plug-in.protected abstract void
beforePluginStart
(Plugin plugin) This method will be called byPluginManager
just before starting plug-in.protected abstract void
configure
(ExtendedProperties config) Configures this handler instance.protected abstract PluginClassLoader
This method should create new instance of class loader for given plug-in.protected abstract Plugin
This method should create new instance of plug-in class.protected abstract void
dispose()
Should dispose all resources allocated by this handler instance.protected PluginManager
protected void
init
(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 factory
implementation.- 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 byPluginManager
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
This method will be called byPluginManager
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.
-