This page last changed on Sep 29, 2009 by mlassau.
 | The Module Type plugin module described below is available only for OSGi-based plugins in JIRA 4.0 and above. |
Purpose of this Module Type
Module Type plugin modules allow you to dynamically add new plugin module types to the plugin framework, generally building on other plugin modules. For example, a plugin developer could create a <dictionary> plugin module that is used to feed a dictionary service used by still other plugins.
Configuration
The root element for the Module Type plugin module is module-type. It allows the following attributes and child elements for configuration:
Attributes
Name |
Required |
Description |
Default |
class |
|
The ModuleDescriptor class to instantiate when a new plugin module of this type is found. |
|
disabled |
|
Indicate whether the plugin module should be disabled by default (value='true') or enabled by default (value='false'). |
false |
i18n-name-key |
|
The localisation key for the human-readable name of the plugin module. |
|
key |
|
The identifier of the plugin module. This key must be unique within the plugin where it is defined.
Sometimes you will need to uniquely identify a module. Do this with the module complete key. A module with key fred in a plugin with key com.example.modules will have a complete key of com.example.modules:fred. I.e. the identifier of the module type. This value will be used as the XML element name to match. |
N/A |
name |
|
The human-readable name of the plugin module. |
|
system |
|
Indicates whether this plugin module is a system plugin module (value='true') or not (value='false'). Only available for non-OSGi plugins. |
false |
Elements
Name |
Required |
Description |
Default |
description |
|
The description of the plugin module. The 'key' attribute can be specified to declare a localisation key for the value instead of text in the element body. |
|
Example
Here is an example atlassian-plugin.xml file containing a plugin module type:
<atlassian-plugin name="Hello World" key="example.plugin.helloworld" plugins-version="2">
<plugin-info>
<description>A dictionary module type test</description>
<vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/>
<version>1.0</version>
</plugin-info>
<module-type key="dictionary" class="example.plugin.DictionaryModuleDescriptor" />
</atlassian-plugin>
The Java code for DictionaryModuleDescriptor could look like this:
public class DictionaryModuleDescriptor extends AbstractModuleDescriptor<Dictionary>
{
private String language;
@Override
public void init(Plugin plugin, Element element) throws PluginParseException
{
super.init(plugin, element);
language = element.attributeValue("lang");
}
public Dictionary getModule()
{
return (Dictionary)((AutowireCapablePlugin)plugin).autowire(getModuleClass());
}
public String getLanguage()
{
return language;
}
}
This will add the new module type 'dictionary' to the plugin framework, allowing other plugins to use the new module type. Here is a plugin that uses the new 'dictionary' module type:
<atlassian-plugin name="Hello World" key="example.plugin.helloworld" plugins-version="2">
<plugin-info>
<description>An english dictionary</description>
<vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/>
<version>1.0</version>
</plugin-info>
<dictionary key="english" class="example.plugin.english.MyDictionary" />
</atlassian-plugin>
Notes
Some information to be aware of when developing or configuring a Module Type plugin module:
|