3.1.2. Node types

3.1.2.1. Node type definition
3.1.2.2. Node type registration

Note

Support of node types is required by the JSR-170 specification. Beyond the methods required by the specification, eXo JCR has its own API extension for the Node type registration as well as the ability to declaratively define node types in the Repository at the start-up time.

Node type registration extension is declared in the org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager interface.

Your custom service can register some necessary predefined node types at the start-up time. The node definition should be placed in a special XML file (see DTD below) and declared in the service's configuration file thanks to the eXo component plugin mechanism as described below:


<external-component-plugins>
    <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
        <component-plugin>
            <name>add.nodeType</name>
            <set-method>addPlugin</set-method>
            <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
            <init-params>
                <values-param>
                    <name>autoCreatedInNewRepository</name>
                    <description>Node types configuration file</description>
                    <value>jar:/conf/test/nodetypes-tck.xml</value>
                    <value>jar:/conf/test/nodetypes-impl.xml</value>
                </values-param>
                <values-param>
                    <name>repo1</name>
                    <description>Node types configuration file for repository with name repo1</description>
                    <value>jar:/conf/test/nodetypes-test.xml</value>
                </values-param>
                <values-param>
                    <name>repo2</name>
                    <description>Node types configuration file for repository with name repo2</description>
                    <value>jar:/conf/test/nodetypes-test2.xml</value>
                </values-param>
            </init-params>
        </component-plugin>

There are two registration types. The first type is the registration of node types in all created repositories, it is configured in values-param with the name autoCreatedInNewRepository. The second type is registration of node types in specified repository and it is configured in values-param with the name of repository.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus