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 voidaddLockToken(String lt)voidcheckPermission(String absPath, String actions)voidexportDocumentView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse)voidexportDocumentView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse)voidexportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse)voidexportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse)@NotNull AccessControlManagergetAccessControlManager()ObjectgetAttribute(String name)String[]getAttributeNames()@NotNull Set<Principal>getBoundPrincipals()Returns the set of principals associated with this session.@NotNull StringgetExpandedName(@NotNull Item item)Returns the expanded name of the givenItem.@NotNull StringgetExpandedPath(@NotNull Item item)Returns the expanded path of the givenItem.@NotNull ContentHandlergetImportContentHandler(String parentAbsPath, int uuidBehavior)ItemgetItem(String absPath)@Nullable ItemgetItemOrNull(String absPath)Returns the node at the specified absolute path in the workspace.@NotNull String[]getLockTokens()StringgetNamespacePrefix(String uri)String[]getNamespacePrefixes()StringgetNamespaceURI(String prefix)NodegetNode(String absPath)@NotNull NodegetNodeByIdentifier(String id)@NotNull NodegetNodeByUUID(String uuid)@Nullable NodegetNodeOrNull(String absPath)Returns the node at the specified absolute path in the workspace ornullif no such node exists.@Nullable NodegetParentOrNull(@NotNull Item item)Returns the parent of the givenItemornullif no parent exists (either because the givenItemrepresents the root node or the current session does not have sufficient access to retrieve the parent).@NotNull PrincipalManagergetPrincipalManager()Returns thePrincipalManagerfor the currentSession.PropertygetProperty(String absPath)@Nullable PropertygetPropertyOrNull(String absPath)Returns the property at the specified absolute path in the workspace ornullif no such node exists.@NotNull RepositorygetRepository()@NotNull RetentionManagergetRetentionManager()@NotNull NodegetRootNode()StringgetUserID()@NotNull UserManagergetUserManager()Returns theUserManagerfor the currentSession.@NotNull ValueFactorygetValueFactory()@NotNull WorkspacegetWorkspace()booleanhasCapability(String methodName, Object target, Object[] arguments)booleanhasPendingChanges()booleanhasPermission(@NotNull String absPath, @NotNull String... actions)Returnstrueif thisSessionhas permission to perform the specified actions at the specifiedabsPathandfalseotherwise.booleanhasPermission(String absPath, String actions)@NotNull Sessionimpersonate(Credentials credentials)voidimportXML(String parentAbsPath, InputStream in, int uuidBehavior)booleanisLive()booleanitemExists(String absPath)voidlogout()voidmove(String srcAbsPath, String destAbsPath)booleannodeExists(String absPath)booleanpropertyExists(String absPath)voidrefresh(boolean keepChanges)voidremoveItem(String absPath)voidremoveLockToken(String lt)voidsave()voidsetNamespacePrefix(String prefix, String uri)StringtoString()
-
-
-
Constructor Detail
-
SessionImpl
public SessionImpl(SessionContext sessionContext)
-
-
Method Detail
-
getNodeOrNull
@Nullable public @Nullable Node getNodeOrNull(String absPath) throws RepositoryException
Description copied from interface:JackrabbitSessionReturns the node at the specified absolute path in the workspace ornullif no such node exists.- Specified by:
getNodeOrNullin interfaceJackrabbitSession- Parameters:
absPath- An absolute path.- Returns:
- the specified
Nodeornull. - Throws:
RepositoryException- If another error occurs.
-
getPropertyOrNull
@Nullable public @Nullable Property getPropertyOrNull(String absPath) throws RepositoryException
Description copied from interface:JackrabbitSessionReturns the property at the specified absolute path in the workspace ornullif no such node exists.- Specified by:
getPropertyOrNullin interfaceJackrabbitSession- Parameters:
absPath- An absolute path.- Returns:
- the specified
Propertyornull. - Throws:
RepositoryException- if another error occurs.
-
getItemOrNull
@Nullable public @Nullable Item getItemOrNull(String absPath) throws RepositoryException
Description copied from interface:JackrabbitSessionReturns 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:
getItemOrNullin interfaceJackrabbitSession- Parameters:
absPath- An absolute path.- Returns:
- the specified
Itemornull. - Throws:
RepositoryException- if another error occurs.
-
getParentOrNull
@Nullable public @Nullable Node getParentOrNull(@NotNull @NotNull Item item) throws RepositoryException
Description copied from interface:JackrabbitSessionReturns the parent of the givenItemornullif no parent exists (either because the givenItemrepresents the root node or the current session does not have sufficient access to retrieve the parent).- Specified by:
getParentOrNullin interfaceJackrabbitSession- Parameters:
item- AnItemthat has been obtained by the current session.- Returns:
- The parent node of the given
Itemornull. - Throws:
RepositoryException- If another error occurs.- See Also:
Item.getParent()
-
getRepository
@NotNull public @NotNull Repository getRepository()
- Specified by:
getRepositoryin interfaceSession
-
getAttributeNames
public String[] getAttributeNames()
- Specified by:
getAttributeNamesin interfaceSession
-
getAttribute
public Object getAttribute(String name)
- Specified by:
getAttributein interfaceSession
-
getWorkspace
@NotNull public @NotNull Workspace getWorkspace()
- Specified by:
getWorkspacein interfaceSession
-
impersonate
@NotNull public @NotNull Session impersonate(Credentials credentials) throws RepositoryException
- Specified by:
impersonatein interfaceSession- Throws:
RepositoryException
-
getValueFactory
@NotNull public @NotNull ValueFactory getValueFactory() throws RepositoryException
- Specified by:
getValueFactoryin interfaceSession- Throws:
RepositoryException
-
getRootNode
@NotNull public @NotNull Node getRootNode() throws RepositoryException
- Specified by:
getRootNodein interfaceSession- Throws:
RepositoryException
-
getNode
public Node getNode(String absPath) throws RepositoryException
- Specified by:
getNodein interfaceSession- Throws:
RepositoryException
-
nodeExists
public boolean nodeExists(String absPath) throws RepositoryException
- Specified by:
nodeExistsin interfaceSession- Throws:
RepositoryException
-
getNodeByUUID
@NotNull public @NotNull Node getNodeByUUID(String uuid) throws RepositoryException
- Specified by:
getNodeByUUIDin interfaceSession- Throws:
RepositoryException
-
getNodeByIdentifier
@NotNull public @NotNull Node getNodeByIdentifier(String id) throws RepositoryException
- Specified by:
getNodeByIdentifierin interfaceSession- Throws:
RepositoryException
-
getProperty
public Property getProperty(String absPath) throws RepositoryException
- Specified by:
getPropertyin interfaceSession- Throws:
RepositoryException
-
propertyExists
public boolean propertyExists(String absPath) throws RepositoryException
- Specified by:
propertyExistsin interfaceSession- Throws:
RepositoryException
-
getItem
public Item getItem(String absPath) throws RepositoryException
- Specified by:
getItemin interfaceSession- Throws:
RepositoryException
-
itemExists
public boolean itemExists(String absPath) throws RepositoryException
- Specified by:
itemExistsin interfaceSession- Throws:
RepositoryException
-
move
public void move(String srcAbsPath, String destAbsPath) throws RepositoryException
- Specified by:
movein interfaceSession- Throws:
RepositoryException
-
removeItem
public void removeItem(String absPath) throws RepositoryException
- Specified by:
removeItemin interfaceSession- Throws:
RepositoryException
-
save
public void save() throws RepositoryException- Specified by:
savein interfaceSession- Throws:
RepositoryException
-
refresh
public void refresh(boolean keepChanges) throws RepositoryException- Specified by:
refreshin interfaceSession- Throws:
RepositoryException
-
hasPendingChanges
public boolean hasPendingChanges() throws RepositoryException- Specified by:
hasPendingChangesin interfaceSession- Throws:
RepositoryException
-
getImportContentHandler
@NotNull public @NotNull ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws RepositoryException
- Specified by:
getImportContentHandlerin interfaceSession- Throws:
RepositoryException
-
importXML
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, RepositoryException
- Specified by:
importXMLin interfaceSession- Throws:
IOExceptionRepositoryException
-
exportSystemView
public void exportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws SAXException, RepositoryException
- Specified by:
exportSystemViewin interfaceSession- Throws:
SAXExceptionRepositoryException
-
exportSystemView
public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, RepositoryException
- Specified by:
exportSystemViewin interfaceSession- Throws:
IOExceptionRepositoryException
-
exportDocumentView
public void exportDocumentView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws SAXException, RepositoryException
- Specified by:
exportDocumentViewin interfaceSession- Throws:
SAXExceptionRepositoryException
-
exportDocumentView
public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, RepositoryException
- Specified by:
exportDocumentViewin interfaceSession- Throws:
IOExceptionRepositoryException
-
addLockToken
public void addLockToken(String lt)
- Specified by:
addLockTokenin interfaceSession
-
getLockTokens
@NotNull public @NotNull String[] getLockTokens()
- Specified by:
getLockTokensin interfaceSession
-
removeLockToken
public void removeLockToken(String lt)
- Specified by:
removeLockTokenin interfaceSession
-
hasPermission
public boolean hasPermission(String absPath, String actions) throws RepositoryException
- Specified by:
hasPermissionin interfaceSession- Throws:
RepositoryException
-
checkPermission
public void checkPermission(String absPath, String actions) throws RepositoryException
- Specified by:
checkPermissionin interfaceSession- Throws:
RepositoryException
-
hasCapability
public boolean hasCapability(String methodName, Object target, Object[] arguments) throws RepositoryException
- Specified by:
hasCapabilityin interfaceSession- Throws:
RepositoryException
-
getAccessControlManager
@NotNull public @NotNull AccessControlManager getAccessControlManager() throws RepositoryException
- Specified by:
getAccessControlManagerin interfaceSession- Throws:
RepositoryException
-
getRetentionManager
@NotNull public @NotNull RetentionManager getRetentionManager() throws RepositoryException
- Specified by:
getRetentionManagerin interfaceSession- Throws:
RepositoryException- See Also:
Session.getRetentionManager()
-
setNamespacePrefix
public void setNamespacePrefix(String prefix, String uri) throws RepositoryException
- Specified by:
setNamespacePrefixin interfaceSession- Throws:
RepositoryException
-
getNamespacePrefixes
public String[] getNamespacePrefixes() throws RepositoryException
- Specified by:
getNamespacePrefixesin interfaceSession- Throws:
RepositoryException
-
getNamespaceURI
public String getNamespaceURI(String prefix) throws RepositoryException
- Specified by:
getNamespaceURIin interfaceSession- Throws:
RepositoryException
-
getNamespacePrefix
public String getNamespacePrefix(String uri) throws RepositoryException
- Specified by:
getNamespacePrefixin interfaceSession- Throws:
RepositoryException
-
hasPermission
public boolean hasPermission(@NotNull @NotNull String absPath, @NotNull @NotNull String... actions) throws RepositoryExceptionDescription copied from interface:JackrabbitSessionReturnstrueif thisSessionhas permission to perform the specified actions at the specifiedabsPathandfalseotherwise.The
actionsparameter 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 thisSessionhas permission to add a new property atpath. -
{@code modify_property}: IfhasPermission(path, "modify_property")returnstrue, then thisSessionhas permission to change a property atpath. -
{@code remove_property}: IfhasPermission(path, "remove_property")returnstrue, then thisSessionhas permission to remove a property atpath. -
{@code remove_node}: IfhasPermission(path, "remove_node")returnstrue, then thisSessionhas permission to remove a node atpath. -
{@code node_type_management}: IfhasPermission(path, "node_type_management")returnstrue, then thisSessionhas permission to explicitly set or change the node type information associated with a node atpath. -
{@code versioning}: IfhasPermission(path, "versioning")returnstrue, then thisSessionhas permission to perform version related operations on a node atpath. -
{@code locking}: IfhasPermission(path, "locking")returnstrue, then thisSessionhas permission to lock and unlock a node atpath. -
{@code read_access_control}: IfhasPermission(path, "read_access_control")returnstrue, then thisSessionhas permission to read access control content stored at an item atpath. -
{@code modify_access_control}: IfhasPermission(path, "modify_access_control")returnstrue, then thisSessionhas permission to modify access control content at an item atpath. -
{@code user_management}: IfhasPermission(path, "user_management")returnstrue, then thisSessionhas permission to perform user management operations at an item atpath.
trueif thisSessionhas 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
hasPermissionmay indicate that a particularSessionmay add a property at/A/B/C, the node type of the node at/A/Bmay prevent the addition of a property calledC.- Specified by:
hasPermissionin interfaceJackrabbitSession- Parameters:
absPath- an absolute path.actions- one or several actions.- Returns:
trueif thisSessionhas 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:JackrabbitSessionReturns thePrincipalManagerfor the currentSession.- Specified by:
getPrincipalManagerin interfaceJackrabbitSession- Returns:
- the
PrincipalManagerassociated 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:JackrabbitSessionReturns theUserManagerfor the currentSession.- Specified by:
getUserManagerin interfaceJackrabbitSession- Returns:
- the
UserManagerassociated 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
-
getBoundPrincipals
@NotNull public @NotNull Set<Principal> getBoundPrincipals() throws RepositoryException
Description copied from interface:JackrabbitSessionReturns the set of principals associated with this session.- Specified by:
getBoundPrincipalsin interfaceJackrabbitSession- Returns:
- the set of principals associated with this session. Usually this set is unmodifiable.
- Throws:
RepositoryException- in case principal information cannot be retrieved.
-
getExpandedName
@NotNull public @NotNull String getExpandedName(@NotNull @NotNull Item item) throws RepositoryException
Description copied from interface:JackrabbitSessionReturns the expanded name of the givenItem.- Specified by:
getExpandedNamein 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:
- 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:JackrabbitSessionReturns the expanded path of the givenItem.- Specified by:
getExpandedPathin 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:
- JCR 2.0, 3.2.5.1 Expanded Form
-
-