|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Session
This interface holds extensions made in JCR 2.0 while work is in progress implementing JCR 2.0.
| Field Summary | |
|---|---|
static String |
ACTION_ADD_NODE
A constant representing the add_node action string, used to
determine if this Session has permission to add a new node. |
static String |
ACTION_READ
A constant representing the read action string, used to
determine if this Session has permission to retrieve an
item (and read the value, in the case of a property). |
static String |
ACTION_REMOVE
A constant representing the remove action string,
used to determine if this Session has permission to remove
an item. |
static String |
ACTION_SET_PROPERTY
A constant representing the set_property action string,
used to determine if this Session has permission to set
(add or modify) a property. |
| Method Summary | |
|---|---|
AccessControlManager |
getAccessControlManager()
Returns the access control manager for this Session. |
Node |
getNode(String absPath)
Returns the node at the specified absolute path in the workspace. |
Node |
getNodeByIdentifier(String id)
Returns the node specified by the given identifier. |
Property |
getProperty(String absPath)
Returns the property at the specified absolute path in the workspace. |
RetentionManager |
getRetentionManager()
Returns the retention and hold manager for this Session. |
boolean |
hasCapability(String methodName,
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 |
hasPermission(String absPath,
String actions)
Returns true if this Session has permission to
perform the specified actions at the specified absPath and
false otherwise. |
boolean |
nodeExists(String absPath)
Returns true if a node exists at absPath
and this Session has read access to it; otherwise returns
false. |
boolean |
propertyExists(String absPath)
Returns true if a property exists at absPath
and this Session has read access to it; otherwise returns
false. |
void |
removeItem(String absPath)
Removes the specified item (and its subtree). |
| Methods inherited from interface javax.jcr.Session |
|---|
addLockToken, checkPermission, exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getAttribute, getAttributeNames, getImportContentHandler, getItem, getLockTokens, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getNodeByUUID, getRepository, getRootNode, getUserID, getValueFactory, getWorkspace, hasPendingChanges, impersonate, importXML, isLive, itemExists, logout, move, refresh, removeLockToken, save, setNamespacePrefix |
| Field Detail |
|---|
static final String ACTION_READ
read action string, used to
determine if this Session has permission to retrieve an
item (and read the value, in the case of a property).
hasPermission(String, String),
Session.checkPermission(String, String),
Constant Field Valuesstatic final String ACTION_ADD_NODE
add_node action string, used to
determine if this Session has permission to add a new node.
hasPermission(String, String),
Session.checkPermission(String, String),
Constant Field Valuesstatic final String ACTION_SET_PROPERTY
set_property action string,
used to determine if this Session has permission to set
(add or modify) a property.
hasPermission(String, String),
Session.checkPermission(String, String),
Constant Field Valuesstatic final String ACTION_REMOVE
remove action string,
used to determine if this Session has permission to remove
an item.
hasPermission(String, String),
Session.checkPermission(String, String),
Constant Field Values| Method Detail |
|---|
Node getNodeByIdentifier(String id)
throws ItemNotFoundException,
RepositoryException
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
Node getNode(String absPath)
throws PathNotFoundException,
RepositoryException
PathNotFoundException is thrown.
absPath - An absolute path.
Node.
PathNotFoundException - If no node exists.
RepositoryException - If another error occurs.
Property getProperty(String absPath)
throws PathNotFoundException,
RepositoryException
PathNotFoundException is thrown.
absPath - An absolute path.
Property.
PathNotFoundException - If no property exists.
RepositoryException - if another error occurs.
boolean nodeExists(String absPath)
throws RepositoryException
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.
boolean propertyExists(String absPath)
throws RepositoryException
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.
void removeItem(String absPath)
throws VersionException,
LockException,
ConstraintViolationException,
RepositoryException
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.Item.remove()
boolean hasPermission(String absPath,
String actions)
throws RepositoryException
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.
boolean hasCapability(String methodName,
Object target,
Map arguments)
throws RepositoryException
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.
methodName - 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 occurs
AccessControlManager getAccessControlManager()
throws UnsupportedRepositoryOperationException,
RepositoryException
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.
RetentionManager getRetentionManager()
throws UnsupportedRepositoryOperationException,
RepositoryException
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||