Plugin development
This page describes steps necessary to create your own BioUML or BDK plugin. Suppose you want to create plugin named biouml.plugins.myplugin
. All paths are relative to BioUML/BDK root directory.
Code and compilation
- Create package folder
src/biouml/plugins/myplugin
and put your Java code there. If necessary, create subpackages folders likesrc/biouml/plugins/myplugin/access
. - Create plugin folder
plugins/biouml.plugins.myplugin_1.0.0
(replace 1.0.0 with your plugin version). - Add ant target to
src/build.xml
to build your plugin. It may look like this:
<target name="plugin.myplugin" depends="compile"> <echo message="Making biouml.plugins.myplugin_1.0.0/myplugin.jar" /> <jar jarfile="${PLUGIN_DIR}/biouml.plugins.myplugin_1.0.0/myplugin.jar" compress="true"> <fileset dir="${OUTDIR}"> <patternset> <include name="biouml/plugins/myplugin/**/*.class" /> <exclude name="biouml/plugins/myplugin/**/_test/**/*.class" /> </patternset> </fileset> <fileset dir="${SRCDIR}"> <patternset> <include name="biouml/plugins/myplugin/**/*.gif" /> <include name="biouml/plugins/myplugin/**/*.html" /> </patternset> </fileset> </jar> </target>
${SRCDIR}
fileset is used to copy all the necessary resource files. Add other file types there if you use them.
After these steps your plugin jar file myplugin.jar
can be built using ant plugin.myplugin
command. For convenience you may add the dependence to plugin.all
target.
MANIFEST.MF file
Every plugin must have its MANIFEST.MF file. Create folder plugins/biouml.plugins.myplugin_1.0.0/META-INF
, then create text file MANIFEST.MF
in this folder and fill it in the following manner:
Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Localization: plugin Bundle-Name: My plugin Bundle-SymbolicName: biouml.plugins.myplugin;singleton:=true Bundle-Version: 1.0.0 Bundle-Vendor: Provider Name Require-Bundle: biouml.workbench, ru.biosoft.access, ru.biosoft.analysis, ru.biosoft.table Bundle-ClassPath: myplugin.jar Export-Package: biouml.plugins.myplugin, biouml.plugins.myplugin.access
Let's discuss this file in detail:
Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Localization: plugin
These rows should always look like this, just copy them.
Bundle-Name: My plugin
Here user-friendly plugin name "My plugin" is displayed. It's rarely used in BioUML, but it's good to specify something relevant. If wiki page will be generated for your plugin, this name will be displayed on it.
Bundle-SymbolicName: biouml.plugins.myplugin;singleton:=true
Symbolic name biouml.plugins.myplugin
must be exactly the same as your root Java package and plugin folder name (except version part).
Bundle-Version: 1.0.0
Version must be exactly the same as in plugin folder.
Bundle-Vendor: Provider Name
User-friendly plugin provider name. It's used for wiki pages generation.
Require-Bundle: biouml.workbench, ru.biosoft.access, ru.biosoft.analysis, ru.biosoft.table
Here all other plugins which your plugin directly depends on must be listed. For example, if you're using ru.biosoft.bsa.Site
class somewhere in your plugin, then you must list ru.biosoft.bsa
plugin here.
Bundle-ClassPath: myplugin.jar
Here exact name of the jar file which will be created during plugin build procedure must be specified.
Export-Package: biouml.plugins.myplugin, biouml.plugins.myplugin.access
Here you must specify all packages from your plugin which should be accessible from the outside.
plugin.xml file
If you want to define new extensions or extension points in your plugin, you should create plugins/biouml.plugins.myplugin_1.0.0/plugin.xml
file and fill it like this:
<?xml version="1.0" encoding="UTF-8"?> <plugin> <extension-point name="myExtensionPoint" id="myExtensionPoint"/> <extension point="biouml.plugins.myplugin.myExtensionPoint"> </extension> <extension point="ru.biosoft.analysis.method"> </extension> </plugin>
If you want to create an extension for existing extension point, please refer to the corresponding extension point documentation page.