public abstract class AbstractSessionCache extends Object implements SessionCache, DocumentCache
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractSessionCache.BasicSaveContext |
SessionCache.PreSave, SessionCache.SaveContext| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSessionCache(ExecutionContext context,
WorkspaceCache sharedWorkspaceCache,
SessionEnvironment sessionContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addContextData(String key,
String value)
Adds a [key,value] data pair for this cache's context
|
void |
checkForTransaction()
Signal that this session cache should check for an existing transaction and use the appropriate workspace cache.
|
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 |
completeTransaction()
Signal that the transaction that was active and in which this session participated has completed and that this session
should no longer use a transaction-specific workspace cache.
|
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.
|
protected abstract void |
doClear() |
protected abstract void |
doClear(CachedNode node) |
protected String |
generateIdentifier() |
Iterator<NodeKey> |
getAllNodeKeys()
Get an iterator over all node keys within this cache.
|
Iterator<NodeKey> |
getAllNodeKeysAtAndBelow(NodeKey startingKey)
Get an iterator over all keys for the supplied node and all its descendants.
|
ExecutionContext |
getContext()
Get the context for this session.
|
CachedNode |
getNode(ChildReference reference)
Get the cached representation of the node as represented by the supplied child reference.
|
CachedNode |
getNode(NodeKey key)
Get the cached representation of the node with the supplied node key.
|
Set<NodeKey> |
getNodeKeysAtAndBelow(NodeKey nodeKey)
Returns a set with the
NodeKeys of the existing nodes (persistent not transient & new) which are at and below the
path of the node with the given key. |
NodeKey |
getRootKey()
Get the node key for the root node.
|
NodeCache |
getWorkspace()
Get the cache the reflects the workspace content, without any of the transient, unsaved changes of this session.
|
protected abstract Logger |
logger() |
abstract SessionNode |
mutable(NodeKey key)
Get a mutable form of the node with the supplied key.
|
SessionCache |
unwrap()
Unwrap this instance.
|
WorkspaceCache |
workspaceCache() |
protected String |
workspaceName() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdestroy, getChangedNodeKeys, getChangedNodeKeysAtOrBelow, hasChanges, isDestroyed, isReadOnly, save, save, saveprotected AbstractSessionCache(ExecutionContext context, WorkspaceCache sharedWorkspaceCache, SessionEnvironment sessionContext)
protected abstract Logger logger()
public void checkForTransaction()
checkForTransaction in interface SessionCacheprotected void completeTransaction()
public final SessionCache unwrap()
NodeCacheunwrap in interface NodeCacheunwrap in interface SessionCacheprotected final String workspaceName()
public final ExecutionContext getContext()
SessionCachegetContext in interface SessionCachepublic final WorkspaceCache workspaceCache()
workspaceCache in interface DocumentCachepublic final void addContextData(String key, String value)
SessionCacheaddContextData in interface SessionCachekey - the key for the context datavalue - the value for the context datapublic NodeKey createNodeKey()
SessionCachecreateNodeKey in interface SessionCachepublic NodeKey createNodeKeyWithIdentifier(String identifier)
SessionCachecreateNodeKeyWithIdentifier in interface SessionCacheidentifier - the unique identifier for the key; if null, a generated identifier will be usedpublic NodeKey createNodeKeyWithSource(String sourceName)
SessionCachecreateNodeKeyWithSource in interface SessionCachesourceName - the name (not key) for the source; if null, the key for the current source is usedpublic NodeKey createNodeKey(String sourceName, String identifier)
SessionCachecreateNodeKey in interface SessionCachesourceName - 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 usedprotected String generateIdentifier()
public NodeKey getRootKey()
NodeCachegetRootKey in interface NodeCachepublic NodeCache getWorkspace()
SessionCachegetWorkspace in interface SessionCachepublic CachedNode getNode(NodeKey key)
NodeCachepublic CachedNode getNode(ChildReference reference)
NodeCachegetNode(reference.getKey());
public Set<NodeKey> getNodeKeysAtAndBelow(NodeKey nodeKey)
SessionCacheNodeKeys 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 nodegetNodeKeysAtAndBelow in interface SessionCachenodeKey - the key of node which will be considered the root nodepublic abstract SessionNode mutable(NodeKey key)
SessionCachemutable in interface SessionCachekey - the key for the node; may not be nullpublic Iterator<NodeKey> getAllNodeKeys()
NodeCachegetAllNodeKeys in interface NodeCachepublic Iterator<NodeKey> getAllNodeKeysAtAndBelow(NodeKey startingKey)
NodeCachegetAllNodeKeysAtAndBelow in interface NodeCachestartingKey - the key for the node to start; may not be nullpublic final void clear(CachedNode node)
SessionCacheclear in interface SessionCachenode - the node at or below which all changes should be cleared; may not be nullpublic final void clear()
NodeCacheprotected abstract void doClear(CachedNode node)
protected abstract void doClear()
Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.