Support of namespaces is required by the JSR-170 specification.
The default namespaces are registered by repository at the start-up time.
Your custom service can be extended with a set of namespaces with some specific applications, declaring it in the service's configuration file thanks to the eXo component plugin mechanism as described below:
<component-plugin>
<name>add.namespaces</name>
<set-method>addPlugin</set-method>
<type>org.exoplatform.services.jcr.impl.AddNamespacesPlugin</type>
<init-params>
<properties-param>
<name>namespaces</name>
<property name="test" value="http://www.test.org/test"/>
</properties-param>
</init-params>
</component-plugin>
The JCR implementation supports the namespaces altering.
ExtendedNamespaceRegistry namespaceRegistry = (ExtendedNamespaceRegistry)
workspace.getNamespaceRegistry();
namespaceRegistry.registerNamespace("newMapping", "http://dumb.uri/jcr");
Changing an existing namespace
ExtendedNamespaceRegistry namespaceRegistry = (ExtendedNamespaceRegistry)
workspace.getNamespaceRegistry();
namespaceRegistry.registerNamespace("newMapping", "http://dumb.uri/jcr");
namespaceRegistry.registerNamespace("newMapping2", "http://dumb.uri/jcr");
Removing an existing namespace
ExtendedNamespaceRegistry namespaceRegistry = (ExtendedNamespaceRegistry)
workspace.getNamespaceRegistry();
namespaceRegistry.registerNamespace("newMapping", "http://dumb.uri/jcr");
namespaceRegistry.unregisterNamespace("newMapping");