|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.AbstractStoreManager
org.datanucleus.store.mapped.MappedStoreManager
org.datanucleus.store.rdbms.RDBMSManager
public class RDBMSManager
StoreManager for RDBMS datastores. Provided by the "store-manager" extension key "rdbms" and accepts datastore URLs valid for JDBC.
The RDBMS manager's responsibilities extend those for StoreManager to add :
| Field Summary | |
|---|---|
protected SQLExpressionFactory |
expressionFactory
Factory for expressions using the generic query SQL mechanism. |
protected static org.datanucleus.util.Localiser |
LOCALISER_RDBMS
Localiser for messages. |
| Fields inherited from class org.datanucleus.store.mapped.MappedStoreManager |
|---|
autoCreateColumns, autoCreateConstraints, autoCreateTables, autoCreateWarnOnError, datastoreContainerByIdentifier, dba, identifierFactory, insertedDatastoreClassByStateManager, mappedTypeMgr, mappingManager, validateColumns, validateConstraints, validateTables |
| Fields inherited from class org.datanucleus.store.AbstractStoreManager |
|---|
autoStartMechanism, fixedDatastore, LOCALISER, nontxConnectionFactoryName, omfContext, persistenceHandler, readOnlyDatastore, readOnlyDatastoreAction, schemaHandler, starter, starterInitialised, storeDataMgr, storeManagerKey, storeManagerRuntime, txConnectionFactoryName, valueGenerationMgr |
| Constructor Summary | |
|---|---|
RDBMSManager(org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.OMFContext omfContext)
Constructs a new RDBMSManager. |
|
| Method Summary | |
|---|---|
void |
addClasses(java.lang.String[] classNames,
org.datanucleus.ClassLoaderResolver clr)
Method to add several (PersistenceCapable) classes to the store manager's set of supported classes. |
void |
addClasses(java.lang.String[] classNames,
org.datanucleus.ClassLoaderResolver clr,
java.io.Writer writer,
boolean completeDdl)
Method to add several (PersistenceCapable) classes to the store manager's set of supported classes. |
void |
addWrittenDdlStatement(java.lang.String stmt)
When we are in SchemaTool DDL mode, add a new DDL statement. |
boolean |
allowsBatching()
Convenience method to return if the datastore supports batching and the user wants batching. |
void |
close()
Release of resources |
java.lang.String |
getCatalogName()
Accessor for the (default) RDBMS catalog name. |
java.lang.String |
getClassNameForObjectID(java.lang.Object id,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.ObjectManager om)
Returns the class corresponding to the given object JDO ID. |
RDBMSColumnInfo |
getColumnInfoForColumnName(Table table,
java.sql.Connection conn,
org.datanucleus.store.mapped.DatastoreIdentifier column)
Returns the column info for a column name. |
java.util.List |
getColumnInfoForTable(Table table,
java.sql.Connection conn)
Returns the column info for a database table. |
boolean |
getCompleteDDL()
Accessor for whether we should generate complete DDL when in that mode. |
ConnectionProvider |
getConnectionProvider()
Accessor to the ConnectionProvider |
java.util.Date |
getDatastoreDate()
Get the date/time of the datastore. |
java.io.Writer |
getDdlWriter()
Accessor for the writer for DDL (if set). |
org.datanucleus.store.Extent |
getExtent(org.datanucleus.ObjectManager om,
java.lang.Class c,
boolean subclasses)
Accessor for an Extent for a class, and its subclasses. |
org.datanucleus.store.mapped.FetchStatement |
getFetchStatement(org.datanucleus.store.mapped.DatastoreContainerObject table)
Method to create a new fetch statement for the passed table. |
org.datanucleus.store.fieldmanager.FieldManager |
getFieldManagerForResultProcessing(org.datanucleus.StateManager sm,
java.lang.Object resultSet,
org.datanucleus.store.mapped.StatementClassMapping resultMappings)
Method to return a FieldManager for extracting information from the supplied results. |
org.datanucleus.store.fieldmanager.FieldManager |
getFieldManagerForStatementGeneration(org.datanucleus.StateManager sm,
java.lang.Object stmt,
org.datanucleus.store.mapped.StatementClassMapping stmtMappings,
boolean checkNonNullable)
Method to return a FieldManager for populating information in statements. |
java.util.Collection |
getManagedTables(java.lang.String catalog,
java.lang.String schema)
Convenience accessor of the Table objects managed in this datastore at this point. |
org.datanucleus.store.NucleusConnection |
getNucleusConnection(org.datanucleus.ObjectManager om)
Method to return a NucleusConnection for the ObjectManager. |
org.datanucleus.store.NucleusSequence |
getNucleusSequence(org.datanucleus.ObjectManager om,
org.datanucleus.metadata.SequenceMetaData seqmd)
Method to return a datastore sequence for this datastore matching the passed sequence MetaData. |
protected java.util.Properties |
getPropertiesForGenerator(org.datanucleus.metadata.AbstractClassMetaData cmd,
int absoluteFieldNumber,
org.datanucleus.ObjectManager om,
org.datanucleus.metadata.SequenceMetaData seqmd,
org.datanucleus.metadata.TableGeneratorMetaData tablegenmd)
Method to return the properties to pass to the generator for the specified field. |
java.lang.Object |
getResultValueAtPosition(java.lang.Object resultSet,
org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping,
int position)
Method to return the value from the results for the mapping at the specified position. |
org.datanucleus.util.MultiMap |
getSchemaCallbacks()
|
java.lang.String |
getSchemaName()
Accessor for the (default) RDBMS schema name. |
SQLController |
getSQLController()
Accessor for the SQL controller. |
SQLExpressionFactory |
getSQLExpressionFactory()
Accessor for the SQL expression factory to use when generating SQL statements. |
SQLTypeInfo |
getSQLTypeInfoForJDBCType(int jdbcType)
Accessor for the (default) SQL type info for the specified JDBC type |
protected java.lang.String |
getStrategyForNative(java.lang.String sequence)
Method defining which value-strategy to use when the user specifies "native". |
protected java.lang.Object |
getStrategyValueForGenerator(org.datanucleus.store.valuegenerator.ValueGenerator generator,
org.datanucleus.ObjectManager om)
Accessor for the next value from the specified generator. |
java.util.Collection |
getSupportedOptions()
Accessor for the supported options in string form |
boolean |
hasWrittenDdlStatement(java.lang.String stmt)
When we are in SchemaTool DDL mode, return if the supplied statement is already present. |
protected void |
initialiseIdentifierFactory(org.datanucleus.OMFContext omfContext)
Method to create the IdentifierFactory to be used by this store. |
boolean |
insertValuesOnInsert(org.datanucleus.store.mapped.mapping.DatastoreMapping datastoreMapping)
Accessor for whether this mapping requires values inserting on an INSERT. |
void |
invalidateColumnInfoForTable(Table table)
Method to invalidate the cached column info for a table. |
protected void |
logConfiguration()
Convenience method to log the configuration of this store manager. |
protected org.datanucleus.store.mapped.scostore.FKArrayStore |
newFKArrayStore(org.datanucleus.metadata.AbstractMemberMetaData ammd,
org.datanucleus.ClassLoaderResolver clr)
|
protected org.datanucleus.store.mapped.scostore.FKListStore |
newFKListStore(org.datanucleus.metadata.AbstractMemberMetaData ammd,
org.datanucleus.ClassLoaderResolver clr)
|
protected org.datanucleus.store.mapped.scostore.FKMapStore |
newFKMapStore(org.datanucleus.metadata.AbstractMemberMetaData ammd,
org.datanucleus.ClassLoaderResolver clr)
|
protected org.datanucleus.store.mapped.scostore.FKSetStore |
newFKSetStore(org.datanucleus.metadata.AbstractMemberMetaData ammd,
org.datanucleus.ClassLoaderResolver clr)
|
protected org.datanucleus.store.mapped.scostore.JoinArrayStore |
newJoinArrayStore(org.datanucleus.metadata.AbstractMemberMetaData amd,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.store.mapped.DatastoreContainerObject table)
|
org.datanucleus.store.mapped.DatastoreContainerObject |
newJoinDatastoreContainerObject(org.datanucleus.metadata.AbstractMemberMetaData mmd,
org.datanucleus.ClassLoaderResolver clr)
Called by (container) Mapping objects to request the creation of a DatastoreObject (table). |
protected org.datanucleus.store.mapped.scostore.JoinListStore |
newJoinListStore(org.datanucleus.metadata.AbstractMemberMetaData amd,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.store.mapped.DatastoreContainerObject table)
|
protected org.datanucleus.store.mapped.scostore.JoinMapStore |
newJoinMapStore(org.datanucleus.metadata.AbstractMemberMetaData amd,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.store.mapped.DatastoreContainerObject table)
|
protected org.datanucleus.store.mapped.scostore.JoinSetStore |
newJoinSetStore(org.datanucleus.metadata.AbstractMemberMetaData amd,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.store.mapped.DatastoreContainerObject table)
|
org.datanucleus.store.query.ResultObjectFactory |
newResultObjectFactory(org.datanucleus.store.mapped.DatastoreClass table,
org.datanucleus.metadata.AbstractClassMetaData acmd,
org.datanucleus.store.mapped.StatementClassMapping mappingDefinition,
boolean ignoreCache,
boolean discriminator,
org.datanucleus.FetchPlan fetchPlan,
java.lang.Class persistentClass)
|
void |
printInformation(java.lang.String category,
java.io.PrintStream ps)
Method to output particular information owned by this datastore. |
void |
removeAllClasses(org.datanucleus.ClassLoaderResolver clr)
Utility to remove all classes that we are managing. |
void |
resolveIdentifierMacro(org.datanucleus.util.MacroString.IdentifierMacro im,
org.datanucleus.ClassLoaderResolver clr)
Resolves an identifier macro. |
void |
validateTable(TableImpl table,
org.datanucleus.ClassLoaderResolver clr)
Utility to validate the specified table. |
| Methods inherited from class org.datanucleus.store.mapped.MappedStoreManager |
|---|
addDatastoreContainer, getBackingStoreForField, getClassesManagingTableForClass, getClassWithPrimaryKeyForClass, getDatastoreAdapter, getDatastoreClass, getDatastoreClass, getDatastoreContainerObject, getIdentifierFactory, getMappedTypeManager, getMappingManager, getStoreDataForDatastoreContainerObject, isObjectInserted, isObjectInserted, setObjectIsInsertedToLevel, supportsValueStrategy |
| Methods inherited from class org.datanucleus.store.AbstractStoreManager |
|---|
addClass, assertReadOnlyForUpdateOfObject, clearAutoStarter, deregisterAllStoreData, getApiAdapter, getAutoStartMechanism, getConnection, getConnection, getConnection, getMetaDataManager, getOMFContext, getPersistenceHandler, getRuntimeManager, getSchemaHandler, getStoreManagerKey, getStrategyValue, getSubClassesForClass, getValueGenerationManager, initialiseAutoStart, isStrategyDatastoreAttributed, manageClassForIdentity, managesClass, newStoreData, notifyObjectIsOutdated, performVersionCheck, registerStoreData, supportsQueryLanguage |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.datanucleus.util.Localiser LOCALISER_RDBMS
protected SQLExpressionFactory expressionFactory
| Constructor Detail |
|---|
public RDBMSManager(org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.OMFContext omfContext)
To avoid creating unnecessary redundant RDBMSManagers, new RDBMSManagers
should always be obtained from the StoreManagerFactory,
rather than constructed directly.
clr - the ClassLoaderResolveromfContext - The corresponding PersistenceManagerFactory. This factory's non-tx data source will be
used to get database connections as needed to perform management functions.
org.datanucleus.exceptions.NucleusDataStoreException - If the database could not be accessed or the name of the
schema could not be determined.| Method Detail |
|---|
public org.datanucleus.util.MultiMap getSchemaCallbacks()
protected void logConfiguration()
logConfiguration in class org.datanucleus.store.AbstractStoreManagerprotected void initialiseIdentifierFactory(org.datanucleus.OMFContext omfContext)
omfContext - ObjectManagerFactory contextpublic void close()
close in interface org.datanucleus.store.StoreManagerclose in class org.datanucleus.store.mapped.MappedStoreManager
public org.datanucleus.store.NucleusSequence getNucleusSequence(org.datanucleus.ObjectManager om,
org.datanucleus.metadata.SequenceMetaData seqmd)
getNucleusSequence in interface org.datanucleus.store.StoreManagergetNucleusSequence in class org.datanucleus.store.AbstractStoreManagerom - The ObjectManagerseqmd - SequenceMetaData
public org.datanucleus.store.NucleusConnection getNucleusConnection(org.datanucleus.ObjectManager om)
getNucleusConnection in interface org.datanucleus.store.StoreManagergetNucleusConnection in class org.datanucleus.store.AbstractStoreManagerom - ObjectManager
public SQLController getSQLController()
public SQLExpressionFactory getSQLExpressionFactory()
public java.lang.String getCatalogName()
public java.lang.String getSchemaName()
public ConnectionProvider getConnectionProvider()
public java.util.Date getDatastoreDate()
getDatastoreDate in interface org.datanucleus.store.StoreManagergetDatastoreDate in class org.datanucleus.store.AbstractStoreManager
public void addClasses(java.lang.String[] classNames,
org.datanucleus.ClassLoaderResolver clr)
addClasses in interface org.datanucleus.store.StoreManageraddClasses in class org.datanucleus.store.AbstractStoreManagerclassNames - Name of the class(es) to be added.clr - The ClassLoaderResolver
public void addClasses(java.lang.String[] classNames,
org.datanucleus.ClassLoaderResolver clr,
java.io.Writer writer,
boolean completeDdl)
classNames - Name of the class(es) to be added.clr - The ClassLoaderResolverwriter - Optional writer when you just want the DDL for persisting the specified classescompleteDdl - whether complete DDL will be created when writing DDL to a file, or only for missing elementspublic void removeAllClasses(org.datanucleus.ClassLoaderResolver clr)
removeAllClasses in interface org.datanucleus.store.StoreManagerremoveAllClasses in class org.datanucleus.store.AbstractStoreManagerclr - The ClassLoaderResolverpublic java.io.Writer getDdlWriter()
public boolean getCompleteDDL()
public boolean hasWrittenDdlStatement(java.lang.String stmt)
stmt - The statement
public void addWrittenDdlStatement(java.lang.String stmt)
stmt - The statement
public void validateTable(TableImpl table,
org.datanucleus.ClassLoaderResolver clr)
clr - The ClassLoaderResolverpublic org.datanucleus.store.mapped.FetchStatement getFetchStatement(org.datanucleus.store.mapped.DatastoreContainerObject table)
getFetchStatement in class org.datanucleus.store.mapped.MappedStoreManagertable - The table to fetch from
public java.lang.String getClassNameForObjectID(java.lang.Object id,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.ObjectManager om)
getClassNameForObjectID in interface org.datanucleus.store.StoreManagergetClassNameForObjectID in class org.datanucleus.store.AbstractStoreManagerid - The JDO identity of some object.clr - ClassLoader resolverom - Object Manager (optional - to allow check in the datastore)
java.lang.ClassCastException - If the type of ID is not recognized (
OIDor SCOID).
public org.datanucleus.store.fieldmanager.FieldManager getFieldManagerForResultProcessing(org.datanucleus.StateManager sm,
java.lang.Object resultSet,
org.datanucleus.store.mapped.StatementClassMapping resultMappings)
getFieldManagerForResultProcessing in class org.datanucleus.store.mapped.MappedStoreManagersm - StateManager for the objectresultSet - The resultsresultMappings - Mappings for the results for this class
public org.datanucleus.store.fieldmanager.FieldManager getFieldManagerForStatementGeneration(org.datanucleus.StateManager sm,
java.lang.Object stmt,
org.datanucleus.store.mapped.StatementClassMapping stmtMappings,
boolean checkNonNullable)
getFieldManagerForStatementGeneration in class org.datanucleus.store.mapped.MappedStoreManagersm - The state manager for the object.stmt - The Prepared Statement to set values on.stmtMappings - the index of parameters/mappingscheckNonNullable - Whether to check for nullability
public java.lang.Object getResultValueAtPosition(java.lang.Object resultSet,
org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping,
int position)
getResultValueAtPosition in class org.datanucleus.store.mapped.MappedStoreManagerresultSet - The resultsmapping - The mappingposition - The position in the results
org.datanucleus.exceptions.NucleusDataStoreException - if an error occurs accessing the results
public org.datanucleus.store.Extent getExtent(org.datanucleus.ObjectManager om,
java.lang.Class c,
boolean subclasses)
getExtent in interface org.datanucleus.store.StoreManagergetExtent in class org.datanucleus.store.AbstractStoreManagerom - The ObjectManagerc - The (candidate) class to use for the Extentsubclasses - Whether to include subclasses of 'c'
org.datanucleus.store.exceptions.NoExtentException - if an extent is not managed for the
specified class
protected java.lang.Object getStrategyValueForGenerator(org.datanucleus.store.valuegenerator.ValueGenerator generator,
org.datanucleus.ObjectManager om)
getStrategyValueForGenerator in class org.datanucleus.store.AbstractStoreManagergenerator - The generator
protected java.util.Properties getPropertiesForGenerator(org.datanucleus.metadata.AbstractClassMetaData cmd,
int absoluteFieldNumber,
org.datanucleus.ObjectManager om,
org.datanucleus.metadata.SequenceMetaData seqmd,
org.datanucleus.metadata.TableGeneratorMetaData tablegenmd)
getPropertiesForGenerator in class org.datanucleus.store.AbstractStoreManagercmd - MetaData for the classabsoluteFieldNumber - Number of the field (-1 = datastore identity)om - Object Managerseqmd - Any sequence metadatatablegenmd - Any table generator metadata
protected java.lang.String getStrategyForNative(java.lang.String sequence)
getStrategyForNative in class org.datanucleus.store.AbstractStoreManagersequence - Sequence name if specified
public SQLTypeInfo getSQLTypeInfoForJDBCType(int jdbcType)
throws org.datanucleus.store.exceptions.UnsupportedDataTypeException
jdbcType - JDBC type
org.datanucleus.store.exceptions.UnsupportedDataTypeException - If the JDBC type is not found
public RDBMSColumnInfo getColumnInfoForColumnName(Table table,
java.sql.Connection conn,
org.datanucleus.store.mapped.DatastoreIdentifier column)
throws java.sql.SQLException
Where possible, this method loads and caches column info for more than just the table being requested, improving performance by reducing the overall number of calls made to DatabaseMetaData.getColumns() (each of which usually results in one or more database queries).
table - The table/viewconn - JDBC connection to the database.column - the column
java.sql.SQLException
public java.util.List getColumnInfoForTable(Table table,
java.sql.Connection conn)
throws java.sql.SQLException
Where possible, this method loads and caches column info for more than just the table being requested, improving performance by reducing the overall number of calls made to DatabaseMetaData.getColumns() (each of which usually results in one or more database queries).
table - The table/viewconn - JDBC connection to the database.
java.sql.SQLExceptionpublic void invalidateColumnInfoForTable(Table table)
table - The table
public java.util.Collection getManagedTables(java.lang.String catalog,
java.lang.String schema)
catalog - Name of the catalog to restrict the collection byschema - Name of the schema to restrict the collection by
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||