|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.triactive.jdo.store.StoreManager
Manages the contents of a data store (aka database schema) on behalf of a particular PersistenceManagerFactory and all its persistent instances.
The store manager's responsibilities include:
A store manager's knowledge of its schema's contents is not necessarily complete. It is aware of only those tables whose classes have somehow been accessed, directly or indirectly, by the application during the life of the store manager object.
Nested Class Summary | |
class |
StoreManager.MgmtTransaction
An abstract base class for StoreManager transactions that perform some management function on the database. |
Method Summary | |
void |
delete(StateManager sm)
Deletes a persistent object from the database. |
void |
fetch(StateManager sm,
int[] fieldNumbers)
Fetches a persistent object from the database. |
java.lang.String |
getCatalogName()
|
ClassBaseTable |
getClassBaseTable(java.lang.Class c)
Returns the primary table serving as backing for the given class. |
ClassFinder |
getClassFinder()
Returns the class finder to be used for all lookup of classes associated with this store manager. |
int |
getClassId(java.lang.Class c)
Returns the class ID for the given class. |
ClassTable |
getClassTable(int classId,
java.lang.Class contextClass)
Returns the class table having the given class ID. |
DatabaseAdapter |
getDatabaseAdapter()
Returns the database adapter used by this store manager. |
java.lang.String |
getDatabaseUrl()
|
javax.jdo.Extent |
getExtent(PersistenceManager pm,
java.lang.Class c,
boolean subclasses)
|
static StoreManager |
getInstance(PersistenceManagerFactoryImpl pmf,
java.lang.String userName,
java.lang.String password)
Obtains a store manager instance. |
InitializedConnectionFactory |
getNontransactionalConnectionFactory()
Returns the connection factory to be used for non-transactional access. |
OIDGenerator |
getOIDGenerator(java.lang.Class c)
Returns the OID generator for the specified class. |
SchemaManagementOptions |
getOptions()
Returns the current schema management options for the calling thread. |
java.lang.String |
getSchemaName()
|
ClassTable |
getTable(java.lang.Class c)
Returns the primary table serving as backing for the given class. |
Table |
getTable(int tableId)
Returns the table having the given table ID. |
Table |
getTable(MetaData md)
Returns the table having the given metadata, if any. |
Table |
getTable(TableName name)
Returns the table having the given SQL name, if any. |
InitializedConnectionFactory |
getTransactionalConnectionFactory()
Returns the connection factory to be used for transactional access. |
void |
insert(StateManager sm)
Inserts a persistent object into the database. |
void |
lookup(StateManager sm)
Confirms that a persistent object exists in the database. |
java.lang.Object |
newObjectID(java.lang.Class c)
Returns a new, unique ID for an object of the given class. |
SchemaManager |
newSchemaManager()
Returns a new schema manager. |
void |
reset()
Clears all knowledge of tables, cached requests, metadata, etc and resets the store manager to its initial state. |
void |
update(StateManager sm,
int[] fieldNumbers)
Updates a persistent object in the database. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static StoreManager getInstance(PersistenceManagerFactoryImpl pmf, java.lang.String userName, java.lang.String password)
Caching is implemented such that a store manager becomes eligible for garbage collection when all of the PersistenceManagerFactorys that used it also become eligible.
A newly-created store manager will have successfully connected to the database with the given credentials and determined the schema name, but will not have inspected the schema contents any further. The contents (tables, views, etc.) will be subsequently created and/or validated on-demand as the application accesses persistent classes.
pmf
- A PersistenceManagerFactory. The factory's non-transactional data
source will be used to get database connections as needed to perform
management functions.userName
- The database user name.password
- The database user's password.
javax.jdo.JDODataStoreException
- If the database could not be accessed or the name of the schema
could not be determined.public void reset()
public SchemaManagementOptions getOptions()
public ClassFinder getClassFinder()
public InitializedConnectionFactory getTransactionalConnectionFactory()
public InitializedConnectionFactory getNontransactionalConnectionFactory()
public DatabaseAdapter getDatabaseAdapter()
public java.lang.String getDatabaseUrl()
public java.lang.String getCatalogName()
public java.lang.String getSchemaName()
public SchemaManager newSchemaManager()
public Table getTable(TableName name)
null
if no such table is (yet) known to the store
manager.
name
- The name of the table.
null
.public Table getTable(int tableId)
null
if no such table is (yet) known to the store
manager.
tableId
- The table ID of the table to be returned.
null
.public ClassTable getClassTable(int classId, java.lang.Class contextClass)
classId
- The class ID of the table to be returned.contextClass
- A class used to establish the class loader context in case the
corresponding class needs to be loaded.
javax.jdo.JDOUserException
- if the specified class ID is unknown, not associated with a class
table, or associated with a class table whose class cannot be
loaded.public Table getTable(MetaData md)
null
if no such table is (yet) known to the store
manager.
md
- The metadata for the table.
null
.public ClassTable getTable(java.lang.Class c)
c
- The class whose table is be returned.
NoExtentException
- If the given class is not persistence-capable.public ClassBaseTable getClassBaseTable(java.lang.Class c)
This method is functionally equivalent to getTable(Class)
except that it will only return base tables (not views).
c
- The class whose table is be returned.
NoExtentException
- If the given class is not persistence-capable.
ViewNotSupportedException
- If the given class is backed by a view.public int getClassId(java.lang.Class c)
c
- The class whose ID is be returned.
NoExtentException
- If the given class is not persistence-capable.public javax.jdo.Extent getExtent(PersistenceManager pm, java.lang.Class c, boolean subclasses)
public java.lang.Object newObjectID(java.lang.Class c)
c
- The class of the object.
public OIDGenerator getOIDGenerator(java.lang.Class c)
c
- the class
public void insert(StateManager sm)
sm
- The state manager of the object to be inserted.public void lookup(StateManager sm)
sm
- The state manager of the object to be fetched.public void fetch(StateManager sm, int[] fieldNumbers)
sm
- The state manager of the object to be fetched.fieldNumbers
- The numbers of the fields to be fetched.public void update(StateManager sm, int[] fieldNumbers)
sm
- The state manager of the object to be updated.fieldNumbers
- The numbers of the fields to be updated.public void delete(StateManager sm)
sm
- The state manager of the object to be deleted.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |