java.lang.Object
de.grogra.pf.registry.Plugin
- All Implemented Interfaces:
RegistryContext
- Direct Known Subclasses:
BillboardPlugin,DXFPlugin,GPUFlux,IMP2D,IMP3D,P,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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis method returnstrueiff it is has not yet been invoked before for the same plugin and the same user (extending over all application invocations).final I18NBundleReturns the resource bundle which represents the contents of the plugin.properties file.final PluginDescriptorReturns the plugin descriptor of this plugin.final RegistryReturns theRegistrywhich is linked with this instance.booleanInitializes the plugin during booting of application.voidshutdown()This method is invoked when an active plugin is deactivated, i.e., when the whole application is terminated.voidstartup()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:
trueiff plugin shall be enabled
-
getPluginDescriptor
Returns the plugin descriptor of this plugin.- Returns:
- plugin descriptor
-
getRegistry
Description copied from interface:RegistryContextReturns theRegistrywhich is linked with this instance.- Specified by:
getRegistryin 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, wherenameis 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, wherenameis the name of the plugin. -
checkConfigure
public boolean checkConfigure()This method returnstrueiff 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:
trueiff this method is invoked for the first time
-