public final class Plugin extends Object
Plugin
object encapsulates
all of the data that makes up a plugin, as specified by the plugin's
entry in a JAR Manifest. Instances of the plugin object itself can be
created with the newInstance()
method.Modifier and Type | Field and Description |
---|---|
private String |
className |
private String |
desc |
private String |
expectedType |
private URL |
helpURL |
private Icon |
icon |
private String |
iconFile |
private JarFile |
jar |
private String |
jarFile |
private EventListenerList |
listeners |
private boolean |
loaded |
private PluginClassLoader |
loader |
private PluginLocator |
locator |
private String |
name |
private Class |
pluginClass |
private Properties |
props |
private String |
type |
private String |
version |
Constructor and Description |
---|
Plugin(PluginLocator locator,
String jarFile,
String expectedType) |
Modifier and Type | Method and Description |
---|---|
void |
addPluginReloadListener(PluginReloadListener listener)
Add a
PluginReloadListener to this model's list of
listeners. |
protected void |
firePluginReloaded()
Fire a plugin reloaded event.
|
String |
getClassName()
Get the class name for this plugin.
|
PluginContext |
getContext()
Get the
PluginContext for this plugin. |
String |
getDescription()
Get the description of this plugin.
|
String |
getFile()
Get the path to the file that the plugin was loaded from.
|
URL |
getHelpURL()
Get the help URL for this plugin.
|
Icon |
getIcon()
Get the icon for this plugin.
|
String |
getName()
Get the name of this plugin.
|
Properties |
getProperties()
Get the user-defined properties for the plugin.
|
String |
getProperty(String name)
Get a specific user-defined property for the plugin.
|
String |
getProperty(String name,
String defaultValue)
Get a specific user-defined property for the plugin.
|
String |
getType()
Get the type of this plugin.
|
String |
getVersion()
Get the version number for this plugin.
|
boolean |
isLoaded()
Determine if the plugin is loaded.
|
private void |
load()
Load the plugin.
|
Object |
newInstance()
Create a new instance of the plugin object.
|
void |
reload()
Reload the plugin.
|
void |
removePluginReloadListener(PluginReloadListener listener)
Remove a
PluginReloadListener from this model's list of
listeners. |
String |
toString()
Return a string representation of this plugin, which consists of
its name and version.
|
private void |
unload() |
private boolean loaded
private Properties props
private String expectedType
private Class pluginClass
private PluginClassLoader loader
private PluginLocator locator
private EventListenerList listeners
Plugin(PluginLocator locator, String jarFile, String expectedType) throws PluginException
PluginException
public String getVersion()
public String getClassName()
public PluginContext getContext()
PluginContext
for this plugin.public String getFile()
public Properties getProperties()
Properties
object containing the user-defined
properties.public String getProperty(String name)
name
- The property name (key).null
if there is no
property with the given name.public String getProperty(String name, String defaultValue)
name
- The property name (key).defaultValue
- The default value for this property.defaultValue
if there
is no property with the given name.public String getDescription()
public Icon getIcon()
public URL getHelpURL()
public boolean isLoaded()
private void load() throws PluginException
PluginException
- If the plugin could not be
loaded.private void unload()
public void reload() throws PluginException
PluginException
public Object newInstance() throws PluginException
PluginException
- If a problem occurs during
class instantiation.public void addPluginReloadListener(PluginReloadListener listener)
PluginReloadListener
to this model's list of
listeners.listener
- The listener to add.public void removePluginReloadListener(PluginReloadListener listener)
PluginReloadListener
from this model's list of
listeners.listener
- The listener to remove.protected void firePluginReloaded()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses