Class RepositoryUtil
java.lang.Object
org.apache.sling.commons.testing.jcr.RepositoryUtil
Utility class for managing JCR repositories, used to initialize temporary
Jackrabbit repositories for testing.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.sling.jcr.api.SlingRepositoryGet a repositorystatic 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 voidregisterSlingNodeTypes(javax.jcr.Session adminSession) static voidStart a new repositorystatic voidStop a repository.
-
Field Details
-
ADMIN_NAME
- See Also:
-
ADMIN_PASSWORD
- See Also:
-
HOME_DIR
- See Also:
-
CONFIG_FILE
- See Also:
-
-
Constructor Details
-
RepositoryUtil
public RepositoryUtil()
-
-
Method Details
-
startRepository
public static void startRepository() throws javax.jcr.RepositoryExceptionStart a new repository- Throws:
javax.jcr.RepositoryException- when it is not possible to start the repository.
-
stopRepository
Stop a repository.- Throws:
NamingException
-
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 thesourcewith the node type manager available from the givensession.This method is not synchronized. It is up to the calling method to prevent parallel 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:
IOExceptionjavax.jcr.RepositoryException
-
registerSlingNodeTypes
public static void registerSlingNodeTypes(javax.jcr.Session adminSession) throws IOException, javax.jcr.RepositoryException - Throws:
IOExceptionjavax.jcr.RepositoryException
-