org.priha.core
Class RepositoryImpl

java.lang.Object
  extended by org.priha.core.RepositoryImpl

public class RepositoryImpl
extends java.lang.Object

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

Any property may be overridden also from the command line using a system property.


Nested Class Summary
protected static interface RepositoryImpl.SessionVisitor
           
 
Field Summary
static java.lang.String DEFAULT_WORKSPACE
           
 
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()
           
protected static PathManager getPathManager()
           
 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(Credentials credentials)
           
 SessionImpl login(Credentials credentials, 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

getPathManager

protected static PathManager getPathManager()

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)

getDescriptorKeys

public java.lang.String[] getDescriptorKeys()

login

public SessionImpl login(Credentials credentials,
                         java.lang.String workspaceName)
                  throws LoginException,
                         NoSuchWorkspaceException,
                         RepositoryException
Throws:
LoginException
NoSuchWorkspaceException
RepositoryException

login

public SessionImpl login(Credentials credentials)
                  throws LoginException,
                         RepositoryException
Throws:
LoginException
RepositoryException

login

public SessionImpl login()
                  throws LoginException,
                         RepositoryException
Throws:
LoginException
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 LoginException,
                                  NoSuchWorkspaceException,
                                  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:
LoginException
NoSuchWorkspaceException
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)