|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dspace.core.PluginManager
public class PluginManager
The Plugin Manager is a very simple component container. It creates and organizes components (plugins), and helps select a plugin in the cases where there are many possible choices. It also gives some limited control over the lifecycle of a plugin. It manages three different types (usage patterns) of plugins:
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 Summary | |
|---|---|
PluginManager()
|
|
| Method Summary | |
|---|---|
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 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[] |
getPluginSequence(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 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PluginManager()
| Method Detail |
|---|
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 object
PluginConfigurationError
PluginInstantiationException
public 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.
PluginInstantiationException
public 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 String[] getAllPluginNames(Class intfc)
NOTE: The names are NOT returned in any deterministic order.
intfc - 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
IOException
public static void main(String[] argv)
throws Exception
checkConfiguration and shows the results.
There are no command-line options.
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||