Package org.datanucleus.store.schema
Class AbstractStoreSchemaHandler
java.lang.Object
org.datanucleus.store.schema.AbstractStoreSchemaHandler
- All Implemented Interfaces:
StoreSchemaHandler
- Direct Known Subclasses:
DefaultStoreSchemaHandler
Abstract base for any StoreSchemaHandler.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Whether to auto create any columns that are missing.protected boolean
Whether to auto create any constraintsprotected boolean
Whether to auto create any database (catalog/schema).protected boolean
Whether to auto create any tables.protected final boolean
Whether to warn only when any errors occur on auto-create.protected final boolean
Whether to auto delete any columns that are present but not in the metadata.protected StoreManager
protected final boolean
Whether to validate any columnsprotected final boolean
Whether to validate any constraintsprotected final boolean
Whether to validate any tables -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Method to clear out any cached schema information.void
createDatabase
(String catalogName, String schemaName, Properties props, Object connection) Method to create the specified database (catalog/schema).void
createSchemaForClasses
(Set<String> classNames, Properties props, Object connection) Method to generate the required schema for the supplied classes.void
deleteDatabase
(String catalogName, String schemaName, Properties props, Object connection) Method to delete the specified database (catalog/schema).void
deleteSchemaForClasses
(Set<String> classNames, Properties props, Object connection) Method to delete the schema for the supplied classes.void
Convenience method to override the specified schema generation properties and enable schema generation.getSchemaData
(Object connection, String name, Object[] values) Accessor for schema data store under the provided name and defined by the specified values.boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
void
Convenience method to reset the schema generation properties to their initial creation values, effectively undoing a call to enableSchemaGeneration.void
validateSchema
(Set<String> classNames, Properties props, Object connection) Method to validate the schema for the supplied classes.
-
Field Details
-
storeMgr
-
autoCreateDatabase
protected boolean autoCreateDatabaseWhether to auto create any database (catalog/schema). -
autoCreateTables
protected boolean autoCreateTablesWhether to auto create any tables. -
autoCreateColumns
protected boolean autoCreateColumnsWhether to auto create any columns that are missing. -
autoCreateConstraints
protected boolean autoCreateConstraintsWhether to auto create any constraints -
autoCreateWarnOnError
protected final boolean autoCreateWarnOnErrorWhether to warn only when any errors occur on auto-create. -
autoDeleteColumns
protected final boolean autoDeleteColumnsWhether to auto delete any columns that are present but not in the metadata. -
validateTables
protected final boolean validateTablesWhether to validate any tables -
validateColumns
protected final boolean validateColumnsWhether to validate any columns -
validateConstraints
protected final boolean validateConstraintsWhether to validate any constraints
-
-
Constructor Details
-
AbstractStoreSchemaHandler
-
-
Method Details
-
getStoreManager
- Specified by:
getStoreManager
in interfaceStoreSchemaHandler
-
isAutoCreateDatabase
public boolean isAutoCreateDatabase()- Specified by:
isAutoCreateDatabase
in interfaceStoreSchemaHandler
-
isAutoCreateTables
public boolean isAutoCreateTables()- Specified by:
isAutoCreateTables
in interfaceStoreSchemaHandler
-
isAutoCreateColumns
public boolean isAutoCreateColumns()- Specified by:
isAutoCreateColumns
in interfaceStoreSchemaHandler
-
isAutoCreateConstraints
public boolean isAutoCreateConstraints()- Specified by:
isAutoCreateConstraints
in interfaceStoreSchemaHandler
-
isAutoCreateWarnOnError
public boolean isAutoCreateWarnOnError()- Specified by:
isAutoCreateWarnOnError
in interfaceStoreSchemaHandler
-
isAutoDeleteColumns
public boolean isAutoDeleteColumns()- Specified by:
isAutoDeleteColumns
in interfaceStoreSchemaHandler
-
isValidateTables
public boolean isValidateTables()- Specified by:
isValidateTables
in interfaceStoreSchemaHandler
-
isValidateColumns
public boolean isValidateColumns()- Specified by:
isValidateColumns
in interfaceStoreSchemaHandler
-
isValidateConstraints
public boolean isValidateConstraints()- Specified by:
isValidateConstraints
in interfaceStoreSchemaHandler
-
clear
public void clear()Description copied from interface:StoreSchemaHandler
Method to clear out any cached schema information.- Specified by:
clear
in interfaceStoreSchemaHandler
-
createDatabase
public void createDatabase(String catalogName, String schemaName, Properties props, Object connection) Description copied from interface:StoreSchemaHandler
Method to create the specified database (catalog/schema).- Specified by:
createDatabase
in 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:StoreSchemaHandler
Method to delete the specified database (catalog/schema).- Specified by:
deleteDatabase
in 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
Description copied from interface:StoreSchemaHandler
Method 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:
createSchemaForClasses
in 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
Description copied from interface:StoreSchemaHandler
Method 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:
deleteSchemaForClasses
in 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
Description copied from interface:StoreSchemaHandler
Method to validate the schema for the supplied classes.- Specified by:
validateSchema
in interfaceStoreSchemaHandler
- Parameters:
classNames
- Names of classesprops
- Any properties controlling schema validationconnection
- Connection to use (null implies this will obtain its own connection)
-
getSchemaData
Description copied from interface:StoreSchemaHandler
Accessor 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:
getSchemaData
in 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:StoreSchemaHandler
Convenience method to override the specified schema generation properties and enable schema generation.- Specified by:
enableSchemaGeneration
in interfaceStoreSchemaHandler
-
resetSchemaGeneration
public void resetSchemaGeneration()Description copied from interface:StoreSchemaHandler
Convenience method to reset the schema generation properties to their initial creation values, effectively undoing a call to enableSchemaGeneration.- Specified by:
resetSchemaGeneration
in interfaceStoreSchemaHandler
-