org.apache.cocoon.jcr
Class AbstractRepository

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.jcr.AbstractRepository
All Implemented Interfaces:
Disposable, Component, Configurable, Contextualizable, LogEnabled, Serviceable, ThreadSafe
Direct Known Subclasses:
JackrabbitRepository, JNDIRepository

public abstract class AbstractRepository
extends AbstractLogEnabled
implements ThreadSafe, Contextualizable, Serviceable, Configurable, Disposable, Component

Base class for JCR (aka JSR-170) repository as a Cocoon component. The main purpose of this class is to allow repository credentials to be specified in the component's configuration, so that the application code just has to call repository.login().

There is no Cocoon-specific role for this component: "javax.jcr.Repository" should be used.

The configuration of this class, inherited by its subclasses, is as follows:

    <jcr-repository>
      <jaas src="context://samples/jaas.config"/>
      <credentials login="expression" password="expression"/>
      ... other specific configuration...
    </jcr-repository>
 
Login and password can be specified using the sitemap expression language, thus allowing the use of input modules to compute their values, e.g. password="{session-attr:jcr-password}".

<credentials> is optional. If not specified, the application must explicitely supply credentials when calling Repository.login().

Version:
$Id: AbstractRepository.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Field Summary
protected  Context context
           
protected  Repository delegate
           
static String JCR_SESSION_REQUEST_ATTRIBUTE
          The request attribute in which the JCR session is stored
protected  VariableResolver loginResolver
           
protected  ServiceManager manager
           
protected  VariableResolver passwordResolver
           
static String ROLE
          Role which shall be used for JCR repository implementations.
 
Constructor Summary
AbstractRepository()
           
 
Method Summary
 void configure(Configuration config)
           
 void contextualize(Context context)
           
 void dispose()
           
 String getDescriptor(String key)
           
 String[] getDescriptorKeys()
           
 Session login()
           
 Session login(Credentials creds)
           
 Session login(Credentials creds, String workspace)
           
 Session login(String workspace)
           
 void service(ServiceManager manager)
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROLE

public static final String ROLE
Role which shall be used for JCR repository implementations.

See Also:
Constant Field Values

JCR_SESSION_REQUEST_ATTRIBUTE

public static final String JCR_SESSION_REQUEST_ATTRIBUTE
The request attribute in which the JCR session is stored

See Also:
Constant Field Values

manager

protected ServiceManager manager

context

protected Context context

delegate

protected Repository delegate

loginResolver

protected VariableResolver loginResolver

passwordResolver

protected VariableResolver passwordResolver
Constructor Detail

AbstractRepository

public AbstractRepository()
Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Throws:
ContextException

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException

configure

public void configure(Configuration config)
               throws ConfigurationException
Specified by:
configure in interface Configurable
Throws:
ConfigurationException

dispose

public void dispose()
Specified by:
dispose in interface Disposable

getDescriptor

public String getDescriptor(String key)

getDescriptorKeys

public String[] getDescriptorKeys()

login

public Session login()
              throws LoginException,
                     NoSuchWorkspaceException,
                     RepositoryException
Throws:
LoginException
NoSuchWorkspaceException
RepositoryException

login

public Session login(Credentials creds)
              throws LoginException,
                     NoSuchWorkspaceException,
                     RepositoryException
Throws:
LoginException
NoSuchWorkspaceException
RepositoryException

login

public Session login(Credentials creds,
                     String workspace)
              throws LoginException,
                     NoSuchWorkspaceException,
                     RepositoryException
Throws:
LoginException
NoSuchWorkspaceException
RepositoryException

login

public Session login(String workspace)
              throws LoginException,
                     NoSuchWorkspaceException,
                     RepositoryException
Throws:
LoginException
NoSuchWorkspaceException
RepositoryException


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.