|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdsto.dfc.util.plugins.PluginManager
public class PluginManager
Manages dynamic loading of plugin classes contained in a JAR file. A plugin JAR (usually with a ".jpi" extension) must have a "Plugin-Class" property in its manifest specifying the plugin initialisation class. When loaded, the plugin class's
public static void initPlugin ()
method is called. This method may perform any initialisation required by the plugin.
NOTE: For plugins to work, the system must be using DfcClassLoader
to load the application. See BootStrapLoader
for one way to accomplish this.
Field Summary | |
---|---|
static PluginManager |
INSTANCE
|
static String |
PLUGIN_EXTENSION
|
static FilenameFilter |
PLUGIN_FILENAME_FILTER
|
protected ArrayList |
plugins
|
protected URLSearchPath |
searchPath
|
Constructor Summary | |
---|---|
protected |
PluginManager()
|
Method Summary | |
---|---|
String |
addPlugin(String path)
Load a plugin and initialise it. |
void |
addSearchPathEntry(String directory)
|
void |
addToPluginClasspath(String newPathEntry)
Add a new entry to the plugin classpath. |
String |
getPluginClassName(String path)
Returns the name of the jar file plugin class, or null if no "Plugin-Class" manifest attributes was defined. |
static String |
getPluginName(String path)
Get the logical name for a plugin. |
String[] |
getPlugins()
Get the loaded plugin names. |
protected void |
initPluginClass(String path)
|
boolean |
isPluginLoaded(String path)
Test whether a plugin is loaded. |
String[] |
listPlugins()
Find all plugins currently available on the plugin search path. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PLUGIN_EXTENSION
public static final FilenameFilter PLUGIN_FILENAME_FILTER
public static final PluginManager INSTANCE
protected ArrayList plugins
protected URLSearchPath searchPath
Constructor Detail |
---|
protected PluginManager()
Method Detail |
---|
public void addSearchPathEntry(String directory)
public String[] listPlugins()
public String[] getPlugins()
public static String getPluginName(String path)
public boolean isPluginLoaded(String path)
path
- A plugin path or logical name.
public String addPlugin(String path) throws PluginException
path
- The path pointing to the plugin file.
PluginException
isPluginLoaded(java.lang.String)
,
getPluginName(java.lang.String)
public void addToPluginClasspath(String newPathEntry)
protected void initPluginClass(String path) throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ClassNotFoundException
IOException
IllegalAccessException
NoSuchMethodException
InvocationTargetException
ClassNotFoundException
public String getPluginClassName(String path) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |