java.lang.Object
de.grogra.pf.registry.Plugin
- All Implemented Interfaces:
RegistryContext
- Direct Known Subclasses:
BillboardPlugin
,DXFPlugin
,GPUFlux
,IMP2D
,IMP3D
,PluginManager
,POVPlugin
,ProjectManagerImpl
,UI
,UIApplication
,X3DPlugin
An instance of
Plugin
is the representation of a plugin and
can response to lifetime events of the plugin. It may also opt to disable
the plugin when the application boots. This may be used, e.g., if the
environment does not provide some features required by the plugin.
Normally, instances of this class Plugin
are used to represent
a plugin. If a plugin needs a specific implementation of methods of
Plugin
, it has to provide a specialized subclass and declare
this in the root element of the plugin.xml file as in
<plugin id="de.grogra.foo" version="0.9.7" class="de.grogra.foo.MyPlugin" xmlns="http://grogra.de/registry"> ... </plugin>
- Author:
- Ole Kniemeyer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
This method returnstrue
iff it is has not yet been invoked before for the same plugin and the same user (extending over all application invocations).final I18NBundle
Returns the resource bundle which represents the contents of the plugin.properties file.final PluginDescriptor
Returns the plugin descriptor of this plugin.final Registry
Returns theRegistry
which is linked with this instance.boolean
Initializes the plugin during booting of application.void
shutdown()
This method is invoked when an active plugin is deactivated, i.e., when the whole application is terminated.void
startup()
This method is invoked when the plugin is activated, i.e., when the first class defined by the plugin is loaded (except for the Plugin class itself).
-
Constructor Details
-
Plugin
public Plugin()
-
-
Method Details
-
initialize
public boolean initialize()Initializes the plugin during booting of application. If this method returnsfalse
, the plugin is disabled throughout the lifetime of the application.The default implementation simply returns
true
. Subclasses may override this method if they have to check some preconditions which are required by their plugin.- Returns:
true
iff plugin shall be enabled
-
getPluginDescriptor
Returns the plugin descriptor of this plugin.- Returns:
- plugin descriptor
-
getRegistry
Description copied from interface:RegistryContext
Returns theRegistry
which is linked with this instance.- Specified by:
getRegistry
in interfaceRegistryContext
- Returns:
- the registry linked with this instance
-
getI18NBundle
Returns the resource bundle which represents the contents of the plugin.properties file.- Returns:
- resource bundle of plugin.properties
-
startup
public void startup()This method is invoked when the plugin is activated, i.e., when the first class defined by the plugin is loaded (except for the Plugin class itself). The default implementation executes all executable items in the directory/hooks/startup/name
, wherename
is the name of the plugin.The method
initialize()
has been invoked before. Only if this invocation has returnedtrue
, the plugin may be activated. -
shutdown
public void shutdown()This method is invoked when an active plugin is deactivated, i.e., when the whole application is terminated. The default implementation executes all executable items in the directory/hooks/shutdown/name
, wherename
is the name of the plugin. -
checkConfigure
public boolean checkConfigure()This method returnstrue
iff it is has not yet been invoked before for the same plugin and the same user (extending over all application invocations). To be more precise, the method sets a plugin-specific flag in the preferences of the user and checks whether this flag has not yet been set before.- Returns:
true
iff this method is invoked for the first time
-