|
SolarMetric Kodo JDO 3.1.6 generated on August 25 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--kodo.jdbc.runtime.JDBCStoreManager
StoreManager plugin that uses JDBC to store persistent data in a relational data store.
| Fields inherited from interface kodo.runtime.StoreManager |
FORCE_LOAD_ALL, FORCE_LOAD_DFG, FORCE_LOAD_NONE, FORCE_LOAD_REFRESH, VERSION_DIFFERENT, VERSION_EARLIER, VERSION_LATER, VERSION_SAME |
| Constructor Summary | |
JDBCStoreManager()
|
|
| Method Summary | |
Object |
attachVersion(KodoStateManager state,
Serializable version)
Convert the specified externalized form of the version into a Kodo version object. |
void |
begin()
Begin a data store transaction. |
void |
beginOptimistic()
Notification that an optimistic transaction has started. |
boolean |
cancelAll()
Cancel all pending data store statements. |
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 |
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. |
JDBCConfiguration |
getConfiguration()
Return the configuration for this runtime. |
Object |
getConnection()
Return a connection to the data store. |
int |
getCount(Select sel)
Return the count for the given query. |
Class |
getDataStoreIdClass(ClassMetaData meta)
Return the class used by this StoreManager for datastore identity values. |
Connection |
getJDBCConnection()
Return a SQL connection to the database. |
Class |
getPersistenceCapableClass(Object oid)
Return the persistent class for the given data store identity value. |
KodoPersistenceManager |
getPersistenceManager()
Return the PersistenceManager this StoreManager is owned by. |
SelectResult |
getResult(Select sel)
Return the result of executing the given query using a forward- only result set type. |
SelectResult |
getResult(Select sel,
JDBCFetchConfiguration fetch)
Return the result of executing the given query using a result set type based on the give fetch configuration, or the default if null. |
SequenceGenerator |
getSequenceGenerator(ClassMetaData meta)
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 whether there is a datastore transaction active. |
Object |
load(ClassMapping mapping,
JDBCFetchConfiguration fetch,
Result result)
Load the object in the current row of the given result. |
boolean |
load(KodoStateManager sm,
BitSet fields,
FetchConfiguration fetch,
int lockLevel,
Object connection)
Load the given state manager. |
Object |
load(Object oid,
JDBCFetchConfiguration fetch)
Load the object with the given oid. |
Collection |
loadAll(Collection sms,
JDOState state,
int load,
FetchConfiguration fetch,
Object connection)
Initialize, load, or validate the existance of all of the given objects. |
void |
loadSubclasses(ClassMapping mapping)
Makes sure all subclasses of the given type are loaded in the JVM. |
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 cls,
boolean subclasses)
Return an extent of the given candidate class, optionally including subclasses. |
FetchConfiguration |
newFetchConfiguration()
Return a fetch configuration suitable for this runtime. |
KodoQuery |
newQuery(String language,
Object copy)
Return a query implementation suitable for this runtime. |
CallableStatement |
prepareCall(String sql,
Connection conn,
JDBCFetchConfiguration fetch,
int type,
int concur)
Prepare a statement for execution, taking into account any fetch configuration requirements, and avoiding JDBC2 calls when possible. |
PreparedStatement |
prepareStatement(SQLBuffer sql,
Connection conn,
JDBCFetchConfiguration fetch,
int type,
int concur)
Prepare a statement for execution, taking into account any fetch configuration requirements, and avoiding JDBC2 calls when possible. |
PreparedStatement |
prepareStatement(String sql,
Connection conn,
JDBCFetchConfiguration fetch,
int type,
int concur)
Prepare a statement for execution, taking into account any fetch configuration requirements, and avoiding JDBC2 calls when possible. |
void |
rollback()
Rollback the current data store transaction. |
void |
rollbackOptimistic()
Notification that an optimistic transaction was rolled back before a data store transaction ever began. |
boolean |
selectMappings(Select sel,
ClassMapping mapping,
int subs,
KodoStateManager sm,
BitSet fields,
JDBCFetchConfiguration fetch,
int eager)
For implementation use only. |
void |
setPersistenceManager(KodoPersistenceManager pm)
Set the PersistenceManager this StoreManager is owned by. |
boolean |
synchVersion(KodoStateManager sm,
Object connection)
Update the version information in the given state manager to the version stored in the data store. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public JDBCStoreManager()
| Method Detail |
public KodoPersistenceManager getPersistenceManager()
public void setPersistenceManager(KodoPersistenceManager pm)
setPersistenceManager in interface StoreManagerpublic JDBCConfiguration getConfiguration()
public void beginOptimistic()
StoreManagerStoreManager.begin() method, which will still be called
when a true data store transaction should begin.beginOptimistic in interface StoreManagerpublic void rollbackOptimistic()
StoreManagerrollbackOptimistic in interface StoreManagerpublic void begin()
StoreManagerbegin in interface StoreManagerpublic void commit()
StoreManagercommit in interface StoreManagerpublic void rollback()
StoreManagerrollback in interface StoreManagerpublic Object getConnection()
StoreManagergetConnection in interface StoreManagerpublic boolean hasConnection()
StoreManagerKodoPersistenceManager.getConnectionRetainMode().hasConnection in interface StoreManager
public boolean exists(KodoStateManager sm,
Object connection)
StoreManagerexists in interface StoreManager
public boolean synchVersion(KodoStateManager sm,
Object connection)
StoreManagersynchVersion in interface StoreManagerkodo.runtime.StoreManagersm - the instance to checkconnection - the current connection information, or null if not
given to the calling method of the persistence
managerpublic Serializable detachVersion(KodoStateManager state)
StoreManagerjava.*
classes may be used.detachVersion in interface StoreManagerkodo.runtime.StoreManagerKodoStateManager.getVersion()
public Object attachVersion(KodoStateManager state,
Serializable version)
StoreManagerstate.attachVersion in interface StoreManagerkodo.runtime.StoreManagerStoreManager.detachVersion(kodo.runtime.KodoStateManager),
KodoStateManager.getVersion()
public int compareVersion(KodoStateManager state,
Object v1,
Object v2)
StoreManagerStoreManager.detachVersion(kodo.runtime.KodoStateManager).compareVersion in interface StoreManagerkodo.runtime.StoreManagerstate - the state manager for the objectv1 - the first version object to comparev2 - the second version object to compareStoreManager.VERSION_LATER if v1
is later than v2StoreManager.VERSION_EARLIER if v1
is earlier than v2StoreManager.VERSION_SAME if v1
is the same as v2StoreManager.VERSION_DIFFERENT if v1
is different from v2, but the time
difference of the versions cannot be determined
public boolean initialize(KodoStateManager sm,
JDOState state,
FetchConfiguration fetch,
Object connection)
StoreManagerKodoStateManager.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
StoreManager.load(kodo.runtime.KodoStateManager, java.util.BitSet, kodo.runtime.FetchConfiguration, int, 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.initialize in interface StoreManagerkodo.runtime.StoreManagersm - 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
manager
public boolean load(KodoStateManager sm,
BitSet fields,
FetchConfiguration fetch,
int lockLevel,
Object connection)
StoreManagerKodoStateManager.setVersion(java.lang.Object) method.load in interface StoreManagerkodo.runtime.StoreManagersm - the instance to loadfields - set of fields to load; all field indexes in this
set must be loaded; this set is mutablefetch - the fetch configuration to use when loading
related objectslockLevel - attempt to load simple fields at this lock level;
relations should be loaded at the read lock level
of the fetch configurationconnection - the current connection information, or null if not
given to the calling method of the persistence
manager
public Collection loadAll(Collection sms,
JDOState state,
int load,
FetchConfiguration fetch,
Object connection)
StoreManagerKodoPersistenceManager.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
StoreManager.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 StoreManager.load(kodo.runtime.KodoStateManager, java.util.BitSet, kodo.runtime.FetchConfiguration, int, java.lang.Object), choosing the fields
to load based on the fetch configuration, or loading all fields
if load == FORCE_LOAD_ALL. Any required fields left
unloaded will cause a subsequent invocation of StoreManager.load(kodo.runtime.KodoStateManager, java.util.BitSet, kodo.runtime.FetchConfiguration, int, 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 StoreManager.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.loadAll in interface StoreManagerkodo.runtime.StoreManagersms - 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 smsload - 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
manager
public void changeJDOState(KodoStateManager sm,
JDOState fromState,
JDOState toState)
StoreManagerchangeJDOState in interface StoreManagerpublic Collection flush(Collection states)
StoreManagerKodoStateManager.setNextVersion(java.lang.Object) method. The
current version will roll over to this next version upon successful
commit.flush in interface StoreManagerpublic boolean cancelAll()
StoreManagercancelAll in interface StoreManagerkodo.runtime.StoreManagerpublic Class getPersistenceCapableClass(Object oid)
StoreManagergetPersistenceCapableClass in interface StoreManagerpublic Class getDataStoreIdClass(ClassMetaData meta)
StoreManagergetDataStoreIdClass in interface StoreManager
public Object copyDataStoreId(Object oid,
ClassMetaData meta)
StoreManagercopyDataStoreId in interface StoreManager
public Object newDataStoreId(PersistenceCapable pc,
ClassMetaData meta)
StoreManagernewDataStoreId in interface StoreManager
public Object newDataStoreId(String str,
ClassMetaData meta)
StoreManagernewDataStoreId in interface StoreManager
public KodoExtent newExtent(Class cls,
boolean subclasses)
StoreManagernewExtent in interface StoreManager
public KodoQuery newQuery(String language,
Object copy)
StoreManagernewQuery in interface StoreManagerkodo.runtime.StoreManagerlanguage - the query language; implementations are only
required to support
javax.jdo.query.JDOQLtemplate - 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 FetchConfiguration newFetchConfiguration()
StoreManagerFetchConfigurationImpl.newFetchConfiguration in interface StoreManagerpublic SequenceGenerator getSequenceGenerator(ClassMetaData meta)
StoreManagerSequenceGenerator for the specified class.getSequenceGenerator in interface StoreManagerpublic void close()
StoreManagerclose in interface StoreManagerpublic boolean isActive()
public Connection getJDBCConnection()
StoreManager.getConnection(), but does not require you to
cast the returned object to a SQL connection.
The close method should always be called on the connection
to free any resources it is using. When appropriate, the close
method is implemented as a no-op.
public Object load(ClassMapping mapping,
JDBCFetchConfiguration fetch,
Result result)
throws SQLException
public Object load(Object oid,
JDBCFetchConfiguration fetch)
public int getCount(Select sel)
throws SQLException
public SelectResult getResult(Select sel)
throws SQLException
public SelectResult getResult(Select sel,
JDBCFetchConfiguration fetch)
throws SQLException
public PreparedStatement prepareStatement(String sql,
Connection conn,
JDBCFetchConfiguration fetch,
int type,
int concur)
throws SQLException
type - The result set type to use. If -1, use the result
set type listed in fetch.concur - The result set concurrency to use. If -1, use
ResultSet.CONCUR_READ_ONLY.
public PreparedStatement prepareStatement(SQLBuffer sql,
Connection conn,
JDBCFetchConfiguration fetch,
int type,
int concur)
throws SQLException
type - The result set type to use. If -1, use the result
set type listed in fetch.concur - The result set concurrency to use. If -1, use
ResultSet.CONCUR_READ_ONLY.
public CallableStatement prepareCall(String sql,
Connection conn,
JDBCFetchConfiguration fetch,
int type,
int concur)
throws SQLException
type - The result set type to use. If -1, use the result
set type listed in fetch.concur - The result set concurrency to use. If -1, use
ResultSet.CONCUR_READ_ONLY.
public boolean selectMappings(Select sel,
ClassMapping mapping,
int subs,
KodoStateManager sm,
BitSet fields,
JDBCFetchConfiguration fetch,
int eager)
sel - select to build onmapping - the mapping for the base type to select forsubs - whether the select might include subclasses of the
given mappingsm - state manager if an instance is being loaded or
initialized, else nullfields - if a state manager is being loaded, the set of
fields that must be loaded in JDO order, else nullfetch - the fetch configuration; used if no specific fields
must be loaded, and used when selecting relationseager - eager fetch mode to usepublic void loadSubclasses(ClassMapping mapping)
|
SolarMetric Kodo JDO 3.1.6 generated on August 25 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||