Class RepositoryUtil


  • public class RepositoryUtil
    extends Object
    Utility class for managing JCR repositories, used to initialize temporary Jackrabbit repositories for testing.
    • Constructor Detail

      • RepositoryUtil

        public RepositoryUtil()
    • Method Detail

      • startRepository

        public static void startRepository()
                                    throws javax.jcr.RepositoryException
        Start a new repository
        Throws:
        javax.jcr.RepositoryException - when it is not possible to start the repository.
      • getRepository

        public static org.apache.sling.jcr.api.SlingRepository getRepository()
        Get a repository
        Returns:
        a JCR repository reference
      • registerNodeType

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

        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
        javax.jcr.RepositoryException
      • registerSlingNodeTypes

        public static void registerSlingNodeTypes​(javax.jcr.Session adminSession)
                                           throws IOException,
                                                  javax.jcr.RepositoryException
        Throws:
        IOException
        javax.jcr.RepositoryException