public class PluginLocator extends Object
A plugin consists of one or more classes that implement the plugin itself (with one of those classes being the main or entry-point class). These classes are stored in a JAR file. The JAR file Manifest must contain an entry for the plugin. This entry identifies the plugin entry-point class and other information about the plugin. Here is an example entry:
Name: com/foo/imaging/BlurFilter.class PluginName: Blur Filter PluginType: Image Filter PluginIcon: com/foo/imaging/icons/BlurFilter.gif PluginHelpURL: http://dystance.net/filters/blur.html PluginVersion: 1.1.2
The Name
field identifies the file in the JAR that is the
plugin entry-point class. The PluginName
field provides a
textual name for the plugin, and the PluginType
field
identifies the type of the plugin (the meaning of which is
application-dependent). These fields must be present in the entry, whereas
the remaining fields are optional.
The PluginDescriptio
field provides a brief description of the
plugin (and may optionally include a copyright message or other related
information). PluginIcon
identifies an icon image for the
plugin. Finally, PluginVersion
specifies the version number of
the plugin.
Modifier and Type | Field and Description |
---|---|
private PluginContext |
context |
private ResourceDecoder |
decoder |
private Vector |
forbiddenPackages |
private Vector |
restrictedPackages |
Constructor and Description |
---|
PluginLocator(PluginContext context)
Construct a new
PluginLocator with the specified plugin
context. |
Modifier and Type | Method and Description |
---|---|
void |
addForbiddenPackage(String pkg)
Add a package to the locator's list of forbidden packages.
|
void |
addRestrictedPackage(String pkg)
Add a package to the locator's list of restricted packages.
|
(package private) PluginClassLoader |
createClassLoader() |
(package private) PluginContext |
getContext() |
(package private) ResourceDecoder |
getDecoder() |
Plugin |
loadPlugin(File jarFile,
String type)
Create a Plugin object for the given plugin archive.
|
Plugin |
loadPlugin(String jarFile,
String type)
Create a Plugin object for the given plugin archive.
|
private PluginContext context
private ResourceDecoder decoder
private Vector forbiddenPackages
private Vector restrictedPackages
public PluginLocator(PluginContext context)
PluginLocator
with the specified plugin
context.context
- The PluginContext
for this plugin locator.public void addRestrictedPackage(String pkg)
pkg
- The package name.public void addForbiddenPackage(String pkg)
pkg
- The package name.public Plugin loadPlugin(String jarFile, String type) throws PluginException
jarFile
- The plugin archive.Plugin
, if successfully created, or
null
otherwise.PluginException
public Plugin loadPlugin(File jarFile, String type) throws PluginException
jarFile
- The plugin archive.Plugin
, if successfully created, or
null
otherwise.PluginException
PluginContext getContext()
ResourceDecoder getDecoder()
PluginClassLoader createClassLoader()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses