Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.access
Class DataRowStore

    java.lang.Object
      org.apache.cayenne.access.DataRowStore

All Implemented Interfaces:
  java.io.Serializable

    public class DataRowStore

extends java.lang.Object
implements java.io.Serializable

A fixed size cache of DataRows keyed by ObjectId.

Synchronization Note: DataRowStore synchronizes most operations on its own instance.

Since:
  1.1
Author:
  Andrei Adamchik
See Also:
  Serialized Form

Field Summary
`static java.lang.String` | `EVENT_BRIDGE_FACTORY_DEFAULT`
`static java.lang.String` | `EVENT_BRIDGE_FACTORY_PROPERTY`
`protected EventManager` | `eventManager`
`protected EventSubject` | `eventSubject`
`protected java.lang.String` | `name`
`protected boolean` | `notifyingRemoteListeners`
`static boolean` | `REMOTE_NOTIFICATION_DEFAULT`
`static java.lang.String` | `REMOTE_NOTIFICATION_PROPERTY`
`protected EventBridge` | `remoteNotificationsHandler`
`static int` | `SNAPSHOT_CACHE_SIZE_DEFAULT`
`static java.lang.String` | `SNAPSHOT_CACHE_SIZE_PROPERTY`
`static long` | `SNAPSHOT_EXPIRATION_DEFAULT`
`static java.lang.String` | `SNAPSHOT_EXPIRATION_PROPERTY`
`protected org.apache.commons.collections.map.LRUMap` | `snapshotLists`
`protected org.apache.commons.collections.map.LRUMap` | `snapshots`

Constructor Summary
`DataRowStore(java.lang.String name)` Creates new named DataRowStore with default configuration.
`DataRowStore(java.lang.String name, java.util.Map properties)` Creates new DataRowStore with a specified name and a set of properties.
`DataRowStore(java.lang.String name, java.util.Map properties, EventManager eventManager)` Creates new DataRowStore with a specified name and a set of properties.

Method Summary
`void` | `cacheSnapshots(java.lang.String key, java.util.List snapshots)` Registers a list of snapshots with internal cache, using a String key.
`void` | `clear()` Expires and removes all stored snapshots without sending any notification events.
`void` | `forgetSnapshot(ObjectId id)` Evicts a snapshot from cache without generating any SnapshotEvents.
`DataRow` | `getCachedSnapshot(ObjectId oid)` Returns cached snapshot or null if no snapshot is currently cached for the given ObjectId.
`java.util.List` | `getCachedSnapshots(java.lang.String key)` Returns a list of previously cached snapshots.
`EventManager` | `getEventManager()` Returns an EventManager associated with this DataRowStore.
`java.lang.String` | `getName()` Returns the name of this DataRowStore.
`DataRow` | `getSnapshot(ObjectId oid, QueryEngine engine)` Deprecated. since 1.2 unused, as DataRowStore no longer performs queries on its own.
`EventSubject` | `getSnapshotEventSubject()` Returns EventSubject used by this SnapshotCache to notify of snapshot changes.
`protected void` | `initWithProperties(java.util.Map properties)`
`boolean` | `isNotifyingRemoteListeners()`
`int` | `maximumSize()` Returns maximum allowed cache size.
`void` | `processRemoteEvent(SnapshotEvent event)` Handles remote events received via EventBridge.
`void` | `processSnapshotChanges(java.lang.Object source, java.util.Map updatedSnapshots, java.util.Collection deletedSnapshotIds, java.util.Collection indirectlyModifiedIds)` Deprecated.
`void` | `processSnapshotChanges(java.lang.Object postedBy, java.util.Map updatedSnapshots, java.util.Collection deletedSnapshotIds, java.util.Collection invalidatedSnapshotIds, java.util.Collection indirectlyModifiedIds)` Processes changes made to snapshots.
`void` | `setEventManager(EventManager eventManager)` Sets an EventManager associated with this DataRowStore.
`void` | `setName(java.lang.String name)` Sets the name of this DataRowStore.
`void` | `setNotifyingRemoteListeners(boolean notifyingRemoteListeners)`
`void` | `shutdown()` Shuts down any remote notification connections, and clears internal cache.
`int` | `size()` Returns current cache size.

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

Field Detail

### SNAPSHOT_EXPIRATION_PROPERTY

    public static final java.lang.String SNAPSHOT_EXPIRATION_PROPERTY

See Also:
  Constant Field Values

### SNAPSHOT_CACHE_SIZE_PROPERTY

    public static final java.lang.String SNAPSHOT_CACHE_SIZE_PROPERTY

See Also:
  Constant Field Values

### REMOTE_NOTIFICATION_PROPERTY

    public static final java.lang.String REMOTE_NOTIFICATION_PROPERTY

See Also:
  Constant Field Values

### EVENT_BRIDGE_FACTORY_PROPERTY

    public static final java.lang.String EVENT_BRIDGE_FACTORY_PROPERTY

See Also:
  Constant Field Values

### SNAPSHOT_EXPIRATION_DEFAULT

    public static final long SNAPSHOT_EXPIRATION_DEFAULT

See Also:
  Constant Field Values

### SNAPSHOT_CACHE_SIZE_DEFAULT

    public static final int SNAPSHOT_CACHE_SIZE_DEFAULT

See Also:
  Constant Field Values

### REMOTE_NOTIFICATION_DEFAULT

    public static final boolean REMOTE_NOTIFICATION_DEFAULT

See Also:
  Constant Field Values

### EVENT_BRIDGE_FACTORY_DEFAULT

    public static final java.lang.String EVENT_BRIDGE_FACTORY_DEFAULT

See Also:
  Constant Field Values

### name

    protected java.lang.String name

### snapshots

    protected org.apache.commons.collections.map.LRUMap snapshots

### snapshotLists

    protected org.apache.commons.collections.map.LRUMap snapshotLists

### notifyingRemoteListeners

    protected boolean notifyingRemoteListeners

### eventManager

    protected transient EventManager eventManager

### remoteNotificationsHandler

    protected transient EventBridge remoteNotificationsHandler

### eventSubject

    protected transient EventSubject eventSubject

Constructor Detail

### DataRowStore

    public DataRowStore(java.lang.String name)

  Creates new named DataRowStore with default configuration.

### DataRowStore

    public DataRowStore(java.lang.String name,
                        java.util.Map properties)

  Creates new DataRowStore with a specified name and a set of properties. If no properties are defined, default values are used.

  Parameters:
    `name` - DataRowStore name. Used to idenitfy this DataRowStore in events, etc. Can't be null.
    `properties` - Properties map used to configure DataRowStore parameters. Can be null.

### DataRowStore

    public DataRowStore(java.lang.String name,
                        java.util.Map properties,
                        EventManager eventManager)

  Creates new DataRowStore with a specified name and a set of properties. If no properties are defined, default values are used.

  Parameters:
    `name` - DataRowStore name. Used to idenitfy this DataRowStore in events, etc. Can't be null.
    `properties` - Properties map used to configure DataRowStore parameters. Can be null.
    `eventManager` - EventManager that should be used for posting and receiving events.
  Since:
    1.2

Method Detail

### initWithProperties

    protected void initWithProperties(java.util.Map properties)

### size

    public int size()

  Returns current cache size.

### maximumSize

    public int maximumSize()

  Returns maximum allowed cache size.

### shutdown

    public void shutdown()

  Shuts down any remote notification connections, and clears internal cache.

### getName

    public java.lang.String getName()

  Returns the name of this DataRowStore. Name allows to create EventSubjects for event notifications addressed to or sent from this DataRowStore.

### setName

    public void setName(java.lang.String name)

  Sets the name of this DataRowStore. Name allows to create EventSubjects for event notifications addressed to or sent from this DataRowStore.

### getEventManager

    public EventManager getEventManager()

  Returns an EventManager associated with this DataRowStore.

  Since:
    1.2

### setEventManager

    public void setEventManager(EventManager eventManager)

  Sets an EventManager associated with this DataRowStore.

  Since:
    1.2

### getCachedSnapshot

    public DataRow getCachedSnapshot(ObjectId oid)

  Returns cached snapshot or null if no snapshot is currently cached for the given ObjectId.

### getSnapshot

    public DataRow getSnapshot(ObjectId oid,
                               QueryEngine engine)

  Deprecated. since 1.2 unused, as DataRowStore no longer performs queries on its own.

  Returns a snapshot for ObjectId. If snapshot is currently cached, it is returned. If not, a provided QueryEngine is used to fetch it from the database. If there is no database row for a given id, null is returned.

### cacheSnapshots

    public void cacheSnapshots(java.lang.String key,
                               java.util.List snapshots)

  Registers a list of snapshots with internal cache, using a String key.

### getCachedSnapshots

    public java.util.List getCachedSnapshots(java.lang.String key)

  Returns a list of previously cached snapshots.

### getSnapshotEventSubject

    public EventSubject getSnapshotEventSubject()

  Returns EventSubject used by this SnapshotCache to notify of snapshot changes.

### clear

    public void clear()

  Expires and removes all stored snapshots without sending any notification events.

### forgetSnapshot

    public void forgetSnapshot(ObjectId id)

  Evicts a snapshot from cache without generating any SnapshotEvents.

### processRemoteEvent

    public void processRemoteEvent(SnapshotEvent event)

  Handles remote events received via EventBridge. Performs needed snapshot updates, and then resends the event to local listeners.

### processSnapshotChanges

    public void processSnapshotChanges(java.lang.Object source,
                                       java.util.Map updatedSnapshots,
                                       java.util.Collection deletedSnapshotIds,
                                       java.util.Collection indirectlyModifiedIds)

  Deprecated.

  Processes changes made to snapshots. Modifies internal cache state, and then sends the event to all listeners. Source of these changes is usually an ObjectStore.

### processSnapshotChanges

    public void processSnapshotChanges(java.lang.Object postedBy,
                                       java.util.Map updatedSnapshots,
                                       java.util.Collection deletedSnapshotIds,
                                       java.util.Collection invalidatedSnapshotIds,
                                       java.util.Collection indirectlyModifiedIds)

  Processes changes made to snapshots. Modifies internal cache state, and then sends the event to all listeners. Source of these changes is usually an ObjectStore.

### isNotifyingRemoteListeners

    public boolean isNotifyingRemoteListeners()

### setNotifyingRemoteListeners

    public void setNotifyingRemoteListeners(boolean notifyingRemoteListeners)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2006 Apache.org All Rights Reserved.