Class NodeTypeLoader

java.lang.Object
org.apache.sling.jcr.base.NodeTypeLoader

public class NodeTypeLoader extends Object
The NodeTypeSupport contains utility methods to register node types from a CND nodetype definition file given as an URL or InputStream with the repository.
  • Constructor Details

    • NodeTypeLoader

      public NodeTypeLoader()
  • Method Details

    • registerNodeType

      public static boolean registerNodeType(Session session, URL source)
      Registers node types from the CND file accessible by the URL with the node type manager available from the given session.

      The NodeTypeManager returned by the session's workspace is expected to be of type org.apache.jackrabbit.api.JackrabbitNodeTypeManager for the node type registration to succeed.

      This method is not synchronized. It is up to the calling method to prevent paralell execution.

      Parameters:
      session - The Session providing the node type manager through which the node type is to be registered.
      source - The URL from which to read the CND file
      Returns:
      true if registration of all node types succeeded.
    • registerNodeType

      public static boolean registerNodeType(Session session, InputStream source) throws IOException, RepositoryException
      Registers node types from the CND file read from the source with the node type manager available from the given session.

      The NodeTypeManager returned by the session's workspace is expected to be of type org.apache.jackrabbit.api.JackrabbitNodeTypeManager for the node type registration to succeed.

      This method is not synchronized. It is up to the calling method to prevent paralell execution.

      Parameters:
      session - The Session providing the node type manager through which the node type is to be registered.
      source - The InputStream from which the CND file is read.
      Returns:
      true if registration of all node types succeeded.
      Throws:
      IOException - if there is an error parsing the input stream
      RepositoryException - if another error occurs
    • registerNodeType

      public static boolean registerNodeType(Session session, String systemId, Reader reader, boolean reregisterExisting) throws IOException, RepositoryException
      Throws:
      IOException
      RepositoryException