org.modeshape.repository.util
Class SimpleSessionFactory

java.lang.Object
  extended by org.modeshape.repository.util.AbstractSessionFactory
      extended by org.modeshape.repository.util.SimpleSessionFactory
All Implemented Interfaces:
SessionFactory

public class SimpleSessionFactory
extends AbstractSessionFactory

A SessionFactory implementation that creates Session instances from a map of named Repository references managed by this factory.

By default, this factory creates an anonymous JCR session. To use sessions with specific Credentials, simply register credentials for the appropriate repository/workspace name. For security reasons, it is not possible to retrieve the Credentials once registered with this factory.


Field Summary
 
Fields inherited from class org.modeshape.repository.util.AbstractSessionFactory
DEFAULT_DELIMITERS
 
Constructor Summary
SimpleSessionFactory()
          Create an instance of the factory by creating a new InitialContext.
SimpleSessionFactory(char... workspaceDelimiters)
          Create an instance of the factory by supplying the characters that may be used to delimit the workspace name from the repository name.
 
Method Summary
protected  void doRegisterRepository(String name, javax.jcr.Repository repository)
          
protected  void doUnregisterRepository(String name)
          
protected  javax.jcr.Repository findRegisteredRepository(String name)
          
 
Methods inherited from class org.modeshape.repository.util.AbstractSessionFactory
createSession, getIndexOfLastWorkspaceDelimiter, getRepositoryName, getWorkspaceName, registerCredentials, registerCredentials, registerRepository, removeCredentials
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSessionFactory

public SimpleSessionFactory()
Create an instance of the factory by creating a new InitialContext.


SimpleSessionFactory

public SimpleSessionFactory(char... workspaceDelimiters)
Create an instance of the factory by supplying the characters that may be used to delimit the workspace name from the repository name.

Parameters:
workspaceDelimiters - the delimiters, or null/empty if the default delimiter of '/' should be used.
Method Detail

doRegisterRepository

protected void doRegisterRepository(String name,
                                    javax.jcr.Repository repository)

Specified by:
doRegisterRepository in class AbstractSessionFactory

doUnregisterRepository

protected void doUnregisterRepository(String name)
                               throws SystemFailureException

Specified by:
doUnregisterRepository in class AbstractSessionFactory
Throws:
SystemFailureException

findRegisteredRepository

protected javax.jcr.Repository findRegisteredRepository(String name)
                                                 throws SystemFailureException

Specified by:
findRegisteredRepository in class AbstractSessionFactory
Throws:
SystemFailureException


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.