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 Stringcheckpoint(long lifetimeSeconds)Creates and returns a checkpoint with the given lifetime in seconds.static ConsoleSessioncreate(NodeStore store, Whiteboard whiteboard)NodeStategetRoot()Returns the currently set root node.NodeStoregetStore()WhiteboardgetWhiteboard()@NotNull NodeStategetWorkingNode()The node state for the current working path.StringgetWorkingPath()Returns the current working path.booleanisAutoRefresh()voidrefresh()Performs a manual refresh of the root node state.voidretrieve(String checkpoint)Retrieves the root node from a previously created checkpoint.voidsetAutoRefresh(boolean enable)Enables or disables auto-refresh of the root node state ongetRoot().StringsetWorkingPath(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:
trueif auto-refresh is enabled;falseotherwise.
-
refresh
public void refresh()
Performs a manual refresh of the root node state.
-
-