public interface Plugin extends CommandLineListener
Plugin
class. This class must have one no parameter constructor, which will be used by the applicationplugins.xml
XML file in the plugins directory, or specify the Plugin base class in the Plugin manifestplugins.xml
XML file defines the list of Plugins main classes. Its Schema is:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Plugins"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" ref="plugin" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="plugin"> <xs:complexType> <xs:attribute name="mainclass" type="xs:string" use="required" /> <xs:attribute name="desc" type="xs:string" /> </xs:complexType> </xs:element> </xs:schema>
Modifier and Type | Method and Description |
---|---|
default void |
dispose()
Called by the main application when closing, to tell plugins that they must dispose of their resources.
|
default boolean |
executeCustomAction(java.lang.String actionName,
java.lang.Object... arguments)
Called to execute a custom action.
|
default java.lang.Object |
getDefaultPluginProperty(java.lang.String property)
Return the default plugin property named as the parameter.
|
default java.lang.String |
getPluginBuildDate()
Return the Plugin version.
|
default Configuration |
getPluginConfiguration()
Return the Plugin Configuration class.
|
default ApplicationDesc |
getPluginDesc()
Return the Plugin description.
|
default java.lang.String |
getPluginDescription()
Return the Plugin description.
|
default java.lang.String |
getPluginName()
Return the Plugin name.
|
default java.lang.Object |
getPluginProperty(java.lang.String property)
Return the plugin property named as the parameter.
|
default java.lang.String |
getPluginVersion()
Return the Plugin version.
|
default java.lang.Object |
getProperty(java.lang.Object key)
Return the value for a specific property.
|
default java.lang.Class<?> |
getPropertyType(java.lang.Object key)
Return the Class for a specific property.
|
default boolean |
hasProperty(java.lang.Object key)
Return true if this plugin has a property for a specified key.
|
void |
init(MDIApplication app)
Initialize the Plugin.
|
default void |
loadResources(MDIApplication app,
java.lang.ClassLoader classLoader)
Load the plugin resources.
|
default void |
modifySettings()
This method is used to tell to the Plugin that its settings has been modified.
|
void |
register(MDIApplication app)
Register the Plugin.
|
default void |
resetSettings()
This method is used to reset the settings used by the Plugin.
|
default boolean |
setProperty(java.lang.Object key,
java.lang.Object value)
Set a property.
|
default boolean |
supportCustomAction(java.lang.String actionName)
Return true if the plugin support a named custom action.
|
getCommandLineConfiguration, getCommandLineHandler, handleCommandLineArguments, handleCommandLineArguments, handleCommandLineException, setCommandLineHandler
void register(MDIApplication app) throws java.lang.Exception
app
- the applicationjava.lang.Exception
- if registering the Plugin throws an internal exception in the Plugindefault void loadResources(MDIApplication app, java.lang.ClassLoader classLoader) throws java.lang.Exception
app
- the applicationclassLoader
- the ontext ClassLoaderjava.lang.Exception
- if the Plugin loading throws an exceptionvoid init(MDIApplication app) throws java.lang.Exception
app
- the applicationjava.lang.Exception
- if initializing the Plugin throws an internal exception in the Plugin.default ApplicationDesc getPluginDesc()
default java.lang.String getPluginName()
getPluginDesc()
and return
ApplicationDesc.getApplicationName()
by default.default java.lang.String getPluginDescription()
getPluginDesc()
and return
ApplicationDesc.getAlternateText()
by default.default java.lang.String getPluginVersion()
getPluginDesc()
and return
ApplicationDesc.getVersion()
by default.default java.lang.String getPluginBuildDate()
getPluginDesc()
and return
ApplicationDesc.getBuildDate()
by default.default java.lang.Object getPluginProperty(java.lang.String property)
PluginElementTypes.PROPERTY_DESC
: the Plugin description (as a String)PluginElementTypes.PROPERTY_VERSION
: the Plugin version (as a String)PluginElementTypes.PROPERTY_DATE
: the Plugin date of modification (as a String)PluginElementTypes.PROPERTY_DEPEND
: the Plugin on which this Plugin depends. (name of the Plugin main class on which this Plugin depends, as a
String, or List of names)PluginElementTypes.PROPERTY_DESC
: the getPluginName()
method will be calledPluginElementTypes.PROPERTY_VERSION
: the getPluginVersion()
method will be calledPluginElementTypes.PROPERTY_DATE
: the getPluginBuildDate()
method will be calledgetDefaultPluginProperty(java.lang.String)
method will be calledproperty
- the property namegetDefaultPluginProperty(java.lang.String)
default boolean supportCustomAction(java.lang.String actionName)
actionName
- the action namedefault boolean executeCustomAction(java.lang.String actionName, java.lang.Object... arguments)
actionName
- the action namearguments
- the argumentsdefault java.lang.Object getDefaultPluginProperty(java.lang.String property)
getPluginProperty(java.lang.String)
mehod:
PluginElementTypes.PROPERTY_DESC
: the Plugin description (as a String)PluginElementTypes.PROPERTY_VERSION
: the Plugin version (as a String)PluginElementTypes.PROPERTY_DATE
: the Plugin date of modification (as a String)property
- the property namegetPluginProperty(java.lang.String)
default Configuration getPluginConfiguration()
default void modifySettings()
default void resetSettings()
MDIApplication
to enforce a common behavior for its Plugins.default boolean setProperty(java.lang.Object key, java.lang.Object value)
key
- the property keyvalue
- the property valuedefault java.lang.Object getProperty(java.lang.Object key)
key
- the property keydefault java.lang.Class<?> getPropertyType(java.lang.Object key)
key
- the property keydefault boolean hasProperty(java.lang.Object key)
key
- the property keydefault void dispose()