|
ModeShape Distribution 3.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SessionCache
Nested Class Summary | |
---|---|
static interface |
SessionCache.PreSave
The definition of a callback that can be implemented and passed to save(SessionCache, PreSave) and
save(Set, SessionCache, PreSave) , allowing the caller to recieve a hook where they can interrogate
each of the changed nodes and perform additional logic prior to the actual persisting of the changes. |
static interface |
SessionCache.SaveContext
The context of a save operation, created during each call to save() and passed to the
PreSave#process(MutableCachedNode, SaveContext) invocations. |
Method Summary | |
---|---|
void |
addContextData(String key,
String value)
Adds a [key,value] data pair for this cache's context |
void |
clear(CachedNode node)
Clears all changes in the cache that are at or below the supplied node. |
NodeKey |
createNodeKey()
Create a new node key for the current source and workspace. |
NodeKey |
createNodeKey(String sourceName,
String identifier)
Create a new node key for the current source and workspace. |
NodeKey |
createNodeKeyWithIdentifier(String identifier)
Create a new node key for the current source and workspace. |
NodeKey |
createNodeKeyWithSource(String sourceName)
Create a new node key for the current source and workspace. |
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 node)
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 |
ExecutionContext |
getContext()
Get the context for this session. |
Set<NodeKey> |
getNodeKeysAtAndBelow(NodeKey nodeKey)
Returns a set with the NodeKey s of the existing nodes (persistent not transient & new) which are at and below the
path of the node with the given key. |
NodeCache |
getWorkspace()
Get the cache the reflects the workspace content, without any of the transient, unsaved changes of this session. |
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. |
MutableCachedNode |
mutable(NodeKey key)
Get a mutable form of the node with the supplied key. |
void |
save()
Saves all changes made within this session. |
void |
save(SessionCache otherSession,
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 otherSession,
SessionCache.PreSave preSaveOperation)
Saves all of this session's changes that were made at or below the specified path. |
Methods inherited from interface org.modeshape.jcr.cache.NodeCache |
---|
clear, getAllNodeKeys, getAllNodeKeysAtAndBelow, getNode, getNode, getRootKey |
Method Detail |
---|
ExecutionContext getContext()
void addContextData(String key, String value)
key
- the key for the context datavalue
- the value for the context datavoid 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 sessionvoid save(Set<NodeKey> toBeSaved, SessionCache otherSession, SessionCache.PreSave preSaveOperation)
Item.save()
.
toBeSaved
- the set of keys identifying the nodes whose changes should be saved; may not be nullotherSession
- 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 null
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 sessionvoid save(SessionCache otherSession, SessionCache.PreSave preSaveOperation)
otherSession
- 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 null
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 sessionboolean hasChanges()
Set<NodeKey> getChangedNodeKeys()
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
hasChanges()
is false. The returned set is a mutable copy of the
underlying set.Set<NodeKey> getChangedNodeKeysAtOrBelow(CachedNode node) throws NodeNotFoundException
NodeKey
s of the transient nodes from this cache which are at or below the path of the given
node
node
- a non-null CachedNode
instance
NodeNotFoundException
- if any of changes registered in this cache refer to nodes that have been removed in the
meantime.Set<NodeKey> getNodeKeysAtAndBelow(NodeKey nodeKey)
NodeKey
s of the existing nodes (persistent not transient & new) which are at and below the
path of the node with the given key. Note that this method will attempt to load each node
nodeKey
- the key of node which will be considered the root node
void clear(CachedNode node)
node
- the node at or below which all changes should be cleared; may not be nullNodeCache getWorkspace()
MutableCachedNode mutable(NodeKey key) throws NodeNotFoundException, UnsupportedOperationException
key
- the key for the node; may not be null
NodeNotFoundException
- if there is no existing node in the session cache or workspace cache
UnsupportedOperationException
- if this session is marked for read-only operationsvoid destroy(NodeKey key) throws NodeNotFoundException, UnsupportedOperationException
removed from its parent node
.
key
- the key for the top node in the subgraph; may not be null
NodeNotFoundException
- if there is no existing node in the session cache or workspace cache
UnsupportedOperationException
- if this session is marked for read-only operationsboolean isDestroyed(NodeKey key)
key
- the for the node; may not be null
NodeKey createNodeKey()
NodeKey createNodeKeyWithIdentifier(String identifier)
identifier
- the unique identifier for the key; if null, a generated identifier will be used
boolean isReadOnly()
NodeKey createNodeKeyWithSource(String sourceName)
sourceName
- the name (not key) for the source; if null, the key for the current source is used
NodeKey createNodeKey(String sourceName, String identifier)
sourceName
- the name (not key) for the source; if null, the key for the current source is usedidentifier
- the unique identifier for the key; if null, a generated identifier will be used
|
ModeShape Distribution 3.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |