Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

oracle.javatools.db.ddl
Class DDLDatabase

java.lang.Object
  extended by oracle.javatools.db.AbstractDBObjectProvider
      extended by oracle.javatools.db.AbstractDatabase
          extended by oracle.javatools.db.ddl.DDLDatabase
All Implemented Interfaces:
Database, DBObjectProvider
Direct Known Subclasses:
DictionaryDatabase

public abstract class DDLDatabase
extends AbstractDatabase

Database implementation that uses a DDLGenerator to create, update and delete objects.

Since:
11

Field Summary
 
Fields inherited from class oracle.javatools.db.AbstractDatabase
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 DDLDatabase(java.lang.String connStore, java.lang.String connName, java.sql.Connection conn)
           
 
Method Summary
 boolean canCreate(SystemObject object, boolean replace)
          Whether an attempt to create the specified object is likely to succeed.
 boolean canDelete(SystemObject obj, boolean cascade)
          Checks to see whether a specific object can be deleted.
 void createObjects(SystemObject[] objects, boolean replace)
          Causes the creation of the objects described by the specified meta data.
 void createSchema(Schema schema, boolean replace)
          Causes the creation of a new Schema in the persistent storage.
 void deleteObjects(SystemObject[] objects, boolean cascade)
          Deletes the objects.
 void deleteSchema(Schema schema, boolean cascade)
          Deletes the schema.
protected  boolean executeDDL(DDL ddl, boolean ignoreErrors)
           
 DDLGenerator getDDLGenerator()
          Gets the DDLGenerator for this DDLDatabase implementation.
 DiffEngine getDiffEngine()
          Returns a diff engine setup with the appropriate set of differs for object updating.
protected  boolean isCauseNameInUse(DBException dbe)
          Used by processCreateException to determine whether the given failure in DDL execution should be rolled back (i.e.
protected  java.util.Collection<SystemObject> listObjectsImpl(java.lang.String[] objectTypes, Schema schema, java.lang.String ref)
          Internal listObjects implementation.
 Schema[] listSchemas()
          Retrieves the list of schemas available from this provider regardless of their visibility to the user.
protected  void processCreateException(DBException dbe, SystemObject object)
           
protected  void processDeleteException(DBException dbe, SystemObject object)
          When an exception is encountered during delete of an object it may be for legitimate reasons that we want to ignore (e.g.
protected  void registerExpanders()
           
 void setCompilerOptions()
           
 void undeleteObject(SchemaObject object)
          Undeletes the object, i.e.
 void undeleteObjects(SchemaObject[] objects)
          Undeletes the objects, i.e.
 void updateObjects(Difference rs, boolean replace, boolean cascade)
          Updates the definition of a set of objects.
 void updateSchema(Schema oldSchema, Schema newSchema)
          Updates the definition of a Schema.
 
Methods inherited from class oracle.javatools.db.AbstractDatabase
cancelStatement, canRestrictSchemaList, close, createByIDImpl, createSchema, exists, exists, finishCreate, finishDelete, finishDelete, getAliveTestStatement, getConnection, getConnection, getConnectionName, getConnectionStore, getCreatedObject, getDatabaseSource, getDatabaseSource, getDatabaseType, getDatabaseVersion, getDefaultSchema, getDescriptor, getName, getObjectImpl, getQualifiedName, getTransactionTestQuery, hasTransaction, isConnectionAlive, isConnectionAlive, isObjectValid, isUsernameCaseInsensitive, reconnect, reconnected, registerBuilders, registerValidators, setStatement, sqlTrace, sqlTrace, supportsDebugging, testSQLStatement
 
Methods inherited from class oracle.javatools.db.AbstractDBObjectProvider
addProviderListener, cacheObject, checkCachedObject, clearAllCaches, clearCache, convertObject, createObject, createObjectImpl, createObjectManager, deleteObject, destroyCache, findByID, findObject, findObject, findSchema, fireObjectsAdded, fireObjectsRemoved, fireProviderClosed, fireProviderDeleted, fireProviderOpened, fireProviderReloaded, fireSchemaAdded, fireSchemaObjectUpdated, fireSchemaRemoved, fireSchemaUpdated, getBuilderForType, getCachedTimestamp, getCascadeManager, getCasePolicy, getDataType, getDefaultTemplateForType, getExternalName, getExternalName, getExternalTimestamp, getExternalTimestampImpl, getIdentifierQuoteString, getInternalName, getInternalName, getLogger, getObject, getObject, getObjectFactory, getObjectManager, getOrCreateDataType, getPropertyManager, getQuotedNameCasePolicy, getSchema, getSchemaObjectExpanders, getTimestamp, getTimestamp, getUniqueName, getValidatorForType, hasPriviledge, isEditable, isNewFromTemplateType, isRequestedObject, isValidName, isValidName, listObjects, listObjects, listObjects, listObjects, listObjects, listObjectsFromCache, listObjectsImpl, listObjectsImpl, listObjectTypes, listSchemas, listSupportedDataTypes, logEvent, markForLazyInit, markForLazyInit, normaliseType, putCachedTimestampKey, quoteIdentifier, registerBuilder, registerSchemaObjectExpander, registerType, registerValidator, removeProviderListener, resetObject, resumeTimestampQueries, schemaUpdated, setDefaultTemplateForType, supportsObjectType, supportsTimestamps, supportsTimestamps, suspendTimestampQueries, uncacheObject, unregisterBuilder, unregisterValidator, updateObject, updateObjects, validateName, validateName, validateObject, validateObject, validateObject, validateObject, validateObjectProperty, validateObjectProperty, validateObjectProperty, validateObjectProperty, 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
getIdentifierQuoteString, getUserName
 
Methods inherited from interface oracle.javatools.db.DBObjectProvider
addProviderListener, createObject, deleteObject, getCascadeManager, getDataType, getDefaultTemplateForType, getExternalName, getExternalName, getInternalName, getInternalName, getObject, getObject, getObjectFactory, getObjectManager, getOrCreateDataType, getPropertyManager, getSchema, getTimestamp, getTimestamp, getUniqueName, hasPriviledge, isEditable, isNewFromTemplateType, isValidName, isValidName, listObjects, listObjects, listObjects, listObjects, listObjects, listObjectTypes, listSchemas, listSupportedDataTypes, quoteIdentifier, removeProviderListener, setDefaultTemplateForType, supportsObjectType, updateObject, updateObjects, validateName, validateName, validateObject, validateObject, validateObject, validateObject, validateObjectProperty, validateObjectProperty, validateObjectProperty, validateObjectProperty, validateSchema, validateSchema, validateUniqueName
 

Constructor Detail

DDLDatabase

protected DDLDatabase(java.lang.String connStore,
                      java.lang.String connName,
                      java.sql.Connection conn)
Method Detail

getDDLGenerator

public DDLGenerator getDDLGenerator()
Gets the DDLGenerator for this DDLDatabase implementation. This is a convinience method to wrap DatabaseDescriptor.getDDLGenerator(oracle.javatools.db.DBObjectProvider).

Overrides:
getDDLGenerator in class AbstractDatabase
Returns:
the DDLGenerator for this Database.

listObjectsImpl

protected final java.util.Collection<SystemObject> listObjectsImpl(java.lang.String[] objectTypes,
                                                                   Schema schema,
                                                                   java.lang.String ref)
                                                            throws DBException
Description copied from class: AbstractDBObjectProvider
Internal listObjects implementation. By default this simply calls AbstractDBObjectProvider.listObjectsImpl(DBObjectCriteria) and shouldn't be overridden.

Overrides:
listObjectsImpl in class AbstractDBObjectProvider
Throws:
DBException

getDiffEngine

public DiffEngine getDiffEngine()
Description copied from interface: DBObjectProvider
Returns a diff engine setup with the appropriate set of differs for object updating.

Providers which do not support object updating should return null.

Specified by:
getDiffEngine in interface DBObjectProvider
Overrides:
getDiffEngine in class AbstractDBObjectProvider

executeDDL

protected final boolean executeDDL(DDL ddl,
                                   boolean ignoreErrors)
                            throws DBException
Throws:
DBException

canCreate

public final boolean canCreate(SystemObject object,
                               boolean replace)
Description copied from interface: DBObjectProvider
Whether an attempt to create the specified object is likely to succeed.

Parameters:
object - the SystemObject describing the object to create
replace - whether to replace an existing object. If replace is false and the object exists, canCreate must return false.
Returns:
whether the create will succeed.

canDelete

public final boolean canDelete(SystemObject obj,
                               boolean cascade)
Description copied from interface: DBObjectProvider
Checks to see whether a specific object can be deleted.

Parameters:
obj - the object to check
cascade - whether to assume a cascading delete should be used.
Returns:
whether the delete, if attempted, would succeed.

createSchema

public final void createSchema(Schema schema,
                               boolean replace)
                        throws DBException
Description copied from interface: DBObjectProvider
Causes the creation of a new Schema in the persistent storage.

Specified by:
createSchema in interface DBObjectProvider
Overrides:
createSchema in class AbstractDBObjectProvider
Parameters:
schema - the schema being created
replace - whether to replace an existing schema
Throws:
DBException - if an error is encountered creating the schema

deleteSchema

public final void deleteSchema(Schema schema,
                               boolean cascade)
                        throws DBException
Description copied from interface: DBObjectProvider
Deletes the schema.

Specified by:
deleteSchema in interface DBObjectProvider
Overrides:
deleteSchema in class AbstractDBObjectProvider
Parameters:
schema - the schema to delete
cascade - whether to delete dependent objects (i.e. all SchemaObjects contained in the Schema).
Throws:
DBException - if an error is encountered performing the delete

updateSchema

public final void updateSchema(Schema oldSchema,
                               Schema newSchema)
                        throws DBException
Description copied from interface: DBObjectProvider
Updates the definition of a Schema.

Specified by:
updateSchema in interface DBObjectProvider
Overrides:
updateSchema in class AbstractDBObjectProvider
Parameters:
oldSchema - the old version of the schema
newSchema - the new version of the schema
Throws:
DBException - if the update fails

createObjects

public final void createObjects(SystemObject[] objects,
                                boolean replace)
                         throws DBException
Description copied from interface: DBObjectProvider
Causes the creation of the objects described by the specified meta data.

Parameters:
objects - the SystemObject[] describing the objects to create.
replace - whether to replace an existing objects. If replace is false and the object exists, createObjects will fail.
Throws:
DBException - if an error is encountered creating the objects.

processCreateException

protected void processCreateException(DBException dbe,
                                      SystemObject object)
                               throws DBException
Throws:
DBException

isCauseNameInUse

protected boolean isCauseNameInUse(DBException dbe)
Used by processCreateException to determine whether the given failure in DDL execution should be rolled back (i.e. the objects deleted again). If this returns true (i.e. the cause is that the name is in use) then we will not rollback the attempted create.


deleteObjects

public void deleteObjects(SystemObject[] objects,
                          boolean cascade)
                   throws DBException
Description copied from interface: DBObjectProvider
Deletes the objects.

Parameters:
objects - the objects to delete
cascade - whether to delete dependent objects
Throws:
DBException - if an error is encountered performing the delete

processDeleteException

protected void processDeleteException(DBException dbe,
                                      SystemObject object)
                               throws DBException
When an exception is encountered during delete of an object it may be for legitimate reasons that we want to ignore (e.g. objects missing that we expect to have been deleted). This method allows a DBException to be swallowed. Legitimate exceptions should be re-thrown (which the default implementation does for all exceptions).

Parameters:
dbe - the exception to check and re-throw if we don't want to ignore it
object - the object we're trying to delete
Throws:
DBException - the re-thrown exception assuming we don't want to ignore it

undeleteObject

public final void undeleteObject(SchemaObject object)
                          throws DBException
Description copied from interface: DBObjectProvider
Undeletes the object, i.e. removes it from the recycle bin. In Oracle, only tables and indexes can be undeleted.

Parameters:
object - the object to be undeleted
Throws:
DBException - if an error is encountered performing the undelete

undeleteObjects

public final void undeleteObjects(SchemaObject[] objects)
                           throws DBException
Description copied from interface: DBObjectProvider
Undeletes the objects, i.e. removes them from the recycle bin. In Oracle, only tables and indexes can be undeleted.

Parameters:
objects - the objects to be undeleted
Throws:
DBException - if an error is encountered performing the undelete

updateObjects

public final void updateObjects(Difference rs,
                                boolean replace,
                                boolean cascade)
                         throws DBException
Description copied from interface: DBObjectProvider
Updates the definition of a set of objects. The changes required are described by the Difference which must have been created using the DiffEngine returned by DBObjectProvider.getDiffEngine() The 'change' maybe to create, alter, or delete objects.

Parameters:
rs - the changes described as a Difference - this should be a LIST Difference with the old objects as a() and the new objects as b().
replace - true if an existing object is to be replaced (when creating)
cascade - true if cascade delete should be used to replace an object (when deleting)
Throws:
DBException

registerExpanders

protected void registerExpanders()
Specified by:
registerExpanders in class AbstractDBObjectProvider

listSchemas

public final Schema[] listSchemas()
                           throws DBException
Description copied from interface: DBObjectProvider
Retrieves the list of schemas available from this provider regardless of their visibility to the user.

Specified by:
listSchemas in interface DBObjectProvider
Overrides:
listSchemas in class AbstractDBObjectProvider
Returns:
an array of schemas
Throws:
DBException
See Also:
DBObjectProvider.listSchemas(boolean)

setCompilerOptions

public void setCompilerOptions()

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

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