Available: | Confluence 2.2 and later |
Deprecated: | Confluence 2.10 - use the new Component Module Type instead |
This is an outdated module type
The Component plugin module described below belongs to the first version of the Atlassian Plugin Framework. A new Component plugin module is available to OSGi-based plugins using version 2.x of the Atlassian Plugin Framework, supported in Confluence 2.10 and later.
We recommend that you use the new plugin module type, rather than the old-style Component described below. Confluence still supports the earlier module type, but the new OSGi-based plugin framework fixes a number of bugs and limitations experienced by the old-style plugin modules.
Component plugin modules enable you to add components to Confluence's internal component system (powered by Spring).
Component plugin modules are available in Confluence 1.4 and later.
Each component module adds a single object to Confluence's component management system.
Other plugins and objects within Confluence can then be autowired with your component. This is very useful for having a single component that is automatically passed to all of your other plugin modules (ie a Manager object).
Here is an example atlassian-plugin.xml
file containing a single component module:
1 2<atlassian-plugin name="Sample Component" key="confluence.extra.component"> ... <component name="Keyed Test Component" key="testComponent" alias="bogusComponent" class="com.atlassian.confluence.plugin.descriptor.BogusComponent" /> ... </atlassian-plugin>
Accessing your components is extremely simple.
If your object is being autowired (for example another plugin module or a Struts action), the easiest way to access a component is to add a basic Java setter method.
For example, if you use the above BogusComponent
module your object would retrieve the component as follows:
1 2public void setBogusComponent(BogusComponent bogusComponent) { this.bogusComponent = bogusComponent; }
If your object is not being autowired, you may need to retrieve the component explicitly. This is done via the ContainerManager
like so:
1 2BogusComponent bc = (BogusComponent) ContainerManager.getComponent("bogusComponent");
Some issues to be aware of when developing a component:
Component Module
Writing Confluence Plugins
Installing a Plugin
Rate this page: