org.priha.core
Class RepositoryImpl

java.lang.Object
  extended by org.priha.core.RepositoryImpl
All Implemented Interfaces:
javax.jcr.Repository

public class RepositoryImpl
extends java.lang.Object
implements javax.jcr.Repository

Provides the main Repository class for Priha. You may use this by simply instantiating it with a suitable Properties object.


Nested Class Summary
protected static interface RepositoryImpl.SessionVisitor
           
 
Field Summary
static java.lang.String DEFAULT_WORKSPACE
           
 
Fields inherited from interface javax.jcr.Repository
LEVEL_1_SUPPORTED, LEVEL_2_SUPPORTED, OPTION_LOCKING_SUPPORTED, OPTION_OBSERVATION_SUPPORTED, OPTION_QUERY_SQL_SUPPORTED, OPTION_TRANSACTIONS_SUPPORTED, OPTION_VERSIONING_SUPPORTED, QUERY_XPATH_DOC_ORDER, QUERY_XPATH_POS_INDEX, REP_NAME_DESC, REP_VENDOR_DESC, REP_VENDOR_URL_DESC, REP_VERSION_DESC, SPEC_NAME_DESC, SPEC_VERSION_DESC
 
Constructor Summary
RepositoryImpl(java.util.Properties prefs)
          Create a new Repository using the given properties.
 
Method Summary
 java.lang.String getDescriptor(java.lang.String key)
           
 java.lang.String[] getDescriptorKeys()
           
static NamespaceRegistryImpl getGlobalNamespaceRegistry()
           
 java.lang.String getProperty(java.lang.String key)
           
 java.lang.String getProperty(java.lang.String key, java.lang.String defValue)
           
 java.util.Enumeration<java.lang.String> getPropertyNames()
           
protected  ProviderManager getProviderManager()
           
protected  org.priha.core.RepositoryImpl.SessionManager getSessionManager()
           
 SessionImpl login()
           
 SessionImpl login(javax.jcr.Credentials credentials)
           
 SessionImpl login(javax.jcr.Credentials credentials, java.lang.String workspaceName)
           
 SessionImpl login(java.lang.String workspaceName)
           
protected  void removeSession(SessionImpl s)
           
 void setProperty(java.lang.String key, java.lang.String property)
          Set transient properties for this repository.
 void shutdown()
          Shuts down the entire repository, stops all providers and releases resources.
 SessionImpl superUserLogin(java.lang.String workspaceName)
          Returns a Session which has write permissions to the repository.
protected  void visit(RepositoryImpl.SessionVisitor v)
          Visits all current Sessions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WORKSPACE

public static final java.lang.String DEFAULT_WORKSPACE
See Also:
Constant Field Values
Constructor Detail

RepositoryImpl

public RepositoryImpl(java.util.Properties prefs)
               throws ConfigurationException
Create a new Repository using the given properties. Any property which is not set will be read from the default properties (priha_default.properties).

Parameters:
prefs - Properties to use. Must not be null.
Throws:
ConfigurationException - If the properties are wrong.
Method Detail

getProperty

public java.lang.String getProperty(java.lang.String key)

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defValue)

getProviderManager

protected ProviderManager getProviderManager()
                                      throws ConfigurationException
Throws:
ConfigurationException

getSessionManager

protected org.priha.core.RepositoryImpl.SessionManager getSessionManager()

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String property)
Set transient properties for this repository. These are not saved anywhere, but they might be something that you can use to control the Repository behaviour with.

Parameters:
key -
property -

getPropertyNames

public java.util.Enumeration<java.lang.String> getPropertyNames()

getDescriptor

public java.lang.String getDescriptor(java.lang.String key)
Specified by:
getDescriptor in interface javax.jcr.Repository

getDescriptorKeys

public java.lang.String[] getDescriptorKeys()
Specified by:
getDescriptorKeys in interface javax.jcr.Repository

login

public SessionImpl login(javax.jcr.Credentials credentials,
                         java.lang.String workspaceName)
                  throws javax.jcr.LoginException,
                         javax.jcr.NoSuchWorkspaceException,
                         javax.jcr.RepositoryException
Specified by:
login in interface javax.jcr.Repository
Throws:
javax.jcr.LoginException
javax.jcr.NoSuchWorkspaceException
javax.jcr.RepositoryException

login

public SessionImpl login(javax.jcr.Credentials credentials)
                  throws javax.jcr.LoginException,
                         javax.jcr.RepositoryException
Specified by:
login in interface javax.jcr.Repository
Throws:
javax.jcr.LoginException
javax.jcr.RepositoryException

login

public SessionImpl login(java.lang.String workspaceName)
                  throws javax.jcr.LoginException,
                         javax.jcr.NoSuchWorkspaceException,
                         javax.jcr.RepositoryException
Specified by:
login in interface javax.jcr.Repository
Throws:
javax.jcr.LoginException
javax.jcr.NoSuchWorkspaceException
javax.jcr.RepositoryException

login

public SessionImpl login()
                  throws javax.jcr.LoginException,
                         javax.jcr.RepositoryException
Specified by:
login in interface javax.jcr.Repository
Throws:
javax.jcr.LoginException
javax.jcr.RepositoryException

shutdown

public void shutdown()
Shuts down the entire repository, stops all providers and releases resources. After this call you can restart the repository by either calling login(), or creating a new RepositoryImpl instance.


superUserLogin

public SessionImpl superUserLogin(java.lang.String workspaceName)
                           throws javax.jcr.LoginException,
                                  javax.jcr.NoSuchWorkspaceException,
                                  javax.jcr.RepositoryException
Returns a Session which has write permissions to the repository. Normally, the user has no reason to use this method - it is used internally to sometimes modify the repo.

This method is guaranteed to always return a Session which has all permissions into the repository - assuming the underlying repository implementation does not have any limitations (which it normally should not have).

Parameters:
workspaceName - The workspace to which the login is done.
Returns:
A Priha SessionImpl object.
Throws:
javax.jcr.LoginException
javax.jcr.NoSuchWorkspaceException
javax.jcr.RepositoryException

getGlobalNamespaceRegistry

public static NamespaceRegistryImpl getGlobalNamespaceRegistry()

visit

protected void visit(RepositoryImpl.SessionVisitor v)
Visits all current Sessions

Parameters:
v -

removeSession

protected void removeSession(SessionImpl s)