Class ConsoleSession
- java.lang.Object
-
- org.apache.jackrabbit.oak.console.ConsoleSession
-
public class ConsoleSession extends Object
Light weight session to a NodeStore, holding context information.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
checkpoint(long lifetimeSeconds)
Creates and returns a checkpoint with the given lifetime in seconds.static ConsoleSession
create(NodeStore store, Whiteboard whiteboard)
NodeState
getRoot()
Returns the currently set root node.NodeStore
getStore()
Whiteboard
getWhiteboard()
@NotNull NodeState
getWorkingNode()
The node state for the current working path.String
getWorkingPath()
Returns the current working path.boolean
isAutoRefresh()
void
refresh()
Performs a manual refresh of the root node state.void
retrieve(String checkpoint)
Retrieves the root node from a previously created checkpoint.void
setAutoRefresh(boolean enable)
Enables or disables auto-refresh of the root node state ongetRoot()
.String
setWorkingPath(String path)
Sets a new working path and returns the previously set.
-
-
-
Method Detail
-
create
public static ConsoleSession create(NodeStore store, Whiteboard whiteboard)
-
getWorkingPath
public String getWorkingPath()
Returns the current working path. This method will return the path of the root node if none is set explicity.- Returns:
- the current working path.
-
setWorkingPath
public String setWorkingPath(String path)
Sets a new working path and returns the previously set.- Parameters:
path
- the new working path.- Returns:
- the previously set working path.
-
checkpoint
public String checkpoint(long lifetimeSeconds)
Creates and returns a checkpoint with the given lifetime in seconds.- Parameters:
lifetimeSeconds
- the lifetime of the checkpoint in seconds.- Returns:
- the checkpoint reference.
-
retrieve
public void retrieve(String checkpoint)
Retrieves the root node from a previously created checkpoint. The root node is available withgetRoot()
.- Parameters:
checkpoint
- the checkpoint reference.
-
getRoot
public NodeState getRoot()
Returns the currently set root node. IfisAutoRefresh()
is set, a fresh root node is retrieved from the store.- Returns:
- the current root node.
-
getStore
public NodeStore getStore()
- Returns:
- the underlying node store.
-
getWhiteboard
public Whiteboard getWhiteboard()
-
getWorkingNode
@NotNull public @NotNull NodeState getWorkingNode()
The node state for the current working path. Possibly non-existent.- Returns:
- the working node state.
-
setAutoRefresh
public void setAutoRefresh(boolean enable)
Enables or disables auto-refresh of the root node state ongetRoot()
.- Parameters:
enable
- enables or disables auto-refresh.
-
isAutoRefresh
public boolean isAutoRefresh()
- Returns:
true
if auto-refresh is enabled;false
otherwise.
-
refresh
public void refresh()
Performs a manual refresh of the root node state.
-
-