public class SessionImpl
extends org.apache.jackrabbit.commons.AbstractSession
implements org.apache.jackrabbit.api.JackrabbitSession, org.apache.jackrabbit.spi.commons.SessionExtensions, org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver, org.apache.jackrabbit.spi.commons.conversion.NamePathResolver, org.apache.jackrabbit.spi.commons.conversion.IdentifierResolver
SessionImpl ...| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
attributes
the attributes of this session
|
static String |
AUTO_FIX_CORRUPTIONS
Name of the session attribute that controls whether repository
inconsistencies should be automatically fixed when traversing over child
nodes, when trying to add a child node, or removing a child node.
|
protected SessionContext |
context
The component context of this session.
|
static String |
DISABLE_CLUSTER_SYNC_ON_REFRESH
Name of the session attribute that controls whether the
refresh(boolean) method will cause the repository to
synchronize itself to changes in other cluster nodes. |
protected Map<SessionListener,SessionListener> |
listeners
Listeners (weak references)
|
protected AuthContext |
loginContext
the AuthContext of this session (can be null if this
session was not instantiated through a login process)
|
protected org.apache.jackrabbit.spi.commons.conversion.NamePathResolver |
namePathResolver
Name and Path resolver
|
protected RepositoryContext |
repositoryContext
The component context of the repository that issued this session.
|
protected Subject |
subject
the Subject of this session
|
protected String |
userId
the user ID that was used to acquire this session
|
protected InternalVersionManager |
versionMgr
The version manager for this session
|
ACTION_ADD_PROPERTY, ACTION_LOCKING, ACTION_MODIFY_ACCESS_CONTROL, ACTION_MODIFY_PROPERTY, ACTION_NODE_TYPE_MANAGEMENT, ACTION_READ_ACCESS_CONTROL, ACTION_REMOVE_NODE, ACTION_REMOVE_PROPERTY, ACTION_USER_MANAGEMENT, ACTION_VERSIONINGACTION_ADD_NODE, ACTION_READ, ACTION_REMOVE, ACTION_SET_PROPERTY| Modifier | Constructor and Description |
|---|---|
protected |
SessionImpl(RepositoryContext repositoryContext,
AuthContext loginContext,
WorkspaceConfig wspConfig)
Protected constructor.
|
protected |
SessionImpl(RepositoryContext repositoryContext,
Subject subject,
WorkspaceConfig wspConfig)
Protected constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(SessionListener listener)
Add a
SessionListener |
void |
addLockToken(String lt) |
protected boolean |
autoFixCorruptions()
Checks whether repository inconsistencies should be automatically fixed
when traversing over child nodes, when trying to add a child node, or
when removing a child node.
|
void |
checkFormat(String identifier) |
void |
checkPermission(String absPath,
String actions) |
protected boolean |
clusterSyncOnRefresh()
Checks whether the
refresh(boolean) method should cause
cluster synchronization. |
protected AccessManager |
createAccessManager(Subject subject)
Create the access manager.
|
GarbageCollector |
createDataStoreGarbageCollector()
Create a data store garbage collector for this repository.
|
protected ItemManager |
createItemManager()
Create the item manager.
|
protected ObservationManagerImpl |
createObservationManager(String wspName) |
Session |
createSession(String workspaceName)
Creates a new session with the same subject as this sessions but to a
different workspace.
|
protected SessionItemStateManager |
createSessionItemStateManager()
Create the session item state manager.
|
protected InternalVersionManager |
createVersionManager()
Create the version manager.
|
void |
finalize()
Finalize the session.
|
AccessControlManager |
getAccessControlManager() |
AccessManager |
getAccessManager()
Returns the
AccessManager associated with this session. |
Object |
getAttribute(String name) |
String[] |
getAttributeNames() |
HierarchyManager |
getHierarchyManager()
Returns the
HierarchyManager associated with this session. |
ContentHandler |
getImportContentHandler(String parentAbsPath,
int uuidBehavior) |
InternalVersionManager |
getInternalVersionManager()
Returns the
InternalVersionManager associated with this session. |
Item |
getItem(String absPath) |
ItemManager |
getItemManager()
Returns the
ItemManager of this session. |
Item |
getItemOrNull(String absPath) |
String |
getJCRName(org.apache.jackrabbit.spi.Name name) |
String |
getJCRPath(org.apache.jackrabbit.spi.Path path) |
Lock[] |
getLocks()
Returns all locks owned by this session.
|
String[] |
getLockTokens() |
Node |
getNode(String absPath) |
NodeImpl |
getNodeById(NodeId id)
Retrieves the
Node with the given id. |
Node |
getNodeByIdentifier(String id) |
Node |
getNodeByUUID(String uuid) |
Node |
getNodeOrNull(String absPath) |
NodeTypeManagerImpl |
getNodeTypeManager()
Returns the
NodeTypeManager. |
org.apache.jackrabbit.spi.Path |
getPath(String identifier) |
String |
getPrefix(String uri) |
org.apache.jackrabbit.api.security.principal.PrincipalManager |
getPrincipalManager() |
Property |
getProperty(String absPath) |
Property |
getPropertyOrNull(String absPath) |
org.apache.jackrabbit.spi.Name |
getQName(String name) |
org.apache.jackrabbit.spi.Path |
getQPath(String path) |
org.apache.jackrabbit.spi.Path |
getQPath(String path,
boolean normalizeIdentifier) |
Repository |
getRepository() |
RetentionManager |
getRetentionManager() |
protected RetentionRegistry |
getRetentionRegistry()
Returns the internal retention manager used for evaluation of effective
retention policies and holds.
|
Node |
getRootNode() |
Subject |
getSubject()
Returns a read only copy of the
Subject associated with this
session. |
String |
getURI(String prefix) |
String |
getUserID() |
org.apache.jackrabbit.api.security.user.UserManager |
getUserManager() |
ValueFactory |
getValueFactory() |
Workspace |
getWorkspace() |
boolean |
hasCapability(String methodName,
Object target,
Object[] arguments) |
boolean |
hasPendingChanges() |
boolean |
hasPermission(String absPath,
String... actions) |
boolean |
hasPermission(String absPath,
String actions) |
Session |
impersonate(Credentials otherCredentials) |
boolean |
isAdmin()
Returns
true if this session has been created for the
administrator. |
boolean |
isLive() |
boolean |
isSystem()
Returns
true if the subject contains a
SystemPrincipal; false otherwise. |
boolean |
itemExists(String absPath) |
void |
logout()
Invalidates this session and releases all associated resources.
|
void |
move(String srcAbsPath,
String destAbsPath) |
boolean |
nodeExists(String absPath) |
protected void |
notifyLoggedOut()
Notify the listeners that this session has been closed.
|
protected void |
notifyLoggingOut()
Notify the listeners that this session is about to be closed.
|
boolean |
propertyExists(String absPath) |
void |
refresh(boolean keepChanges) |
void |
removeItem(String absPath) |
void |
removeListener(SessionListener listener)
Remove a
SessionListener |
void |
removeLockToken(String lt) |
protected String |
retrieveUserId(Subject subject,
String workspaceName)
Retrieve the userID from the specified subject.
|
void |
save() |
void |
setAttribute(String name,
Object value)
Sets the named attribute.
|
void |
setNamespacePrefix(String prefix,
String uri) |
String |
toString()
Returns the unique internal name of this session.
|
exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, importXMLclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitexportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, importXMLpublic static final String DISABLE_CLUSTER_SYNC_ON_REFRESH
refresh(boolean) method will cause the repository to
synchronize itself to changes in other cluster nodes. This cluster
synchronization is enabled by default, unless an attribute with this
name is set (any non-null value) for this session.public static final String AUTO_FIX_CORRUPTIONS
protected final SessionContext context
protected final RepositoryContext repositoryContext
protected AuthContext loginContext
protected final Subject subject
protected final String userId
protected org.apache.jackrabbit.spi.commons.conversion.NamePathResolver namePathResolver
protected final InternalVersionManager versionMgr
protected final Map<SessionListener,SessionListener> listeners
protected SessionImpl(RepositoryContext repositoryContext, AuthContext loginContext, WorkspaceConfig wspConfig) throws AccessDeniedException, RepositoryException
repositoryContext - repository contextloginContext - wspConfig - AccessDeniedException - if the subject of the given login context
is not granted access to the specified
workspaceRepositoryException - if another error occursprotected SessionImpl(RepositoryContext repositoryContext, Subject subject, WorkspaceConfig wspConfig) throws AccessDeniedException, RepositoryException
repositoryContext - repository contextsubject - wspConfig - AccessDeniedException - if the given subject is not granted access
to the specified workspaceRepositoryException - if another error occursprotected String retrieveUserId(Subject subject, String workspaceName) throws RepositoryException
RepositoryExceptionprotected SessionItemStateManager createSessionItemStateManager()
protected ItemManager createItemManager()
protected ObservationManagerImpl createObservationManager(String wspName) throws RepositoryException
RepositoryExceptionprotected InternalVersionManager createVersionManager() throws RepositoryException
RepositoryExceptionprotected AccessManager createAccessManager(Subject subject) throws AccessDeniedException, RepositoryException
subject - AccessDeniedException - if the current subject is not granted access
to the current workspaceRepositoryException - if the access manager cannot be instantiatedpublic Subject getSubject()
Subject associated with this
session.Subject associated with this sessionpublic boolean isSystem()
true if the subject contains a
SystemPrincipal; false otherwise.true if this is an system session.public boolean isAdmin()
true if this session has been created for the
administrator. False otherwise.true if this is an admin session.public Session createSession(String workspaceName) throws AccessDeniedException, NoSuchWorkspaceException, RepositoryException
workspaceName - name of the workspace to acquire a session for.AccessDeniedException - in case the current Subject is not allowed
to access the requested WorkspaceNoSuchWorkspaceException - If the named workspace does not exist.RepositoryException - in any other exceptional statepublic AccessManager getAccessManager()
AccessManager associated with this session.AccessManager associated with this sessionpublic NodeTypeManagerImpl getNodeTypeManager()
NodeTypeManager.NodeTypeManagerpublic ItemManager getItemManager()
ItemManager of this session.ItemManagerpublic HierarchyManager getHierarchyManager()
HierarchyManager associated with this session.HierarchyManager associated with this sessionpublic InternalVersionManager getInternalVersionManager()
InternalVersionManager associated with this session.InternalVersionManager associated with this sessionprotected RetentionRegistry getRetentionRegistry() throws RepositoryException
RepositoryExceptionpublic void setAttribute(String name, Object value)
null, then
the named attribute is removed.setAttribute in interface org.apache.jackrabbit.spi.commons.SessionExtensionsname - attribute namevalue - attribute valuepublic NodeImpl getNodeById(NodeId id) throws ItemNotFoundException, RepositoryException
Node with the given id.id - id of node to be retrievedNodeId.ItemNotFoundException - if no such node exists or if this
Session does not have permission to access the node.RepositoryException - if another error occurs.protected void notifyLoggingOut()
protected void notifyLoggedOut()
public void addListener(SessionListener listener)
SessionListenerlistener - the new listener to be informed on modificationspublic void removeListener(SessionListener listener)
SessionListenerlistener - an existing listenerpublic GarbageCollector createDataStoreGarbageCollector() throws RepositoryException
RepositoryExceptionpublic String getPrefix(String uri) throws NamespaceException
getPrefix in interface org.apache.jackrabbit.spi.commons.namespace.NamespaceResolverNamespaceExceptionpublic String getURI(String prefix) throws NamespaceException
getURI in interface org.apache.jackrabbit.spi.commons.namespace.NamespaceResolverNamespaceExceptionpublic String getJCRName(org.apache.jackrabbit.spi.Name name) throws NamespaceException
getJCRName in interface org.apache.jackrabbit.spi.commons.conversion.NameResolverNamespaceExceptionpublic org.apache.jackrabbit.spi.Name getQName(String name) throws org.apache.jackrabbit.spi.commons.conversion.IllegalNameException, NamespaceException
getQName in interface org.apache.jackrabbit.spi.commons.conversion.NameResolverorg.apache.jackrabbit.spi.commons.conversion.IllegalNameExceptionNamespaceExceptionpublic String getJCRPath(org.apache.jackrabbit.spi.Path path) throws NamespaceException
getJCRPath in interface org.apache.jackrabbit.spi.commons.conversion.PathResolverNamespaceExceptionpublic org.apache.jackrabbit.spi.Path getQPath(String path) throws org.apache.jackrabbit.spi.commons.conversion.MalformedPathException, org.apache.jackrabbit.spi.commons.conversion.IllegalNameException, NamespaceException
getQPath in interface org.apache.jackrabbit.spi.commons.conversion.PathResolverorg.apache.jackrabbit.spi.commons.conversion.MalformedPathExceptionorg.apache.jackrabbit.spi.commons.conversion.IllegalNameExceptionNamespaceExceptionpublic org.apache.jackrabbit.spi.Path getQPath(String path, boolean normalizeIdentifier) throws org.apache.jackrabbit.spi.commons.conversion.MalformedPathException, org.apache.jackrabbit.spi.commons.conversion.IllegalNameException, NamespaceException
getQPath in interface org.apache.jackrabbit.spi.commons.conversion.PathResolverorg.apache.jackrabbit.spi.commons.conversion.MalformedPathExceptionorg.apache.jackrabbit.spi.commons.conversion.IllegalNameExceptionNamespaceExceptionpublic org.apache.jackrabbit.spi.Path getPath(String identifier) throws org.apache.jackrabbit.spi.commons.conversion.MalformedPathException
getPath in interface org.apache.jackrabbit.spi.commons.conversion.IdentifierResolverorg.apache.jackrabbit.spi.commons.conversion.MalformedPathExceptionIdentifierResolver.getPath(String)public void checkFormat(String identifier) throws org.apache.jackrabbit.spi.commons.conversion.MalformedPathException
checkFormat in interface org.apache.jackrabbit.spi.commons.conversion.IdentifierResolverorg.apache.jackrabbit.spi.commons.conversion.MalformedPathExceptionIdentifierResolver.checkFormat(String)public boolean hasPermission(String absPath, String... actions) throws RepositoryException
hasPermission in interface org.apache.jackrabbit.api.JackrabbitSessionRepositoryExceptionJackrabbitSession.hasPermission(String, String...)public org.apache.jackrabbit.api.security.principal.PrincipalManager getPrincipalManager()
throws RepositoryException,
AccessDeniedException
getPrincipalManager in interface org.apache.jackrabbit.api.JackrabbitSessionRepositoryExceptionAccessDeniedExceptionJackrabbitSession.getPrincipalManager()public org.apache.jackrabbit.api.security.user.UserManager getUserManager()
throws AccessDeniedException,
RepositoryException
getUserManager in interface org.apache.jackrabbit.api.JackrabbitSessionAccessDeniedExceptionRepositoryExceptionJackrabbitSession.getUserManager()public Item getItemOrNull(String absPath) throws RepositoryException
getItemOrNull in interface org.apache.jackrabbit.api.JackrabbitSessionRepositoryExceptionpublic Property getPropertyOrNull(String absPath) throws RepositoryException
getPropertyOrNull in interface org.apache.jackrabbit.api.JackrabbitSessionRepositoryExceptionpublic Node getNodeOrNull(String absPath) throws RepositoryException
getNodeOrNull in interface org.apache.jackrabbit.api.JackrabbitSessionRepositoryExceptionpublic void checkPermission(String absPath, String actions) throws AccessControlException, RepositoryException
checkPermission in interface SessionAccessControlExceptionRepositoryExceptionpublic Workspace getWorkspace()
getWorkspace in interface Sessionpublic Session impersonate(Credentials otherCredentials) throws LoginException, RepositoryException
impersonate in interface Sessionimpersonate in class org.apache.jackrabbit.commons.AbstractSessionLoginExceptionRepositoryExceptionpublic Node getRootNode() throws RepositoryException
getRootNode in interface SessionRepositoryExceptionpublic Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException
getNodeByUUID in interface SessionItemNotFoundExceptionRepositoryExceptionpublic Item getItem(String absPath) throws RepositoryException
getItem in interface SessiongetItem in class org.apache.jackrabbit.commons.AbstractSessionRepositoryExceptionpublic boolean itemExists(String absPath) throws RepositoryException
itemExists in interface SessionitemExists in class org.apache.jackrabbit.commons.AbstractSessionRepositoryExceptionpublic void save()
throws RepositoryException
save in interface SessionRepositoryExceptionpublic void refresh(boolean keepChanges)
throws RepositoryException
refresh in interface SessionRepositoryExceptionprotected boolean clusterSyncOnRefresh()
refresh(boolean) method should cause
cluster synchronization.
Subclasses can override this method to implement alternative rules on when cluster synchronization should be done.
true if the DISABLE_CLUSTER_SYNC_ON_REFRESH
attribute is not set, false otherwiseprotected boolean autoFixCorruptions()
true if the AUTO_FIX_CORRUPTIONS
attribute is set, false otherwisepublic boolean hasPendingChanges()
throws RepositoryException
hasPendingChanges in interface SessionRepositoryExceptionpublic void move(String srcAbsPath, String destAbsPath) throws RepositoryException
move in interface SessionRepositoryExceptionpublic ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws PathNotFoundException, ConstraintViolationException, VersionException, LockException, RepositoryException
getImportContentHandler in interface SessionPathNotFoundExceptionConstraintViolationExceptionVersionExceptionLockExceptionRepositoryExceptionpublic void logout()
public Repository getRepository()
getRepository in interface Sessionpublic ValueFactory getValueFactory()
getValueFactory in interface Sessionpublic Object getAttribute(String name)
getAttribute in interface Sessionpublic String[] getAttributeNames()
getAttributeNames in interface Sessionpublic void setNamespacePrefix(String prefix, String uri) throws NamespaceException, RepositoryException
setNamespacePrefix in interface SessionsetNamespacePrefix in class org.apache.jackrabbit.commons.AbstractSessionNamespaceExceptionRepositoryExceptionpublic void addLockToken(String lt)
addLockToken in interface Sessionpublic String[] getLockTokens()
getLockTokens in interface Sessionpublic void removeLockToken(String lt)
removeLockToken in interface Sessionpublic Lock[] getLocks()
Lockspublic Node getNodeByIdentifier(String id) throws ItemNotFoundException, RepositoryException
getNodeByIdentifier in interface SessionItemNotFoundExceptionRepositoryExceptionSession.getNodeByIdentifier(String)public Node getNode(String absPath) throws RepositoryException
getNode in interface SessiongetNode in class org.apache.jackrabbit.commons.AbstractSessionRepositoryExceptionSession.getNode(String)public Property getProperty(String absPath) throws RepositoryException
getProperty in interface SessiongetProperty in class org.apache.jackrabbit.commons.AbstractSessionRepositoryExceptionSession.getProperty(String)public boolean nodeExists(String absPath) throws RepositoryException
nodeExists in interface SessionnodeExists in class org.apache.jackrabbit.commons.AbstractSessionRepositoryExceptionSession.nodeExists(String)public boolean propertyExists(String absPath) throws RepositoryException
propertyExists in interface SessionpropertyExists in class org.apache.jackrabbit.commons.AbstractSessionRepositoryExceptionSession.propertyExists(String)public void removeItem(String absPath) throws RepositoryException
removeItem in interface SessionremoveItem in class org.apache.jackrabbit.commons.AbstractSessionRepositoryExceptionSession.removeItem(String)public boolean hasPermission(String absPath, String actions) throws RepositoryException
hasPermission in interface SessionRepositoryExceptionSession.hasPermission(String, String)public boolean hasCapability(String methodName, Object target, Object[] arguments) throws RepositoryException
hasCapability in interface SessionRepositoryExceptionSession.hasCapability(String, Object, Object[])public AccessControlManager getAccessControlManager() throws UnsupportedRepositoryOperationException, RepositoryException
getAccessControlManager in interface SessionUnsupportedRepositoryOperationExceptionRepositoryExceptionSession.getAccessControlManager()public RetentionManager getRetentionManager() throws UnsupportedRepositoryOperationException, RepositoryException
getRetentionManager in interface SessionUnsupportedRepositoryOperationExceptionRepositoryExceptionSession.getRetentionManager()public String toString()
toString in class ObjectsessionNameCopyright © 2004–2018 The Apache Software Foundation. All rights reserved.