Extension SDK 10.1.3.36.73

oracle.javatools.db
Class AbstractDatabase

java.lang.Object
  extended byoracle.javatools.db.AbstractDBObjectProvider
      extended byoracle.javatools.db.AbstractDatabase
All Implemented Interfaces:
Database, DBObjectProvider
Direct Known Subclasses:
BaseOracleDatabase, JdbcDatabase

public abstract class AbstractDatabase
extends AbstractDBObjectProvider
implements Database

Base implementation of the Database interface. AbstractDatabase can be subclassed to provide support for specific types of databases.

Since:
9.0.5
See Also:
JdbcDatabase, BaseOracleDatabase

Field Summary
static java.lang.String SQLSTATE_NOT_IMPLEMENTED
           
 
Fields inherited from class oracle.javatools.db.AbstractDBObjectProvider
EMPTY_LIST, LOWER_CASE_NAME_POLICY, MIXED_CASE_NAME_POLICY, 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
 
Constructor Summary
protected AbstractDatabase(java.lang.String connName, java.sql.Connection conn)
          Constructs a new AbstractDatabase.
 
Method Summary
 void close()
          Closes the Database Connection (and the supplied JDBC Connection).
 void createObjects(SchemaObject[] objects, boolean replace)
          Default implementation of this method simply iterates through the objects calling createObject on each.
protected  Schema createSchema(java.lang.String name)
           
 void deleteObjects(SchemaObject[] objects, boolean cascade)
          Default implementation of this method simply iterates through the objects calling createObject on each.
protected  boolean exists(SchemaObject obj)
          Whether the specified object exists.
 boolean exists(java.lang.String type, java.lang.String schema, java.lang.String name)
          Checks for existance of a schema object named objectName.
protected  void finishCreate(SchemaObject[] objects, SchemaObject[] oldObjects)
          Use to finish the create or update of objects after the changes have been made in the db.
protected  void finishDelete(Schema schema, SchemaObject[] objs)
          Use to finish the delete of the given objects after the operation has been performed against the db.
 java.sql.Connection getConnection()
          Gets the JDBC connection associated with this database.
 java.lang.String getConnectionName()
          Retrieves the ConnectionManager name for the Connection associated with this Database.
 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.
protected  DDLGenerator getDDLGenerator()
          Retrieves the DDLGenerator used by default.
 Schema getDefaultSchema()
          Returns the default schema for the provider.
 java.lang.String getName()
          Returns an identifier for this provider.
protected  SchemaObject getObjectImpl(java.lang.String objectType, Schema schema, java.lang.String name)
           
 java.lang.Long getTimestamp(java.lang.String objectName, Schema schema, java.lang.String type)
          Retrieves the timestamp representing the last modification time of the specified object's metadata.
 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 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.
protected  void setDDLGenerator(DDLGenerator gen)
          Sets the DDLGenerator used by default.
protected  void sqlTrace(java.lang.String query)
          Tracing method to print out SQL that is about to be executed against the db.
protected  void sqlTrace(java.lang.String query, java.lang.Object[] params)
          Tracing method to print out SQL that is about to be executed against the db.
 boolean supportsDebugging()
          Whether this database instance supports JDWP debugging.
 void updateObjects(SchemaObject[] oldObjects, SchemaObject[] newObjects)
          Default implementation of this method simply iterates through the objects calling createObject on each.
protected static void validateIdentifier(java.lang.String name, char quoter, int maxLength, java.lang.String allowedChars, boolean alphaStart, java.util.Set reservedWords, int casePolicy)
          Checks that the given identifier is correctly quoted and does not exceed the given max length (taking quotes into account).
 
Methods inherited from class oracle.javatools.db.AbstractDBObjectProvider
addProviderListener, cacheObject, canCreate, canCreate, canDelete, canDelete, clearAllCaches, clearCache, convertObject, convertToExternal, convertToInternal, createByIDImpl, createObject, createObjectManager, createSchema, createSchemaObjectImpl, deleteObject, deleteSchema, destroyCache, findByID, findObject, fireObjectsAdded, fireObjectsRemoved, fireProviderClosed, fireProviderOpened, fireProviderReloaded, fireSchemaAdded, fireSchemaRemoved, fireSchemaUpdated, getBuilderForType, getCasePolicy, getDataType, getExternalName, getExternalName, getIdentifierQuoteString, getInternalName, getInternalName, getObject, getObjectManager, getSchema, getUniqueName, getValidatorForType, hasPriviledge, isValidName, listObjects, listObjects, listObjects, listObjects, listObjectsImpl, listObjectsImpl, listObjectTypes, listSchemas, listSupportedDataTypes, markForLazyInit, needsQuoting, normaliseType, quoteIdentifier, registerBuilder, registerType, registerValidator, removeProviderListener, schemaUpdated, uncacheObject, unregisterBuilder, unregisterValidator, updateObject, updateSchema, validateName, validateObject, validateObject, validateObject, validateObject, validateSchema, validateSchema, validateUniqueName
 
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
getDatabaseType, getIdentifierQuoteString, getUserName
 
Methods inherited from interface oracle.javatools.db.DBObjectProvider
addProviderListener, canCreate, canCreate, canDelete, canDelete, createObject, createSchema, deleteObject, deleteSchema, getDataType, getExternalName, getExternalName, getInternalName, getInternalName, getObject, getSchema, getUniqueName, hasPriviledge, isValidName, listObjects, listObjects, listObjects, listObjects, listObjectTypes, listSchemas, listSupportedDataTypes, quoteIdentifier, removeProviderListener, updateObject, updateSchema, validateName, validateObject, validateObject, validateObject, validateObject, validateSchema, validateSchema, validateUniqueName
 

Field Detail

SQLSTATE_NOT_IMPLEMENTED

public static final java.lang.String SQLSTATE_NOT_IMPLEMENTED
See Also:
Constant Field Values
Constructor Detail

AbstractDatabase

protected AbstractDatabase(java.lang.String connName,
                           java.sql.Connection conn)
Constructs a new AbstractDatabase.

Parameters:
connName - a String containing the ConnectionManager name for the connection associated with this Database
conn - the Connection used by this AbstractDatabase
Method Detail

sqlTrace

protected void sqlTrace(java.lang.String query)
Tracing method to print out SQL that is about to be executed against the db.


sqlTrace

protected void sqlTrace(java.lang.String query,
                        java.lang.Object[] params)
Tracing method to print out SQL that is about to be executed against the db.


registerValidators

protected void registerValidators()
By default this registers default validators for Schema, Sequences, Synonyms, Indexes, Constraints and Columns for the wizards to use.


setDDLGenerator

protected void setDDLGenerator(DDLGenerator gen)
Sets the DDLGenerator used by default.

Parameters:
gen - The DDLGenerator to use for generating DDL

getDDLGenerator

protected DDLGenerator getDDLGenerator()
Retrieves the DDLGenerator used by default.

Returns:
the DDLGenerator used for generating DDL

exists

protected boolean exists(SchemaObject obj)
Whether the specified object exists.

Parameters:
obj - The object being checked
Returns:
whether the object exists.

registerBuilders

protected abstract void registerBuilders()
Called to request that the DBOBjectBuilders be registered.


getConnection

public java.sql.Connection getConnection()
Description copied from interface: Database
Gets the JDBC connection associated with this database.

Specified by:
getConnection in interface Database
Returns:
The Connection owned by this database object

getName

public java.lang.String getName()
Description copied from class: AbstractDBObjectProvider
Returns an identifier for this provider.

Specified by:
getName in class AbstractDBObjectProvider

getConnectionName

public java.lang.String getConnectionName()
Description copied from interface: Database
Retrieves the ConnectionManager name for the Connection associated with this Database.

Specified by:
getConnectionName in interface Database
Returns:
a String containing the connection name

close

public void close()
Description copied from interface: Database
Closes the Database Connection (and the supplied JDBC Connection).

Specified by:
close in interface Database

exists

public boolean exists(java.lang.String type,
                      java.lang.String schema,
                      java.lang.String name)
Description copied from interface: Database
Checks for existance of a schema object named objectName.

Specified by:
exists in interface Database
Parameters:
name - The name of the schema object.
Returns:
true if the object exists, false otherwise.

isObjectValid

public boolean isObjectValid(java.lang.String objectType,
                             java.lang.String schema,
                             java.lang.String objectName)
Description copied from interface: Database
Determines whether the specified database object is in a valid state.

Specified by:
isObjectValid in interface Database
Parameters:
schema - the name of the schema containing the object
objectName - the name of the object
objectType - the type of the object.

createSchema

protected final Schema createSchema(java.lang.String name)

finishCreate

protected void finishCreate(SchemaObject[] objects,
                            SchemaObject[] oldObjects)
                     throws DBException
Use to finish the create or update of objects after the changes have been made in the db. This method will sort out any cache updates and fire approriate provider messages.

Throws:
DBException

finishDelete

protected void finishDelete(Schema schema,
                            SchemaObject[] objs)
Use to finish the delete of the given objects after the operation has been performed against the db. The cache is updated, delete cascaded to any already built objects and any messages fired.


createObjects

public void createObjects(SchemaObject[] objects,
                          boolean replace)
                   throws DBException
Default implementation of this method simply iterates through the objects calling createObject on each. Subclasses should provide a more concrete implementation.

Specified by:
createObjects in interface DBObjectProvider
Specified by:
createObjects in class AbstractDBObjectProvider
Throws:
DBException

deleteObjects

public void deleteObjects(SchemaObject[] objects,
                          boolean cascade)
                   throws DBException
Default implementation of this method simply iterates through the objects calling createObject on each. Subclasses should provide a more concrete implementation.

Specified by:
deleteObjects in interface DBObjectProvider
Specified by:
deleteObjects in class AbstractDBObjectProvider
Throws:
DBException

updateObjects

public void updateObjects(SchemaObject[] oldObjects,
                          SchemaObject[] newObjects)
                   throws DBException
Default implementation of this method simply iterates through the objects calling createObject on each. Subclasses should provide a more concrete implementation.

Specified by:
updateObjects in interface DBObjectProvider
Specified by:
updateObjects in class AbstractDBObjectProvider
Throws:
DBException

getDatabaseSource

public java.lang.String getDatabaseSource(java.lang.String objectType,
                                          Schema schema,
                                          java.lang.String objectName)
                                   throws DBException
Description copied from interface: Database
Retrieves the source for an object in the database. The specified object is assumed to be of some type that represents source; non-source based objects will return null.

Specified by:
getDatabaseSource in interface Database
Parameters:
objectType - The type of object for which the source is needed
schema - The Schema containing the object
objectName - The name of the object
Returns:
The source representing the object
Throws:
DBException - if an error occurs fetching the source

getDatabaseSource

public java.lang.String getDatabaseSource(java.lang.String objectType,
                                          Schema schema,
                                          java.lang.String objectName,
                                          java.lang.String sourceType)
                                   throws DBException
Description copied from interface: Database
Retrieves the source for an object in the database. The specified object is assumed to be of some type that represents source; non-source based objects will return null. This method combines spec and body for those source types that support both.

Specified by:
getDatabaseSource in interface Database
Parameters:
objectType - The type of object for which the source is needed
schema - The Schema containing the object
objectName - The name of the object
sourceType - 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.
Returns:
The source representing the object
Throws:
DBException - if an error occurs fetching the source

getDefaultSchema

public Schema getDefaultSchema()
                        throws DBException
Description copied from interface: DBObjectProvider
Returns the default schema for the provider.

Specified by:
getDefaultSchema in interface DBObjectProvider
Throws:
DBException

getTimestamp

public java.lang.Long getTimestamp(java.lang.String objectName,
                                   Schema schema,
                                   java.lang.String type)
Description copied from interface: DBObjectProvider
Retrieves the timestamp representing the last modification time of the specified object's metadata. If the provider does not provide timestamp information for metadata, a null value should be returned.

Specified by:
getTimestamp in interface DBObjectProvider
Parameters:
objectName - a String containing the type of the object
schema - the Schema containing the object
type - a String containing the name of the object
Returns:
the timestamp as a Long value

supportsDebugging

public boolean supportsDebugging()
Description copied from interface: Database
Whether this database instance supports JDWP debugging. If the database does not support debugging, or only supports debugging using a custom protocol, this method should return false.

Specified by:
supportsDebugging in interface Database
Returns:
true if JDWP debugging is supported against this database, false otherwise

validateIdentifier

protected static void validateIdentifier(java.lang.String name,
                                         char quoter,
                                         int maxLength,
                                         java.lang.String allowedChars,
                                         boolean alphaStart,
                                         java.util.Set reservedWords,
                                         int casePolicy)
                                  throws InvalidNameException
Checks that the given identifier is correctly quoted and does not exceed the given max length (taking quotes into account). Used by the more specific validate*Identifier() methods on the Database implementations.

Parameters:
name - the identifier to check
quoter - the quote string (e.g. " )
maxLength - the maximum length a name can be (not including quotes)
allowedChars - characters that are allowed in the name (other than alphanumeric
alphaStart - whether to enforce that the string must start with an alphabet character.
reservedWords - Set of words that are reserved in the database
casePolicy - the case policy to use
Throws:
InvalidNameException - with an appropraite message if the identifier isn't valid.

getObjectImpl

protected SchemaObject getObjectImpl(java.lang.String objectType,
                                     Schema schema,
                                     java.lang.String name)
                              throws DBException
Overrides:
getObjectImpl in class AbstractDBObjectProvider
Throws:
DBException

Extension SDK 10.1.3.36.73

 

Copyright © 1997, 2005, Oracle.All rights reserved.