Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.4.3 generated on March 27 2003
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.solarmetric.kodo.runtime.datacache
Class DataCacheStoreManager

    java.lang.Object
      |
      +--com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager

All Implemented Interfaces:
  StoreManager

public class DataCacheStoreManager
extends Object
implements StoreManager

StoreManager proxy that delegates to a data cache when possible.

Constructor Summary
`DataCacheStoreManager(StoreManager sm, DataCache cache)` Constructor.

Method Summary
`void` | `begin()` Begin a data store transaction.
`void` | `beginOptimistic()` Notification that an optimistic transaction has started.
`protected boolean` | `canCache(StateManagerImpl sm)` Returns `true` if `sm` is eligible to be enlisted in the cache; otherwise returns `false`.
`boolean` | `checkVersion(StateManagerImpl sm)` Determine whether the given StateManager is the same version as the datastore version.
`void` | `commit()` Commit the current data store transaction.
`Object` | `copyDataStoreId(Object oid, ClassMetaData meta)` Copy the given object id value.
`boolean` | `exists(Object oid, ClassMetaData meta)` Verify that the given instance exists in the data store.
`Collection` | `flush(Collection states)` Flush the given state manager collection to the datastore, returning a collection of user exceptions encountered during flushing.
`DataCache` | `getDataCache()` Return the cache in use.
`Class` | `getDataStoreIdClass(ClassMetaData meta)` Return the class used by this StoreManager for datastore identity values.
`StoreManager` | `getStoreManager()` Return the internal store manager.
`boolean` | `initialize(StateManagerImpl sm, com.solarmetric.kodo.runtime.JDOState state, Object conn)` Initialize the given StateManager.
`void` | `load(StateManagerImpl sm, Object conn, BitSet fields, boolean setVersion)` Load the given StateManager.
`Object` | `newDataStoreId(ClassMetaData meta)` Create a new unique datastore identity for the given type.
`Object` | `newDataStoreId(String str, ClassMetaData meta)` Create a new unique datastore identity for the given type from the given string.
`Extent` | `newExtent(ClassMetaData meta, boolean subclasses)` Return an extent of the given candidate class, optionally including subclasses.
`com.solarmetric.kodo.query.FilterExtensions` | `newFilterExtensions()` Return a FilterExtensions implementation for use in queries.
`protected com.solarmetric.kodo.runtime.PCData` | `newPCData(StateManagerImpl sm)`
`Query` | `newQuery(String language, Object template)` Return a query implementation suitable for this runtime.
`void` | `rollback()` Rollback the current data store transaction.
`void` | `setPersistenceManager(PersistenceManagerImpl pm)` Set a reference to the corresponding PersistenceManager.

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

Constructor Detail

### DataCacheStoreManager

    public DataCacheStoreManager(StoreManager sm,
                                 DataCache cache)

  Constructor.
  Parameters:
    `sm` - the store manager to delegate to
    `cache` - the cache to access for shared objects

Method Detail

### getStoreManager

    public StoreManager getStoreManager()

  Return the internal store manager.

### getDataCache

    public DataCache getDataCache()

  Return the cache in use.

### setPersistenceManager

    public void setPersistenceManager(PersistenceManagerImpl pm)

  Description copied from interface: `StoreManager`
  Set a reference to the corresponding PersistenceManager. This method will be called before the StoreManager is used.
  Specified by:
    `setPersistenceManager` in interface `StoreManager`

### beginOptimistic

    public void beginOptimistic()

  Description copied from interface: `StoreManager`
  Notification that an optimistic transaction has started. This method does not replace the `StoreManager.begin()` method, which will still be called when a true data store transaction should begin.
  Specified by:
    `beginOptimistic` in interface `StoreManager`

### begin

    public void begin()

  Description copied from interface: `StoreManager`
  Begin a data store transaction. If optimistic transactions are in use, this method will only be called when the user is ready to commit the transaction. At this time, the PersistenceManager will call this begin method, will store all modified data, and will call the commit method in succession, minimizing the length of the actual data store transaction. In this case, it is possible that the optimistic transaction does not have the latest versions of all instances (i.e. another transaction has modified the same instances and committed since the optimistic transaction started). On commit, an exception must be thrown on any attempt to overwrite data for an instance with an older version.
  Specified by:
    `begin` in interface `StoreManager`

### commit

    public void commit()

  Description copied from interface: `StoreManager`
  Commit the current data store transaction.
  Specified by:
    `commit` in interface `StoreManager`

### rollback

    public void rollback()

  Description copied from interface: `StoreManager`
  Rollback the current data store transaction.
  Specified by:
    `rollback` in interface `StoreManager`

### exists

    public boolean exists(Object oid,
                          ClassMetaData meta)

  Description copied from interface: `StoreManager`
  Verify that the given instance exists in the data store.
  Specified by:
    `exists` in interface `StoreManager`

### checkVersion

    public boolean checkVersion(StateManagerImpl sm)

  Description copied from interface: `StoreManager`
  Determine whether the given StateManager is the same version as the datastore version.
  Specified by:
    `checkVersion` in interface `StoreManager`
  Following copied from interface: `com.solarmetric.kodo.runtime.StoreManager`
  Parameters:
    `sm` - the instance to check
  Returns:
    true if the instance is up-to-date, false otherwise

### initialize

    public boolean initialize(StateManagerImpl sm,
                              com.solarmetric.kodo.runtime.JDOState state,
                              Object conn)

  Description copied from interface: `StoreManager`
  Initialize the given StateManager. The `oid` of the StateManager will be set, and the `meta` field of the StateManager will be set to the class of the instance to load, or possibly one of its superclasses. Initialization involves first calling the `StateManagerImpl#setPersistenceCapable` method with a new instance of the correct type constructed with the `JDOImplHelper#newInstance(Class,StateManager,Object)` method (this will reset the `meta` field of the StateManager if the actual type was a subclass), then possibly loading any fields if desired. The version information for the StateManager should also be set via the `StateManagerImpl.setVersion(java.lang.Object)` method. If this method is called during a data store transaction, the instance should be locked.
  Specified by:
    `initialize` in interface `StoreManager`
  Following copied from interface: `com.solarmetric.kodo.runtime.StoreManager`
  Parameters:
    `sm` - the instance to initialize
    `state` - the JDO state to pass through to the state manager's initialize method
    `connection` - the current connection information, or null if not given to the calling method of the persistence manager
  Returns:
    true if the matching instance exists in the data store, false otherwise

### load

    public void load(StateManagerImpl sm,
                     Object conn,
                     BitSet fields,
                     boolean setVersion)

  Description copied from interface: `StoreManager`
  Load the given StateManager. Note that any collection or map types loaded into the StateManager will be proxied with the correct type; therefore the StoreManager does not have to load the same concrete collection/map types as the instance declares. However, array types must be consistent with the array type stored by the PersistenceCapable instance. If this method is called during a data store transaction, the instance should be locked.
  Specified by:
    `load` in interface `StoreManager`
  Following copied from interface: `com.solarmetric.kodo.runtime.StoreManager`
  Parameters:
    `sm` - the instance to load
    `connection` - the current connection information, or null if not given to the calling method of the persistence manager
    `fields` - the fields to load; the field corrsponding to the metadata field at each set bit position should be loaded; additional fields can be loaded if desired; attempting to load an additional field that has been dirtied will cause the load to be ignored; this bit set should not be modified
    `setVersion` - if true, the version information should also be loaded from the db and set in the instance via the `StateManagerImpl.setVersion(java.lang.Object)` method

### flush

    public Collection flush(Collection states)

  Description copied from interface: `StoreManager`
  Flush the given state manager collection to the datastore, returning a collection of user exceptions encountered during flushing. The given state collection may include states that do not require data store action, such as persistent-clean instances. For datastore updates and inserts, the dirty fields of each state should be flushed. Datastore version information should be updated during flush, and the state manager's version indicator updated through the `StateManagerImpl.setNextVersion(java.lang.Object)` method. The current version will roll over to this next version upon successful commit.
  Specified by:
    `flush` in interface `StoreManager`

### getDataStoreIdClass

    public Class getDataStoreIdClass(ClassMetaData meta)

  Description copied from interface: `StoreManager`
  Return the class used by this StoreManager for datastore identity values.
  Specified by:
    `getDataStoreIdClass` in interface `StoreManager`

### copyDataStoreId

    public Object copyDataStoreId(Object oid,
                                  ClassMetaData meta)

  Description copied from interface: `StoreManager`
  Copy the given object id value.
  Specified by:
    `copyDataStoreId` in interface `StoreManager`

### newDataStoreId

    public Object newDataStoreId(ClassMetaData meta)

  Description copied from interface: `StoreManager`
  Create a new unique datastore identity for the given type.
  Specified by:
    `newDataStoreId` in interface `StoreManager`

### newDataStoreId

    public Object newDataStoreId(String str,
                                 ClassMetaData meta)

  Description copied from interface: `StoreManager`
  Create a new unique datastore identity for the given type from the given string.
  Specified by:
    `newDataStoreId` in interface `StoreManager`

### newExtent

    public Extent newExtent(ClassMetaData meta,
                            boolean subclasses)

  Description copied from interface: `StoreManager`
  Return an extent of the given candidate class, optionally including subclasses. If the extent is iterated within a data store transaction, returned instances should be locked.
  Specified by:
    `newExtent` in interface `StoreManager`

### newQuery

    public Query newQuery(String language,
                          Object template)

  Description copied from interface: `StoreManager`
  Return a query implementation suitable for this runtime. If the query is iterated within a data store transaction, returned instances should be locked.
  Specified by:
    `newQuery` in interface `StoreManager`
  Following copied from interface: `com.solarmetric.kodo.runtime.StoreManager`
  Parameters:
    `the` - query language; implementations are only required to support `javax.jdo.query.JDOQL`
    `a` - template query instance also from this StoreManager; this instance may be null; if not null, the filter, variables, parameters, imports, and candidate class should be copied from the template to the returned Query instance

### newFilterExtensions

    public com.solarmetric.kodo.query.FilterExtensions newFilterExtensions()

  Description copied from interface: `StoreManager`
  Return a FilterExtensions implementation for use in queries. To return no extensions, do:
  `return FilterExtensions.DefaultExtensions.newExtensions ()`
  Specified by:
    `newFilterExtensions` in interface `StoreManager`

### newPCData

    protected com.solarmetric.kodo.runtime.PCData newPCData(StateManagerImpl sm)

### canCache

    protected boolean canCache(StateManagerImpl sm)

  Returns `true` if `sm` is eligible to be enlisted in the cache; otherwise returns `false`.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.4.3 generated on March 27 2003
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.