| <?xml version="1.0"?> |
| <document> |
| <properties> |
| <title>Jackrabbit Extension Framework - Configuration</title> |
| </properties> |
| <body> |
| <section name="Configuration"> |
| <p> |
| The Jackrabbit Extension framework supports configuration of |
| the extensions by means of the |
| <a |
| href="http://jakarta.apache.org/commons/configuration/"> |
| Apache Commons Configuration |
| </a> |
| project. As such, the class specified in the |
| <code>rep:configurationClass</code> |
| property of the extension descriptor must implement the |
| <code>Configuration</code> |
| interface. Generally, it will be an implementation of |
| the |
| <code>RepositoryConfiguration</code> |
| interface, which supports loading and saving of |
| configuration from and to the Jackrabbit repository. The Jackrabbit |
| Extension Framework provides three implementations of |
| the |
| <code>RepositoryConfiguration</code> |
| interface: |
| <code><a href="#ItemConfiguration">ItemConfiguration</a></code>, |
| <code><a href="#PropertiesNodeConfiguration">PropertiesNodeConfiguration</a></code> |
| and |
| <code><a href="#XMLNodeConfiguration">XMLNodeConfiguration</a></code>. |
| </p> |
| <p> |
| The default configuration class used if none is |
| configured in the extension node, is the |
| <code>ItemConfiguration</code>. |
| </p> |
| <p> |
| The configuration object is only created and loaded when |
| the |
| <code>getConfiguration()</code> |
| method of the extension descriptor is first called. |
| </p> |
| |
| <subsection name="ItemConfiguration"> |
| <p> |
| The |
| <code> |
| <a |
| href="apidocs/org/apache/jackrabbit/extension/configuration/ItemConfiguration.html"> |
| ItemConfiguration |
| </a> |
| </code> |
| loads a subtree of the repository rooted at the |
| <code>rep:configuration</code> |
| child node of the extension node as a |
| <code> |
| <a |
| href="http://jakarta.apache.org/commons/configuration/apidocs/org/apache/commons/configuration/HierarchicalConfiguration.html"> |
| HierarchicalConfiguration</a></code>. Each node |
| in the subtree becomes a configuration |
| node and each property becomes an attribute. |
| Protected nodes and properties (such as |
| <i>jcr:primaryType</i>) are ignored and neither read nor |
| written (they cannot be written anyway). |
| </p> |
| <p> |
| Generally the nodes making up the |
| <code>ItemConfiguration</code> |
| will be |
| <code>nt:unstructured</code> |
| node thus providing full flexibility for defining |
| the configuration. When an instance of the |
| <code>ItemConfiguration</code> |
| class saves configuration data, this node type is |
| used for newly created nodes. |
| </p> |
| <p> |
| <b>Example</b> |
| </p> |
| <source><![CDATA[ |
| /extensions/sample |
| +-- ... extension descriptor omitted ... |
| +-- rep:configuration |
| +-- handler |
| | +-- class = "some.Class" |
| | +-- name = "the name" |
| | +-- path = [ "/folder1", "/folder2" ] |
| +-- codes |
| +-- boolean = true |
| +-- double = 2.5D |
| +-- long = 10L |
| +-- string = "a string" |
| +-- date = 2002-10-11Z19:28]]></source> |
| <p> |
| The data structure shown above translates into a |
| configuration data structure with the following |
| contents. Note the |
| <i><b>[@</b>name<b>]</b></i> |
| notation which designates configuration attributes |
| in contrast to configuration nodes. |
| </p> |
| <source><![CDATA[ |
| handler[@class] = "some.Class" |
| handler[@name] = "the name" |
| handler[@path](0) = "/folder1" |
| handler[@path](1) = "/folder2" |
| handler.codes[@boolean] = true |
| handler.codes[@double] = 2.5D |
| handler.codes[@long] = 10L |
| handler.codes[@string] = "a string" |
| handler.codes[@date] = 2002-10-11Z19:28]]></source> |
| </subsection> |
| |
| <subsection name="PropertiesNodeConfiguration"> |
| <p> |
| The |
| <code> |
| <a |
| href="apidocs/org/apache/jackrabbit/extension/configuration/PropertiesNodeConfiguration.html"> |
| PropertiesNodeConfiguration |
| </a> |
| </code> |
| extends the |
| <code> |
| <a |
| href="http://jakarta.apache.org/commons/configuration/apidocs/org/apache/commons/configuration/PropertiesConfiguration.html"> |
| PropertiesConfiguration |
| </a> |
| </code> |
| class and supports loading and saving of properties |
| files from and to the |
| <code>rep:configuration</code> |
| property of the extension node. |
| </p> |
| </subsection> |
| |
| <subsection name="XMLNodeConfiguration"> |
| <p> |
| The |
| <code> |
| <a |
| href="apidocs/org/apache/jackrabbit/extension/configuration/XMLNodeConfiguration.html"> |
| XMLNodeConfiguration |
| </a> |
| </code> |
| extends the |
| <code> |
| <a |
| href="http://jakarta.apache.org/commons/configuration/apidocs/org/apache/commons/configuration/XMLConfiguration.html"> |
| XMLConfiguration |
| </a> |
| </code> |
| class and supports loading and saving of XML files |
| from and to the |
| <code>rep:configuration</code> |
| property of the extension node. |
| </p> |
| </subsection> |
| </section> |
| </body> |
| </document> |