Purpose: Define all user level protocol for development time database manipulation.
Responsibilities:
| Modifier and Type | Field and Description |
|---|---|
| protected boolean | createDatabaseSchemas
Flag to determine if database schemas should be created during DDL generation |
| protected HashSet | |
| protected HashSet | |
| protected Writer | |
| protected boolean | |
| protected TableCreator | |
| protected HashMap | |
| protected Writer | |
| public static boolean | FAST_TABLE_CREATOR
Allow table creator to occur "fast" by just deleting all the rows. |
| public static boolean | FORCE_DROP
Allow replacing of table to force the drop, this may require several passes. |
| protected DatabaseSessionImpl |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | appendToDDLWriter(String stringToWrite)
PUBLIC: If the schema manager is writing to a writer, append this string to that writer. |
| public void | |
| public void | buildFieldTypes(TableDefinition tableDef)
INTERNAL: builds the field names based on the type read in from the builder |
| protected SequenceDefinition | |
| protected Set | |
| public boolean | Returns: value oftrue if given table exists or false otherwisedatabase table meta-data table, final boolean whether to suppress logging during query execution suppressLogging)Check if the table exists by issuing a query. |
| public boolean | Returns: value oftrue if given table exists or false otherwisedatabase table meta-data table)Check if the table exists by issuing a query. |
| public void | |
| public void | |
| protected void | collectDatabaseSchemasForDrop(DatabaseObjectDefinition databaseObjectDefinition)
INTERNAL: Called when dropping tables. |
| public void | createConstraints(TableDefinition tableDefinition)
Use the table definition to add the constraints to the database, this is normally done in two steps to avoid dependencies. |
| public void | createDefaultTables(boolean generateFKConstraints)
Create the default table schema for the project this session associated with. |
| pack-priv void | |
| public void | createObject(DatabaseObjectDefinition databaseObjectDefinition)
Use the definition object to create the schema entity on the database. |
| protected void | createOrReplaceSequences(boolean
- true to create the sequences, false to replace them (dropped then create) create)Common implementor for createSequence and replaceSequence |
| protected void | createOrReplaceSequences(boolean
- true to create the sequences tables, false to replace them (dropped then create) createSequenceTables, boolean - true to create the sequences objects, false to replace them (dropped then create) createSequences)Common implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objects |
| public void | createSequences()
Create all the receiver's sequences on the database for all of the loaded descriptors. |
| pack-priv void | |
| public void | dropConstraints(TableDefinition tableDefinition)
Use the table definition to drop the constraints from the table, this is normally done in two steps to avoid dependencies. |
| public void | |
| public void | |
| public void | dropObject(DatabaseObjectDefinition databaseObjectDefinition)
Use the definition object to drop the schema entity from the database. |
| protected void | |
| public void | |
| public void | extendDefaultTables(boolean generateFKConstraints)
Create or extend the default table schema for the project this session associated with. |
| public void | finalize()
Overrides java. |
| public void | generateStoredProcedures()
PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors. |
| public void | generateStoredProcedures(Writer writer)
PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors. |
| public void | generateStoredProceduresAndAmendmentClass(Writer writer, String fullyQualifiedClassName)
PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors. |
| public void | generateStoredProceduresAndAmendmentClass(String path, String fullyQualifiedClassName)
PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors. |
| protected DatabaseAccessor | |
| public Vector | Returns: a Vector of Records.a table name pattern tableName)Get a description of table columns available in a catalog. |
| public Vector | Returns: a Vector of Records.a schema name pattern; "" retrieves those
without a schema creatorName, String a table name pattern tableName)Get a description of table columns available in a catalog. |
| public Vector | |
| public Vector | Returns: a Vector of Records.a schema name pattern; "" retrieves those
without a schema creatorName)Get a description of table columns available in a catalog. |
| public Vector | Returns: a Vector of Records.a catalog name; "" retrieves those without a
catalog; null means drop catalog name from the selection criteria catalog, String a schema name pattern; "" retrieves those
without a schema schema, String a table name pattern tableName, String a column name pattern columnName)Get a description of table columns available in a catalog. |
| public Vector | |
| protected TableCreator | |
| protected Writer | |
| public AbstractSession | |
| public Vector | Returns: a Vector of Records.a catalog name; "" retrieves those without a
catalog; null means drop catalog name from the selection criteria catalog, String a schema name pattern; "" retrieves those
without a schema schema, String a table name pattern tableName, String[] a list of table types to include; null returns all types types)Get a description of tables available in a catalog. |
| protected Writer | |
| public void | |
| public void | |
| public void | |
| public void | outputDDLToFile(String fileName)
PUBLIC: Output all DDL statements to a file writer specified by the name in the parameter. |
| public void | outputDDLToWriter(Writer schemaWriter)
PUBLIC: Output all DDL statements to a writer specified in the parameter. |
| public void | |
| public void | |
| protected void | processSequenceDefinition(SequenceDefinition
- the sequence definition definition, final boolean - true if table sequence table definitions should be created. createTables, final boolean - true if the sequence definition should be created,
false if it should be dropped. createSequences, final boolean - true if table definitions and sequence definitions should be replaced. replace, Set<String> createdTableNames, Set<String> droppedTableNames)Method creates database tables/objects. |
| protected void | processSequenceDefinitions(boolean
- true to create the sequences tables, false to replace them (dropped then create) createSequenceTables, boolean - true to create the sequences objects, false to replace them (dropped then create) createSequences, boolean - true to actually replace, false to drop only. replaceSequences)Common implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objects |
| public void | replaceDefaultTables()
Drop and recreate the default table schema for the project this session associated with. |
| public void | replaceDefaultTables(boolean createSequenceTables, boolean generateFKConstraints)
Drop and recreate the default table schema for the project this session associated with. |
| public void | replaceDefaultTables(boolean createSequenceTables, boolean createSequences, boolean generateFKConstraints)
Drop and recreate the default table schema for the project this session associated with. |
| public void | replaceObject(DatabaseObjectDefinition databaseDefinition)
Use the definition object to drop and recreate the schema entity on the database. |
| public void | replaceSequences()
Drop and recreate all the receiver's sequences on the database for all of the loaded descriptors. |
| public void | setCreateDatabaseSchemas(boolean createDatabaseSchemas)
INTERNAL: Set to true if database schemas should be built during the DDL generation. |
| public void | |
| public void | |
| protected boolean | shouldCreateDatabaseSchema(DatabaseObjectDefinition databaseObjectDefinition, Set<String> createdDatabaseSchemas)
INTERNAL: Returns true if a database schema should be created during ddl generation for the given databaseObjectDefinition. |
| public boolean | shouldWriteToDatabase()
PUBLIC: Return true if this SchemaManager should write to the database directly |
| createDatabaseSchemas | back to summary |
|---|---|
| protected boolean createDatabaseSchemas Flag to determine if database schemas should be created during DDL generation | |
| createdDatabaseSchemas | back to summary |
|---|---|
| protected HashSet<String> createdDatabaseSchemas | |
| createdDatabaseSchemasOnDatabase | back to summary |
|---|---|
| protected HashSet<String> createdDatabaseSchemasOnDatabase | |
| createSchemaWriter | back to summary |
|---|---|
| protected Writer createSchemaWriter | |
| createSQLFiles | back to summary |
|---|---|
| protected boolean createSQLFiles | |
| defaultTableCreator | back to summary |
|---|---|
| protected TableCreator defaultTableCreator | |
| dropDatabaseSchemas | back to summary |
|---|---|
| protected HashMap<String, DatabaseObjectDefinition> dropDatabaseSchemas | |
| dropSchemaWriter | back to summary |
|---|---|
| protected Writer dropSchemaWriter | |
| FAST_TABLE_CREATOR | back to summary |
|---|---|
| public static boolean FAST_TABLE_CREATOR Allow table creator to occur "fast" by just deleting all the rows. | |
| FORCE_DROP | back to summary |
|---|---|
| public static boolean FORCE_DROP Allow replacing of table to force the drop, this may require several passes. | |
| session | back to summary |
|---|---|
| protected DatabaseSessionImpl session | |
| SchemaManager | back to summary |
|---|---|
| public SchemaManager(DatabaseSessionImpl session) | |
| SchemaManager | back to summary |
|---|---|
| public SchemaManager(DatabaseSession session) | |
| alterSequence | back to summary |
|---|---|
| public void alterSequence(SequenceDefinition sequenceDefinition) throws EclipseLinkException Use the definition to alter sequence. | |
| appendToDDLWriter | back to summary |
|---|---|
| public void appendToDDLWriter(String stringToWrite) PUBLIC: If the schema manager is writing to a writer, append this string to that writer. | |
| appendToDDLWriter | back to summary |
|---|---|
| public void appendToDDLWriter(Writer schemaWriter, String stringToWrite) | |
| buildFieldTypes | back to summary |
|---|---|
| public void buildFieldTypes(TableDefinition tableDef) INTERNAL: builds the field names based on the type read in from the builder | |
| buildSequenceDefinition | back to summary |
|---|---|
| protected SequenceDefinition buildSequenceDefinition(Sequence sequence) | |
| buildSequenceDefinitions | back to summary |
|---|---|
| protected Set INTERNAL: Build the sequence definitions. | |
| checkTableExists | back to summary |
|---|---|
| public boolean checkTableExists(TableDefinition table, final boolean suppressLogging) Check if the table exists by issuing a query.
| |
| checkTableExists | back to summary |
|---|---|
| public boolean checkTableExists(TableDefinition table) Check if the table exists by issuing a query. Logging is suppressed during query execution.
| |
| closeDDLWriter | back to summary |
|---|---|
| public void closeDDLWriter() PUBLIC: Close the schema writer. | |
| closeDDLWriter | back to summary |
|---|---|
| public void closeDDLWriter(Writer schemaWriter) | |
| collectDatabaseSchemasForDrop | back to summary |
|---|---|
| protected void collectDatabaseSchemasForDrop(DatabaseObjectDefinition databaseObjectDefinition) INTERNAL: Called when dropping tables. Will build a map of those schemas (and a table that references it) that should be dropped. | |
| createConstraints | back to summary |
|---|---|
| public void createConstraints(TableDefinition tableDefinition) throws EclipseLinkException Use the table definition to add the constraints to the database, this is normally done in two steps to avoid dependencies. | |
| createDefaultTables | back to summary |
|---|---|
| public void createDefaultTables(boolean generateFKConstraints) Create the default table schema for the project this session associated with. | |
| createForeignConstraints | back to summary |
|---|---|
| pack-priv void createForeignConstraints(TableDefinition tableDefinition) throws EclipseLinkException | |
| createObject | back to summary |
|---|---|
| public void createObject(DatabaseObjectDefinition databaseObjectDefinition) throws EclipseLinkException Use the definition object to create the schema entity on the database. This is used for creating tables, views, procedures ... etc ... | |
| createOrReplaceSequences | back to summary |
|---|---|
| protected void createOrReplaceSequences(boolean create) throws EclipseLinkException Common implementor for createSequence and replaceSequence
| |
| createOrReplaceSequences | back to summary |
|---|---|
| protected void createOrReplaceSequences(boolean createSequenceTables, boolean createSequences) throws EclipseLinkException Common implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objects
| |
| createSequences | back to summary |
|---|---|
| public void createSequences() throws EclipseLinkException Create all the receiver's sequences on the database for all of the loaded descriptors. | |
| createUniqueConstraints | back to summary |
|---|---|
| pack-priv void createUniqueConstraints(TableDefinition tableDefinition) throws EclipseLinkException | |
| dropConstraints | back to summary |
|---|---|
| public void dropConstraints(TableDefinition tableDefinition) throws EclipseLinkException Use the table definition to drop the constraints from the table, this is normally done in two steps to avoid dependencies. | |
| dropDatabaseSchemas | back to summary |
|---|---|
| public void dropDatabaseSchemas() INTERNAL: Iterate over the schemas that need to be dropped. | |
| dropDefaultTables | back to summary |
|---|---|
| public void dropDefaultTables() Create the default table schema for the project this session associated with. | |
| dropObject | back to summary |
|---|---|
| public void dropObject(DatabaseObjectDefinition databaseObjectDefinition) throws EclipseLinkException Use the definition object to drop the schema entity from the database. This is used for dropping tables, views, procedures ... etc ... | |
| dropSequences | back to summary |
|---|---|
| protected void dropSequences() This will drop the database schemas if managing the database schemas. | |
| dropTable | back to summary |
|---|---|
| public void dropTable(String tableName) throws EclipseLinkException Drop (delete) the table named tableName from the database. | |
| extendDefaultTables | back to summary |
|---|---|
| public void extendDefaultTables(boolean generateFKConstraints) throws EclipseLinkException Create or extend the default table schema for the project this session associated with. | |
| finalize | back to summary |
|---|---|
| public void finalize() Overrides java. INTERNAL: Close the schema writer when the schema manger is garbage collected
| |
| generateStoredProcedures | back to summary |
|---|---|
| public void generateStoredProcedures() throws EclipseLinkException PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors. This should be used with caution as it maintenance will be high. Stored procedures may be generated either directly on the database or to a file. | |
| generateStoredProcedures | back to summary |
|---|---|
| public void generateStoredProcedures(Writer writer) throws EclipseLinkException PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors. This should be used with caution as it maintenance will be high. Stored procedures may be generated either directly on the database or to a file. | |
| generateStoredProceduresAndAmendmentClass | back to summary |
|---|---|
| public void generateStoredProceduresAndAmendmentClass(Writer writer, String fullyQualifiedClassName) throws EclipseLinkException PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors. This should be used with caution as it maintenance will be high. Stored procedures may be generated either directly on the database or to a file. | |
| generateStoredProceduresAndAmendmentClass | back to summary |
|---|---|
| public void generateStoredProceduresAndAmendmentClass(String path, String fullyQualifiedClassName) throws EclipseLinkException PUBLIC: Use this method to generate stored procedures based on the dynamic SQL generated for your mappings and descriptors. This should be used with caution as it maintenance will be high. Stored procedures may be generated either directly on the database or to a file. | |
| getAccessor | back to summary |
|---|---|
| protected DatabaseAccessor getAccessor() Return the appropriate accessor. Assume we are dealing with a JDBC accessor. | |
| getAllColumnNames | back to summary |
|---|---|
| public Vector Get a description of table columns available in a catalog. Each column description has the following columns:
| |
| getAllColumnNames | back to summary |
|---|---|
| public Vector Get a description of table columns available in a catalog. Each column description has the following columns:
| |
| getAllTableNames | back to summary |
|---|---|
| public Vector Get a description of tables available in a catalog. Each table description has the following columns:
Note Some databases may not return information for all tables.
| |
| getAllTableNames | back to summary |
|---|---|
| public Vector Get a description of table columns available in a catalog. Each column description has the following columns:
| |
| getColumnInfo | back to summary |
|---|---|
| public Vector Get a description of table columns available in a catalog. Only column descriptions matching the catalog, schema, table and column name criteria are returned. They are ordered by TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION. Each column description has the following columns:
| |
| getColumnInfo | back to summary |
|---|---|
| public Vector | |
| getDefaultTableCreator | back to summary |
|---|---|
| protected TableCreator getDefaultTableCreator(boolean generateFKConstraints) Construct the default TableCreator. If the default TableCreator is already created, just returns it. | |
| getDropSchemaWriter | back to summary |
|---|---|
| protected Writer getDropSchemaWriter() | |
| getSession | back to summary |
|---|---|
| public AbstractSession getSession() | |
| getTableInfo | back to summary |
|---|---|
| public Vector Get a description of tables available in a catalog. Only table descriptions matching the catalog, schema, table name and type criteria are returned. They are ordered by TABLE_TYPE, TABLE_SCHEM and TABLE_NAME. Each table description has the following columns:
Note Some databases may not return information for all tables.
| |
| getWriter | back to summary |
|---|---|
| protected Writer getWriter(String fileName) | |
| outputCreateDDLToFile | back to summary |
|---|---|
| public void outputCreateDDLToFile(String fileName) | |
| outputCreateDDLToWriter | back to summary |
|---|---|
| public void outputCreateDDLToWriter(Writer createWriter) | |
| outputDDLToDatabase | back to summary |
|---|---|
| public void outputDDLToDatabase() PUBLIC: Output all DDL statements directly to the database. | |
| outputDDLToFile | back to summary |
|---|---|
| public void outputDDLToFile(String fileName) PUBLIC: Output all DDL statements to a file writer specified by the name in the parameter. | |
| outputDDLToWriter | back to summary |
|---|---|
| public void outputDDLToWriter(Writer schemaWriter) PUBLIC: Output all DDL statements to a writer specified in the parameter. | |
| outputDropDDLToFile | back to summary |
|---|---|
| public void outputDropDDLToFile(String fileName) | |
| outputDropDDLToWriter | back to summary |
|---|---|
| public void outputDropDDLToWriter(Writer dropWriter) | |
| processSequenceDefinition | back to summary |
|---|---|
| protected void processSequenceDefinition(SequenceDefinition definition, final boolean createTables, final boolean createSequences, final boolean replace, Set<String> createdTableNames, Set<String> droppedTableNames) throws EclipseLinkException Method creates database tables/objects. If create is true, it will attempt to create the object and silently ignore exceptions. If create is false, it will drop the object ignoring any exceptions, then create it if the replace flag is true (otherwise a drop only).
| |
| processSequenceDefinitions | back to summary |
|---|---|
| protected void processSequenceDefinitions(boolean createSequenceTables, boolean createSequences, boolean replaceSequences) throws EclipseLinkException Common implementor for createSequence and replaceSequence, distinguishes between sequence tables and sequence objects
| |
| replaceDefaultTables | back to summary |
|---|---|
| public void replaceDefaultTables() throws EclipseLinkException Drop and recreate the default table schema for the project this session associated with. | |
| replaceDefaultTables | back to summary |
|---|---|
| public void replaceDefaultTables(boolean createSequenceTables, boolean generateFKConstraints) throws EclipseLinkException Drop and recreate the default table schema for the project this session associated with. | |
| replaceDefaultTables | back to summary |
|---|---|
| public void replaceDefaultTables(boolean createSequenceTables, boolean createSequences, boolean generateFKConstraints) throws EclipseLinkException Drop and recreate the default table schema for the project this session associated with. | |
| replaceObject | back to summary |
|---|---|
| public void replaceObject(DatabaseObjectDefinition databaseDefinition) throws EclipseLinkException Use the definition object to drop and recreate the schema entity on the database. This is used for dropping tables, views, procedures ... etc ... This handles and ignore any database error while dropping in case the object did not previously exist. | |
| replaceSequences | back to summary |
|---|---|
| public void replaceSequences() throws EclipseLinkException Drop and recreate all the receiver's sequences on the database for all of the loaded descriptors. | |
| setCreateDatabaseSchemas | back to summary |
|---|---|
| public void setCreateDatabaseSchemas(boolean createDatabaseSchemas) INTERNAL: Set to true if database schemas should be built during the DDL generation. | |
| setCreateSQLFiles | back to summary |
|---|---|
| public void setCreateSQLFiles(boolean genFlag) | |
| setSession | back to summary |
|---|---|
| public void setSession(DatabaseSessionImpl session) | |
| shouldCreateDatabaseSchema | back to summary |
|---|---|
| protected boolean shouldCreateDatabaseSchema(DatabaseObjectDefinition databaseObjectDefinition, Set<String> createdDatabaseSchemas) INTERNAL: Returns true if a database schema should be created during ddl generation for the given databaseObjectDefinition. | |
| shouldWriteToDatabase | back to summary |
|---|---|
| public boolean shouldWriteToDatabase() PUBLIC: Return true if this SchemaManager should write to the database directly | |