Class SessionImpl
java.lang.Object
org.apache.jackrabbit.oak.jcr.session.SessionImpl
- All Implemented Interfaces:
Session
,JackrabbitSession
TODO document
-
Field Summary
Fields inherited from interface org.apache.jackrabbit.api.JackrabbitSession
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_VERSIONING
Fields inherited from interface javax.jcr.Session
ACTION_ADD_NODE, ACTION_READ, ACTION_REMOVE, ACTION_SET_PROPERTY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLockToken
(String lt) void
checkPermission
(String absPath, String actions) void
exportDocumentView
(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) void
exportDocumentView
(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) void
exportSystemView
(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) void
exportSystemView
(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) @NotNull AccessControlManager
getAttribute
(String name) String[]
Returns the set of principals associated with this session.@NotNull String
getExpandedName
(@NotNull Item item) Returns the expanded name of the givenItem
.@NotNull String
getExpandedPath
(@NotNull Item item) Returns the expanded path of the givenItem
.@NotNull ContentHandler
getImportContentHandler
(String parentAbsPath, int uuidBehavior) @Nullable Item
getItemOrNull
(String absPath) Returns the node at the specified absolute path in the workspace.@NotNull String[]
getNamespacePrefix
(String uri) String[]
getNamespaceURI
(String prefix) @NotNull Node
@NotNull Node
getNodeByUUID
(String uuid) @Nullable Node
getNodeOrNull
(String absPath) Returns the node at the specified absolute path in the workspace ornull
if no such node exists.@Nullable Node
getParentOrNull
(@NotNull Item item) Returns the parent of the givenItem
ornull
if no parent exists (either because the givenItem
represents the root node or the current session does not have sufficient access to retrieve the parent).@NotNull PrincipalManager
Returns thePrincipalManager
for the currentSession
.getProperty
(String absPath) @Nullable Property
getPropertyOrNull
(String absPath) Returns the property at the specified absolute path in the workspace ornull
if no such node exists.@NotNull Repository
@NotNull RetentionManager
@NotNull Node
@NotNull UserManager
Returns theUserManager
for the currentSession
.@NotNull ValueFactory
@NotNull Workspace
boolean
hasCapability
(String methodName, Object target, Object[] arguments) boolean
boolean
hasPermission
(@NotNull String absPath, @NotNull String... actions) Returnstrue
if thisSession
has permission to perform the specified actions at the specifiedabsPath
andfalse
otherwise.boolean
hasPermission
(String absPath, String actions) @NotNull Session
impersonate
(Credentials credentials) void
importXML
(String parentAbsPath, InputStream in, int uuidBehavior) boolean
isLive()
boolean
itemExists
(String absPath) void
logout()
void
boolean
nodeExists
(String absPath) boolean
propertyExists
(String absPath) void
refresh
(boolean keepChanges) void
removeItem
(String absPath) void
void
save()
void
setNamespacePrefix
(String prefix, String uri) toString()
-
Constructor Details
-
SessionImpl
-
-
Method Details
-
getNodeOrNull
Description copied from interface:JackrabbitSession
Returns the node at the specified absolute path in the workspace ornull
if no such node exists.- Specified by:
getNodeOrNull
in interfaceJackrabbitSession
- Parameters:
absPath
- An absolute path.- Returns:
- the specified
Node
ornull
. - Throws:
RepositoryException
- If another error occurs.
-
getPropertyOrNull
Description copied from interface:JackrabbitSession
Returns the property at the specified absolute path in the workspace ornull
if no such node exists.- Specified by:
getPropertyOrNull
in interfaceJackrabbitSession
- Parameters:
absPath
- An absolute path.- Returns:
- the specified
Property
ornull
. - Throws:
RepositoryException
- if another error occurs.
-
getItemOrNull
Description copied from interface:JackrabbitSession
Returns the node at the specified absolute path in the workspace. If no such node exists, then it returns the property at the specified path. If no such property exists, then it returnnull
.- Specified by:
getItemOrNull
in interfaceJackrabbitSession
- Parameters:
absPath
- An absolute path.- Returns:
- the specified
Item
ornull
. - Throws:
RepositoryException
- if another error occurs.
-
getParentOrNull
@Nullable public @Nullable Node getParentOrNull(@NotNull @NotNull Item item) throws RepositoryException Description copied from interface:JackrabbitSession
Returns the parent of the givenItem
ornull
if no parent exists (either because the givenItem
represents the root node or the current session does not have sufficient access to retrieve the parent).- Specified by:
getParentOrNull
in interfaceJackrabbitSession
- Parameters:
item
- AnItem
that has been obtained by the current session.- Returns:
- The parent node of the given
Item
ornull
. - Throws:
RepositoryException
- If another error occurs.- See Also:
-
getRepository
- Specified by:
getRepository
in interfaceSession
-
getUserID
-
getAttributeNames
- Specified by:
getAttributeNames
in interfaceSession
-
getAttribute
- Specified by:
getAttribute
in interfaceSession
-
getWorkspace
- Specified by:
getWorkspace
in interfaceSession
-
impersonate
- Specified by:
impersonate
in interfaceSession
- Throws:
RepositoryException
-
getValueFactory
- Specified by:
getValueFactory
in interfaceSession
- Throws:
RepositoryException
-
getRootNode
- Specified by:
getRootNode
in interfaceSession
- Throws:
RepositoryException
-
getNode
- Specified by:
getNode
in interfaceSession
- Throws:
RepositoryException
-
nodeExists
- Specified by:
nodeExists
in interfaceSession
- Throws:
RepositoryException
-
getNodeByUUID
- Specified by:
getNodeByUUID
in interfaceSession
- Throws:
RepositoryException
-
getNodeByIdentifier
- Specified by:
getNodeByIdentifier
in interfaceSession
- Throws:
RepositoryException
-
getProperty
- Specified by:
getProperty
in interfaceSession
- Throws:
RepositoryException
-
propertyExists
- Specified by:
propertyExists
in interfaceSession
- Throws:
RepositoryException
-
getItem
- Specified by:
getItem
in interfaceSession
- Throws:
RepositoryException
-
itemExists
- Specified by:
itemExists
in interfaceSession
- Throws:
RepositoryException
-
move
- Specified by:
move
in interfaceSession
- Throws:
RepositoryException
-
removeItem
- Specified by:
removeItem
in interfaceSession
- Throws:
RepositoryException
-
save
- Specified by:
save
in interfaceSession
- Throws:
RepositoryException
-
refresh
- Specified by:
refresh
in interfaceSession
- Throws:
RepositoryException
-
hasPendingChanges
- Specified by:
hasPendingChanges
in interfaceSession
- Throws:
RepositoryException
-
isLive
public boolean isLive() -
logout
public void logout() -
getImportContentHandler
@NotNull public @NotNull ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws RepositoryException - Specified by:
getImportContentHandler
in interfaceSession
- Throws:
RepositoryException
-
importXML
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, RepositoryException - Specified by:
importXML
in interfaceSession
- Throws:
IOException
RepositoryException
-
exportSystemView
public void exportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws SAXException, RepositoryException - Specified by:
exportSystemView
in interfaceSession
- Throws:
SAXException
RepositoryException
-
exportSystemView
public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, RepositoryException - Specified by:
exportSystemView
in interfaceSession
- Throws:
IOException
RepositoryException
-
exportDocumentView
public void exportDocumentView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws SAXException, RepositoryException - Specified by:
exportDocumentView
in interfaceSession
- Throws:
SAXException
RepositoryException
-
exportDocumentView
public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, RepositoryException - Specified by:
exportDocumentView
in interfaceSession
- Throws:
IOException
RepositoryException
-
addLockToken
- Specified by:
addLockToken
in interfaceSession
-
getLockTokens
- Specified by:
getLockTokens
in interfaceSession
-
removeLockToken
- Specified by:
removeLockToken
in interfaceSession
-
hasPermission
- Specified by:
hasPermission
in interfaceSession
- Throws:
RepositoryException
-
checkPermission
- Specified by:
checkPermission
in interfaceSession
- Throws:
RepositoryException
-
hasCapability
public boolean hasCapability(String methodName, Object target, Object[] arguments) throws RepositoryException - Specified by:
hasCapability
in interfaceSession
- Throws:
RepositoryException
-
getAccessControlManager
- Specified by:
getAccessControlManager
in interfaceSession
- Throws:
RepositoryException
-
getRetentionManager
- Specified by:
getRetentionManager
in interfaceSession
- Throws:
RepositoryException
- See Also:
-
setNamespacePrefix
- Specified by:
setNamespacePrefix
in interfaceSession
- Throws:
RepositoryException
-
getNamespacePrefixes
- Specified by:
getNamespacePrefixes
in interfaceSession
- Throws:
RepositoryException
-
getNamespaceURI
- Specified by:
getNamespaceURI
in interfaceSession
- Throws:
RepositoryException
-
getNamespacePrefix
- Specified by:
getNamespacePrefix
in interfaceSession
- Throws:
RepositoryException
-
hasPermission
public boolean hasPermission(@NotNull @NotNull String absPath, @NotNull @NotNull String... actions) throws RepositoryException Description copied from interface:JackrabbitSession
Returnstrue
if thisSession
has permission to perform the specified actions at the specifiedabsPath
andfalse
otherwise.The
actions
parameter is a list of action strings. Apart from the actions defined onSession
, this variant also allows to specify the following additional actions to provide better permission discovery:-
: Ifadd_property
hasPermission(path, "add_property")
returnstrue
, then thisSession
has permission to add a new property atpath
. -
: Ifmodify_property
hasPermission(path, "modify_property")
returnstrue
, then thisSession
has permission to change a property atpath
. -
: Ifremove_property
hasPermission(path, "remove_property")
returnstrue
, then thisSession
has permission to remove a property atpath
. -
: Ifremove_node
hasPermission(path, "remove_node")
returnstrue
, then thisSession
has permission to remove a node atpath
. -
: Ifnode_type_management
hasPermission(path, "node_type_management")
returnstrue
, then thisSession
has permission to explicitly set or change the node type information associated with a node atpath
. -
: Ifversioning
hasPermission(path, "versioning")
returnstrue
, then thisSession
has permission to perform version related operations on a node atpath
. -
: Iflocking
hasPermission(path, "locking")
returnstrue
, then thisSession
has permission to lock and unlock a node atpath
. -
: Ifread_access_control
hasPermission(path, "read_access_control")
returnstrue
, then thisSession
has permission to read access control content stored at an item atpath
. -
: Ifmodify_access_control
hasPermission(path, "modify_access_control")
returnstrue
, then thisSession
has permission to modify access control content at an item atpath
. -
: Ifuser_management
hasPermission(path, "user_management")
returnstrue
, then thisSession
has permission to perform user management operations at an item atpath
.
true
if thisSession
has permission to perform all of the listed actions at the specified path.The information returned through this method will only reflect the permission status (both JCR defined and implementation-specific) and not other restrictions that may exist, such as node type or other implementation enforced constraints. For example, even though
hasPermission
may indicate that a particularSession
may add a property at/A/B/C
, the node type of the node at/A/B
may prevent the addition of a property calledC
.- Specified by:
hasPermission
in interfaceJackrabbitSession
- Parameters:
absPath
- an absolute path.actions
- one or several actions.- Returns:
true
if thisSession
has permission to perform the specified actions at the specifiedabsPath
.- Throws:
RepositoryException
- if an error occurs.- See Also:
-
-
getPrincipalManager
Description copied from interface:JackrabbitSession
Returns thePrincipalManager
for the currentSession
.- Specified by:
getPrincipalManager
in interfaceJackrabbitSession
- Returns:
- the
PrincipalManager
associated with thisSession
. - Throws:
AccessDeniedException
- If the session lacks privileges to access the principal manager or principals in general.UnsupportedRepositoryOperationException
- If principal management is not supported.RepositoryException
- If another error occurs.- See Also:
-
getUserManager
Description copied from interface:JackrabbitSession
Returns theUserManager
for the currentSession
.- Specified by:
getUserManager
in interfaceJackrabbitSession
- Returns:
- the
UserManager
associated with thisSession
. - Throws:
AccessDeniedException
- If this session is not allowed to to access user data.UnsupportedRepositoryOperationException
- If user management is not supported.RepositoryException
- If another error occurs.- See Also:
-
getBoundPrincipals
Description copied from interface:JackrabbitSession
Returns the set of principals associated with this session.- Specified by:
getBoundPrincipals
in interfaceJackrabbitSession
- Returns:
- the set of principals associated with this session. Usually this set is unmodifiable.
- Throws:
RepositoryException
- in case principal information cannot be retrieved.
-
toString
-
getExpandedName
@NotNull public @NotNull String getExpandedName(@NotNull @NotNull Item item) throws RepositoryException Description copied from interface:JackrabbitSession
Returns the expanded name of the givenItem
.- Specified by:
getExpandedName
in interfaceJackrabbitSession
- Parameters:
item
- the item for which to retrieve the name- Returns:
- the name of the item in expanded form.
- Throws:
NamespaceException
- when no expanded name can be determined (for instance, if the registered namespace (name) is invalid)RepositoryException
- if another error occurs- See Also:
-
getExpandedPath
@NotNull public @NotNull String getExpandedPath(@NotNull @NotNull Item item) throws RepositoryException Description copied from interface:JackrabbitSession
Returns the expanded path of the givenItem
.- Specified by:
getExpandedPath
in interfaceJackrabbitSession
- Parameters:
item
- the item for which to retrieve the name- Returns:
- the path of the item in expanded form.
- Throws:
NamespaceException
- when no expanded name can be determined (for instance, if the registered namespace (name) is invalid)RepositoryException
- if another error occurs.- See Also:
-