org.apache.james.phoenix.jcr
Class AvalonJCRMailRepository

java.lang.Object
  extended by org.apache.james.jcr.JCRMailRepository
      extended by org.apache.james.phoenix.jcr.AvalonJCRMailRepository
All Implemented Interfaces:
org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.configuration.Configurable, MailRepository

public class AvalonJCRMailRepository
extends JCRMailRepository
implements org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable

Managed Avalon wrapper for the JCRMailRepository class.


Field Summary
protected  javax.jcr.Credentials credentials
          Login credentials for accessing the repository.
protected  org.apache.commons.logging.Log logger
           
protected  java.lang.String path
          Path (relative to root) of the mail repository within the workspace.
protected  javax.jcr.Repository repository
          JCR content repository used as the mail repository.
protected  java.lang.String workspace
          Name of the workspace used as the mail repository.
 
Fields inherited from interface org.apache.james.services.MailRepository
MAIL, ROLE
 
Constructor Summary
AvalonJCRMailRepository()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 javax.jcr.Credentials getCredentials()
          Returns the login credentials for accessing the repository.
 org.apache.commons.logging.Log getLogger()
          Gets the current logger.
 java.lang.String getPath()
          Returns the path of the mail repository within the workspace.
 javax.jcr.Repository getRepository()
          Retuns the JCR content repository used as the mail repository.
 java.lang.String getWorkspace()
          Returns the name of the workspace used as the mail repository.
 void initialize()
           
protected  javax.jcr.Session login()
          Logs into a new session.
protected  javax.jcr.NodeIterator query(javax.jcr.Session session, java.lang.String xpath)
           
 void setCredentials(javax.jcr.Credentials credentials)
          Sets the login credentials for accessing the repository.
 void setLogger(org.apache.commons.logging.Log logger)
          Sets the current logger.
 void setPath(java.lang.String path)
          Sets the path of the mail repository within the workspace.
 void setRepository(javax.jcr.Repository repository)
          Sets the JCR content repository to be used as the mail repository.
 void setWorkspace(java.lang.String workspace)
          Sets the name of the workspace used as the mail repository.
protected  java.lang.String toSafeName(java.lang.String key)
           
 
Methods inherited from class org.apache.james.jcr.JCRMailRepository
list, lock, remove, remove, remove, retrieve, store, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.apache.commons.logging.Log logger

repository

protected javax.jcr.Repository repository
JCR content repository used as the mail repository. Must be set before the any mail operations are performed.


credentials

protected javax.jcr.Credentials credentials
Login credentials for accessing the repository. Set to null (the default) to use default credentials.


workspace

protected java.lang.String workspace
Name of the workspace used as the mail repository. Set to null (the default) to use the default workspace.


path

protected java.lang.String path
Path (relative to root) of the mail repository within the workspace.

Constructor Detail

AvalonJCRMailRepository

public AvalonJCRMailRepository()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

initialize

public void initialize()
                throws java.lang.Exception
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
java.lang.Exception

getLogger

public final org.apache.commons.logging.Log getLogger()
Gets the current logger.

Returns:
the logger, not null

setLogger

public final void setLogger(org.apache.commons.logging.Log logger)
Sets the current logger.

Parameters:
logger - the logger to set, not null

getRepository

public javax.jcr.Repository getRepository()
Retuns the JCR content repository used as the mail repository.

Returns:
JCR content repository

setRepository

public void setRepository(javax.jcr.Repository repository)
Sets the JCR content repository to be used as the mail repository.

Parameters:
repository - JCR content repository

getCredentials

public javax.jcr.Credentials getCredentials()
Returns the login credentials for accessing the repository.

Returns:
login credentials, or null if using the default credentials

setCredentials

public void setCredentials(javax.jcr.Credentials credentials)
Sets the login credentials for accessing the repository.

Parameters:
credentials - login credentials, or null to use the default credentials

getWorkspace

public java.lang.String getWorkspace()
Returns the name of the workspace used as the mail repository.

Returns:
workspace name, or null if using the default workspace

setWorkspace

public void setWorkspace(java.lang.String workspace)
Sets the name of the workspace used as the mail repository.

Parameters:
workspace - workspace name, or null to use the default workspace

getPath

public java.lang.String getPath()
Returns the path of the mail repository within the workspace.

Returns:
repository path

setPath

public void setPath(java.lang.String path)
Sets the path of the mail repository within the workspace.

Parameters:
path - repository path

login

protected javax.jcr.Session login()
                           throws javax.jcr.LoginException,
                                  javax.jcr.NoSuchWorkspaceException,
                                  javax.jcr.RepositoryException
Logs into a new session.

Returns:
new session, not null
Throws:
javax.jcr.LoginException - when login fails
javax.jcr.NoSuchWorkspaceException - when workspace does not exist
javax.jcr.RepositoryException - when access fails

toSafeName

protected java.lang.String toSafeName(java.lang.String key)

query

protected javax.jcr.NodeIterator query(javax.jcr.Session session,
                                       java.lang.String xpath)
                                throws javax.jcr.RepositoryException,
                                       javax.jcr.query.InvalidQueryException
Throws:
javax.jcr.RepositoryException
javax.jcr.query.InvalidQueryException


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.