|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager
StoreManager proxy that delegates to a data cache when possible.
| Field Summary | |
static String |
DEFAULT_DATA_CACHE
The key under which the default data cache is stored in the internal map of caches. |
static String |
TIMEOUT_EXTENSION
The key under which a class's cache timeout value is stored. |
| Constructor Summary | |
DataCacheStoreManager(StoreManager sm,
Map caches,
QueryCache queryCache)
Constructor. |
|
| Method Summary | |
void |
begin(boolean lock)
Begin a data store transaction. |
void |
beginOptimistic()
Notification that an optimistic transaction has started. |
protected Set |
bitSetToFieldSet(ClassMetaData meta,
BitSet bits)
|
static boolean |
canCache(ClassMetaData meta)
Return true if the specified class can be cached. |
boolean |
checkVersion(StateManagerImpl sm)
Determine whether the given StateManager is the same version as the datastore version. |
void |
close()
Close any resources used by this store manager. |
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. |
protected BitSet |
fieldSetToBitSet(ClassMetaData meta,
Set fields)
|
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 default cache. |
DataCache |
getDataCache(ClassMetaData meta)
Returns the DataCache associated with the
persistence-capable class identified by meta, or
null if meta is not cacheable. |
DataCache |
getDataCache(String name)
Return the cache whose name is name. |
Object |
getDatastoreConnection()
Returns a connection to the data store suitable for use with StoreManager APIs that require a conneciton
argument. |
Class |
getDataStoreIdClass(ClassMetaData meta)
Return the class used by this StoreManager for datastore identity values. |
PersistenceManagerImpl |
getPersistenceManager()
|
QueryCache |
getQueryCache()
Return the query cache in use. |
StoreManager |
getStoreManager()
Return the internal store manager. |
long |
getTimeout(ClassMetaData meta)
Returns the number of milliseconds that the specified class is valid for. |
boolean |
handlesMarkingFlushedFields()
Returns true if this store manager
implementation takes responsibility for marking which fields
are successfully flushed during flush(java.util.Collection); otherwise
returns false. |
boolean |
initialize(StateManagerImpl sm,
JDOState state,
Object conn,
Set fields)
Initialize the given StateManager. |
boolean |
isActive()
Returns true if this store manager has an active
transaction associated with it. |
boolean |
isLocking()
Returns true if data loaded through this store
manager will be locked on the data store side. |
boolean |
isOnline()
Returns true if this store manager currently has
a dedicated connection to the data store that it will keep
until a well-defined boundary (transaction commit or
PersistenceManager commit). |
void |
load(StateManagerImpl sm,
Object conn,
Set fields,
boolean setVersion)
Load the given StateManager. |
static DataCache |
newDataCache(String cacheName,
Configuration conf)
Create a new DataCache object with the given
name. |
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. |
KodoExtent |
newExtent(Class clazz,
boolean subclasses)
Return an extent of the given candidate class, optionally including subclasses. |
KodoExtent |
newExtent(ClassMetaData meta,
boolean subclasses)
Return an extent of the given candidate class, optionally including subclasses. |
protected PCData |
newPCData(StateManagerImpl sm)
|
com.solarmetric.kodo.query.KodoQuery |
newQuery(String language,
Object template)
Return a query implementation suitable for this runtime. |
void |
releaseDatastoreConnection(Object o)
Releases a connection obtained through an invocation of getDatastoreConnection(). |
void |
rollback()
Rollback the current data store transaction. |
void |
setPersistenceManager(PersistenceManagerImpl pm)
Set a reference to the corresponding PersistenceManager. |
protected PCData |
wrapPCData(PCData data,
ClassMetaData meta)
|
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final String TIMEOUT_EXTENSION
cache-timeout.public static final String DEFAULT_DATA_CACHE
getDataCache()
is equivalent to
getDataCache(DEFAULT_DATA_CACHE). The value of
this string is default.| Constructor Detail |
public DataCacheStoreManager(StoreManager sm,
Map caches,
QueryCache queryCache)
sm - the store manager to delegate tocaches - the map of caches to access for shared objectsqueryCache - the cache to use for storing query results| Method Detail |
public StoreManager getStoreManager()
public DataCache getDataCache()
getDataCache(DEFAULT_DATA_CACHE).public DataCache getDataCache(String name)
name.public QueryCache getQueryCache()
public PersistenceManagerImpl getPersistenceManager()
public void setPersistenceManager(PersistenceManagerImpl pm)
StoreManagersetPersistenceManager in interface StoreManagerpublic void beginOptimistic()
StoreManagerStoreManager.begin(boolean) method, which will still be called
when a true data store transaction should begin.beginOptimistic in interface StoreManagerpublic void begin(boolean lock)
StoreManagerBegin a data store transaction. If lock is
true, designate that any data loaded through the
store manager should be locked on the data store
side. Otherwise, data loaded from the store manager will not
be locked. After this method is invoked, any operations
performed on this data store are considered to be performed
within a single transactional context, and it should be
possible to commit or roll back these changes at a later time.
This method should be invoked before attempts to flush any
data to the data store, at the latest. It is permissible for a
store manager implementation to throw an exception in StoreManager.flush(java.util.Collection) if this method has not been invoked since the store
manager was created or since the last StoreManager.commit() or
StoreManager.rollback() invocation, whichever happened later.
If optimistic transactions are in use, this method will not be called until the store manager needs to maintain a transactionally consistent connection to the data store. 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.
begin in interface StoreManagerpublic void commit()
StoreManagercommit in interface StoreManagerpublic void rollback()
StoreManagerrollback in interface StoreManagerpublic boolean isActive()
StoreManagertrue if this store manager has an active
transaction associated with it.isActive in interface StoreManagerpublic boolean isLocking()
StoreManagertrue if data loaded through this store
manager will be locked on the data store side.isLocking in interface StoreManagerpublic boolean isOnline()
StoreManagertrue if this store manager currently has
a dedicated connection to the data store that it will keep
until a well-defined boundary (transaction commit or
PersistenceManager commit).isOnline in interface StoreManagerpublic Object getDatastoreConnection()
StoreManagerStoreManager APIs that require a conneciton
argument. If a transaction is not currently in progress, then
the connection may not be associated with this store manager's
transaction. If a transaction is in progress, it is guaranteed
that the returned connection will be the same as that
currently being used by the transaction.getDatastoreConnection in interface StoreManagerpublic void releaseDatastoreConnection(Object o)
StoreManagerStoreManager.getDatastoreConnection(). If this store manager has a reserved
connection, and the Connection argument is the same as the
Connection that is currently in use, then no action will be
taken. Otherwise, the connection will be closed.releaseDatastoreConnection in interface StoreManager
public boolean exists(Object oid,
ClassMetaData meta)
StoreManagerexists in interface StoreManagerpublic boolean checkVersion(StateManagerImpl sm)
StoreManagercheckVersion in interface StoreManagercom.solarmetric.kodo.runtime.StoreManagersm - the instance to check
public boolean initialize(StateManagerImpl sm,
JDOState state,
Object conn,
Set fields)
StoreManageroid 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.initialize(javax.jdo.spi.PersistenceCapable, com.solarmetric.kodo.runtime.JDOState) method with
a new instance of the correct type constructed with the
JDOImplHelper.newInstance(java.lang.Class,javax.jdo.spi.StateManager,java.lang.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.initialize in interface StoreManagercom.solarmetric.kodo.runtime.StoreManagersm - the instance to initializestate - the JDO state to pass through to the state
manager's initialize methodconnection - the current connection information, or null if not
given to the calling method of the persistence
managerfields - the fields to load. 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
public void load(StateManagerImpl sm,
Object conn,
Set fields,
boolean setVersion)
StoreManagerload in interface StoreManagercom.solarmetric.kodo.runtime.StoreManagersm - the instance to loadconnection - the current connection information, or null if not
given to the calling method of the persistence
managerfields - the fields to load. 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 modifiedsetVersion - 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
protected BitSet fieldSetToBitSet(ClassMetaData meta,
Set fields)
protected Set bitSetToFieldSet(ClassMetaData meta,
BitSet bits)
public Collection flush(Collection states)
StoreManagerFlush 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 or persistent-dirty instances that have not been
modified since they were last flushed. For datastore updates
and inserts, the dirty, non-flushed 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.
If StoreManager.handlesMarkingFlushedFields() returns
true, then this method is responsible for marking
which fields are successfully flushed to the data
store. Otherwise, the PersistenceManagerImpl will mark
all dirty fields in all flushed objects as flushed upon
successful completion of this method. See StoreManager.handlesMarkingFlushedFields() for details.
flush in interface StoreManagerpublic boolean handlesMarkingFlushedFields()
StoreManagerReturns true if this store manager
implementation takes responsibility for marking which fields
are successfully flushed during StoreManager.flush(java.util.Collection); otherwise
returns false.
It is preferable for implementations to return
true from this method. If the store manager can
mark those fields that are successfully flushed, then
exceptions returned from StoreManager.flush(java.util.Collection) can be ignored, as the
state of the objects will be consistent with the data
store.
If this method returns false, then the PersistenceManagerImpl will mark all dirty fields in all
flushed objects as flushed after successful completion of
StoreManager.flush(java.util.Collection). If an exception is thrown during the flush,
then the PersistenceManagerImpl will throw a JDOFatalDataStoreException and the transaction will be rolled
back. The post-rollback values of the unsuccessfully flushed
objects will be defined by the normal behavior of a rollback
during a transaction commit.
handlesMarkingFlushedFields in interface StoreManagerpublic Class getDataStoreIdClass(ClassMetaData meta)
StoreManagergetDataStoreIdClass in interface StoreManager
public Object copyDataStoreId(Object oid,
ClassMetaData meta)
StoreManagercopyDataStoreId in interface StoreManagerpublic Object newDataStoreId(ClassMetaData meta)
StoreManagernewDataStoreId in interface StoreManager
public Object newDataStoreId(String str,
ClassMetaData meta)
StoreManagernewDataStoreId in interface StoreManager
public KodoExtent newExtent(ClassMetaData meta,
boolean subclasses)
StoreManagernewExtent in interface StoreManager
public KodoExtent newExtent(Class clazz,
boolean subclasses)
StoreManagernewExtent in interface StoreManager
public com.solarmetric.kodo.query.KodoQuery newQuery(String language,
Object template)
StoreManagernewQuery in interface StoreManagercom.solarmetric.kodo.runtime.StoreManagerthe - query language; implementations are only required to
support javax.jdo.query.JDOQLa - 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 instancepublic void close()
StoreManagerclose in interface StoreManagerprotected PCData newPCData(StateManagerImpl sm)
protected PCData wrapPCData(PCData data,
ClassMetaData meta)
public long getTimeout(ClassMetaData meta)
-1 if this class does not have
a timeout, and no default is set for the system.public DataCache getDataCache(ClassMetaData meta)
Returns the DataCache associated with the
persistence-capable class identified by meta, or
null if meta is not cacheable. If no
cache exists for meta, one will be created here.
If type A's superclass is not cacheable, then A cannot be cacheable either. This is because we need to be able to look up the object in the class knowing only the least-derived class information.
Similarly, all subclasses of a type B must be in the same cache as B's cache.
public static DataCache newDataCache(String cacheName,
Configuration conf)
DataCache object with the given
name. This implementation creates a new instance of the type
specified in the DataCache configuration property, passing the
DataCacheProperties to it for initial configuration.public static boolean canCache(ClassMetaData meta)
true if the specified class can be cached.
|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||