Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.cache.document
Class ReadOnlySessionCache

    java.lang.Object
      org.modeshape.jcr.cache.document.AbstractSessionCache
          org.modeshape.jcr.cache.document.ReadOnlySessionCache

All Implemented Interfaces:
  DocumentCache, NodeCache, SessionCache

    @ThreadSafe
    public class ReadOnlySessionCache

extends AbstractSessionCache

A read-only `SessionCache` implementation.

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
`ReadOnlySessionCache(ExecutionContext context, WorkspaceCache workspaceCache, SessionEnvironment sessionContext)`

Method Summary
`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.
`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
`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.
`void` | `save()` Saves all changes made within this session.
`void` | `save(CachedNode node, SessionCache otherSession, SessionCache.PreSave preSaveOperation)` Saves all of this session's changes that were made at or below the specified path.
`void` | `save(SessionCache otherSession, SessionCache.PreSave preSaveOperation)` Saves all changes made within this session and the supplied session, using a single transaction for both.
`String` | `toString()`

Methods inherited from class org.modeshape.jcr.cache.document.AbstractSessionCache
`addContextData, createNodeKey, createNodeKey, createNodeKeyWithIdentifier, createNodeKeyWithSource, generateIdentifier, getContext, getNode, getNode, getNodeKeysAtAndBelow, getRootKey, getWorkspace, workspaceCache`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ReadOnlySessionCache

    public ReadOnlySessionCache(ExecutionContext context,
                                WorkspaceCache workspaceCache,
                                SessionEnvironment sessionContext)

Method Detail

### clear

    public void clear()

  Description copied from interface: `NodeCache`
  Clears all changes in the cache.

### hasChanges

    public boolean hasChanges()

  Description copied from interface: `SessionCache`
  Determine whether this session has any transient, unsaved changes.

  Returns:
    true if there are unsaved changes, or false otherwise

### getChangedNodeKeys

    public Set<NodeKey> getChangedNodeKeys()

  Description copied from interface: `SessionCache`
  Returns a set with the `NodeKey`s of the transient nodes from this cache. Please note that there may be nodes which have been removed by another session.

  Returns:
    a `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.

### getChangedNodeKeysAtOrBelow

    public Set<NodeKey> getChangedNodeKeysAtOrBelow(CachedNode node)

  Description copied from interface: `SessionCache`
  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

  Parameters:
    `node` - a non-null `CachedNode` instance
  Returns:
    a Set of nodekeys, or an empty set if no nodes are found

### clear

    public void clear(CachedNode node)

  Description copied from interface: `SessionCache`
  Clears all changes in the cache that are at or below the supplied node.

  Parameters:
    `node` - the node at or below which all changes should be cleared; may not be null

### save

    public void save()

  Description copied from interface: `SessionCache`
  Saves all changes made within this session.

### save

    public void save(SessionCache otherSession,
                     SessionCache.PreSave preSaveOperation)

  Description copied from interface: `SessionCache`
  Saves all changes made within this session and the supplied session, using a single transaction for both.

  Parameters:
    `otherSession` - another session whose changes should be saved with this session's changes; may not be null
    `preSaveOperation` - the set of operations to run against the new and changed nodes prior to saving; may be null

### save

    public void save(CachedNode node,
                     SessionCache otherSession,
                     SessionCache.PreSave preSaveOperation)

  Description copied from interface: `SessionCache`
  Saves all of this session's changes that were made at or below the specified path. Note that this is not terribly efficient, but is done to implement the deprecated `Item.save()`.

  Parameters:
    `node` - the node at or below which all changes should be saved; may not be null
    `otherSession` - another session whose changes should be saved with this session's changes; may not be null
    `preSaveOperation` - the set of operations to run against the new and changed nodes prior to saving; may be null

### mutable

    public SessionNode mutable(NodeKey key)

  Description copied from interface: `SessionCache`
  Get a mutable form of the node with the supplied key. If this session already has a mutable node in its cache, that existing mutable node is returned; otherwise, a new mutable node is created and added to the session's cache.

  Specified by:
    `mutable` in interface `SessionCache`
  Specified by:
    `mutable` in class `AbstractSessionCache`
  Parameters:
    `key` - the key for the node; may not be null
  Returns:
    the mutable child node

### isReadOnly

    public boolean isReadOnly()

  Description copied from interface: `SessionCache`
  Returns whether this cache is readonly.

  Returns:
    true if this cache is readonly, or false otherwise

### destroy

    public void destroy(NodeKey key)

  Description copied from interface: `SessionCache`
  Destroy the subgraph with the supplied node as the top node in the subgraph. This method should be called after the node is already `removed from its parent node`.

  Parameters:
    `key` - the key for the top node in the subgraph; may not be null

### isDestroyed

    public boolean isDestroyed(NodeKey key)

  Description copied from interface: `SessionCache`
  Return whether the node with the supplied key has been removed using this session but not yet persisted.

  Parameters:
    `key` - the for the node; may not be null
  Returns:
    true if the node was removed in this session, or false otherwise

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.