Accessing Confluence Components from Plugin Modules

ConfluenceはSpring(Javaのためのオープンソース・フレームワーク)の周りに作られています。
もしSpringに詳しい場合は、Confluence plugin modules(および、それらが実装しているclass群)が名前によってautowiredされているということだけ知れば良いです。
ゆえに、もしプラグインからConfluenceのコンポーネントにアクセスしたい場合は、実装しているクラスに適切なセッタ・メソッドを含む必要があります。

もしConfluenceのプラグインを書きたいがSpringに関して詳しくない場合は、このページのrestによって、どのようにしてConfluenceとプラグインとの対話をするかについて、充分な情報を得ることができます。

Interacting with Confluence

単純ではないConfluenceのプラグインを書いている場合、情報を検索したり変更したり格納するためにConfluenceアプリケーションと対話をする必要があります。
このドキュメントではこれをどのようにするかについて描写します。

Manager Objects

Confluenceの核となるのは、"Manager"オブジェクト群です。
例えば、pageManagerはConfluence pages、spaceManagerはspaces、attachmentManagerはattachmentsといった感じです。

Dependency Injection

伝統的に、コンポーネント・ベースのシステムにおいて、コンポーネントはある種のセントラル・レポジトリから検索されます。
例えば、EJBベースのシステムにおいて、アプリケーション・サーバのJNDIレポジトリからbeanを検索します。

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. There are two different mechanisms that are used, based on whether you are using a v1 or v2 plugin.

Manager Classes

Confluenceには、機能の異なるエリアのための数ダースのManagerが用意されています。
下記の表のリストで、最もよく使われるもののいくつかを紹介します。

Manager class 責任(responsibility) サンプルのメソッド
戻り値 説明
PageManager Pages,blogs Page getPage(long id)
BlogPost getBlogPost(long id)
List getRecentlyAddedPages(int MaxPosts, Date timeSince, StringSpaceKey)
BlogPost findNextBlogPost(String Key, date time)
void saveContentEntity()
SpaceManager Spaces getSpace()
getParsonalSpace()

タグ:

+ タグ編集
  • タグ:
最終更新:2012年07月11日 15:05