org.apache.jackrabbit.test
Class RepositoryHelper

java.lang.Object
  extended by org.apache.jackrabbit.test.RepositoryHelper

public class RepositoryHelper
extends Object

Utility class to get access to Session instances.


Constructor Summary
RepositoryHelper()
          Creates a repository helper with configuration from repositoryStubImpl.properties file.
RepositoryHelper(Map config)
          Creates a repository helper with additional configuration parameters.
 
Method Summary
 String getProperty(String name)
          Returns the value of the configuration property with specified name.
 javax.jcr.Credentials getReadOnlyCredentials()
          Returns the read-only credentials created from the username and password specified in the configuration properties.
 javax.jcr.Session getReadOnlySession()
          Returns a Session of the default workspace with read only access to the workspace.
 javax.jcr.Session getReadOnlySession(String workspaceName)
          Returns a Session of the workspace with name workspaceName with read only access to the workspace.
 javax.jcr.Credentials getReadWriteCredentials()
          Returns the read-write credentials created from the username and password specified in the configuration properties.
 javax.jcr.Session getReadWriteSession()
          Returns a Session of the default workspace with read and write access to the workspace.
 javax.jcr.Session getReadWriteSession(String workspaceName)
          Returns a Session of the workspace with name workspaceName with read and write access to the workspace.
 javax.jcr.Repository getRepository()
          Returns the repository instance to test.
 javax.jcr.Credentials getSuperuserCredentials()
          Returns the superuser credentials created from the username and password specified in the configuration properties.
 javax.jcr.Session getSuperuserSession()
          Returns a superuser Session of the default workspace.
 javax.jcr.Session getSuperuserSession(String workspaceName)
          Returns a superuser Session of the workspace with name workspaceName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryHelper

public RepositoryHelper()
Creates a repository helper with configuration from repositoryStubImpl.properties file.


RepositoryHelper

public RepositoryHelper(Map config)
Creates a repository helper with additional configuration parameters.

Parameters:
config - configuration which overlays the values from the property file.
Method Detail

getRepository

public javax.jcr.Repository getRepository()
                                   throws javax.jcr.RepositoryException
Returns the repository instance to test.

Returns:
the repository instance to test.
Throws:
javax.jcr.RepositoryException - if the repository could not be obtained.

getSuperuserSession

public javax.jcr.Session getSuperuserSession()
                                      throws javax.jcr.RepositoryException
Returns a superuser Session of the default workspace. The returned Session has read and write access to the whole workspace.

Returns:
a superuser Session.
Throws:
javax.jcr.RepositoryException - if login to the repository failed.

getSuperuserSession

public javax.jcr.Session getSuperuserSession(String workspaceName)
                                      throws javax.jcr.RepositoryException
Returns a superuser Session of the workspace with name workspaceName. The returned Session has read and write access to the whole workspace.

Returns:
a superuser Session.
Throws:
javax.jcr.RepositoryException - if login to the repository failed.

getReadWriteSession

public javax.jcr.Session getReadWriteSession()
                                      throws javax.jcr.RepositoryException
Returns a Session of the default workspace with read and write access to the workspace.

Returns:
a Session with read and write access.
Throws:
javax.jcr.RepositoryException - if login to the repository failed.

getReadWriteSession

public javax.jcr.Session getReadWriteSession(String workspaceName)
                                      throws javax.jcr.RepositoryException
Returns a Session of the workspace with name workspaceName with read and write access to the workspace.

Returns:
a Session with read and write access.
Throws:
javax.jcr.RepositoryException - if login to the repository failed.

getReadOnlySession

public javax.jcr.Session getReadOnlySession()
                                     throws javax.jcr.RepositoryException
Returns a Session of the default workspace with read only access to the workspace.

Returns:
a Session with read only.
Throws:
javax.jcr.RepositoryException - if login to the repository failed.

getReadOnlySession

public javax.jcr.Session getReadOnlySession(String workspaceName)
                                     throws javax.jcr.RepositoryException
Returns a Session of the workspace with name workspaceName with read only access to the workspace.

Returns:
a Session with read only access.
Throws:
javax.jcr.RepositoryException - if login to the repository failed.

getProperty

public String getProperty(String name)
                   throws javax.jcr.RepositoryException
Returns the value of the configuration property with specified name. If the property does not exist null is returned.

Configuration properties are defined in the file: repositoryStubImpl.properties.

Parameters:
name - the name of the property to retrieve.
Returns:
the value of the property or null if non existent.
Throws:
javax.jcr.RepositoryException - if the configuration file cannot be found.

getReadOnlyCredentials

public javax.jcr.Credentials getReadOnlyCredentials()
Returns the read-only credentials created from the username and password specified in the configuration properties. Configuration properties are defined in the file: repositoryStubImpl.properties.

Returns:
read-only Credentials

getReadWriteCredentials

public javax.jcr.Credentials getReadWriteCredentials()
Returns the read-write credentials created from the username and password specified in the configuration properties. Configuration properties are defined in the file: repositoryStubImpl.properties.

Returns:
read-write Credentials

getSuperuserCredentials

public javax.jcr.Credentials getSuperuserCredentials()
Returns the superuser credentials created from the username and password specified in the configuration properties. Configuration properties are defined in the file: repositoryStubImpl.properties.

Returns:
superuser Credentials


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.