public class PluginManager extends Object
The name is just a String to be associated with the
combination of implementation class and interface. It may contain
any characters except for comma (,) and equals (=). It may contain
embedded spaces. Comma is a special character used to separate
names in the configuration entry.
SelfNamedPlugin| Constructor and Description |
|---|
PluginManager() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkConfiguration()
Validate the entries in the DSpace Configuration relevant to
PluginManager.
|
static String[] |
getAllPluginNames(Class intfc)
Returns all of the names under which a named plugin implementing
the interface intface can be requested (with getNamedPlugin()).
|
static String[] |
getAllPluginNames(String module,
Class intfc)
Returns all of the names under which a named plugin implementing
the interface intface can be requested (with getNamedPlugin()).
|
static Object |
getNamedPlugin(Class intfc,
String name)
Returns an instance of a plugin that implements the interface
intface and is bound to a name matching name.
|
static Object |
getNamedPlugin(String module,
Class intfc,
String name)
Returns an instance of a plugin that implements the interface
intface and is bound to a name matching name.
|
static Object[] |
getPluginSequence(Class intfc)
Returns instances of all plugins that implement the interface
intface, in an Array.
|
static Object[] |
getPluginSequence(String module,
Class intfc)
Returns instances of all plugins that implement the interface
intface, in an Array.
|
static Object |
getSinglePlugin(Class interfaceClass)
Returns an instance of the singleton (single) plugin implementing
the given interface.
|
static Object |
getSinglePlugin(String module,
Class interfaceClass)
Returns an instance of the singleton (single) plugin implementing
the given interface.
|
static boolean |
hasNamedPlugin(Class intfc,
String name)
Returns whether a plugin exists which implements the specified interface
and has a specified name.
|
static boolean |
hasNamedPlugin(String module,
Class intfc,
String name)
Returns whether a plugin exists which implements the specified interface
and has a specified name.
|
static void |
main(String[] argv)
Invoking this class from the command line just runs
checkConfiguration and shows the results. |
static void |
releasePlugin(Object plugin)
Tells the Plugin Manager to let go of any references to a
reusable plugin, to prevent it from being given out again and to
allow the object to be garbage-collected.
|
public static Object getSinglePlugin(Class interfaceClass) throws PluginConfigurationError, PluginInstantiationException
PluginConfigurationError is thrown.
Note that this is the only "get plugin" method which throws an exception. It is typically used at initialization time to set up a permanent part of the system so any failure is fatal.
interfaceClass - interface Class objectPluginConfigurationErrorPluginInstantiationExceptionpublic static Object getSinglePlugin(String module, Class interfaceClass) throws PluginConfigurationError, PluginInstantiationException
PluginConfigurationError is thrown.
Note that this is the only "get plugin" method which throws an exception. It is typically used at initialization time to set up a permanent part of the system so any failure is fatal.
module - name of config module, or null for standard locationinterfaceClass - interface Class objectPluginConfigurationErrorPluginInstantiationExceptionpublic static Object[] getPluginSequence(Class intfc) throws PluginInstantiationException
The order of the plugins in the array is the same as their class names in the configuration's value field.
intfc - interface for which to find plugins.PluginInstantiationExceptionpublic static Object[] getPluginSequence(String module, Class intfc) throws PluginInstantiationException
The order of the plugins in the array is the same as their class names in the configuration's value field.
module - name of config module, or null for standardintfc - interface for which to find plugins.PluginInstantiationExceptionpublic static Object getNamedPlugin(Class intfc, String name) throws PluginInstantiationException
intfc - the interface class of the pluginname - under which the plugin implementation is configured.PluginInstantiationExceptionpublic static Object getNamedPlugin(String module, Class intfc, String name) throws PluginInstantiationException
module - config module, or null for standard locationintfc - the interface class of the pluginname - under which the plugin implementation is configured.PluginInstantiationExceptionpublic static boolean hasNamedPlugin(Class intfc, String name) throws PluginInstantiationException
intfc - the interface class of the pluginname - under which the plugin implementation is configured.PluginInstantiationExceptionpublic static boolean hasNamedPlugin(String module, Class intfc, String name) throws PluginInstantiationException
module - the config module or null for regular locationintfc - the interface class of the pluginname - under which the plugin implementation is configured.PluginInstantiationExceptionpublic static String[] getAllPluginNames(Class intfc)
NOTE: The names are NOT returned in any deterministic order.
intfc - plugin interface for which to return names.public static String[] getAllPluginNames(String module, Class intfc)
NOTE: The names are NOT returned in any deterministic order.
module - the module nameintfc - plugin interface for which to return names.public static void releasePlugin(Object plugin)
plugin - the object to release, must have been created by
getNamedPlugin etc.public static void checkConfiguration()
throws IOException
SelfNamedPlugin
IOExceptionCopyright © 2014 DuraSpace. All Rights Reserved.