|
ModeShape Distribution 3.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.jcr.cache.document.AbstractSessionCache
org.modeshape.jcr.cache.document.WritableSessionCache
@ThreadSafe public class WritableSessionCache
A writable SessionCache
implementation capable of making transient changes and saving them.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.modeshape.jcr.cache.document.AbstractSessionCache |
---|
AbstractSessionCache.BasicSaveContext |
Nested classes/interfaces inherited from interface org.modeshape.jcr.cache.SessionCache |
---|
SessionCache.PreSave, SessionCache.SaveContext |
Field Summary |
---|
Fields inherited from class org.modeshape.jcr.cache.document.AbstractSessionCache |
---|
workspaceCache |
Constructor Summary | |
---|---|
WritableSessionCache(ExecutionContext context,
WorkspaceCache workspaceCache,
SessionEnvironment sessionContext)
Create a new SessionCache that can be used for making changes to the workspace. |
Method Summary | |
---|---|
protected SessionNode |
add(SessionNode newNode)
|
protected void |
assertInSession(SessionNode node)
|
void |
clear()
Clears all changes in the cache. |
void |
clear(CachedNode node)
Clears all changes in the cache that are at or below the supplied node. |
protected void |
clearModifiedState()
|
protected void |
clearModifiedState(Iterable<NodeKey> savedNodesInOrder)
|
protected void |
clearState()
|
protected void |
clearState(Iterable<NodeKey> savedNodesInOrder)
|
void |
destroy(NodeKey key)
Destroy the subgraph with the supplied node as the top node in the subgraph. |
Set<NodeKey> |
getChangedNodeKeys()
Returns a set with the NodeKey s of the transient nodes from this cache. |
Set<NodeKey> |
getChangedNodeKeysAtOrBelow(CachedNode srcNode)
Returns a set with the NodeKey s of the transient nodes from this cache which are at or below the path of the given
node |
CachedNode |
getNode(NodeKey key)
Get the cached representation of the node with the supplied node key. |
boolean |
hasChanges()
Determine whether this session has any transient, unsaved changes. |
boolean |
isDestroyed(NodeKey key)
Return whether the node with the supplied key has been removed using this session but not yet persisted. |
boolean |
isReadOnly()
Returns whether this cache is readonly. |
SessionNode |
mutable(NodeKey key)
Get a mutable form of the node with the supplied key. |
protected ChangeSet |
persistChanges(Iterable<NodeKey> changedNodesInOrder,
SessionEnvironment.Monitor monitor)
Persist the changes within an already-established transaction. |
void |
save()
Persist the changes within a transaction. |
protected void |
save(SessionCache.PreSave preSaveOperation)
|
void |
save(SessionCache other,
SessionCache.PreSave preSaveOperation)
Saves all changes made within this session and the supplied session, using a single transaction for both. |
void |
save(Set<NodeKey> toBeSaved,
SessionCache other,
SessionCache.PreSave preSaveOperation)
This method saves the changes made by both sessions within a single transaction. |
String |
toString()
|
Methods inherited from class org.modeshape.jcr.cache.document.AbstractSessionCache |
---|
addContextData, createNodeKey, createNodeKey, createNodeKeyWithIdentifier, createNodeKeyWithSource, generateIdentifier, getAllNodeKeys, getAllNodeKeysAtAndBelow, getContext, getNode, getNodeKeysAtAndBelow, getRootKey, getWorkspace, workspaceCache |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WritableSessionCache(ExecutionContext context, WorkspaceCache workspaceCache, SessionEnvironment sessionContext)
context
- the execution context; may not be nullworkspaceCache
- the (shared) workspace cache; may not be nullsessionContext
- the context for the session; may not be nullMethod Detail |
---|
protected final void assertInSession(SessionNode node)
public CachedNode getNode(NodeKey key)
NodeCache
getNode
in interface NodeCache
getNode
in class AbstractSessionCache
key
- the node key; may not be null
public SessionNode mutable(NodeKey key)
SessionCache
mutable
in interface SessionCache
mutable
in class AbstractSessionCache
key
- the key for the node; may not be null
public boolean isReadOnly()
SessionCache
public void clear()
NodeCache
public void clear(CachedNode node)
SessionCache
node
- the node at or below which all changes should be cleared; may not be nullpublic Set<NodeKey> getChangedNodeKeys()
SessionCache
NodeKey
s of the transient nodes from this cache. Please note that there may be nodes which
have been removed by another session.
Set
with the changed keys, or an empty set if
SessionCache.hasChanges()
is false. The returned set is a mutable copy of the
underlying set.public Set<NodeKey> getChangedNodeKeysAtOrBelow(CachedNode srcNode)
SessionCache
NodeKey
s of the transient nodes from this cache which are at or below the path of the given
node
srcNode
- a non-null CachedNode
instance
public boolean hasChanges()
SessionCache
public void save()
LockFailureException
- if a requested lock could not be made
DocumentAlreadyExistsException
- if this session attempts to create a document that has the same key as an existing
document
DocumentNotFoundException
- if one of the modified documents was removed by another sessionprotected void save(SessionCache.PreSave preSaveOperation)
protected void clearState()
protected void clearState(Iterable<NodeKey> savedNodesInOrder)
protected void clearModifiedState()
protected void clearModifiedState(Iterable<NodeKey> savedNodesInOrder)
public void save(SessionCache other, SessionCache.PreSave preSaveOperation)
SessionCache
other
- another session whose changes should be saved with this session's changes; may not be nullpreSaveOperation
- the set of operations to run against the new and changed nodes prior to saving; may be nullpublic void save(Set<NodeKey> toBeSaved, SessionCache other, SessionCache.PreSave preSaveOperation)
toBeSaved
- the set of keys identifying the nodes whose changes should be saved; may not be nullother
- the other sessionpreSaveOperation
- the pre-save operation
LockFailureException
- if a requested lock could not be made
DocumentAlreadyExistsException
- if this session attempts to create a document that has the same key as an existing
document
DocumentNotFoundException
- if one of the modified documents was removed by another sessionprotected ChangeSet persistChanges(Iterable<NodeKey> changedNodesInOrder, SessionEnvironment.Monitor monitor)
changedNodesInOrder
- the nodes that are to be persisted; may not be nullmonitor
- the monitor for these changes; may be null if not needed
LockFailureException
- if a requested lock could not be made
DocumentAlreadyExistsException
- if this session attempts to create a document that has the same key as an existing
document
DocumentNotFoundException
- if one of the modified documents was removed by another sessionprotected SessionNode add(SessionNode newNode)
public void destroy(NodeKey key)
SessionCache
removed from its parent node
.
key
- the key for the top node in the subgraph; may not be nullpublic boolean isDestroyed(NodeKey key)
SessionCache
key
- the for the node; may not be null
public String toString()
toString
in class Object
|
ModeShape Distribution 3.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |