|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.properties.PropertyStore
org.datanucleus.store.AbstractStoreManager
org.datanucleus.store.mapped.MappedStoreManager
org.datanucleus.store.rdbms.RDBMSStoreManager
public class RDBMSStoreManager
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 |
|---|
catalogName, datastoreContainerByIdentifier, dba, identifierFactory, insertedDatastoreClassByStateManager, mappedTypeMgr, mappingManager, schemaLock, schemaName |
| Fields inherited from class org.datanucleus.store.AbstractStoreManager |
|---|
autoCreateColumns, autoCreateConstraints, autoCreateTables, autoCreateWarnOnError, autoStartMechanism, connectionMgr, fixedDatastore, LOCALISER, namingFactory, nontxConnectionFactoryName, nucleusContext, persistenceHandler, readOnlyDatastore, schemaHandler, starter, starterInitialised, storeDataMgr, storeManagerKey, txConnectionFactoryName, validateColumns, validateConstraints, validateTables |
| Fields inherited from class org.datanucleus.properties.PropertyStore |
|---|
properties |
| Constructor Summary | |
|---|---|
RDBMSStoreManager(org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.NucleusContext ctx,
Map<String,Object> props)
Constructs a new RDBMSManager. |
|
| Method Summary | |
|---|---|
void |
addClasses(String[] classNames,
org.datanucleus.ClassLoaderResolver clr)
Method to add several persistable classes to the store manager's set of supported classes. |
void |
addSchemaCallback(String className,
org.datanucleus.metadata.AbstractMemberMetaData mmd)
|
protected void |
addSequenceForMetaData(org.datanucleus.metadata.MetaData md,
String seq,
org.datanucleus.ClassLoaderResolver clr,
Set<String> sequencesGenerated,
FileWriter ddlWriter)
|
protected void |
addSequenceTableForMetaData(org.datanucleus.metadata.MetaData md,
org.datanucleus.ClassLoaderResolver clr,
Set<String> seqTablesGenerated)
|
void |
addWrittenDdlStatement(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. |
protected static Set<String> |
cleanInputClassNames(org.datanucleus.NucleusContext ctx,
Set<String> inputClassNames)
Method to generate a set of class names using the input list. |
void |
close()
Release of resources |
void |
createSchema(Set<String> inputClassNames,
Properties props)
|
protected void |
createSchemaSequences(Set<String> classNames,
org.datanucleus.ClassLoaderResolver clr,
FileWriter ddlWriter)
|
void |
deleteSchema(Set<String> inputClassNames,
Properties props)
|
Calendar |
getCalendarForDateTimezone()
Accessor for the Calendar to be used in handling all timezone issues with the datastore. |
String |
getCatalogName()
Accessor for the (default) RDBMS catalog name. |
String |
getClassNameForObjectID(Object id,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.store.ExecutionContext ec)
Returns the class corresponding to the given object identity. |
RDBMSColumnInfo |
getColumnInfoForColumnName(Table table,
Connection conn,
org.datanucleus.store.mapped.DatastoreIdentifier column)
Returns the column info for a column name. |
List |
getColumnInfoForTable(Table table,
Connection conn)
Returns the column info for a database table. |
boolean |
getCompleteDDL()
Accessor for whether we should generate complete DDL when in that mode. |
Date |
getDatastoreDate()
Get the date/time of the datastore. |
Writer |
getDdlWriter()
Accessor for the writer for DDL (if set). |
org.datanucleus.store.fieldmanager.FieldManager |
getFieldManagerForResultProcessing(org.datanucleus.store.ExecutionContext ec,
Object resultSet,
org.datanucleus.store.mapped.StatementClassMapping resultMappings,
org.datanucleus.metadata.AbstractClassMetaData cmd)
|
org.datanucleus.store.fieldmanager.FieldManager |
getFieldManagerForResultProcessing(org.datanucleus.store.ObjectProvider sm,
Object resultSet,
org.datanucleus.store.mapped.StatementClassMapping resultMappings)
|
org.datanucleus.store.fieldmanager.FieldManager |
getFieldManagerForStatementGeneration(org.datanucleus.store.ObjectProvider sm,
Object stmt,
org.datanucleus.store.mapped.StatementClassMapping stmtMappings,
boolean checkNonNullable)
Method to return a FieldManager for populating information in statements. |
Collection |
getManagedTables(String catalog,
String schema)
Convenience accessor of the Table objects managed in this datastore at this point. |
org.datanucleus.store.NucleusConnection |
getNucleusConnection(org.datanucleus.store.ExecutionContext ec)
Method to return a NucleusConnection for the ObjectManager. |
org.datanucleus.store.NucleusSequence |
getNucleusSequence(org.datanucleus.store.ExecutionContext ec,
org.datanucleus.metadata.SequenceMetaData seqmd)
Method to return a datastore sequence for this datastore matching the passed sequence MetaData. |
protected Properties |
getPropertiesForGenerator(org.datanucleus.metadata.AbstractClassMetaData cmd,
int absoluteFieldNumber,
org.datanucleus.store.ExecutionContext ec,
org.datanucleus.metadata.SequenceMetaData seqmd,
org.datanucleus.metadata.TableGeneratorMetaData tablegenmd)
Method to return the properties to pass to the generator for the specified field. |
String |
getQueryCacheKey()
|
Object |
getResultValueAtPosition(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()
|
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 SQL type info for the specified JDBC type |
SQLTypeInfo |
getSQLTypeInfoForJDBCType(int jdbcType,
String sqlType)
Accessor for the SQL type info for the specified JDBC type. |
protected String |
getStrategyForNative(org.datanucleus.metadata.AbstractClassMetaData cmd,
int absFieldNumber)
Method defining which value-strategy to use when the user specifies "native". |
protected Object |
getStrategyValueForGenerator(org.datanucleus.store.valuegenerator.ValueGenerator generator,
org.datanucleus.store.ExecutionContext ec)
Accessor for the next value from the specified generator. |
Collection |
getSupportedOptions()
Accessor for the supported options in string form |
boolean |
hasWrittenDdlStatement(String stmt)
When we are in SchemaTool DDL mode, return if the supplied statement is already present. |
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.scostore.ArrayStore |
newFKArrayStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
org.datanucleus.ClassLoaderResolver clr)
|
protected org.datanucleus.store.scostore.ListStore |
newFKListStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
org.datanucleus.ClassLoaderResolver clr)
|
protected org.datanucleus.store.scostore.MapStore |
newFKMapStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
org.datanucleus.ClassLoaderResolver clr)
|
protected org.datanucleus.store.scostore.SetStore |
newFKSetStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
org.datanucleus.ClassLoaderResolver clr)
|
protected org.datanucleus.store.scostore.ArrayStore |
newJoinArrayStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
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.scostore.ListStore |
newJoinListStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.store.mapped.DatastoreContainerObject table)
|
protected org.datanucleus.store.scostore.MapStore |
newJoinMapStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.store.mapped.DatastoreContainerObject table)
|
protected org.datanucleus.store.scostore.SetStore |
newJoinSetStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.store.mapped.DatastoreContainerObject table)
|
protected org.datanucleus.store.scostore.PersistableRelationStore |
newPersistableRelationStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.store.mapped.DatastoreContainerObject table)
|
org.datanucleus.store.query.ResultObjectFactory |
newResultObjectFactory(org.datanucleus.metadata.AbstractClassMetaData acmd,
org.datanucleus.store.mapped.StatementClassMapping mappingDefinition,
boolean ignoreCache,
org.datanucleus.FetchPlan fetchPlan,
Class persistentClass)
|
void |
printInformation(String category,
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. |
boolean |
useBackedSCOWrapperForMember(org.datanucleus.metadata.AbstractMemberMetaData mmd,
org.datanucleus.store.ExecutionContext ec)
|
boolean |
usesBackedSCOWrappers()
|
void |
validateSchema(Set<String> inputClassNames,
Properties props)
|
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, getDefaultIdentifierCase, getIdentifierFactory, getMappedTypeManager, getMappingManager, getStoreDataForDatastoreContainerObject, initialiseIdentifierFactory, isObjectInserted, isObjectInserted, setObjectIsInsertedToLevel, supportsValueStrategy |
| Methods inherited from class org.datanucleus.store.AbstractStoreManager |
|---|
addClass, assertReadOnlyForUpdateOfObject, clearAutoStarter, deregisterAllStoreData, getApiAdapter, getBooleanObjectProperty, getBooleanProperty, getBooleanProperty, getConnection, getConnection, getConnection, getConnectionDriverName, getConnectionFactory, getConnectionFactory2, getConnectionFactory2Name, getConnectionFactoryName, getConnectionManager, getConnectionPassword, getConnectionURL, getConnectionUserName, getExtent, getIntProperty, getMetaDataManager, getNamingFactory, getNucleusContext, getPersistenceHandler, getProperty, getQueryManager, getSchemaHandler, getStoreManagerKey, getStrategyValue, getStringProperty, getSubClassesForClass, getValueGenerationManager, initialiseAutoStart, isAutoCreateColumns, isAutoCreateConstraints, isAutoCreateTables, isStrategyDatastoreAttributed, isValidateColumns, isValidateConstraints, isValidateTables, manageClassForIdentity, managesClass, newStoreData, registerConnectionFactory, registerConnectionMgr, registerStoreData, supportsQueryLanguage, transactionCommitted, transactionRolledBack, transactionStarted |
| Methods inherited from class org.datanucleus.properties.PropertyStore |
|---|
hasProperty, hasPropertyNotNull, setPropertyInternal |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.datanucleus.store.StoreManager |
|---|
hasProperty |
| Field Detail |
|---|
protected static final org.datanucleus.util.Localiser LOCALISER_RDBMS
protected SQLExpressionFactory expressionFactory
| Constructor Detail |
|---|
public RDBMSStoreManager(org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.NucleusContext ctx,
Map<String,Object> props)
clr - the ClassLoaderResolverctx - The corresponding Context. This factory's non-tx data source will be
used to get database connections as needed to perform management functions.props - Properties for the datastore
org.datanucleus.exceptions.NucleusDataStoreException - If the database could not be accessed or the name of the
schema could not be determined.| Method Detail |
|---|
public String getQueryCacheKey()
getQueryCacheKey in interface org.datanucleus.store.StoreManagergetQueryCacheKey in class org.datanucleus.store.AbstractStoreManagerpublic org.datanucleus.util.MultiMap getSchemaCallbacks()
public void addSchemaCallback(String className,
org.datanucleus.metadata.AbstractMemberMetaData mmd)
protected void logConfiguration()
logConfiguration in class org.datanucleus.store.AbstractStoreManagerpublic void close()
close in interface org.datanucleus.store.StoreManagerclose in class org.datanucleus.store.mapped.MappedStoreManager
public org.datanucleus.store.NucleusSequence getNucleusSequence(org.datanucleus.store.ExecutionContext ec,
org.datanucleus.metadata.SequenceMetaData seqmd)
getNucleusSequence in interface org.datanucleus.store.StoreManagergetNucleusSequence in class org.datanucleus.store.AbstractStoreManagerec - execution contextseqmd - SequenceMetaData
public org.datanucleus.store.NucleusConnection getNucleusConnection(org.datanucleus.store.ExecutionContext ec)
getNucleusConnection in interface org.datanucleus.store.StoreManagergetNucleusConnection in class org.datanucleus.store.AbstractStoreManagerec - execution context
public SQLController getSQLController()
public SQLExpressionFactory getSQLExpressionFactory()
public String getCatalogName()
public String getSchemaName()
public Date getDatastoreDate()
getDatastoreDate in interface org.datanucleus.store.StoreManagergetDatastoreDate in class org.datanucleus.store.AbstractStoreManager
public void addClasses(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 ClassLoaderResolverpublic void removeAllClasses(org.datanucleus.ClassLoaderResolver clr)
removeAllClasses in interface org.datanucleus.store.StoreManagerremoveAllClasses in class org.datanucleus.store.AbstractStoreManagerclr - The ClassLoaderResolverpublic Writer getDdlWriter()
public boolean getCompleteDDL()
public boolean hasWrittenDdlStatement(String stmt)
stmt - The statement
public void addWrittenDdlStatement(String stmt)
stmt - The statement
public void validateTable(TableImpl table,
org.datanucleus.ClassLoaderResolver clr)
clr - The ClassLoaderResolver
public String getClassNameForObjectID(Object id,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.store.ExecutionContext ec)
getClassNameForObjectID in interface org.datanucleus.store.StoreManagergetClassNameForObjectID in class org.datanucleus.store.AbstractStoreManagerid - The identity of some object.clr - ClassLoader resolverec - execution context (optional - to allow check inheritance level in datastore)
public org.datanucleus.store.fieldmanager.FieldManager getFieldManagerForResultProcessing(org.datanucleus.store.ObjectProvider sm,
Object resultSet,
org.datanucleus.store.mapped.StatementClassMapping resultMappings)
getFieldManagerForResultProcessing in class org.datanucleus.store.mapped.MappedStoreManager
public org.datanucleus.store.fieldmanager.FieldManager getFieldManagerForResultProcessing(org.datanucleus.store.ExecutionContext ec,
Object resultSet,
org.datanucleus.store.mapped.StatementClassMapping resultMappings,
org.datanucleus.metadata.AbstractClassMetaData cmd)
getFieldManagerForResultProcessing in class org.datanucleus.store.mapped.MappedStoreManager
public org.datanucleus.store.fieldmanager.FieldManager getFieldManagerForStatementGeneration(org.datanucleus.store.ObjectProvider sm,
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 Object getResultValueAtPosition(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
protected Object getStrategyValueForGenerator(org.datanucleus.store.valuegenerator.ValueGenerator generator,
org.datanucleus.store.ExecutionContext ec)
getStrategyValueForGenerator in class org.datanucleus.store.AbstractStoreManagergenerator - The generatorec - execution context
protected Properties getPropertiesForGenerator(org.datanucleus.metadata.AbstractClassMetaData cmd,
int absoluteFieldNumber,
org.datanucleus.store.ExecutionContext ec,
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)ec - execution contextseqmd - Any sequence metadatatablegenmd - Any table generator metadata
protected String getStrategyForNative(org.datanucleus.metadata.AbstractClassMetaData cmd,
int absFieldNumber)
getStrategyForNative in class org.datanucleus.store.AbstractStoreManager
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 SQLTypeInfo getSQLTypeInfoForJDBCType(int jdbcType,
String sqlType)
throws org.datanucleus.store.exceptions.UnsupportedDataTypeException
jdbcType - JDBC typesqlType - The SQL type name (if known, otherwise uses the default for this JDBC type).
org.datanucleus.store.exceptions.UnsupportedDataTypeException - If the JDBC type is not found
public RDBMSColumnInfo getColumnInfoForColumnName(Table table,
Connection conn,
org.datanucleus.store.mapped.DatastoreIdentifier column)
throws 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
SQLException
public List getColumnInfoForTable(Table table,
Connection conn)
throws 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.
SQLExceptionpublic void invalidateColumnInfoForTable(Table table)
table - The table
public Collection getManagedTables(String catalog,
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 | |||||||||