Package org.apache.sling.jcr.base
Class NodeTypeLoader
- java.lang.Object
-
- org.apache.sling.jcr.base.NodeTypeLoader
-
public class NodeTypeLoader extends Object
TheNodeTypeSupportcontains utility methods to register node types from a CND nodetype definition file given as an URL or InputStream with the repository.
-
-
Constructor Summary
Constructors Constructor Description NodeTypeLoader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanregisterNodeType(javax.jcr.Session session, InputStream source)Registers node types from the CND file read from thesourcewith the node type manager available from the givensession.static booleanregisterNodeType(javax.jcr.Session session, String systemId, Reader reader, boolean reregisterExisting)static booleanregisterNodeType(javax.jcr.Session session, URL source)Registers node types from the CND file accessible by theURLwith the node type manager available from the givensession.
-
-
-
Method Detail
-
registerNodeType
public static boolean registerNodeType(javax.jcr.Session session, URL source)Registers node types from the CND file accessible by theURLwith the node type manager available from the givensession.The
NodeTypeManagerreturned by thesession's workspace is expected to be of typeorg.apache.jackrabbit.api.JackrabbitNodeTypeManagerfor the node type registration to succeed.This method is not synchronized. It is up to the calling method to prevent paralell execution.
- Parameters:
session- TheSessionproviding the node type manager through which the node type is to be registered.source- The URL from which to read the CND file- Returns:
trueif registration of all node types succeeded.
-
registerNodeType
public static boolean registerNodeType(javax.jcr.Session session, InputStream source) throws IOException, javax.jcr.RepositoryExceptionRegisters node types from the CND file read from thesourcewith the node type manager available from the givensession.The
NodeTypeManagerreturned by thesession's workspace is expected to be of typeorg.apache.jackrabbit.api.JackrabbitNodeTypeManagerfor the node type registration to succeed.This method is not synchronized. It is up to the calling method to prevent paralell execution.
- Parameters:
session- TheSessionproviding the node type manager through which the node type is to be registered.source- TheInputStreamfrom which the CND file is read.- Returns:
trueif registration of all node types succeeded.- Throws:
IOException- if there is an error parsing the input streamjavax.jcr.RepositoryException- if another error occurs
-
registerNodeType
public static boolean registerNodeType(javax.jcr.Session session, String systemId, Reader reader, boolean reregisterExisting) throws IOException, javax.jcr.RepositoryException- Throws:
IOExceptionjavax.jcr.RepositoryException
-
-