Interface DBSchemaCapability
-
- All Superinterfaces:
DFCapability
- All Known Subinterfaces:
JChemSchemaCapability
public interface DBSchemaCapability extends DFCapability
Schema's capability specially for relational DB connections.Note that there potentially confusing terminology for the term "schema" as it is used for two purposes:
- The IJC schema (represented by instances of this capability) and really represents a connection to a database
- The database schema name for databases that support schemas (e.g. Oracle)
Where possible we try to distinguish these by using the term ijcSchema for the former and dbSchemaName for the latter.
Note: Support for multiple database schemas does not yet exist in DIF. Methods for multiple schemas are in place ready for this, but at this stage all operations default to the default schema. Multi-schema support will be implemented in a future version.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DBSchemaCapability.NullPositionAfterOrdering
Definition of the strategy for null values - first, last or db default sorting order.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROP_EXTRA_SCHEMAS
static java.lang.String
PROP_SUPPLEMENTAL_TABLES
Name for the 'supplemental tables' property.static java.lang.String
PROP_TABLES
Name for the 'allTableNames' property.static java.lang.String
PROP_VIEWS
TODO unused propertystatic java.lang.String
XATTR_CONNECTION_ACTIVATION_SCRIPT
Extra attribute key for a connection activation script.static java.lang.String
XATTR_CONNECTION_DEACTIVATION_SCRIPT
Extra attribute key for a connection deactivation script.static java.lang.String
XATTR_PREFIX_SCHEMA_QUERY_STRUCTURE_STANDARDIZER
Extra attribute prefix for Query structure standardizers.static java.lang.String
XATTR_QUERY_TIMEOUT
Extra attribute key for a query timeout.static java.lang.String
XATTR_SCHEMA_INIT_SCRIPT
Extra attribute key for a schema connect/disconnect script.static java.lang.String
XATTR_SCHEMA_LOGGING
An IJC schema extra attribute name.static java.lang.String
XATTR_STRUCTURE_SEARCH_TYPE
Extra attribute key for structure search type.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description boolean
claimTableOwnership(com.im.commons.db.util.SchemaQualifiedName tableName)
Determines if the table is an implementation artifact of the Schema.java.util.Set<com.im.commons.db.ddl.DBTableInfo>
getAllManagedTableInfos()
Gets all managed tables from all schemas.java.lang.String[]
getAllSchemas()
com.im.commons.db.ddl.DBTableInfo[]
getAllTableInfos()
java.lang.String[]
getAllTableNames()
Deprecated.java.lang.String[]
getAllTableNames(java.lang.String dbSchemaName)
Get the names of the actual physical tables know to this IJC schema.com.im.commons.db.ddl.DBTableInfo[]
getAllViewInfos()
java.lang.String[]
getAllViewNames()
Deprecated.Use the form that takes the dbSchema as an argument.java.lang.String[]
getAllViewNames(java.lang.String dbSchemaName)
Get the names of the views know to this schema.com.im.commons.db.util.SchemaQualifiedName[]
getConstraintNames()
Retrieves names of constraints defined within the database.com.im.commons.db.DBType
getDatabaseType()
Get the database type e.g.java.lang.String
getDefaultDBSchemaName()
The default schema used by this database.java.lang.String[]
getExtraSchemas()
java.util.Set<java.lang.String>
getManagedTables()
Deprecated.Use the form that takes the dbSchema as an argument.java.util.Set<java.lang.String>
getManagedTables(java.lang.String dbSchemaName)
Returns the set of 'managed' tables, those the schema knows about.int
getMaxColumnNameLength()
int
getMaxIndexNameLength()
int
getMaxTableNameLength()
DBSchemaCapability.NullPositionAfterOrdering
getNullPositionAfterOrdering()
Getter for the previously set value.com.im.ijcs.api.ddl.dto.SchemaInfo.PerformanceMode
getPerformanceMode()
com.im.ijcs.api.ddl.dto.SchemaInfo.PerformanceMode
getPreviousPerformanceMode()
java.util.Set<java.lang.String>
getSystemTables()
Returns the set of system tables created for internal purposes of IJC.com.im.commons.db.ddl.DBTableInfo
getTableInfo(com.im.commons.db.util.SchemaQualifiedName schemaPlusTable)
Get information about the specified table.com.im.commons.db.ddl.DBTableInfo
getTableInfo(java.lang.String schemaPlusTable)
Deprecated.com.im.commons.db.ddl.DBTableInfo
getTableInfo(java.lang.String dbSchemaName, java.lang.String tableName)
Get information about the specified table, possibly retrieving it from a cache.java.util.Set<com.im.commons.db.ddl.DBDatabaseInfo.DatabaseOperation>
getUnsupportedDatabaseOperations()
boolean
isSupportingDBSchemas()
Whether DB used by this schema supports DB schemas.void
removeTable(java.lang.String dbSchemaName, java.lang.String tableName, com.im.commons.progress.DFEnvironmentRW env)
void
setExtraSchemas(java.util.List<java.lang.String> dbSchemas, com.im.commons.progress.DFEnvironmentRW env)
void
setNullPositionAfterOrdering(DBSchemaCapability.NullPositionAfterOrdering newNullPositionAfterOrdering, com.im.commons.progress.DFEnvironmentRW env)
Sets the current value for ordering of nulls in the DB.void
setPerformanceMode(com.im.ijcs.api.ddl.dto.SchemaInfo.PerformanceMode performanceMode, com.im.commons.progress.DFEnvironmentRW env)
-
-
-
Field Detail
-
PROP_TABLES
static final java.lang.String PROP_TABLES
Name for the 'allTableNames' property. TODO property change event is not never fired for this property.- See Also:
- Constant Field Values
-
PROP_SUPPLEMENTAL_TABLES
static final java.lang.String PROP_SUPPLEMENTAL_TABLES
Name for the 'supplemental tables' property.- See Also:
- Constant Field Values
-
PROP_VIEWS
static final java.lang.String PROP_VIEWS
TODO unused property- See Also:
- Constant Field Values
-
PROP_EXTRA_SCHEMAS
static final java.lang.String PROP_EXTRA_SCHEMAS
- See Also:
- Constant Field Values
-
XATTR_QUERY_TIMEOUT
static final java.lang.String XATTR_QUERY_TIMEOUT
Extra attribute key for a query timeout.- See Also:
- Constant Field Values
-
XATTR_STRUCTURE_SEARCH_TYPE
static final java.lang.String XATTR_STRUCTURE_SEARCH_TYPE
Extra attribute key for structure search type.- See Also:
- Constant Field Values
-
XATTR_SCHEMA_LOGGING
static final java.lang.String XATTR_SCHEMA_LOGGING
An IJC schema extra attribute name. For details seeDDLService.XATTR_SCHEMA_LOGGING
.- See Also:
- Constant Field Values
-
XATTR_SCHEMA_INIT_SCRIPT
static final java.lang.String XATTR_SCHEMA_INIT_SCRIPT
Extra attribute key for a schema connect/disconnect script.- See Also:
- Constant Field Values
-
XATTR_CONNECTION_ACTIVATION_SCRIPT
static final java.lang.String XATTR_CONNECTION_ACTIVATION_SCRIPT
Extra attribute key for a connection activation script.- See Also:
- Constant Field Values
-
XATTR_CONNECTION_DEACTIVATION_SCRIPT
static final java.lang.String XATTR_CONNECTION_DEACTIVATION_SCRIPT
Extra attribute key for a connection deactivation script.- See Also:
- Constant Field Values
-
XATTR_PREFIX_SCHEMA_QUERY_STRUCTURE_STANDARDIZER
static final java.lang.String XATTR_PREFIX_SCHEMA_QUERY_STRUCTURE_STANDARDIZER
Extra attribute prefix for Query structure standardizers.- See Also:
- Constant Field Values
-
-
Method Detail
-
getUnsupportedDatabaseOperations
java.util.Set<com.im.commons.db.ddl.DBDatabaseInfo.DatabaseOperation> getUnsupportedDatabaseOperations()
- Returns:
- the set of unsupported operations in this database.
-
getMaxTableNameLength
int getMaxTableNameLength()
- Returns:
- the maximum number of characters this database allows in a table name.
-
getMaxColumnNameLength
int getMaxColumnNameLength()
- Returns:
- the maximum number of characters this database allows for a column name.
-
getMaxIndexNameLength
int getMaxIndexNameLength()
- Returns:
- the maximum number of characters this database allows for a index name.
-
getAllTableNames
@Deprecated java.lang.String[] getAllTableNames()
Deprecated.Gets the names of the actual physical tables know to this IJC schema. This will not include views, synonyms etc.NOTE: This is a snapshot of the table names and is not updated if tables are added or dropped. Do not hold a long term reference to this.
-
getAllTableNames
java.lang.String[] getAllTableNames(java.lang.String dbSchemaName)
Get the names of the actual physical tables know to this IJC schema. This will not include views, synonyms etc.NOTE: This is a snapshot of the table names and is not updated if tables are added or dropped. Do not hold a long term reference to this.
- Parameters:
dbSchemaName
- The name of the database schema (not to be confused with the name of this IJC schema). Will be null for databases that do not support schemas.- Returns:
- An array of table names
-
getManagedTables
java.util.Set<java.lang.String> getManagedTables()
Deprecated.Use the form that takes the dbSchema as an argument.Returns the set of 'managed' tables in the default db schema, those the schema knows about. This include entity tables as well as any other "supplemental" tables, like the schema meta data tables or jchem property tables associated with the entities.This depends on actual implementation.
- Returns:
- The tables names
-
getManagedTables
java.util.Set<java.lang.String> getManagedTables(java.lang.String dbSchemaName)
Returns the set of 'managed' tables, those the schema knows about. This include entity tables as well as any other "supplemental" tables, like the schema meta data tables or jchem property tables associated with the entities.This depends on actual implementation.
- Parameters:
dbSchemaName
- The name of the database schema (not to be confused with the name of this IJC schema). Will be null for databases that do not support schemas.- Returns:
- The tables names
-
getAllManagedTableInfos
java.util.Set<com.im.commons.db.ddl.DBTableInfo> getAllManagedTableInfos()
Gets all managed tables from all schemas.- Returns:
- The managed tables
-
getSystemTables
java.util.Set<java.lang.String> getSystemTables()
Returns the set of system tables created for internal purposes of IJC.- Returns:
- The set of system tables
-
getTableInfo
@Deprecated com.im.commons.db.ddl.DBTableInfo getTableInfo(java.lang.String schemaPlusTable)
Deprecated.Get information about the specified table. The term "table" is used in the generic sense and can include views etc. See @{link com.im.commons.db.ddl.DBTableInfo} for more details.NOTE: This is a snapshot of the table and will not be updated if the table changes in any way. Do not hold a long term reference to this.
- Parameters:
schemaPlusTable
- The schema qualified name of the table, view etc.- Returns:
- A
DBTableInfo
object describing the table.
-
getTableInfo
com.im.commons.db.ddl.DBTableInfo getTableInfo(com.im.commons.db.util.SchemaQualifiedName schemaPlusTable)
Get information about the specified table. The term "table" is used in the generic sense and can include views etc. See @{link com.im.commons.db.ddl.DBTableInfo} for more details.NOTE: This is a snapshot of the table and will not be updated if the table changes in any way. Do not hold a long term reference to this.
- Parameters:
schemaPlusTable
- The schema qualified name of the table, view etc.- Returns:
- A
DBTableInfo
object describing the table.
-
getTableInfo
com.im.commons.db.ddl.DBTableInfo getTableInfo(java.lang.String dbSchemaName, java.lang.String tableName)
Get information about the specified table, possibly retrieving it from a cache. The term "table" is used in the generic sense and can include views etc. See @{link com.im.commons.db.ddl.DBTableInfo} for more details.NOTE: This is a snapshot of the table and will not be updated if the table changes in any way. Do not hold a long term reference to this.
- Parameters:
tableName
- The name of the table, view etc.dbSchemaName
- The name of the database schema (not to be confused with the name of this IJC schema). Will be null for databases that do not support schemas.- Returns:
- A
DBTableInfo
object describing the table.
-
getAllViewNames
java.lang.String[] getAllViewNames()
Deprecated.Use the form that takes the dbSchema as an argument.Get the names of the views know to this schema. This will not include table, synonyms etc.NOTE: This is a snapshot of the view names and is not updated if views are added or dropped. Do not hold a long term reference to this.
- Returns:
- An array of all available sql views in schema.
-
getAllViewNames
java.lang.String[] getAllViewNames(java.lang.String dbSchemaName)
Get the names of the views know to this schema. This will not include table, synonyms etc.NOTE: This is a snapshot of the view names and is not updated if views are added or dropped. Do not hold a long term reference to this.
- Parameters:
dbSchemaName
- The name of the database schema (not to be confused with the name of this IJC schema). Will be null for databases that do not support schemas.- Returns:
- An array of all available sql views in schema.
-
claimTableOwnership
boolean claimTableOwnership(com.im.commons.db.util.SchemaQualifiedName tableName)
Determines if the table is an implementation artifact of the Schema.- Parameters:
tableName
-- Returns:
- True if this table is an IJC system table for this schema
-
getDatabaseType
com.im.commons.db.DBType getDatabaseType()
Get the database type e.g. oracle, derby, mysql, as returned by the getDBType() method ofDBDatabaseInfo
- Returns:
- The database type.
-
getConstraintNames
com.im.commons.db.util.SchemaQualifiedName[] getConstraintNames()
Retrieves names of constraints defined within the database. The names should include names of all FKs, but also names of unique and other constraints.- Returns:
- The names of all constraints.
-
getDefaultDBSchemaName
java.lang.String getDefaultDBSchemaName()
The default schema used by this database. Not to be confused with the IJC schema, this is the schema within the database (e.g. APP for Derby) so that tables can be referred to using their schema qualified name e.g. APP.SOME_TABLE- Returns:
- The name of the default schema, or null if the database does not support schemas
-
getExtraSchemas
java.lang.String[] getExtraSchemas()
- Returns:
- The extra defined schema names
-
getAllSchemas
java.lang.String[] getAllSchemas()
- Returns:
- The all schema names
-
getAllTableInfos
com.im.commons.db.ddl.DBTableInfo[] getAllTableInfos()
- Returns:
- The all tables from all schemas
-
getAllViewInfos
com.im.commons.db.ddl.DBTableInfo[] getAllViewInfos()
- Returns:
- The all views from all schemas
-
setExtraSchemas
void setExtraSchemas(java.util.List<java.lang.String> dbSchemas, com.im.commons.progress.DFEnvironmentRW env)
-
isSupportingDBSchemas
boolean isSupportingDBSchemas()
Whether DB used by this schema supports DB schemas.- Returns:
- True if DB support DB schemas, false otherwise
-
getPerformanceMode
com.im.ijcs.api.ddl.dto.SchemaInfo.PerformanceMode getPerformanceMode()
-
getPreviousPerformanceMode
com.im.ijcs.api.ddl.dto.SchemaInfo.PerformanceMode getPreviousPerformanceMode()
-
setPerformanceMode
void setPerformanceMode(com.im.ijcs.api.ddl.dto.SchemaInfo.PerformanceMode performanceMode, com.im.commons.progress.DFEnvironmentRW env)
-
removeTable
void removeTable(java.lang.String dbSchemaName, java.lang.String tableName, com.im.commons.progress.DFEnvironmentRW env)
-
setNullPositionAfterOrdering
void setNullPositionAfterOrdering(DBSchemaCapability.NullPositionAfterOrdering newNullPositionAfterOrdering, com.im.commons.progress.DFEnvironmentRW env)
Sets the current value for ordering of nulls in the DB.- Parameters:
newNullPositionAfterOrdering
- is the description of the sortingenv
- is the environment variable
-
getNullPositionAfterOrdering
DBSchemaCapability.NullPositionAfterOrdering getNullPositionAfterOrdering()
Getter for the previously set value.- Returns:
- the strategy of the null position ordering.
-
-