|
JPF 1.5.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.java.plugin.PluginManager
public abstract class PluginManager
JPF "runtime" class - the entry point to the framework API. It is expected that only one instance of this class will be created per application (other scenarios may be possible but not tested).
Usage example. Somewhere in the beginning of your application:
manager = factory.createManager(); manager.publishPlugins(getLocations(dir));Later on, before accessing plug-in:
manager.activatePlugin(pluginId);
ObjectFactory.createManager()
Nested Class Summary | |
---|---|
static interface |
PluginManager.EventListener
Plug-ins life-cycle events callback interface. |
static class |
PluginManager.EventListenerAdapter
An abstract adapter class for receiving plug-ins life-cycle events. |
static interface |
PluginManager.PluginLocation
Simple callback interface to hold info about plug-in manifest and plug-in data locations. |
Field Summary | |
---|---|
static java.lang.String |
VERSION
JPF version number. |
static java.lang.String |
VERSION_PROPERTY
JPF version system property name. |
Constructor Summary | |
---|---|
PluginManager()
|
Method Summary | |
---|---|
abstract void |
activatePlugin(java.lang.String id)
Activates plug-in with given ID if it is not activated yet. |
abstract void |
deactivatePlugin(java.lang.String id)
Deactivates plug-in with given ID if it has been successfully activated before. |
abstract PluginDescriptor[] |
disablePlugin(PluginDescriptor descr)
Disables plug-in (with dependencies) in this manager instance. |
protected void |
disposeClassLoader(PluginClassLoader cl)
Forwards call to PluginClassLoader.dispose() method. |
abstract PluginDescriptor[] |
enablePlugin(PluginDescriptor descr,
boolean includeDependings)
Enables plug-in (or plug-ins) in this manager instance. |
abstract PathResolver |
getPathResolver()
|
abstract Plugin |
getPlugin(java.lang.String id)
Looks for plug-in with given ID and activates it if it is not activated yet. |
abstract PluginClassLoader |
getPluginClassLoader(PluginDescriptor descr)
Returns instance of plug-in's class loader and not tries to activate plug-in. |
abstract Plugin |
getPluginFor(java.lang.Object obj)
Looks for plug-in, given object belongs to. |
abstract PluginRegistry |
getRegistry()
|
protected void |
initPlugin(Plugin plugin,
PluginDescriptor descr)
Initializes given plug-in with this manager instance and given descriptor. |
abstract boolean |
isBadPlugin(PluginDescriptor descr)
|
abstract boolean |
isPluginActivated(PluginDescriptor descr)
|
abstract boolean |
isPluginActivating(PluginDescriptor descr)
|
abstract boolean |
isPluginEnabled(PluginDescriptor descr)
|
static PluginManager |
lookup(java.lang.Object obj)
Looks for plug-in manager instance for given object. |
protected void |
notifyClassLoader(PluginClassLoader cl)
Forwards call to PluginClassLoader.pluginsSetChanged() method. |
abstract java.util.Map<java.lang.String,Identity> |
publishPlugins(PluginManager.PluginLocation[] locations)
Registers plug-ins and their locations with this plug-in manager. |
abstract void |
registerListener(PluginManager.EventListener listener)
Registers plug-in manager event listener. |
abstract void |
shutdown()
Shuts down the framework. |
protected void |
startPlugin(Plugin plugin)
Starts given plug-in. |
protected void |
stopPlugin(Plugin plugin)
Stops given plug-in. |
abstract void |
unregisterListener(PluginManager.EventListener listener)
Unregisters manager event listener. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION
public static final java.lang.String VERSION_PROPERTY
Constructor Detail |
---|
public PluginManager()
Method Detail |
---|
public static PluginManager lookup(java.lang.Object obj)
obj
- any object that may be managed by some plug-in manager
null
if given object
doesn't belong to any plug-in (possibly it is part of "host"
application) and thus doesn't managed by the Framework directly
or indirectly.public abstract PluginRegistry getRegistry()
public abstract PathResolver getPathResolver()
public abstract java.util.Map<java.lang.String,Identity> publishPlugins(PluginManager.PluginLocation[] locations) throws JpfException
PluginRegistry.register(URL[])
method that just makes plug-in's
meta-data available for reading and doesn't "know" where are things
actually located).
Note that this method only load plug-ins to this manager but not activate
them. Call activatePlugin(String)
method to make plug-in
activated. It is recommended to do this immediately before first plug-in
use.
locations
- plug-in locations data
JpfException
- if given plug-ins can't be registered or published (optional
behavior)PluginDescriptor
,
PluginFragment
public abstract Plugin getPlugin(java.lang.String id) throws PluginLifecycleException
null
.
id
- plug-in ID
PluginLifecycleException
- if plug-in can't be found or activatedpublic abstract void activatePlugin(java.lang.String id) throws PluginLifecycleException
Plugin.doStart()
method. This
method will effectively activate all depending plug-ins. It is safe to
call this method more than once.
id
- plug-in ID
PluginLifecycleException
- if plug-in can't be found or activatedpublic abstract Plugin getPluginFor(java.lang.Object obj)
obj
- any object that maybe belongs to some plug-in
null
if given object doesn't belong to
any plug-in (possibly it is part of "host" application) and thus
doesn't managed by the Framework directly or indirectlypublic abstract boolean isPluginActivated(PluginDescriptor descr)
descr
- plug-in descriptor
true
if plug-in with given descriptor is activatedpublic abstract boolean isBadPlugin(PluginDescriptor descr)
descr
- plug-in descriptor
true
if plug-in disabled as it's activation failspublic abstract boolean isPluginActivating(PluginDescriptor descr)
descr
- plug-in descriptor
true
if plug-in is currently activatingpublic abstract PluginClassLoader getPluginClassLoader(PluginDescriptor descr)
descr
- plug-in descriptor
public abstract void shutdown()
public abstract void deactivatePlugin(java.lang.String id)
Plugin.doStop()
method. Note that this method will effectively
deactivate all depending plug-ins.
id
- plug-in IDpublic abstract PluginDescriptor[] disablePlugin(PluginDescriptor descr)
Be careful with this method as it can effectively disable large set of inter-depending plug-ins and your application may become unstable or even disabled as whole.
descr
- descriptor of plug-in to be disabled
public abstract PluginDescriptor[] enablePlugin(PluginDescriptor descr, boolean includeDependings)
descr
- descriptor of plug-in to be enabledincludeDependings
- if true
, depending plug-ins will be also
enabled
disablePlugin(PluginDescriptor)
public abstract boolean isPluginEnabled(PluginDescriptor descr)
descr
- plug-in descriptor
true
if given plug-in is disabled in this managerpublic abstract void registerListener(PluginManager.EventListener listener)
IllegalArgumentException
.
listener
- new manager event listenerpublic abstract void unregisterListener(PluginManager.EventListener listener)
IllegalArgumentException
.
listener
- registered listenerprotected final void initPlugin(Plugin plugin, PluginDescriptor descr)
plugin
- plug-in instance to be initializeddescr
- plug-in descriptorprotected final void startPlugin(Plugin plugin) throws java.lang.Exception
Plugin.doStart()
method.
plugin
- plug-in to be started
java.lang.Exception
- if any error has occurred during plug-in startprotected final void stopPlugin(Plugin plugin) throws java.lang.Exception
Plugin.doStop()
method.
plugin
- plug-in to be stopped
java.lang.Exception
- if any error has occurred during plug-in stopprotected final void disposeClassLoader(PluginClassLoader cl)
PluginClassLoader.dispose()
method.
cl
- plug-in class loader to be disposedprotected final void notifyClassLoader(PluginClassLoader cl)
PluginClassLoader.pluginsSetChanged()
method.
cl
- plug-in class loader to be notified
|
JPF 1.5.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |