-
Notifications
You must be signed in to change notification settings - Fork 4
The Plugin Concept
[Back to the overview of Concepts] (https://github.com/iks-github/MOGLiCodeCreator/wiki/Concepts)
The basic plugin idea is described in chapter [Solution, Ideas and Strategy] (https://github.com/iks-github/MOGLiCodeCreator/wiki/Solution%2C-Ideas-and-Strategy). Some further insight is provided in the [Building Block View] (https://github.com/iks-github/MOGLiCodeCreator/wiki/Building-Block-View) and the [Runtime View] (https://github.com/iks-github/MOGLiCodeCreator/wiki/Runtime-View).
When the MOGLiCC start script is started, the subdirectory "lib/plugins" in the application root dir (where the start script is located) is scanned for MOGLiCC plugins.
A MOGLiCC plugin is a jar-file with following attributes:
- it contains a "Mogli.properties" file in the root dir
- this properties file contains the key "starterclass"
- the value of this key contains a fully qualified classname
- to this class, a java file within the jar file exists
- this class implements one of the following [MOGLiPlugin] (https://github.com/iks-github/MOGLiCodeCreator/blob/master/interfaces/src/main/java/com/iksgmbh/moglicc/plugin/MOGLiPlugin.java) interface
The methods of the three most important plugin types are as follows:
The [MOGLiPlugin] (https://github.com/iks-github/MOGLiCodeCreator/blob/master/interfaces/src/main/java/com/iksgmbh/moglicc/plugin/MOGLiPlugin.java) is the most basic plugin type. The getID()
method returns the name of the plugin which must unique in the plugin container.
The plugin container handles all plugins the following way:
- when found, a PluginMetaData object (containing e.g. the name of the starter class) is created for the plugin
- the plugin is loaded by instantiating the starter class via reflection and casting it on the type MOGLiPlugin
- it is checked whether all dependencies returned by the
getDependencies()
method are resolved and an execution order is calculated - if necessary, help files are read from the plugin's jar file and written into the help subdirectory by calling the
unpackPluginHelpFiles()
method - if necessary, default input files are read from the plugin's jar file and written into the input subdirectory by calling the
unpackDefaultInputData()
method - a MOGLiCC infrastructure object is created and set to the plugin. This object is needed for execution (e.g. to get an instance from another plugin on which the executed plugin depends)
- the plugin is executed by calling its
doYourJob()
method
[Back to the overview of Concepts] (https://github.com/iks-github/MOGLiCodeCreator/wiki/Concepts)