|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
oracle.javatools.db.AbstractDBObjectProvider
oracle.javatools.db.AbstractDatabase
public abstract class AbstractDatabase
Base implementation of the Database interface. AbstractDatabase can be subclassed to provide support for specific types of databases.
JdbcDatabase, BaseOracleDatabase| Field Summary | |
|---|---|
static java.lang.String |
SQLSTATE_NOT_IMPLEMENTED |
| Fields inherited from class oracle.javatools.db.AbstractDBObjectProvider |
|---|
CASE_SENSITIVE_NAME_POLICY, EMPTY_LIST, LOWER_CASE_NAME_POLICY, MIXED_CASE_NAME_POLICY, NEW_FROM_TEMPLATE_TYPE, TIMESTAMP_PROPERTY, UPPER_CASE_NAME_POLICY |
| Fields inherited from interface oracle.javatools.db.Database |
|---|
FOUR_GIG, GENERIC_JDBC_DATABASE, SOURCE_TYPE_BODY, SOURCE_TYPE_SPEC, TWO_GIG |
| Fields inherited from interface oracle.javatools.db.DBObjectProvider |
|---|
CREATE_PRIVILEDGE, DELETE_PRIVILEDGE, MODIFY_PRIVILEDGE, NEW_FROM_TEMPLATE_TYPE |
| Constructor Summary | |
|---|---|
protected |
AbstractDatabase(java.lang.String connStore, java.lang.String connName, java.sql.Connection conn)Constructs a new AbstractDatabase. |
| Method Summary | ||
|---|---|---|
void |
cancelStatement()Cancels the Statement currently executing against this Database if: such a statement has been recorded by the use of a StatementWrapper/QueryWrapper both the DBMS and driver support aborting an SQL statement |
|
boolean |
canRestrictSchemaList()Whether this provider supports restricting the list of schemas to those with visible objects. |
|
void |
close()Closes the Database Connection (and the supplied JDBC Connection). |
|
protected SystemObject |
createByIDImpl(DBObjectID id) |
|
protected Schema |
createSchema(java.lang.String name) |
|
boolean |
exists(java.lang.String type, java.lang.String schema, java.lang.String name)Checks for existance of a schema object named objectName. |
|
protected boolean |
exists(SystemObject obj)Whether the specified object exists. |
|
protected void |
finishCreate(SystemObject[] objects, SystemObject[] oldObjects)Use to finish the create or update of objects after the changes have been made in the db. |
|
protected void |
finishDelete(Schema schema, SystemObject[] objs)Use to finish the delete of the given objects after the operation has been performed against the db. |
|
protected void |
finishDelete(SystemObject[] objs)Use to finish the delete of the given objects after the operation has been performed against the db. |
|
protected java.lang.String |
getAliveTestStatement()Returns a statement that, if executed succesfully, tests whether the given connections is live. |
|
java.sql.Connection |
getConnection()Gets the JDBC connection associated with this database. |
|
java.sql.Connection |
getConnection(boolean reconnect)Gets the JDBC connection associated with this database. |
|
java.lang.String |
getConnectionName()Retrieves the name for the Connection associated with this Database in whichever connection store it is stored in. |
|
java.lang.String |
getConnectionStore()Retrieves the connection store the Connection associated with this Database is stored in. |
|
protected SystemObject |
getCreatedObject(java.lang.String type, Schema schema, java.lang.String name)Used by finishCreate() to get the object that's just been created back from the database so that it can be verified before returning to the user. |
|
java.lang.String |
getDatabaseSource(java.lang.String objectType, Schema schema, java.lang.String objectName)Retrieves the source for an object in the database. |
|
java.lang.String |
getDatabaseSource(java.lang.String objectType, Schema schema, java.lang.String objectName, java.lang.String sourceType)Retrieves the source for an object in the database. |
|
java.lang.String |
getDatabaseType()Gets the type of database. |
|
int |
getDatabaseVersion()Gets the version of the database for the api implementation. |
|
DDLGenerator |
getDDLGenerator()Deprecated. - pushed down to DDLDatabase |
|
Schema |
getDefaultSchema()Returns the default schema for the connection or null if there isn't one. |
|
DatabaseDescriptor |
getDescriptor()Returns the DatabaseDescriptor for this provider |
|
java.lang.String |
getName()Returns an identifier for this provider. |
|
protected
|
getObjectImpl(DBObjectCriteria<T> criteria) |
|
java.lang.String |
getQualifiedName()Retrieves a qualified name containing the connection store and connection name. |
|
protected java.lang.String |
getTransactionTestQuery()Gets the query used to test whether there is an transaction open on the Connection this Database is using. |
|
boolean |
hasTransaction()Tests whether there is currently a "transaction" open on the underlying java.sql.Connection. |
|
boolean |
isConnectionAlive()Tests whether the connection underneath this Database is "alive" - i.e. |
|
boolean |
isConnectionAlive(java.sql.Connection conn)Tests whether the given Connection is "alive" - i.e. |
|
protected boolean |
isConnectionAliveImpl(java.sql.Connection conn)Implementation that checks whether the given (current) connection is alive. |
|
java.lang.Boolean |
isConnectionClosed(java.sql.SQLException sqe)Tests whether the given SQLException (assumed to have come from the connection of this db) is the result of the connection being closed. |
|
protected java.lang.Boolean |
isConnectionClosedImpl(java.sql.SQLException sqe, java.sql.Connection conn)Tests whether the given SQLException is the result of the given connection being closed. |
|
boolean |
isObjectValid(java.lang.String objectType, java.lang.String schema, java.lang.String objectName)Determines whether the specified database object is in a valid state. |
|
protected boolean |
isUsernameCaseInsensitive()Returns true if the username is treated as case insensitive. |
|
protected void |
reconnected(java.sql.Connection c)Called when a reconnect happens to (re)initialise any member appropriately on the new Connection. |
|
protected abstract void |
registerBuilders()Called to request that the DBOBjectBuilders be registered. |
|
protected void |
registerValidators()By default this registers default validators for Schema, Sequences, Synonyms, Indexes, Constraints and Columns for the wizards to use. |
|
void |
setStatement(java.sql.Statement statement)Internal use only. |
|
protected void |
sqlTrace(java.lang.String query)Deprecated. - Tracing is done automatically by the QueryWrapper implementations. DDL tracing is done automatically for implementations of DDLDatabase. |
|
protected void |
sqlTrace(java.lang.String query, java.lang.Object[] params)Deprecated. - Tracing is done automatically by the QueryWrapper implementations. DDL tracing is done automatically for implementations of DDLDatabase. |
|
boolean |
supportsDebugging()Whether this database instance supports JDWP debugging. |
|
void |
testSQLStatement(java.lang.String sql)Tests that the given SQL executes against the database. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface oracle.javatools.db.Database |
|---|
getIdentifierQuoteString, getUserName |
| Field Detail |
|---|
public static final java.lang.String SQLSTATE_NOT_IMPLEMENTED
| Constructor Detail |
|---|
protected AbstractDatabase(java.lang.String connStore,
java.lang.String connName,
java.sql.Connection conn)
connName - a String containing the ConnectionManager name for the connection associated with this Databaseconn - the Connection used by this AbstractDatabase| Method Detail |
|---|
@Deprecated
protected void sqlTrace(java.lang.String query)
@Deprecated
protected void sqlTrace(java.lang.String query,
java.lang.Object[] params)
public final java.lang.String getDatabaseType()
DatabasegetDatabaseType in interface DatabaseDatabaseMetaData.getDatabaseProductName()public final int getDatabaseVersion()
DatabasegetDatabaseVersion in interface Databaseprotected void registerValidators()
@Deprecated
public DDLGenerator getDDLGenerator()
DDLDatabaseprotected final boolean exists(SystemObject obj)
exists(String,String,String) with the appropriate details.obj - The object being checkedprotected abstract void registerBuilders()
public final java.sql.Connection getConnection()
DatabaseCode should, where possible, use one of the wrapper classes in oracle.javatools.db.execute to use a Connection and not need to directly call this method.
getConnection in interface DatabaseDatabase.getConnection(boolean)
public final java.sql.Connection getConnection(boolean reconnect)
throws DBException
DatabaseDatabase.isConnectionAlive().getConnection in interface Databasereconnect - whether to try and reconnect to the dbDBException - wrapping a SQLException if there is a problem reconnectingpublic final boolean isConnectionAlive()
DatabaseNote the implementation of this is database specific - a positive can be assumed true but a negative could be incorrect.
This is equivalent to db.isConnectionAlive( db.getConnection( false ) )
isConnectionAlive in interface DatabaseDatabase.getConnection(boolean)protected boolean isConnectionAliveImpl(java.sql.Connection conn)
getConnection() or similar, and only check the passed Connection object.
The calling of this method assumes that if the execution is blocked waiting for a monitor lock, the block is because of the Connection being busy and therefore alive. It is therefore illegal for any implemenation of this method to try and get the monitor lock for any object other than the connection.
conn - the connection to check (will not be null).public boolean isConnectionAlive(java.sql.Connection conn)
DatabaseNote the implementation of this is database specific - a positive can be assumed true but a negative could be incorrect.
isConnectionAlive in interface DatabaseDatabase.isConnectionAlive()protected java.lang.String getAliveTestStatement()
Statement.execute(java.lang.String) to be a valid test (e.g. SELECT 1 FROM DUAL for Oracle).public java.lang.Boolean isConnectionClosed(java.sql.SQLException sqe)
DatabaseIf the method returns null it indicates that the API cannot identify the cause of any SQLException, either because:
If this method is called with a null parameter value, it should return null if SQLException identification isn't supported, or Boolean.FALSE if it is.
isConnectionClosed in interface Databasesqe - the exception to test (this can be null to test if SQLException identification is supported).
protected java.lang.Boolean isConnectionClosedImpl(java.sql.SQLException sqe,
java.sql.Connection conn)
isConnectionClosed(SQLException) and includes the Connection so that the JDBC driver can be identified (as error codes are driver specific).
This default implementation returns null unless the SQLException has a SQLState of "08003" - the ANSI standard for "closed connection". Few JDBC drivers adhere to the standard, so for all other exceptions this method will return null indicating that the exception cannot be identified. Consequently for the connection closed support to work a Database implementation should override this method.
sqe - the exception to test (can be null to test the support for this connection).conn - the underlying connectionpublic boolean hasTransaction()
DatabaseNote the implementation of this is database specific - a positive can be assumed true but a negative could be incorrect.
hasTransaction in interface Databaseprotected java.lang.String getTransactionTestQuery()
hasTransaction() will always return false.
public void testSQLStatement(java.lang.String sql)
throws DBException
DatabasetestSQLStatement in interface Databasesql - the sql to testInvalidSQLException - if the sql doesn't execute (because the syntax is invalid etc).DBException - for any other error in executing the sqlpublic final java.lang.String getName()
AbstractDBObjectProvidergetName in class AbstractDBObjectProviderpublic final java.lang.String getConnectionName()
DatabasegetConnectionName in interface DatabaseDatabase.getConnectionStore(), Database.getQualifiedName()public final java.lang.String getConnectionStore()
DatabasegetConnectionStore in interface DatabaseDatabase.getQualifiedName()public final java.lang.String getQualifiedName()
DatabaseIf this connection has no connection store associated with it, this method will simply return the encoded connection name.
getQualifiedName in interface DatabaseDatabase.getConnectionStore(), Database.getConnectionName()protected void reconnected(java.sql.Connection c)
c - the connection to initialise onpublic void close()
Databaseclose in interface Database
public boolean exists(java.lang.String type,
java.lang.String schema,
java.lang.String name)
DatabaseobjectName.exists in interface Databasename - The name of the schema object.true if the object exists, false otherwise.
public boolean isObjectValid(java.lang.String objectType,
java.lang.String schema,
java.lang.String objectName)
DatabaseisObjectValid in interface DatabaseobjectType - the type of the object.schema - the name of the schema containing the objectobjectName - the name of the objectprotected final Schema createSchema(java.lang.String name)
protected void finishCreate(SystemObject[] objects,
SystemObject[] oldObjects)
throws DBException
DBException
protected SystemObject getCreatedObject(java.lang.String type,
Schema schema,
java.lang.String name)
throws DBException
AbstractDBObjectProvider.getObject(String,Schema,String)DBExceptionfinishCreate(oracle.javatools.db.SystemObject[], oracle.javatools.db.SystemObject[])protected void finishDelete(SystemObject[] objs)
finishDelete for each schema that the given objects are owned by.#finishDelete(Schema,SchemaObject[])
protected void finishDelete(Schema schema,
SystemObject[] objs)
protected SystemObject createByIDImpl(DBObjectID id)
throws DBException
createByIDImpl in class AbstractDBObjectProviderDBException
public java.lang.String getDatabaseSource(java.lang.String objectType,
Schema schema,
java.lang.String objectName)
throws DBException
Databasenull.getDatabaseSource in interface DatabaseobjectType - The type of object for which the source is neededschema - The Schema containing the objectobjectName - The name of the objectDBException - if an error occurs fetching the source
public java.lang.String getDatabaseSource(java.lang.String objectType,
Schema schema,
java.lang.String objectName,
java.lang.String sourceType)
throws DBException
Databasenull. This method combines spec and body for those source types that support both.getDatabaseSource in interface DatabaseobjectType - The type of object for which the source is neededschema - The Schema containing the objectobjectName - The name of the objectsourceType - In the case of types that have more than one source, the type of source required. Can be Database.SOURCE_TYPE_SPEC or Database.SOURCE_TYPE_BODY. If null, the default of body is selected.DBException - if an error occurs fetching the source
public Schema getDefaultSchema()
throws DBException
getDefaultSchema in interface DBObjectProviderDBExceptionprotected boolean isUsernameCaseInsensitive()
public boolean supportsDebugging()
Databasefalse.supportsDebugging in interface Databasetrue if JDWP debugging is supported against this database, false otherwise
protected <T extends SystemObject> T getObjectImpl(DBObjectCriteria<T> criteria)
throws DBException
getObjectImpl in class AbstractDBObjectProviderDBExceptionpublic DatabaseDescriptor getDescriptor()
DBObjectProvidergetDescriptor in interface DBObjectProviderpublic boolean canRestrictSchemaList()
DatabasecanRestrictSchemaList in interface Databasepublic void setStatement(java.sql.Statement statement)
statement - the Statement being executedjava.lang.IllegalArgumentException - if a non-null Statement is passed and there is already a non-null Statement recorded against the AbstractDatabasepublic void cancelStatement()
StatementWrapper/QueryWrapper
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||