Package org.apache.jackrabbit.oak.api
Interface ContentSession
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
public interface ContentSession extends java.io.Closeable
Authentication session for accessing a content repository. AContentSession
provides access to the actual content through itsgetLatestRoot()
method.This interface is thread-safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull AuthInfo
getAuthInfo()
This methods provides access to information related to authentication and authorization of this content session.@NotNull Root
getLatestRoot()
The current head root as seen by this content session.java.lang.String
getWorkspaceName()
The name of the workspace thisContentSession
instance has been created for.
-
-
-
Method Detail
-
getAuthInfo
@NotNull @NotNull AuthInfo getAuthInfo()
This methods provides access to information related to authentication and authorization of this content session. Multiple calls to this method may return different instances which are guaranteed to be equal wrt. toObject.equals(Object)
.- Returns:
- immutable
AuthInfo
instance
-
getWorkspaceName
java.lang.String getWorkspaceName()
The name of the workspace thisContentSession
instance has been created for. If no workspace name has been specified during repository login this method will return the name of the default workspace.TODO clarify workspace handling once multiple workspaces are supported. See OAK-118.
- Returns:
- name of the workspace this instance has been created for or
null
if this content session is repository bound.
-
getLatestRoot
@NotNull @NotNull Root getLatestRoot()
The current head root as seen by this content session. UseRoot.commit()
to atomically apply the changes made in that subtree the underlying Microkernel.The root instance gives you a stable view of the tree at the time the root is acquired. In certain setups (i.e. clusters) changes committed through other sessions might not be immediately reflected through this call.
Please note this method is possibly expensive because it internally reads from the backend to detect if there were any changes (from any session).
- Returns:
- the current head root
-
-