|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jackrabbit.commons.AbstractSession
org.apache.jackrabbit.core.SessionImpl
public class SessionImpl
A SessionImpl
...
Field Summary | |
---|---|
protected AccessManager |
accessMgr
the AccessManager associated with this session |
static String |
ADD_NODE_ACTION
Deprecated. Use Session.ACTION_ADD_NODE instead. |
protected boolean |
alive
flag indicating whether this session is alive |
protected HashMap |
attributes
the attributes 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 HierarchyManager |
hierMgr
the HierarchyManager associated with this session |
protected ItemManager |
itemMgr
the item mgr associated with this session |
protected SessionItemStateManager |
itemStateMgr
the item state mgr associated with this session |
protected Map |
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 NamePathResolver |
namePathResolver
Name and Path resolver |
protected NodeTypeManagerImpl |
ntMgr
the node type manager |
static String |
READ_ACTION
Deprecated. Use Session.ACTION_READ instead. |
static String |
REMOVE_ACTION
Deprecated. Use Session.ACTION_REMOVE instead. |
protected RepositoryImpl |
rep
the repository that issued this session |
static String |
SET_PROPERTY_ACTION
Deprecated. Use Session.ACTION_SET_PROPERTY instead. |
protected Subject |
subject
the Subject of this session |
protected String |
userId
the user ID that was used to acquire this session |
protected ValueFactory |
valueFactory
value factory |
protected VersionManager |
versionMgr
The version manager for this session |
protected WorkspaceImpl |
wsp
the Workspace associated with this session |
Fields inherited from interface org.apache.jackrabbit.api.jsr283.Session |
---|
ACTION_ADD_NODE, ACTION_READ, ACTION_REMOVE, ACTION_SET_PROPERTY |
Constructor Summary | |
---|---|
protected |
SessionImpl(RepositoryImpl rep,
AuthContext loginContext,
WorkspaceConfig wspConfig)
Protected constructor. |
protected |
SessionImpl(RepositoryImpl rep,
Subject subject,
WorkspaceConfig wspConfig)
Protected constructor. |
Method Summary | |
---|---|
void |
addListener(SessionListener listener)
Add a SessionListener |
void |
addLockToken(String lt)
|
void |
checkPermission(String absPath,
String actions)
|
protected boolean |
clusterSyncOnRefresh()
Checks whether the refresh(boolean) method should cause
cluster synchronization. |
protected AccessManager |
createAccessManager(Subject subject,
HierarchyManager hierarchyManager)
Create the access manager. |
GarbageCollector |
createDataStoreGarbageCollector()
Create a data store garbage collector for this repository. |
protected ItemManager |
createItemManager(SessionItemStateManager itemStateMgr,
HierarchyManager hierMgr)
Create the item manager. |
Session |
createSession(String workspaceName)
Creates a new session with the same subject as this sessions but to a different workspace. |
protected SessionItemStateManager |
createSessionItemStateManager(LocalItemStateManager manager)
Create the session item state manager. |
protected VersionManager |
createVersionManager(RepositoryImpl rep)
Create the version manager. |
protected void |
createWorkspace(String workspaceName)
Creates a workspace with the given name. |
protected void |
createWorkspace(String workspaceName,
InputSource configTemplate)
Creates a workspace with the given name and a workspace configuration template. |
protected WorkspaceImpl |
createWorkspaceInstance(WorkspaceConfig wspConfig,
SharedItemStateManager stateMgr,
RepositoryImpl rep,
SessionImpl session)
Creates the workspace instance backing this session. |
void |
dump(PrintStream ps)
Dumps the state of this instance in a human readable format for diagnostic purposes. |
void |
finalize()
Finalize the session. |
AccessControlManager |
getAccessControlManager()
Returns the access control manager for this Session . |
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)
|
Item |
getItem(String absPath)
Returns the node or property at the given path. |
ItemManager |
getItemManager()
Returns the ItemManager of this session. |
protected SessionItemStateManager |
getItemStateManager()
Returns the SessionItemStateManager associated with this session. |
String |
getJCRName(Name name)
Returns the prefixed JCR name for the given qualified name. |
String |
getJCRPath(Path path)
Returns the prefixed JCR path for the given qualified path. |
LockManager |
getLockManager()
Return the lock manager for this session. |
Lock[] |
getLocks()
Returns all locks owned by this session. |
String[] |
getLockTokens()
|
Node |
getNode(String absPath)
Returns the node at the specified absolute path in the workspace. |
NodeImpl |
getNodeById(NodeId id)
Retrieves the Node with the given id. |
Node |
getNodeByIdentifier(String id)
Returns the node specified by the given identifier. |
Node |
getNodeByUUID(String uuid)
|
Node |
getNodeByUUID(UUID uuid)
Retrieves the referenceable node with the given UUID . |
NodeTypeManagerImpl |
getNodeTypeManager()
Returns the NodeTypeManager . |
String |
getPrefix(String uri)
Returns the prefix which is mapped to the given URI. |
PrincipalManager |
getPrincipalManager()
Returns the PrincipalManager for the current Session . |
Property |
getProperty(String absPath)
Returns the property at the specified absolute path in the workspace. |
Name |
getQName(String name)
Returns the qualified name for the given prefixed JCR name. |
Path |
getQPath(String path)
Returns the qualified path for the given prefixed JCR path. |
Repository |
getRepository()
|
RetentionManager |
getRetentionManager()
Returns the retention and hold manager for this Session . |
protected RetentionRegistry |
getRetentionRegistry()
Returns the internal retention manager used for evaluation of effective retention policies and holds. |
Node |
getRootNode()
|
Subject |
getSubject()
Returns the Subject associated with this session. |
String |
getURI(String prefix)
Returns the URI to which the given prefix is mapped. |
String |
getUserID()
|
UserManager |
getUserManager()
Returns the UserManager for the current Session . |
ItemValidator |
getValidator()
|
ValueFactory |
getValueFactory()
|
VersionManager |
getVersionManager()
Returns the VersionManager associated with this session. |
Workspace |
getWorkspace()
|
protected String[] |
getWorkspaceNames()
Returns the names of all workspaces of this repository with respect of the access rights of this session. |
boolean |
hasCapability(String methodType,
Object target,
Map arguments)
Checks whether an operation can be performed given as much context as can be determined by the repository, including: Permissions granted to the current user, including access control privileges. |
boolean |
hasPendingChanges()
|
boolean |
hasPermission(String absPath,
String actions)
Returns true if this Session has permission to
perform the specified actions at the specified absPath and
false otherwise. |
Session |
impersonate(Credentials otherCredentials)
Logs in the same workspace with the given credentials. |
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)
Returns true if a node exists at absPath
and this Session has read access to it; otherwise returns
false . |
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)
Returns true if a property exists at absPath
and this Session has read access to it; otherwise returns
false . |
void |
refresh(boolean keepChanges)
|
void |
removeItem(String absPath)
Removes the specified item (and its subtree). |
void |
removeListener(SessionListener listener)
Remove a SessionListener |
void |
removeLockToken(String lt)
|
protected String |
retrieveUserId(Subject subject)
Retrieve the userID from the specified subject. |
protected void |
sanityCheck()
Performs a sanity check on this session. |
void |
save()
|
protected void |
setAttribute(String name,
Object value)
Sets the named attribute. |
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, importXML |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.jcr.Session |
---|
exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, importXML |
Field Detail |
---|
public 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 READ_ACTION
Session.ACTION_READ
instead.public static final String REMOVE_ACTION
Session.ACTION_REMOVE
instead.public static final String ADD_NODE_ACTION
Session.ACTION_ADD_NODE
instead.public static final String SET_PROPERTY_ACTION
Session.ACTION_SET_PROPERTY
instead.protected boolean alive
protected final RepositoryImpl rep
protected AuthContext loginContext
protected final Subject subject
protected final String userId
protected final HashMap attributes
protected final NodeTypeManagerImpl ntMgr
protected AccessManager accessMgr
protected final SessionItemStateManager itemStateMgr
protected final HierarchyManager hierMgr
protected final ItemManager itemMgr
protected final WorkspaceImpl wsp
protected NamePathResolver namePathResolver
protected final VersionManager versionMgr
protected final Map listeners
protected ValueFactory valueFactory
Constructor Detail |
---|
protected SessionImpl(RepositoryImpl rep, AuthContext loginContext, WorkspaceConfig wspConfig) throws AccessDeniedException, RepositoryException
rep
- loginContext
- wspConfig
-
AccessDeniedException
- if the subject of the given login context
is not granted access to the specified
workspace
RepositoryException
- if another error occursprotected SessionImpl(RepositoryImpl rep, Subject subject, WorkspaceConfig wspConfig) throws AccessDeniedException, RepositoryException
rep
- subject
- wspConfig
-
AccessDeniedException
- if the given subject is not granted access
to the specified workspace
RepositoryException
- if another error occursMethod Detail |
---|
protected String retrieveUserId(Subject subject) throws RepositoryException
RepositoryException
protected SessionItemStateManager createSessionItemStateManager(LocalItemStateManager manager)
protected WorkspaceImpl createWorkspaceInstance(WorkspaceConfig wspConfig, SharedItemStateManager stateMgr, RepositoryImpl rep, SessionImpl session)
wspConfig
- The workspace configurationstateMgr
- The shared item state managerrep
- The repositorysession
- The session
WorkspaceImpl
class or an extension
thereof.protected ItemManager createItemManager(SessionItemStateManager itemStateMgr, HierarchyManager hierMgr)
protected VersionManager createVersionManager(RepositoryImpl rep) throws RepositoryException
RepositoryException
protected AccessManager createAccessManager(Subject subject, HierarchyManager hierarchyManager) throws AccessDeniedException, RepositoryException
subject
- hierarchyManager
-
AccessDeniedException
- if the current subject is not granted access
to the current workspace
RepositoryException
- if the access manager cannot be instantiatedprotected void sanityCheck() throws RepositoryException
RepositoryException
- if this session has been rendered invalid
for some reason (e.g. if this session has
been closed explicitly or if it has expired)public ItemValidator getValidator() throws RepositoryException
RepositoryException
- If an error occurs.public Subject getSubject()
Subject
associated with this session.
Subject
associated with this sessionpublic 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 Workspace
NoSuchWorkspaceException
- 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
.
NodeTypeManager
public ItemManager getItemManager()
ItemManager
of this session.
ItemManager
protected SessionItemStateManager getItemStateManager()
SessionItemStateManager
associated with this session.
SessionItemStateManager
associated with this sessionpublic HierarchyManager getHierarchyManager()
HierarchyManager
associated with this session.
HierarchyManager
associated with this sessionpublic VersionManager getVersionManager()
VersionManager
associated with this session.
VersionManager
associated with this sessionprotected RetentionRegistry getRetentionRegistry() throws RepositoryException
RepositoryException
protected void setAttribute(String name, Object value)
null
, then
the named attribute is removed.
name
- attribute namevalue
- attribute valuepublic Node getNodeByUUID(UUID uuid) throws ItemNotFoundException, RepositoryException
UUID
.
uuid
- uuid of the node to be retrieved
ItemNotFoundException
- if no node exists with the given uuid or
if the existing node is not referenceable.
RepositoryException
- if another error occurs.getNodeByUUID(String)
,
getNodeById(NodeId)
public NodeImpl getNodeById(NodeId id) throws ItemNotFoundException, RepositoryException
Node
with the given id.
id
- id of node to be retrieved
NodeId
.
ItemNotFoundException
- if no such node exists or if this
Session
does not have permission to access the node.
RepositoryException
- if another error occurs.protected String[] getWorkspaceNames() throws RepositoryException
RepositoryException
- if an error occursprotected void createWorkspace(String workspaceName) throws AccessDeniedException, RepositoryException
workspaceName
- name of the new workspace
AccessDeniedException
- if the current session is not allowed to
create the workspace
RepositoryException
- if a workspace with the given name
already exists or if another error occursprotected void createWorkspace(String workspaceName, InputSource configTemplate) throws AccessDeniedException, RepositoryException
workspaceName
- name of the new workspaceconfigTemplate
- the configuration template of the new workspace
AccessDeniedException
- if the current session is not allowed to
create the workspace
RepositoryException
- if a workspace with the given name already
exists or if another error occursprotected void notifyLoggingOut()
protected void notifyLoggedOut()
public void addListener(SessionListener listener)
SessionListener
listener
- the new listener to be informed on modificationspublic void removeListener(SessionListener listener)
SessionListener
listener
- an existing listenerpublic GarbageCollector createDataStoreGarbageCollector() throws RepositoryException
RepositoryException
public String getPrefix(String uri) throws NamespaceException
NamespaceResolver
getPrefix
in interface NamespaceResolver
uri
- namespace URI
NamespaceException
- if the URI is unknown.public String getURI(String prefix) throws NamespaceException
NamespaceResolver
getURI
in interface NamespaceResolver
prefix
- namespace prefix
NamespaceException
- if the prefix is unknown.public String getJCRName(Name name) throws NamespaceException
NameResolver
getJCRName
in interface NameResolver
name
- qualified name
NamespaceException
- if the namespace URI can not be resolvedpublic Name getQName(String name) throws IllegalNameException, NamespaceException
NameResolver
getQName
in interface NameResolver
name
- prefixed JCR name
IllegalNameException
- if the JCR name format is invalid
NamespaceException
- if the namespace prefix can not be resolvedpublic String getJCRPath(Path path) throws NamespaceException
PathResolver
getJCRPath
in interface PathResolver
path
- qualified path
NamespaceException
- if a namespace URI can not be resolvedpublic Path getQPath(String path) throws MalformedPathException, IllegalNameException, NamespaceException
PathResolver
getQPath
in interface PathResolver
path
- prefixed JCR path
MalformedPathException
- if the JCR path format is invalid.
IllegalNameException
- if any of the JCR names contained in the path are invalid.
NamespaceException
- if a namespace prefix can not be resolved.public PrincipalManager getPrincipalManager() throws RepositoryException, AccessDeniedException
JackrabbitSession
PrincipalManager
for the current Session
.
getPrincipalManager
in interface JackrabbitSession
AccessDeniedException
UnsupportedRepositoryOperationException
- If principal management
is not supported.
RepositoryException
JackrabbitSession.getPrincipalManager()
public UserManager getUserManager() throws AccessDeniedException, RepositoryException
JackrabbitSession
UserManager
for the current Session
.
getUserManager
in interface JackrabbitSession
AccessDeniedException
- If this session is not allowed to
to access user data.
UnsupportedRepositoryOperationException
- If user management is
not supported.
RepositoryException
- If another error occurs.JackrabbitSession.getUserManager()
public void checkPermission(String absPath, String actions) throws AccessControlException, RepositoryException
checkPermission
in interface Session
AccessControlException
RepositoryException
public Workspace getWorkspace()
getWorkspace
in interface Session
public Session impersonate(Credentials otherCredentials) throws LoginException, RepositoryException
The default implementation:
Repository
instance using
Session.getRepository()
Session.getWorkspace()
Workspace.getName()
Repository.login(Credentials, String)
on the
retrieved repository with the given credentials and the retrieved
workspace name.
impersonate
in interface Session
impersonate
in class AbstractSession
otherCredentials
- login credentials
RepositoryException
- if an error occurs
LoginException
public Node getRootNode() throws RepositoryException
getRootNode
in interface Session
RepositoryException
public Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException
getNodeByUUID
in interface Session
ItemNotFoundException
RepositoryException
public Item getItem(String absPath) throws PathNotFoundException, RepositoryException
The default implementation:
PathNotFoundException
if the given path
does not start with a slash.
Node.getNode(String)
on the root node with the
part of the given path after the first slash
Node.getProperty(String)
similarly in case the
above call fails with a PathNotFoundException
getItem
in interface Session
getItem
in class AbstractSession
absPath
- absolute path
PathNotFoundException
- if the given path is invalid or not found
RepositoryException
- if another error occurspublic boolean itemExists(String absPath) throws RepositoryException
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.
itemExists
in interface Session
itemExists
in class AbstractSession
absPath
- absolute path
true
if an item exists at the given path,
false
otherwise
RepositoryException
- if an error occurspublic void save() throws AccessDeniedException, ItemExistsException, ConstraintViolationException, InvalidItemStateException, VersionException, LockException, NoSuchNodeTypeException, RepositoryException
save
in interface Session
AccessDeniedException
ItemExistsException
ConstraintViolationException
InvalidItemStateException
VersionException
LockException
NoSuchNodeTypeException
RepositoryException
public void refresh(boolean keepChanges) throws RepositoryException
refresh
in interface Session
RepositoryException
protected 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
otherwisepublic boolean hasPendingChanges() throws RepositoryException
hasPendingChanges
in interface Session
RepositoryException
public void move(String srcAbsPath, String destAbsPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException
move
in interface Session
ItemExistsException
PathNotFoundException
VersionException
ConstraintViolationException
LockException
RepositoryException
public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws PathNotFoundException, ConstraintViolationException, VersionException, LockException, RepositoryException
getImportContentHandler
in interface Session
PathNotFoundException
ConstraintViolationException
VersionException
LockException
RepositoryException
public boolean isLive()
isLive
in interface Session
public void logout()
super.logout()
when overriding this method to avoid
namespace mappings to be carried over to a new session.
logout
in interface Session
logout
in class AbstractSession
public Repository getRepository()
getRepository
in interface Session
public ValueFactory getValueFactory() throws UnsupportedRepositoryOperationException, RepositoryException
getValueFactory
in interface Session
UnsupportedRepositoryOperationException
RepositoryException
public String getUserID()
getUserID
in interface Session
public Object getAttribute(String name)
getAttribute
in interface Session
public String[] getAttributeNames()
getAttributeNames
in interface Session
public void setNamespacePrefix(String prefix, String uri) throws NamespaceException, RepositoryException
This behaviour is based on JSR 283 (JCR 2.0), but remains backwards compatible with JCR 1.0.
setNamespacePrefix
in interface Session
setNamespacePrefix
in class AbstractSession
prefix
- namespace prefixuri
- namespace URI
NamespaceException
- if the mapping is illegal
RepositoryException
- if a repository error occurspublic void addLockToken(String lt)
addLockToken
in interface Session
public String[] getLockTokens()
getLockTokens
in interface Session
public void removeLockToken(String lt)
removeLockToken
in interface Session
public LockManager getLockManager() throws RepositoryException
RepositoryException
public Lock[] getLocks()
Lock
spublic Node getNodeByIdentifier(String id) throws ItemNotFoundException, RepositoryException
Session
ItemNotFoundException
is thrown if no node with the
specified identifier exists. This exception is also thrown if this
Session does not have read access to the node with the
specified identifier.
A RepositoryException
is thrown if another error occurs.
- Parameters:
id
- An identifier.
- Returns:
- A
Node
.
- Throws:
ItemNotFoundException
- if the specified identifier is not found.
RepositoryException
- if another error occurs.- Since:
- JCR 2.0
- See Also:
Session.getNodeByIdentifier(String)
public Node getNode(String absPath) throws PathNotFoundException, RepositoryException
Session
PathNotFoundException
is thrown.
absPath
- An absolute path.
Node
.
PathNotFoundException
- If no node exists.
RepositoryException
- If another error occurs.Session.getNode(String)
public Property getProperty(String absPath) throws PathNotFoundException, RepositoryException
Session
PathNotFoundException
is thrown.
absPath
- An absolute path.
Property
.
PathNotFoundException
- If no property exists.
RepositoryException
- if another error occurs.Session.getProperty(String)
public boolean nodeExists(String absPath) throws RepositoryException
Session
true
if a node exists at absPath
and this Session
has read access to it; otherwise returns
false
.
Throws a RepositoryException
if absPath
is not a well-formed absolute path.
absPath
- An absolute path.
boolean
RepositoryException
- if absPath
is not a well-formed
absolute path.Session.nodeExists(String)
public boolean propertyExists(String absPath) throws RepositoryException
Session
true
if a property exists at absPath
and this Session
has read access to it; otherwise returns
false
.
Throws a RepositoryException
if absPath
is not a well-formed absolute path.
absPath
- An absolute path.
boolean
RepositoryException
- if absPath
is not a well-formed
absolute path.Session.propertyExists(String)
public void removeItem(String absPath) throws VersionException, LockException, ConstraintViolationException, RepositoryException
Session
save
must be
performed.
If a node with same-name siblings is removed, this decrements by one the
indices of all the siblings with indices greater than that of the removed
node. In other words, a removal compacts the array of same-name siblings
and causes the minimal re-numbering required to maintain the original
order but leave no gaps in the numbering.
A ReferentialIntegrityException
will be thrown on save
if the specified item or an item in its subtree is currently the target of a REFERENCE
property located in this workspace but outside the specified item's subtree and the current Session
has read access to that REFERENCE
property.
An AccessDeniedException
will be thrown on save
if the specified item or an item in its subtree is currently the target of a REFERENCE
property located in this workspace but outside the specified item's subtree and the current Session
does not have read access to that REFERENCE
property.
A ConstraintViolationException
will be thrown either immediately
or on save
, if removing the specified item would violate a node type or implementation-specific
constraint. Implementations may differ on when this validation is performed.
A VersionException
will be thrown either immediately
or on save
, if the parent node of the specified item is versionable and checked-in
or is non-versionable but its nearest versionable ancestor is checked-in. Implementations
may differ on when this validation is performed.
A LockException
will be thrown either immediately or on save
if a lock prevents the removal of the specified item. Implementations may differ on when this validation is performed.
absPath
- the absolute path of the item to be removed.
VersionException
- if the parent node of the item at absPath is versionable and checked-in
or is non-versionable but its nearest versionable ancestor is checked-in and this
implementation performs this validation immediately instead of waiting until save
.
LockException
- if a lock prevents the removal of the specified item and this
implementation performs this validation immediately instead of waiting until save
.
ConstraintViolationException
- if removing the specified item would violate a node type or
implementation-specific constraint and this implementation performs this validation immediately
instead of waiting until save
.
RepositoryException
- if another error occurs.Session.removeItem(String)
public boolean hasPermission(String absPath, String actions) throws RepositoryException
Session
true
if this Session
has permission to
perform the specified actions at the specified absPath
and
false
otherwise.
The actions
parameter is a comma separated list of action strings.
The following action strings are defined:
add_node
: If
hasPermission(path, "add_node")
returns true
,
then this Session
has permission to add a node at
path
.
set_property
: If
hasPermission(path, "set_property")
returns true
, then this Session
has permission
to set (add or change) a property at path
.
remove
: If
hasPermission(path, "remove")
returns true
,
then this Session
has permission to remove an item at
path
.
read
: If
hasPermission(path, "read")
returns true
, then
this Session
has permission to retrieve (and read the value
of, in the case of a property) an item at path
.
actions
parameter, this method will only return true
if this
Session
has permission to perform all of the listed
actions at the specified path.
The information returned through this method will only reflect the access
control status (both JCR defined and implementation-specific) and not other
restrictions that may exist, such as node type constraints. For example,
even though hasPermission
may indicate that a particular
Session
may add a property at /A/B/C
,
the node type of the node at /A/B
may prevent the addition
of a property called C
.
absPath
- an absolute path.actions
- a comma separated list of action strings.
true
if this Session
has permission to
perform the specified actions at the specified absPath
.
RepositoryException
- if an error occurs.Session.hasPermission(String, String)
public boolean hasCapability(String methodType, Object target, Map arguments) throws RepositoryException
Session
false
guarantees
that the operation cannot be performed, but returning true
does not guarantee
the opposite. The repository implementation should use this to give priority to
performance over completeness. An exception should be thrown only for important
failures such as loss of connectivity to the back-end.
The implementation of this method is best effort: returning false guarantees that the operation cannot be performed, but returning true does not guarantee the opposite.
The methodName
parameter identifies the method in question by its name
as defined in the Javadoc.
The target
parameter identifies the object on which the specified method is called.
The arguments
parameter contains a Map
object consisting of
name/value pairs where the name is a String holding the parameter name of
the method as defined in the Javadoc and the value is an Object holding
the value to be passed. In cases where the value is a Java primitive type
it must be converted to its corresponding Java object form before being passed.
For example, given a Session
S
and Node
N
then
Map p = new HashMap();
p.put("relPath", "foo");
boolean b = S.hasCapability("addNode", N, p);
will result in b == false if a child node called foo cannot be added to the node
N
within the session S
.
methodType
- the nakme of the method.target
- the target object of the operation.arguments
- the arguments of the operation.
false
if the operation cannot be performed,
true
if the operation can be performed or if the repository
cannot determine whether the operation can be performed.
RepositoryException
- if an error occursSession.hasCapability(String, Object, Map)
public AccessControlManager getAccessControlManager() throws UnsupportedRepositoryOperationException, RepositoryException
Session
Session
.
An UnsupportedRepositoryOperationException
is thrown if
access control is not supported.
A RepositoryException
is thrown if another error occurs.
Session
UnsupportedRepositoryOperationException
- if access control
is not supported.
RepositoryException
- if another error occurs.Session.getAccessControlManager()
public RetentionManager getRetentionManager() throws UnsupportedRepositoryOperationException, RepositoryException
Session
Session
.
An UnsupportedRepositoryOperationException
is thrown if
retention and hold are not supported.
A RepositoryException
is thrown if another error occurs.
Session
.
UnsupportedRepositoryOperationException
- if retention and hold
are not supported.
RepositoryException
- if another error occurs.Session.getRetentionManager()
public void dump(PrintStream ps)
dump
in interface Dumpable
ps
- stream to dump state topublic void finalize()
finalize
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |