Class SessionImpl
- java.lang.Object
-
- org.apache.jackrabbit.oak.jcr.session.SessionImpl
-
- All Implemented Interfaces:
Session
,JackrabbitSession
public class SessionImpl extends Object implements 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 Constructor Description SessionImpl(SessionContext sessionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
getAccessControlManager()
Object
getAttribute(String name)
String[]
getAttributeNames()
@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)
Item
getItem(String absPath)
@Nullable Item
getItemOrNull(String absPath)
Returns the node at the specified absolute path in the workspace.@NotNull String[]
getLockTokens()
String
getNamespacePrefix(String uri)
String[]
getNamespacePrefixes()
String
getNamespaceURI(String prefix)
Node
getNode(String absPath)
@NotNull Node
getNodeByIdentifier(String id)
@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
getPrincipalManager()
Returns thePrincipalManager
for the currentSession
.Property
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
getRepository()
@NotNull RetentionManager
getRetentionManager()
@NotNull Node
getRootNode()
String
getUserID()
@NotNull UserManager
getUserManager()
Returns theUserManager
for the currentSession
.@NotNull ValueFactory
getValueFactory()
@NotNull Workspace
getWorkspace()
boolean
hasCapability(String methodName, Object target, Object[] arguments)
boolean
hasPendingChanges()
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
move(String srcAbsPath, String destAbsPath)
boolean
nodeExists(String absPath)
boolean
propertyExists(String absPath)
void
refresh(boolean keepChanges)
void
removeItem(String absPath)
void
removeLockToken(String lt)
void
save()
void
setNamespacePrefix(String prefix, String uri)
String
toString()
-
-
-
Constructor Detail
-
SessionImpl
public SessionImpl(SessionContext sessionContext)
-
-
Method Detail
-
getNodeOrNull
@Nullable public @Nullable Node getNodeOrNull(String absPath) throws RepositoryException
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
@Nullable public @Nullable Property getPropertyOrNull(String absPath) throws RepositoryException
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
@Nullable public @Nullable Item getItemOrNull(String absPath) throws RepositoryException
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:
Item.getParent()
-
getRepository
@NotNull public @NotNull Repository getRepository()
- Specified by:
getRepository
in interfaceSession
-
getAttributeNames
public String[] getAttributeNames()
- Specified by:
getAttributeNames
in interfaceSession
-
getAttribute
public Object getAttribute(String name)
- Specified by:
getAttribute
in interfaceSession
-
getWorkspace
@NotNull public @NotNull Workspace getWorkspace()
- Specified by:
getWorkspace
in interfaceSession
-
impersonate
@NotNull public @NotNull Session impersonate(Credentials credentials) throws RepositoryException
- Specified by:
impersonate
in interfaceSession
- Throws:
RepositoryException
-
getValueFactory
@NotNull public @NotNull ValueFactory getValueFactory() throws RepositoryException
- Specified by:
getValueFactory
in interfaceSession
- Throws:
RepositoryException
-
getRootNode
@NotNull public @NotNull Node getRootNode() throws RepositoryException
- Specified by:
getRootNode
in interfaceSession
- Throws:
RepositoryException
-
getNode
public Node getNode(String absPath) throws RepositoryException
- Specified by:
getNode
in interfaceSession
- Throws:
RepositoryException
-
nodeExists
public boolean nodeExists(String absPath) throws RepositoryException
- Specified by:
nodeExists
in interfaceSession
- Throws:
RepositoryException
-
getNodeByUUID
@NotNull public @NotNull Node getNodeByUUID(String uuid) throws RepositoryException
- Specified by:
getNodeByUUID
in interfaceSession
- Throws:
RepositoryException
-
getNodeByIdentifier
@NotNull public @NotNull Node getNodeByIdentifier(String id) throws RepositoryException
- Specified by:
getNodeByIdentifier
in interfaceSession
- Throws:
RepositoryException
-
getProperty
public Property getProperty(String absPath) throws RepositoryException
- Specified by:
getProperty
in interfaceSession
- Throws:
RepositoryException
-
propertyExists
public boolean propertyExists(String absPath) throws RepositoryException
- Specified by:
propertyExists
in interfaceSession
- Throws:
RepositoryException
-
getItem
public Item getItem(String absPath) throws RepositoryException
- Specified by:
getItem
in interfaceSession
- Throws:
RepositoryException
-
itemExists
public boolean itemExists(String absPath) throws RepositoryException
- Specified by:
itemExists
in interfaceSession
- Throws:
RepositoryException
-
move
public void move(String srcAbsPath, String destAbsPath) throws RepositoryException
- Specified by:
move
in interfaceSession
- Throws:
RepositoryException
-
removeItem
public void removeItem(String absPath) throws RepositoryException
- Specified by:
removeItem
in interfaceSession
- Throws:
RepositoryException
-
save
public void save() throws RepositoryException
- Specified by:
save
in interfaceSession
- Throws:
RepositoryException
-
refresh
public void refresh(boolean keepChanges) throws RepositoryException
- Specified by:
refresh
in interfaceSession
- Throws:
RepositoryException
-
hasPendingChanges
public boolean hasPendingChanges() throws RepositoryException
- Specified by:
hasPendingChanges
in interfaceSession
- Throws:
RepositoryException
-
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
public void addLockToken(String lt)
- Specified by:
addLockToken
in interfaceSession
-
getLockTokens
@NotNull public @NotNull String[] getLockTokens()
- Specified by:
getLockTokens
in interfaceSession
-
removeLockToken
public void removeLockToken(String lt)
- Specified by:
removeLockToken
in interfaceSession
-
hasPermission
public boolean hasPermission(String absPath, String actions) throws RepositoryException
- Specified by:
hasPermission
in interfaceSession
- Throws:
RepositoryException
-
checkPermission
public void checkPermission(String absPath, String actions) throws RepositoryException
- 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
@NotNull public @NotNull AccessControlManager getAccessControlManager() throws RepositoryException
- Specified by:
getAccessControlManager
in interfaceSession
- Throws:
RepositoryException
-
getRetentionManager
@NotNull public @NotNull RetentionManager getRetentionManager() throws RepositoryException
- Specified by:
getRetentionManager
in interfaceSession
- Throws:
RepositoryException
- See Also:
Session.getRetentionManager()
-
setNamespacePrefix
public void setNamespacePrefix(String prefix, String uri) throws RepositoryException
- Specified by:
setNamespacePrefix
in interfaceSession
- Throws:
RepositoryException
-
getNamespacePrefixes
public String[] getNamespacePrefixes() throws RepositoryException
- Specified by:
getNamespacePrefixes
in interfaceSession
- Throws:
RepositoryException
-
getNamespaceURI
public String getNamespaceURI(String prefix) throws RepositoryException
- Specified by:
getNamespaceURI
in interfaceSession
- Throws:
RepositoryException
-
getNamespacePrefix
public String getNamespacePrefix(String uri) throws RepositoryException
- 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:-
{@code add_property}
: IfhasPermission(path, "add_property")
returnstrue
, then thisSession
has permission to add a new property atpath
. -
{@code modify_property}
: IfhasPermission(path, "modify_property")
returnstrue
, then thisSession
has permission to change a property atpath
. -
{@code remove_property}
: IfhasPermission(path, "remove_property")
returnstrue
, then thisSession
has permission to remove a property atpath
. -
{@code remove_node}
: IfhasPermission(path, "remove_node")
returnstrue
, then thisSession
has permission to remove a node atpath
. -
{@code node_type_management}
: IfhasPermission(path, "node_type_management")
returnstrue
, then thisSession
has permission to explicitly set or change the node type information associated with a node atpath
. -
{@code versioning}
: IfhasPermission(path, "versioning")
returnstrue
, then thisSession
has permission to perform version related operations on a node atpath
. -
{@code locking}
: IfhasPermission(path, "locking")
returnstrue
, then thisSession
has permission to lock and unlock a node atpath
. -
{@code read_access_control}
: IfhasPermission(path, "read_access_control")
returnstrue
, then thisSession
has permission to read access control content stored at an item atpath
. -
{@code modify_access_control}
: IfhasPermission(path, "modify_access_control")
returnstrue
, then thisSession
has permission to modify access control content at an item atpath
. -
{@code user_management}
: IfhasPermission(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:
Session.hasPermission(String, String)
-
-
getPrincipalManager
@NotNull public @NotNull PrincipalManager getPrincipalManager() throws RepositoryException
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:
PrincipalManager
-
getUserManager
@NotNull public @NotNull UserManager getUserManager() throws RepositoryException
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:
UserManager
-
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:
RepositoryException
- if another error occurs.- See Also:
- JCR 2.0, 3.2.5.1 Expanded Form
-
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:
RepositoryException
- if another error occurs.- See Also:
- JCR 2.0, 3.2.5.1 Expanded Form
-
-