org.apache.jackrabbit.jcr2spi
Class SessionImpl

java.lang.Object
  extended by org.apache.jackrabbit.commons.AbstractSession
      extended by org.apache.jackrabbit.jcr2spi.SessionImpl
All Implemented Interfaces:
Session, ManagerProvider, NamespaceResolver
Direct Known Subclasses:
XASessionImpl

public class SessionImpl
extends AbstractSession
implements NamespaceResolver, ManagerProvider

SessionImpl...


Method Summary
 void addListener(SessionListener listener)
          Add a SessionListener
 void addLockToken(String lt)
           
 void checkPermission(String absPath, String actions)
           
protected  ItemManager createItemManager(HierarchyManager hierarchyManager)
           
protected  SessionItemStateManager createSessionItemStateManager(UpdatableItemStateManager workspaceStateManager, ItemStateFactory isf)
           
protected  WorkspaceImpl createWorkspaceInstance(RepositoryConfig config, SessionInfo sessionInfo)
           
 AccessManager getAccessManager()
           
 Object getAttribute(String name)
          Always returns null.
 String[] getAttributeNames()
          Always returns an empty String array.
 EffectiveNodeTypeProvider getEffectiveNodeTypeProvider()
           
 HierarchyManager getHierarchyManager()
           
 IdFactory getIdFactory()
           
 ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior)
           
 Item getItem(String absPath)
          Returns the node or property at the given path.
 ItemDefinitionProvider getItemDefinitionProvider()
           
 ValueFactory getJcrValueFactory()
          Same as Session.getValueFactory() but omits the check, if this repository is really level 2 compliant.
 LockManager getLockManager()
          Returns the AccessManager associated with this ManagerProvider.
 String[] getLockTokens()
           
 NameFactory getNameFactory()
           
 NamePathResolver getNamePathResolver()
           
 NameResolver getNameResolver()
           
 NamespaceResolver getNamespaceResolver()
           
 Node getNodeByUUID(String uuid)
           
 PathResolver getPathResolver()
           
 String getPrefix(String uri)
          Returns the prefix which is mapped to the given URI.
 QValueFactory getQValueFactory()
           
 Repository getRepository()
           
 Node getRootNode()
           
 String getURI(String prefix)
          Returns the URI to which the given prefix is mapped.
 String getUserID()
           
 ItemStateValidator getValidator()
           
 ValueFactory getValueFactory()
           
 VersionManager getVersionManager()
          Returns the VersionManager associated with this ManagerProvider.
 Workspace getWorkspace()
           
 boolean hasPendingChanges()
           
 Session impersonate(Credentials credentials)
          Logs in the same workspace with the given credentials.
 void importXML(String parentAbsPath, InputStream in, int uuidBehavior)
          Parses the given input stream as an XML document and processes the SAX events using the ContentHandler returned by Session.getImportContentHandler(String, int).
 boolean isLive()
           
 boolean itemExists(String absPath)
          Calls AbstractSession.getItem(String) with the given path and returns true if the call succeeds.
 void logout()
          Clears the local namespace mappings.
 void move(String srcAbsPath, String destAbsPath)
           
 void refresh(boolean keepChanges)
           
 void removeListener(SessionListener listener)
          Remove a SessionListener
 void removeLockToken(String lt)
           
 void save()
           
 void setNamespacePrefix(String prefix, String uri)
          Modifies the session local namespace mappings to contain the given prefix to URI mapping.
 
Methods inherited from class org.apache.jackrabbit.commons.AbstractSession
exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRepository

public Repository getRepository()
Specified by:
getRepository in interface Session
See Also:
Session.getRepository()

getUserID

public String getUserID()
Specified by:
getUserID in interface Session
See Also:
Session.getUserID()

getAttribute

public Object getAttribute(String name)
Always returns null.

Specified by:
getAttribute in interface Session
See Also:
Session.getAttribute(String)

getAttributeNames

public String[] getAttributeNames()
Always returns an empty String array.

Specified by:
getAttributeNames in interface Session
See Also:
Session.getAttributeNames()

getWorkspace

public Workspace getWorkspace()
Specified by:
getWorkspace in interface Session
See Also:
Session.getWorkspace()

impersonate

public Session impersonate(Credentials credentials)
                    throws LoginException,
                           RepositoryException
Description copied from class: AbstractSession
Logs in the same workspace with the given credentials.

The default implementation:

Specified by:
impersonate in interface Session
Overrides:
impersonate in class AbstractSession
Parameters:
credentials - login credentials
Returns:
logged in session
Throws:
RepositoryException - if an error occurs
LoginException
See Also:
Session.impersonate(Credentials)

getRootNode

public Node getRootNode()
                 throws RepositoryException
Specified by:
getRootNode in interface Session
Throws:
RepositoryException
See Also:
Session.getRootNode()

getNodeByUUID

public Node getNodeByUUID(String uuid)
                   throws ItemNotFoundException,
                          RepositoryException
Specified by:
getNodeByUUID in interface Session
Throws:
ItemNotFoundException
RepositoryException
See Also:
Session.getNodeByUUID(String)

getItem

public Item getItem(String absPath)
             throws PathNotFoundException,
                    RepositoryException
Description copied from class: AbstractSession
Returns the node or property at the given path.

The default implementation:

Specified by:
getItem in interface Session
Overrides:
getItem in class AbstractSession
Parameters:
absPath - absolute path
Returns:
the node or property with the given path
Throws:
PathNotFoundException - if the given path is invalid or not found
RepositoryException - if another error occurs
See Also:
Session.getItem(String)

itemExists

public boolean itemExists(String absPath)
                   throws RepositoryException
Description copied from class: AbstractSession
Calls AbstractSession.getItem(String) with the given path and returns true if the call succeeds. Returns false if a PathNotFoundException was thrown. Other exceptions are passed through.

Specified by:
itemExists in interface Session
Overrides:
itemExists in class AbstractSession
Parameters:
absPath - absolute path
Returns:
true if an item exists at the given path, false otherwise
Throws:
RepositoryException - if an error occurs
See Also:
Session.itemExists(String)

move

public void move(String srcAbsPath,
                 String destAbsPath)
          throws ItemExistsException,
                 PathNotFoundException,
                 VersionException,
                 ConstraintViolationException,
                 LockException,
                 RepositoryException
Specified by:
move in interface Session
Throws:
ItemExistsException
PathNotFoundException
VersionException
ConstraintViolationException
LockException
RepositoryException
See Also:
Session.move(String, String)

save

public void save()
          throws AccessDeniedException,
                 ConstraintViolationException,
                 InvalidItemStateException,
                 VersionException,
                 LockException,
                 RepositoryException
Specified by:
save in interface Session
Throws:
AccessDeniedException
ConstraintViolationException
InvalidItemStateException
VersionException
LockException
RepositoryException
See Also:
Session.save()

refresh

public void refresh(boolean keepChanges)
             throws RepositoryException
Specified by:
refresh in interface Session
Throws:
RepositoryException
See Also:
Session.refresh(boolean)

hasPendingChanges

public boolean hasPendingChanges()
                          throws RepositoryException
Specified by:
hasPendingChanges in interface Session
Throws:
RepositoryException
See Also:
Session.hasPendingChanges()

getValueFactory

public ValueFactory getValueFactory()
                             throws UnsupportedRepositoryOperationException,
                                    RepositoryException
Specified by:
getValueFactory in interface Session
Throws:
UnsupportedRepositoryOperationException
RepositoryException
See Also:
Session.getValueFactory()

checkPermission

public void checkPermission(String absPath,
                            String actions)
                     throws AccessControlException,
                            RepositoryException
Specified by:
checkPermission in interface Session
Throws:
AccessControlException
RepositoryException
See Also:
Session.checkPermission(String, String)

getImportContentHandler

public ContentHandler getImportContentHandler(String parentAbsPath,
                                              int uuidBehavior)
                                       throws PathNotFoundException,
                                              ConstraintViolationException,
                                              VersionException,
                                              LockException,
                                              RepositoryException
Specified by:
getImportContentHandler in interface Session
Throws:
PathNotFoundException
ConstraintViolationException
VersionException
LockException
RepositoryException
See Also:
Session.getImportContentHandler(String, int)

importXML

public void importXML(String parentAbsPath,
                      InputStream in,
                      int uuidBehavior)
               throws IOException,
                      PathNotFoundException,
                      ItemExistsException,
                      ConstraintViolationException,
                      VersionException,
                      InvalidSerializedDataException,
                      LockException,
                      RepositoryException
Description copied from class: AbstractSession
Parses the given input stream as an XML document and processes the SAX events using the ContentHandler returned by Session.getImportContentHandler(String, int).

Specified by:
importXML in interface Session
Overrides:
importXML in class AbstractSession
Parameters:
parentAbsPath - passed through
in - input stream to be parsed as XML and imported
uuidBehavior - passed through
Throws:
IOException - if an I/O error occurs
InvalidSerializedDataException - if an XML parsing error occurs
RepositoryException - if a repository error occurs
PathNotFoundException
ItemExistsException
ConstraintViolationException
VersionException
LockException
See Also:
Session.importXML(String, java.io.InputStream, int)

setNamespacePrefix

public void setNamespacePrefix(String prefix,
                               String uri)
                        throws RepositoryException
Description copied from class: AbstractSession
Modifies the session local namespace mappings to contain the given prefix to URI mapping.

This behaviour is based on JSR 283 (JCR 2.0), but remains backwards compatible with JCR 1.0.

Specified by:
setNamespacePrefix in interface Session
Overrides:
setNamespacePrefix in class AbstractSession
Parameters:
prefix - namespace prefix
uri - namespace URI
Throws:
NamespaceException - if the mapping is illegal
RepositoryException - if a repository error occurs
See Also:
Session.setNamespacePrefix(String, String)

logout

public void logout()
Description copied from class: AbstractSession
Clears the local namespace mappings. Subclasses that for example want to participate in a session pools should remember to call super.logout() when overriding this method to avoid namespace mappings to be carried over to a new session.

Specified by:
logout in interface Session
Overrides:
logout in class AbstractSession
See Also:
Session.logout()

isLive

public boolean isLive()
Specified by:
isLive in interface Session
See Also:
Session.isLive()

addLockToken

public void addLockToken(String lt)
Specified by:
addLockToken in interface Session
See Also:
Session.addLockToken(String)

getLockTokens

public String[] getLockTokens()
Specified by:
getLockTokens in interface Session
See Also:
Session.getLockTokens()

removeLockToken

public void removeLockToken(String lt)
Specified by:
removeLockToken in interface Session
See Also:
Session.removeLockToken(String)

getPrefix

public String getPrefix(String uri)
                 throws NamespaceException
Description copied from interface: NamespaceResolver
Returns the prefix which is mapped to the given URI.

Specified by:
getPrefix in interface NamespaceResolver
Parameters:
uri - namespace URI
Returns:
the prefix mapped to the given URI.
Throws:
NamespaceException - if the URI is unknown.

getURI

public String getURI(String prefix)
              throws NamespaceException
Description copied from interface: NamespaceResolver
Returns the URI to which the given prefix is mapped.

Specified by:
getURI in interface NamespaceResolver
Parameters:
prefix - namespace prefix
Returns:
the namespace URI to which the given prefix is mapped.
Throws:
NamespaceException - if the prefix is unknown.

addListener

public void addListener(SessionListener listener)
Add a SessionListener

Parameters:
listener - the new listener to be informed on modifications

removeListener

public void removeListener(SessionListener listener)
Remove a SessionListener

Parameters:
listener - an existing listener

createWorkspaceInstance

protected WorkspaceImpl createWorkspaceInstance(RepositoryConfig config,
                                                SessionInfo sessionInfo)
                                         throws RepositoryException
Throws:
RepositoryException

createSessionItemStateManager

protected SessionItemStateManager createSessionItemStateManager(UpdatableItemStateManager workspaceStateManager,
                                                                ItemStateFactory isf)
                                                         throws RepositoryException
Throws:
RepositoryException

createItemManager

protected ItemManager createItemManager(HierarchyManager hierarchyManager)

getNamePathResolver

public NamePathResolver getNamePathResolver()
Specified by:
getNamePathResolver in interface ManagerProvider

getNameResolver

public NameResolver getNameResolver()
Specified by:
getNameResolver in interface ManagerProvider
See Also:
ManagerProvider.getNameResolver()

getPathResolver

public PathResolver getPathResolver()
Specified by:
getPathResolver in interface ManagerProvider
See Also:
ManagerProvider.getPathResolver()

getNamespaceResolver

public NamespaceResolver getNamespaceResolver()
Specified by:
getNamespaceResolver in interface ManagerProvider
See Also:
ManagerProvider.getNamespaceResolver()

getHierarchyManager

public HierarchyManager getHierarchyManager()
Specified by:
getHierarchyManager in interface ManagerProvider
See Also:
ManagerProvider.getHierarchyManager()

getLockManager

public LockManager getLockManager()
Description copied from interface: ManagerProvider
Returns the AccessManager associated with this ManagerProvider.

Specified by:
getLockManager in interface ManagerProvider
Returns:
the AccessManager associated with this ManagerProvider
See Also:
ManagerProvider.getLockManager()

getAccessManager

public AccessManager getAccessManager()
Specified by:
getAccessManager in interface ManagerProvider
See Also:
ManagerProvider.getAccessManager()

getVersionManager

public VersionManager getVersionManager()
Description copied from interface: ManagerProvider
Returns the VersionManager associated with this ManagerProvider.

Specified by:
getVersionManager in interface ManagerProvider
Returns:
the VersionManager associated with this ManagerProvider
See Also:
ManagerProvider.getVersionManager()

getItemDefinitionProvider

public ItemDefinitionProvider getItemDefinitionProvider()
Specified by:
getItemDefinitionProvider in interface ManagerProvider
See Also:
ManagerProvider.getItemDefinitionProvider()

getEffectiveNodeTypeProvider

public EffectiveNodeTypeProvider getEffectiveNodeTypeProvider()
Specified by:
getEffectiveNodeTypeProvider in interface ManagerProvider
See Also:
ManagerProvider.getEffectiveNodeTypeProvider()

getQValueFactory

public QValueFactory getQValueFactory()
                               throws RepositoryException
Specified by:
getQValueFactory in interface ManagerProvider
Throws:
RepositoryException
See Also:
ManagerProvider.getQValueFactory()

getJcrValueFactory

public ValueFactory getJcrValueFactory()
                                throws RepositoryException
Description copied from interface: ManagerProvider
Same as Session.getValueFactory() but omits the check, if this repository is really level 2 compliant. Therefore, this method may be used for internal functionality only, that require creation and conversion of JCR values.

Specified by:
getJcrValueFactory in interface ManagerProvider
Returns:
Throws:
RepositoryException
See Also:
ManagerProvider.getJcrValueFactory()

getValidator

public ItemStateValidator getValidator()

getIdFactory

public IdFactory getIdFactory()
                       throws RepositoryException
Throws:
RepositoryException

getNameFactory

public NameFactory getNameFactory()
                           throws RepositoryException
Throws:
RepositoryException


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.