@ThreadSafe public class ReadOnlySessionCache extends AbstractSessionCache
SessionCache
implementation.AbstractSessionCache.BasicSaveContext
SessionCache.PreSave, SessionCache.SaveContext
Constructor and Description |
---|
ReadOnlySessionCache(ExecutionContext context,
WorkspaceCache workspaceCache) |
Modifier and Type | Method and Description |
---|---|
void |
checkForTransaction()
Check whether this session is running within a transaction.
|
void |
destroy(NodeKey key)
Destroy the subgraph with the supplied node as the top node in the subgraph.
|
protected void |
doClear() |
protected void |
doClear(CachedNode node) |
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 |
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.
|
protected Logger |
logger() |
SessionNode |
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.
|
String |
toString() |
addContextData, clear, clear, createNodeKey, createNodeKey, createNodeKeyWithIdentifier, createNodeKeyWithSource, generateIdentifier, getAllNodeKeys, getAllNodeKeysAtAndBelow, getContext, getNode, getNode, getNodeKeysAtAndBelow, getRootKey, getWorkspace, unwrap, workspaceCache, workspaceName
public ReadOnlySessionCache(ExecutionContext context, WorkspaceCache workspaceCache)
protected Logger logger()
logger
in class AbstractSessionCache
public boolean hasChanges()
SessionCache
public 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 node)
SessionCache
NodeKey
s of the transient nodes from this cache which are at or below the path of the given
nodenode
- a non-null CachedNode
instanceprotected void doClear()
doClear
in class AbstractSessionCache
protected void doClear(CachedNode node)
doClear
in class AbstractSessionCache
public void save()
SessionCache
public void save(SessionCache otherSession, SessionCache.PreSave preSaveOperation)
SessionCache
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 nullpublic void save(Set<NodeKey> toBeSaved, SessionCache otherSession, SessionCache.PreSave preSaveOperation)
SessionCache
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 nullpublic SessionNode mutable(NodeKey key)
SessionCache
mutable
in interface SessionCache
mutable
in class AbstractSessionCache
key
- the key for the node; may not be nullpublic boolean isReadOnly()
SessionCache
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 nullpublic void checkForTransaction()
SessionCache
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.