Available: | Confluence 2.10 and later. |
Status: | This feature is DEPRECATED in favor of Atlassian Spring Scanner. |
Component Import plugin modules allow you to access Java components shared by other plugins, even if the component is upgraded at runtime.
The root element for the Component Import plugin module is component-import
. It allows the following attributes and child elements for configuration:
Name* | Description |
---|---|
interface | The Java interface of the component to import. This attribute is only required if the |
key | The unique identifier of the plugin module. You refer to this key to use the resource from other contexts in your plugin, such as from the plugin Java code or JavaScript resources.
In the example, That is, the identifier of the component to import. |
filter | The LDAP filter to use to match public components (OSGi services). The format of the filter must be a valid LDAP filter. (Plugin Framework 2.3 and later.) |
*interface and key attributes are required.
interface
attribute is not used. Required.Here is an example atlassian-plugin.xml
file containing a single component import:
1 2<atlassian-plugin name="Hello World" key="example.plugin.helloworld" plugins-version="2"> <plugin-info> <description>A basic component import module test</description> <vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/> <version>1.0</version> </plugin-info> <component-import key="helloWorldService"> <interface>com.myapp.HelloWorldService</interface> </component-import> </atlassian-plugin>
It consumes a component made available via a different plugin:
1 2<atlassian-plugin name="Hello World Provider" key="example.plugin.helloworld.provider" plugins-version="2"> <plugin-info> <description>A basic component module test</description> <vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/> <version>1.0</version> </plugin-info> <component key="helloWorldService" class="com.myapp.internal.MyHelloWorldService" public="true"> <interface>com.myapp.HelloWorldService</interface> </component> </atlassian-plugin>
Here is an example of matching via an LDAP filter. Since a component import is really just matching an OSGi service, you can optionally specify an LDAP filter to match the specific service. Here is an example that matches a dictionary service that provides a language
attribute that equals English
:
1 2<component-import key="dictionaryService" interface="com.myapp.DictionaryService" filter="(language=English)" />
Some information to be aware of when developing or configuring a Component Import plugin module:
atlassian-plugins-spring.xml
Spring Framework configuration file, transforming Component Import plugin modules into OSGi service references using Spring Dynamic Modules.META-INF/spring
in your plugin jar. This is recommended if you are needing to import multiple services that implement an interface, for example.Writing Confluence Plugins
Information sourced from Plugin Framework documentation
Rate this page: