Package org.datanucleus.store.schema
Class AbstractStoreSchemaHandler
- java.lang.Object
-
- org.datanucleus.store.schema.AbstractStoreSchemaHandler
-
- All Implemented Interfaces:
StoreSchemaHandler
- Direct Known Subclasses:
DefaultStoreSchemaHandler
public abstract class AbstractStoreSchemaHandler extends Object implements StoreSchemaHandler
Abstract base for any StoreSchemaHandler.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanautoCreateColumnsWhether to auto create any columns that are missing.protected booleanautoCreateConstraintsWhether to auto create any constraintsprotected booleanautoCreateDatabaseWhether to auto create any database (catalog/schema).protected booleanautoCreateTablesWhether to auto create any tables.protected booleanautoCreateWarnOnErrorWhether to warn only when any errors occur on auto-create.protected booleanautoDeleteColumnsWhether to auto delete any columns that are present but not in the metadata.protected StoreManagerstoreMgrprotected booleanvalidateColumnsWhether to validate any columnsprotected booleanvalidateConstraintsWhether to validate any constraintsprotected booleanvalidateTablesWhether to validate any tables
-
Constructor Summary
Constructors Constructor Description AbstractStoreSchemaHandler(StoreManager storeMgr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Method to clear out any cached schema information.voidcreateDatabase(String catalogName, String schemaName, Properties props, Object connection)Method to create the specified database (catalog/schema).voidcreateSchemaForClasses(Set<String> classNames, Properties props, Object connection)Method to generate the required schema for the supplied classes.voiddeleteDatabase(String catalogName, String schemaName, Properties props, Object connection)Method to delete the specified database (catalog/schema).voiddeleteSchemaForClasses(Set<String> classNames, Properties props, Object connection)Method to delete the schema for the supplied classes.voidenableSchemaGeneration()Convenience method to override the specified schema generation properties and enable schema generation.StoreSchemaDatagetSchemaData(Object connection, String name, Object[] values)Accessor for schema data store under the provided name and defined by the specified values.StoreManagergetStoreManager()booleanisAutoCreateColumns()booleanisAutoCreateConstraints()booleanisAutoCreateDatabase()booleanisAutoCreateTables()booleanisAutoCreateWarnOnError()booleanisAutoDeleteColumns()booleanisValidateColumns()booleanisValidateConstraints()booleanisValidateTables()voidresetSchemaGeneration()Convenience method to reset the schema generation properties to their initial creation values, effectively undoing a call to enableSchemaGeneration.voidvalidateSchema(Set<String> classNames, Properties props, Object connection)Method to validate the schema for the supplied classes.
-
-
-
Field Detail
-
storeMgr
protected StoreManager storeMgr
-
autoCreateDatabase
protected boolean autoCreateDatabase
Whether to auto create any database (catalog/schema).
-
autoCreateTables
protected boolean autoCreateTables
Whether to auto create any tables.
-
autoCreateColumns
protected boolean autoCreateColumns
Whether to auto create any columns that are missing.
-
autoCreateConstraints
protected boolean autoCreateConstraints
Whether to auto create any constraints
-
autoCreateWarnOnError
protected final boolean autoCreateWarnOnError
Whether to warn only when any errors occur on auto-create.
-
autoDeleteColumns
protected final boolean autoDeleteColumns
Whether to auto delete any columns that are present but not in the metadata.
-
validateTables
protected final boolean validateTables
Whether to validate any tables
-
validateColumns
protected final boolean validateColumns
Whether to validate any columns
-
validateConstraints
protected final boolean validateConstraints
Whether to validate any constraints
-
-
Constructor Detail
-
AbstractStoreSchemaHandler
public AbstractStoreSchemaHandler(StoreManager storeMgr)
-
-
Method Detail
-
getStoreManager
public StoreManager getStoreManager()
- Specified by:
getStoreManagerin interfaceStoreSchemaHandler
-
isAutoCreateDatabase
public boolean isAutoCreateDatabase()
- Specified by:
isAutoCreateDatabasein interfaceStoreSchemaHandler
-
isAutoCreateTables
public boolean isAutoCreateTables()
- Specified by:
isAutoCreateTablesin interfaceStoreSchemaHandler
-
isAutoCreateColumns
public boolean isAutoCreateColumns()
- Specified by:
isAutoCreateColumnsin interfaceStoreSchemaHandler
-
isAutoCreateConstraints
public boolean isAutoCreateConstraints()
- Specified by:
isAutoCreateConstraintsin interfaceStoreSchemaHandler
-
isAutoCreateWarnOnError
public boolean isAutoCreateWarnOnError()
- Specified by:
isAutoCreateWarnOnErrorin interfaceStoreSchemaHandler
-
isAutoDeleteColumns
public boolean isAutoDeleteColumns()
- Specified by:
isAutoDeleteColumnsin interfaceStoreSchemaHandler
-
isValidateTables
public boolean isValidateTables()
- Specified by:
isValidateTablesin interfaceStoreSchemaHandler
-
isValidateColumns
public boolean isValidateColumns()
- Specified by:
isValidateColumnsin interfaceStoreSchemaHandler
-
isValidateConstraints
public boolean isValidateConstraints()
- Specified by:
isValidateConstraintsin interfaceStoreSchemaHandler
-
clear
public void clear()
Description copied from interface:StoreSchemaHandlerMethod to clear out any cached schema information.- Specified by:
clearin interfaceStoreSchemaHandler
-
createDatabase
public void createDatabase(String catalogName, String schemaName, Properties props, Object connection)
Description copied from interface:StoreSchemaHandlerMethod to create the specified database (catalog/schema).- Specified by:
createDatabasein interfaceStoreSchemaHandler- Parameters:
catalogName- Name of the catalogschemaName- Name of the schemaprops- Any properties controlling the schema generationconnection- Connection to use (null implies this will obtain its own connection)
-
deleteDatabase
public void deleteDatabase(String catalogName, String schemaName, Properties props, Object connection)
Description copied from interface:StoreSchemaHandlerMethod to delete the specified database (catalog/schema).- Specified by:
deleteDatabasein interfaceStoreSchemaHandler- Parameters:
catalogName- Name of the catalogschemaName- Name of the schemaprops- Any properties controlling the schema deletionconnection- Connection to use (null implies this will obtain its own connection)
-
createSchemaForClasses
public void createSchemaForClasses(Set<String> classNames, Properties props, Object connection)
Description copied from interface:StoreSchemaHandlerMethod to generate the required schema for the supplied classes. Note that this does not generate a "schema", just the tables. Refer to createDatabase to create a "schema".- Specified by:
createSchemaForClassesin interfaceStoreSchemaHandler- Parameters:
classNames- Names of the classes we want the schema generating for.props- Any properties controlling the schema generationconnection- Connection to use (null implies this will obtain its own connection)
-
deleteSchemaForClasses
public void deleteSchemaForClasses(Set<String> classNames, Properties props, Object connection)
Description copied from interface:StoreSchemaHandlerMethod to delete the schema for the supplied classes. Note that this does not delete a "schema", just the tables. Refer to deleteDatabase to delete a "schema".- Specified by:
deleteSchemaForClassesin interfaceStoreSchemaHandler- Parameters:
classNames- Names of the classes we want the schema deleting for.props- Any properties controlling the schema deletionconnection- Connection to use (null implies this will obtain its own connection)
-
validateSchema
public void validateSchema(Set<String> classNames, Properties props, Object connection)
Description copied from interface:StoreSchemaHandlerMethod to validate the schema for the supplied classes.- Specified by:
validateSchemain interfaceStoreSchemaHandler- Parameters:
classNames- Names of classesprops- Any properties controlling schema validationconnection- Connection to use (null implies this will obtain its own connection)
-
getSchemaData
public StoreSchemaData getSchemaData(Object connection, String name, Object[] values)
Description copied from interface:StoreSchemaHandlerAccessor for schema data store under the provided name and defined by the specified values. The supported types of values is particular to the implementation.- Specified by:
getSchemaDatain interfaceStoreSchemaHandler- Parameters:
connection- Connection to the datastorename- Name of the schema component to return.values- Value(s) to use as qualifier(s) for selecting the schema component- Returns:
- Schema data definition for this name
-
enableSchemaGeneration
public void enableSchemaGeneration()
Description copied from interface:StoreSchemaHandlerConvenience method to override the specified schema generation properties and enable schema generation.- Specified by:
enableSchemaGenerationin interfaceStoreSchemaHandler
-
resetSchemaGeneration
public void resetSchemaGeneration()
Description copied from interface:StoreSchemaHandlerConvenience method to reset the schema generation properties to their initial creation values, effectively undoing a call to enableSchemaGeneration.- Specified by:
resetSchemaGenerationin interfaceStoreSchemaHandler
-
-