Confluence 2.5 のサポートは終了しています。
ドキュメントの最新バージョンを確認してください。
Confluence is built around Spring, an open-source component framework for for Java.
If you are familiar with Spring, then you may only wish to know that Confluence plugin modules (and their implementing classes) are autowired by name. Thus, if you want to access a Confluence component from your plugin, just include the appropriate setter method in your implementing class.
If you want to write Confluence plugins but are unfamiliar with Spring, the rest of this page should give you more than enough information on how to have your plugin interact with Confluence.
Interacting with Confluence
When you are writing anything but the simplest Confluence plugin, you will need to interact with the Confluence application itself in order to retrieve, change or store information. This document describes how this can be done.
Manager Objects
At the core of Confluence is a group of "Manager" objects. For example, the pageManager
is in charge of Confluence pages, the spaceManager
of spaces, the attachmentManager
of attachments, and so on.
Dependency Injection
Traditionally, in a component-based system, components are retrieved from some kind of central repository. For example, in an EJB-based system, you would retrieve the bean from the application server's JNDI repository.
Confluence works the other way round. When a plugin module is instantiated, Confluence determines which components the module needs, and delivers them to it.
Confluence determines which components a module needs by reflecting on the module's methods. Any method with a signature that matches a standard JavaBeans-style setter of the same name as a Confluence component will have that component passed to it when the module is initialised.
So, if your plugin module needs to access the pageManager
, all you need to do is put the following setter method on your module's implementing class:
public void setPageManager(PageManager pageManager) { this.pageManager = pageManager; }
詳細情報
- The Confluence API documentation is available online.
- If you have any questions about the Confluence API, or which manager object you will need to look for to perform a particular function, or if this Dependency Injection thing just confuses you, you're best off asking on the confluence-user mailing-list, where the Confluence development team are happy to answer technical questions.
- You might also want to see the Confluence Developer FAQ, which answers particular questions that have come up from users regarding coding within Confluence. You can also ask questions using the comments there.