Component Import Module
Confluence 2.10 and later
Purpose of this Module Type
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:
The Java interface of the component to import.
This attribute is only required if the
<component-import key="appProps" interface="com.atlassian.sal.api.ApplicationProperties"/>
In the example,
That is, the identifier of the component to import.
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 - the Java interface under which the component to retrieve is registered. This element can appear zero or more times, but is required if the
interfaceattribute is not used. Required.
Here is an example
atlassian-plugin.xml file containing a single component import:
It consumes a component made available via a different 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
Some information to be aware of when developing or configuring a Component Import plugin module:
- Component imports, at installation time, are used to generate the
atlassian-plugins-spring.xmlSpring Framework configuration file, transforming Component Import plugin modules into OSGi service references using Spring Dynamic Modules.
- The imported component will have its bean name set to the component import key, which may be important if using 'by name' dependency injection.
- If you wish to have more control over how imported services are discovered and made available to your plugin, you can create your own Spring configuration file containing Spring Dynamic Modules elements, stored in
META-INF/springin your plugin jar. This is recommended if you are needing to import multiple services that implement an interface, for example.
- You can use component imports to customise the bean name of host components, particularly useful if you plan to use 'by name' dependency injection.
Information sourced from Plugin Framework documentation