|
SolarMetric Kodo JDO 3.0.3 generated on February 20 2004 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface to be implemented by data store mechanisms to interact with this JDO runtime.
Field Summary | |
static int |
FORCE_LOAD_ALL
|
static int |
FORCE_LOAD_DFG
|
static int |
FORCE_LOAD_NONE
|
static int |
VERSION_DIFFERENT
|
static int |
VERSION_EARLIER
|
static int |
VERSION_LATER
|
static int |
VERSION_SAME
|
Method Summary | |
Object |
attachVersion(KodoStateManager state,
Serializable version)
Convert the specified externalized form of the version into a Kodo version object. |
void |
begin(boolean lock)
Begin a data store transaction. |
void |
beginOptimistic()
Notification that an optimistic transaction has started. |
void |
changeJDOState(KodoStateManager sm,
JDOState fromState,
JDOState toState)
Notification that the given state manager is about to change its JDO state. |
void |
close()
Free any resources this store manager is using. |
void |
closeConnection(Object conn)
Close the given connection if needed. |
void |
commit()
Commit the current data store transaction. |
int |
compareVersion(KodoStateManager state,
Object v1,
Object v2)
Compare the two version objects. |
Object |
copyDataStoreId(Object oid,
ClassMetaData meta)
Copy the given object id value. |
Serializable |
detachVersion(KodoStateManager state)
Returns a serializable external form of the specified internal version state. |
boolean |
exists(KodoStateManager sm,
Object connection)
Verify that the given instance exists in the data store; return false if it does not. |
Collection |
flush(Collection states)
Flush the given state manager collection to the datastore, returning a collection of optimistic exceptions encountered during flushing. |
Object |
getConnection()
Return a connection to the data store. |
Class |
getDataStoreIdClass(ClassMetaData meta)
Return the class used by this StoreManager for datastore identity values. |
Class |
getPersistenceCapableClass(Object oid)
Return the persistent class for the given data store identity value. |
SequenceGenerator |
getSequenceGenerator(Class forClass)
Returns a SequenceGenerator for the specified class. |
boolean |
hasConnection()
Return true if this store manager has established a dedicated connection to the data store. |
boolean |
initialize(KodoStateManager sm,
JDOState state,
FetchConfiguration fetch,
Object connection)
Initialize the given state manager. |
boolean |
isActive()
Return true if there is a data store transaction in progress. |
boolean |
isLocking()
Return true if data loaded through this store manager will be locked on the data store side. |
boolean |
load(KodoStateManager sm,
Collection fields,
FetchConfiguration fetch,
Object connection)
Load the given state manager. |
Collection |
loadAll(Collection sms,
JDOState state,
int load,
FetchConfiguration fetch,
Object connection)
Initialize, load, or validate the existance of all of the given objects. |
Object |
newDataStoreId(PersistenceCapable pc,
ClassMetaData meta)
Create a new unique datastore identity for the given instance. |
Object |
newDataStoreId(String str,
ClassMetaData meta)
Create a new unique datastore identity for the given type from the given string. |
KodoExtent |
newExtent(Class type,
boolean subclasses)
Return an extent of the given candidate class, optionally including subclasses. |
KodoQuery |
newQuery(String language,
Object template)
Return a query implementation suitable for this runtime. |
void |
rollback()
Rollback the current data store transaction. |
void |
setPersistenceManager(KodoPersistenceManager pm)
Set a reference to the corresponding PersistenceManager. |
boolean |
synchVersion(KodoStateManager sm,
Object connection)
Update the version information in the given state manager to the version stored in the data store. |
Field Detail |
public static final int VERSION_LATER
public static final int VERSION_EARLIER
public static final int VERSION_SAME
public static final int VERSION_DIFFERENT
public static final int FORCE_LOAD_NONE
public static final int FORCE_LOAD_DFG
public static final int FORCE_LOAD_ALL
Method Detail |
public void setPersistenceManager(KodoPersistenceManager pm)
public void beginOptimistic()
begin(boolean)
method, which will still be called
when a true data store transaction should begin.public void begin(boolean lock)
lock
is true, loaded
data should be locked in the data store. After this method is called,
it is assumed that all further operations are operating in a single
transaction that can be committed or rolled back. If optimistic
transactions are in use, this method will only be called when the
system requires a transactionally consistent connection due to a
user request to flush or commit the JDO 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.public void commit()
public void rollback()
public boolean isActive()
begin(boolean)
has been called more recently than
commit()
or rollback()
.public boolean isLocking()
begin(boolean)
was called with lock
set
to true.public boolean exists(KodoStateManager sm, Object connection)
public boolean synchVersion(KodoStateManager sm, Object connection)
sm
- the instance to checkconnection
- the current connection information, or null if not
given to the calling method of the persistence
managerpublic boolean initialize(KodoStateManager sm, JDOState state, FetchConfiguration fetch, Object connection)
KodoStateManager.initialize(javax.jdo.spi.PersistenceCapable, kodo.runtime.JDOState)
method with
a new instance of the correct type constructed with the
JDOImplHelper.newInstance(Class,StateManager,Object)
method
(this will reset the state manager's metadata if the actual type was a
subclass). After instance initialization, load the fields for the
given fetch configuration. If any of the configured fields are not
loaded in this method, they will be loaded with a subsequent call to
load(kodo.runtime.KodoStateManager, java.util.Collection, kodo.runtime.FetchConfiguration, java.lang.Object)
. If this method is called during a data store
transaction, the instance's database record should be locked. Version
information can be loaded if desired through the
KodoStateManager.setVersion(java.lang.Object)
method.sm
- the instance to initializestate
- the lifecycle state to initialize the state
manager withfetch
- configuration for how to load the instanceconnection
- the current connection information, or null if not
given to the calling method of the persistence
managerpublic boolean load(KodoStateManager sm, Collection fields, FetchConfiguration fetch, Object connection)
KodoStateManager.setVersion(java.lang.Object)
method.sm
- the instance to loadfields
- immutable set of fields to load; all fields in this
set must be loaded; the fields are in JDO orderfetch
- the fetch configuration to use when loading
related objectsconnection
- the current connection information, or null if not
given to the calling method of the persistence
managerpublic Collection loadAll(Collection sms, JDOState state, int load, FetchConfiguration fetch, Object connection)
KodoPersistenceManager.getObjectsById(java.lang.Object[], boolean)
. It gives the store
manager an opportunity to efficiently batch-load data for several
objects. Each of the given state managers will be in one of three
states, each requiring a different action:
stateManager.getPersistenceCapable () == null
: An
uninitialized state manager. Perform the same actions as in
initialize(kodo.runtime.KodoStateManager, kodo.runtime.JDOState, kodo.runtime.FetchConfiguration, java.lang.Object)
.load != FORCE_LOAD_NONE || stateManager.getJDOState ()
== JDOState.HOLLOW
: A hollow state manager, or one whose
fields must be loaded because this is a refresh or retrieve action.
Peform the same actions as in load(kodo.runtime.KodoStateManager, java.util.Collection, kodo.runtime.FetchConfiguration, java.lang.Object)
, choosing the fields
to load based on the fetch configuration (one easy way to get a
collection of fields for an object is via
KodoStateManager.getUnloadedFields(kodo.runtime.FetchConfiguration)
), or loading all fields
if load == FORCE_LOAD_ALL
. Any required fields left
unloaded will cause a subsequent invocation of load(kodo.runtime.KodoStateManager, java.util.Collection, kodo.runtime.FetchConfiguration, java.lang.Object)
on
the individual object in question.load == FORCE_LOAD_NONE &&
stateManager.getJDOState () != JDOState.HOLLOW
: A non-hollow
state manager. Perform the same actions as in exists(kodo.runtime.KodoStateManager, java.lang.Object)
,
and load additional state if desired. Non-hollow objects will only
be included outside of refresh invocations if a user calls
getObjectsById
with the validate
parameter set to true
.sms
- the state manager instances to loadstate
- the lifecycle state to initialize uninitialized
state managers with; may be null if no uninitialized
instances are included in sms
load
- one of the FORCE_LOAD_* constants describing the
fields to force-load if this is a refresh or
retrieve actionfetch
- the current fetch configuration to use when loading
related objectsconnection
- the current connection information, or null if not
given to the calling method of the persistence
managerpublic void changeJDOState(KodoStateManager sm, JDOState fromState, JDOState toState)
public Collection flush(Collection states)
KodoStateManager.setNextVersion(java.lang.Object)
method. The
current version will roll over to this next version upon successful
commit.public Class getPersistenceCapableClass(Object oid)
public Class getDataStoreIdClass(ClassMetaData meta)
public Object copyDataStoreId(Object oid, ClassMetaData meta)
public Object newDataStoreId(PersistenceCapable pc, ClassMetaData meta)
public Object newDataStoreId(String str, ClassMetaData meta)
public Object getConnection()
public boolean hasConnection()
KodoPersistenceManager.getConnectionRetainMode()
.public void closeConnection(Object conn)
public KodoExtent newExtent(Class type, boolean subclasses)
public KodoQuery newQuery(String language, Object template)
language
- the query language; implementations are only
required to support
javax.jdo.query.JDOQL
template
- 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 instancepublic Serializable detachVersion(KodoStateManager state)
java.*
classes may be used.KodoStateManager.getVersion()
public Object attachVersion(KodoStateManager state, Serializable version)
detachVersion(kodo.runtime.KodoStateManager)
,
KodoStateManager.getVersion()
public int compareVersion(KodoStateManager state, Object v1, Object v2)
state
- the state manager for the objectv1
- the first version object to comparev2
- the second version object to compareVERSION_LATER
if v1
is later than v2
VERSION_EARLIER
if v1
is earlier than v2
VERSION_SAME
if v1
is the same as v2
VERSION_DIFFERENT
if v1
is different from v2
, but the time
difference of the versions cannot be determinedpublic SequenceGenerator getSequenceGenerator(Class forClass)
SequenceGenerator
for the specified class.public void close()
close
in interface com.solarmetric.util.Closeable
|
SolarMetric Kodo JDO 3.0.3 generated on February 20 2004 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |