public class SessionDelegate extends Object
| Constructor and Description |
|---|
SessionDelegate(@NotNull org.apache.jackrabbit.oak.api.ContentSession contentSession,
@NotNull org.apache.jackrabbit.oak.spi.security.SecurityProvider securityProvider,
@NotNull RefreshStrategy refreshStrategy,
@NotNull ThreadLocal<Long> threadSaveCount,
@NotNull org.apache.jackrabbit.oak.stats.StatisticManager statisticManager,
@NotNull org.apache.jackrabbit.oak.stats.Clock clock)
Create a new session delegate for a
ContentSession. |
| Modifier and Type | Method and Description |
|---|---|
void |
checkAlive()
Check that this session is alive.
|
void |
checkProtectedNode(String path) |
void |
commit()
Commits the changes currently in the transient space.
|
void |
commit(org.apache.jackrabbit.oak.api.Root root)
Commits the changes applied to the given root.
|
@NotNull org.apache.jackrabbit.oak.api.AuthInfo |
getAuthInfo() |
@NotNull org.apache.jackrabbit.oak.api.ContentSession |
getContentSession() |
@NotNull org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager |
getIdManager() |
@Nullable ItemDelegate |
getItem(String path)
Returns the node or property delegate at the given path.
|
SessionNamespaces |
getNamespaces() |
@Nullable NodeDelegate |
getNode(String path)
NodeDelegate at the given path |
@Nullable NodeDelegate |
getNodeByIdentifier(String id) |
@NotNull org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider |
getPermissionProvider() |
@Nullable PropertyDelegate |
getProperty(String path)
PropertyDelegate at the given path |
@NotNull org.apache.jackrabbit.oak.api.QueryEngine |
getQueryEngine() |
@NotNull org.apache.jackrabbit.oak.api.Root |
getRoot()
The current
Root instance this session delegate instance operates on. |
@Nullable NodeDelegate |
getRootNode() |
@NotNull SessionStats |
getSessionStats() |
long |
getUpdateCount() |
@NotNull String |
getWorkspaceName() |
boolean |
hasPendingChanges() |
boolean |
isAlive()
Determine whether this session is alive and has not been logged
out or become stale by other means.
|
void |
logout() |
void |
move(String srcPath,
String destPath,
boolean transientOp)
Move a node
|
<T> T |
perform(@NotNull SessionOperation<T> sessionOperation)
Performs the passed
SessionOperation in a safe execution context. |
<T> T |
performNullable(@NotNull SessionOperation<T> sessionOperation)
Same as
perform(org.apache.jackrabbit.oak.jcr.session.operation.SessionOperation)
but with the option to return null; thus calling
SessionOperation.performNullable() |
void |
performVoid(SessionOperation<Void> sessionOperation)
Same as
perform(org.apache.jackrabbit.oak.jcr.session.operation.SessionOperation)
for calls that don't expect any return value; thus calling
SessionOperation.performVoid(). |
void |
refresh(boolean keepChanges) |
void |
refreshAtNextAccess() |
<T> T |
safePerform(SessionOperation<T> sessionOperation)
Same as
perform(SessionOperation) unless this method expects
SessionOperation.perform() not to throw a RepositoryException. |
void |
save(String path)
Save the subtree rooted at the given
path, or the entire
transient space if given the root path or null. |
void |
setUserData(String userData) |
<T> Iterator<T> |
sync(Iterator<T> iterator)
Wrap the passed
iterator in an iterator that synchronizes
all access to the underlying session. |
String |
toString() |
public SessionDelegate(@NotNull
@NotNull org.apache.jackrabbit.oak.api.ContentSession contentSession,
@NotNull
@NotNull org.apache.jackrabbit.oak.spi.security.SecurityProvider securityProvider,
@NotNull
@NotNull RefreshStrategy refreshStrategy,
@NotNull
@NotNull ThreadLocal<Long> threadSaveCount,
@NotNull
@NotNull org.apache.jackrabbit.oak.stats.StatisticManager statisticManager,
@NotNull
@NotNull org.apache.jackrabbit.oak.stats.Clock clock)
ContentSession. The refresh behaviour of the
session is governed by the value of the refreshInterval argument: if the session
has been idle longer than that value, an implicit refresh will take place.
In addition a refresh can always be scheduled from the next access by an explicit call
to refreshAtNextAccess(). This is typically done from within the observation event
dispatcher in order.contentSession - the content sessionsecurityProvider - the security providerrefreshStrategy - the refresh strategy used for auto refreshing this sessionstatisticManager - the statistics manager for tracking session operations@NotNull public @NotNull SessionStats getSessionStats()
public void refreshAtNextAccess()
public <T> Iterator<T> sync(Iterator<T> iterator)
iterator in an iterator that synchronizes
all access to the underlying session.T - iterator - iterator to synchronized@NotNull
public <T> T perform(@NotNull
@NotNull SessionOperation<T> sessionOperation)
throws RepositoryException
SessionOperation in a safe execution context. This
context ensures that the session is refreshed if necessary and that refreshing
occurs before the session operation is performed and the refreshing is done only
once.T - return type of sessionOperationsessionOperation - the SessionOperation to performsessionOperation.perform()RepositoryExceptiongetRoot()@Nullable
public <T> T performNullable(@NotNull
@NotNull SessionOperation<T> sessionOperation)
throws RepositoryException
perform(org.apache.jackrabbit.oak.jcr.session.operation.SessionOperation)
but with the option to return null; thus calling
SessionOperation.performNullable()T - return type of sessionOperationsessionOperation - the SessionOperation to performsessionOperation.performNullable(), which
might also be null.RepositoryExceptionperform(org.apache.jackrabbit.oak.jcr.session.operation.SessionOperation)public void performVoid(SessionOperation<Void> sessionOperation) throws RepositoryException
perform(org.apache.jackrabbit.oak.jcr.session.operation.SessionOperation)
for calls that don't expect any return value; thus calling
SessionOperation.performVoid().sessionOperation - the SessionOperation to perform.RepositoryExceptionperform(org.apache.jackrabbit.oak.jcr.session.operation.SessionOperation)public <T> T safePerform(SessionOperation<T> sessionOperation)
perform(SessionOperation) unless this method expects
SessionOperation.perform() not to throw a RepositoryException.
Such exceptions will be wrapped into a RuntimeException and rethrown as they
are considered an internal error.T - return type of sessionOperationsessionOperation - the SessionOperation to performsessionOperation.perform()getRoot()@NotNull public @NotNull org.apache.jackrabbit.oak.api.ContentSession getContentSession()
public boolean isAlive()
true if this session is alive, false otherwise.public void checkAlive()
throws RepositoryException
RepositoryException - if this session is not aliveisAlive()public long getUpdateCount()
public void setUserData(String userData)
public void commit()
throws org.apache.jackrabbit.oak.api.CommitFailedException
org.apache.jackrabbit.oak.api.CommitFailedException - if the commit failedpublic void commit(org.apache.jackrabbit.oak.api.Root root) throws org.apache.jackrabbit.oak.api.CommitFailedException
org.apache.jackrabbit.oak.api.CommitFailedException - if the commit failedpublic void checkProtectedNode(String path) throws RepositoryException
RepositoryException@NotNull public @NotNull org.apache.jackrabbit.oak.api.AuthInfo getAuthInfo()
public void logout()
@NotNull public @NotNull org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager getIdManager()
@Nullable public @Nullable NodeDelegate getRootNode()
@Nullable public @Nullable NodeDelegate getNode(String path)
NodeDelegate at the given pathpath - Oak pathNodeDelegate at path or null if
none exists or not accessible.@Nullable public @Nullable ItemDelegate getItem(String path)
path - Oak pathnull if none exists@Nullable public @Nullable NodeDelegate getNodeByIdentifier(String id)
@Nullable public @Nullable PropertyDelegate getProperty(String path)
PropertyDelegate at the given pathpath - Oak pathPropertyDelegate at path or null if
none exists or not accessible.public boolean hasPendingChanges()
public void save(String path) throws RepositoryException
path, or the entire
transient space if given the root path or null.
This implementation only performs the save if the subtree rooted
at path contains all transient changes and will throw an
UnsupportedRepositoryOperationException otherwise.
path - RepositoryExceptionpublic void refresh(boolean keepChanges)
@NotNull public @NotNull String getWorkspaceName()
public void move(String srcPath, String destPath, boolean transientOp) throws RepositoryException
srcPath - oak path to the source node to copydestPath - oak path to the destinationtransientOp - whether or not to perform the move in transient spaceRepositoryException@NotNull public @NotNull org.apache.jackrabbit.oak.api.QueryEngine getQueryEngine()
@NotNull public @NotNull org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider getPermissionProvider()
@NotNull public @NotNull org.apache.jackrabbit.oak.api.Root getRoot()
Root instance this session delegate instance operates on.
To ensure the returned root reflects the correct repository revision access
should only be done from within a SessionOperation closure through
perform(SessionOperation).public SessionNamespaces getNamespaces()
Copyright © 2012–2020 The Apache Software Foundation. All rights reserved.