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...


Field Summary
 
Fields inherited from interface javax.jcr.Session
ACTION_ADD_NODE, ACTION_READ, ACTION_REMOVE, ACTION_SET_PROPERTY
 
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)
           
 AccessControlManager getAccessControlManager()
           
 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.
 LockStateManager getLockStateManager()
          Returns the LockStateManager associated with this ManagerProvider.
 String[] getLockTokens()
           
 NameFactory getNameFactory()
           
 NamePathResolver getNamePathResolver()
           
 NameResolver getNameResolver()
           
 NamespaceResolver getNamespaceResolver()
           
 Node getNode(String absPath)
          Returns the node with the given absolute path.
 Node getNodeByIdentifier(String id)
           
 Node getNodeByUUID(String uuid)
           
 NodeTypeDefinitionProvider getNodeTypeDefinitionProvider()
           
 PathResolver getPathResolver()
           
 String getPrefix(String uri)
          Returns the prefix which is mapped to the given URI.
 Property getProperty(String absPath)
          Returns the property with the given absolute path.
 QValueFactory getQValueFactory()
           
 Repository getRepository()
           
 RetentionManager getRetentionManager()
           
 Node getRootNode()
           
 String getURI(String prefix)
          Returns the URI to which the given prefix is mapped.
 String getUserID()
           
 ItemStateValidator getValidator()
           
 ValueFactory getValueFactory()
           
 VersionManager getVersionStateManager()
          Returns the VersionManager associated with this ManagerProvider.
 Workspace getWorkspace()
           
 boolean hasCapability(String methodName, Object target, Object[] arguments)
           
 boolean hasPendingChanges()
           
 boolean hasPermission(String absPath, String actions)
           
 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)
           
 boolean nodeExists(String absPath)
          Checks whether a node with the given absolute path exists.
 boolean propertyExists(String absPath)
          Checks whether a property with the given absolute path exists.
 void refresh(boolean keepChanges)
           
 void removeItem(String absPath)
          Removes the identified item.
 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)

getAccessControlManager

public AccessControlManager getAccessControlManager()
                                             throws RepositoryException
Specified by:
getAccessControlManager in interface Session
Throws:
RepositoryException
See Also:
Session.getAccessControlManager()

getNode

public Node getNode(String absPath)
             throws RepositoryException
Description copied from class: AbstractSession
Returns the node with the given absolute path.

Specified by:
getNode in interface Session
Overrides:
getNode in class AbstractSession
Parameters:
absPath - absolute path
Returns:
node at the given path
Throws:
RepositoryException - if the node can not be accessed
See Also:
Session.getNode(String)

getNodeByIdentifier

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

getProperty

public Property getProperty(String absPath)
                     throws RepositoryException
Description copied from class: AbstractSession
Returns the property with the given absolute path.

Specified by:
getProperty in interface Session
Overrides:
getProperty in class AbstractSession
Parameters:
absPath - absolute path
Returns:
node at the given path
Throws:
RepositoryException - if the property can not be accessed
See Also:
Session.getProperty(String)

getRetentionManager

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

hasCapability

public boolean hasCapability(String methodName,
                             Object target,
                             Object[] arguments)
                      throws RepositoryException
Specified by:
hasCapability in interface Session
Throws:
RepositoryException
See Also:
Session.hasCapability(String, Object, Object[])

hasPermission

public boolean hasPermission(String absPath,
                             String actions)
                      throws RepositoryException
Specified by:
hasPermission in interface Session
Throws:
RepositoryException
See Also:
Session.hasPermission(String, String)

nodeExists

public boolean nodeExists(String absPath)
                   throws RepositoryException
Description copied from class: AbstractSession
Checks whether a node with the given absolute path exists.

Specified by:
nodeExists in interface Session
Overrides:
nodeExists in class AbstractSession
Parameters:
absPath - absolute path
Returns:
true if a node with the given path exists, false otherwise
Throws:
RepositoryException - if the path is invalid
See Also:
Session.nodeExists(String)

propertyExists

public boolean propertyExists(String absPath)
                       throws RepositoryException
Description copied from class: AbstractSession
Checks whether a property with the given absolute path exists.

Specified by:
propertyExists in interface Session
Overrides:
propertyExists in class AbstractSession
Parameters:
absPath - absolute path
Returns:
true if a property with the given path exists, false otherwise
Throws:
RepositoryException - if the path is invalid
See Also:
Session.propertyExists(String)

removeItem

public void removeItem(String absPath)
                throws RepositoryException
Description copied from class: AbstractSession
Removes the identified item. Implemented by calling Item.remove() on the item removed by AbstractSession.getItem(String).

Specified by:
removeItem in interface Session
Overrides:
removeItem in class AbstractSession
Parameters:
absPath - An absolute path of the item to be removed
Throws:
RepositoryException - if the item can not be removed
See Also:
Session.removeItem(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.
See Also:
NamespaceResolver.getPrefix(String)

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.
See Also:
NamespaceResolver.getURI(String)

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
See Also:
ManagerProvider.getNamePathResolver()

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()

getLockStateManager

public LockStateManager getLockStateManager()
Description copied from interface: ManagerProvider
Returns the LockStateManager associated with this ManagerProvider.

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

getAccessManager

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

getVersionStateManager

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

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

getItemDefinitionProvider

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

getNodeTypeDefinitionProvider

public NodeTypeDefinitionProvider getNodeTypeDefinitionProvider()
Specified by:
getNodeTypeDefinitionProvider in interface ManagerProvider
See Also:
ManagerProvider.getNodeTypeDefinitionProvider()

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-2010 The Apache Software Foundation. All Rights Reserved.