Confluence 2.5.6 : Component Plugins
This page last changed on Jan 18, 2007 by jnolen.
Component plugin modules enable you to add components to Confluence's internal component system (powered by Spring).
Component Plugin ModuleEach 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: <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 ComponentsAccessing your components is extremely simple. Autowired ObjectsIf your object is being autowired (for example another plugin module or an XWork 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: public void setBogusComponent(BogusComponent bogusComponent) { this.bogusComponent = bogusComponent; } Non-autowired ObjectsIf your object is not being autowired, you may need to retrieve the component explicitly. This is done via the ContainerManager like so: BogusComponent bc = (BogusComponent) ContainerManager.getComponent("bogusComponent");
NotesSome issues to be aware of when developing a component:
|
![]() |
Document generated by Confluence on Oct 10, 2007 18:36 |