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

E13403-02

oracle.javatools.db
Class AbstractDBObjectProvider

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

public abstract class AbstractDBObjectProvider
extends java.lang.Object
implements DBObjectProvider

Provides a base implementation of the DBObjectProvider interface. AbstractDBObjectProvider provides support for registering DBObjectBuilder instances for building specific types of DBObjects. The list of builders is used to determine the types of objects supported by the DBObjectProvider implementation, to list the available objects of a specific type, and to retrieve the SchemaObject representations of the objects.

Subclasses are responsible for ensuring that DBObjectBuilder and DBObjectValidator instances are registered for the types of objects that will be supported. AbstractDBObjectProvider is abstract; sublasses are also responsible for providing implementations of those methods that do not have a generic implementation.

AbstractDBObjectProvider also handles caching of DBObject instances. When new instances are created, they are stored in a WeakHashMap. Subsequent requests for the same metadata will result in the same DBObject instance being returned.

Since:
9.0.5

Field Summary
static int CASE_SENSITIVE_NAME_POLICY
          Names are case sensitive and stored in mixed case
protected static java.lang.String[] EMPTY_LIST
           
static int LOWER_CASE_NAME_POLICY
          Names are case insensitive and stored in lower case
static int MIXED_CASE_NAME_POLICY
          Names are case insensitive and stored in mixed case
static java.lang.String TIMESTAMP_PROPERTY
           
static int UPPER_CASE_NAME_POLICY
          Names are case insensitive and stored in upper case
 
Fields inherited from interface oracle.javatools.db.DBObjectProvider
CREATE_PRIVILEDGE, DELETE_PRIVILEDGE, MODIFY_PRIVILEDGE, NEW_FROM_TEMPLATE_TYPE
 
Constructor Summary
AbstractDBObjectProvider()
           
 
Method Summary
 void addProviderListener(DBObjectProviderListener list)
          Adds the given listener to this provider to listen for provider and schema events.
protected  void cacheObject(SchemaObject object, boolean loadOperation)
          Adds an object to the cache.
protected  void clearAllCaches()
          Clears all the object caches.
protected  void clearCache(java.lang.String type)
          Clears the cache of objects of the specified type.
static java.lang.String convertObject(DBObject obj)
          Converts a DBObject into a String representation of the object name.
protected  SchemaObject createByIDImpl(DBObjectID id)
           
 void createObject(SchemaObject obj, boolean replace)
          Causes the creation of the object described by the specified meta data.
protected  SchemaObjectManager createObjectManager()
          Creates the object manager for this provider.
protected  SchemaObject createSchemaObjectImpl(java.lang.String type, Schema schema, java.lang.String name)
          Uses listObjectsImpl to find or create an object with the given type, schema and name.
 void deleteObject(SchemaObject obj, boolean cascade)
          Deletes the object.
 void destroyCache()
          Destroys the object cache.
protected  DBObject findByID(DBObjectID id)
           
protected  SchemaObject findObject(DBObjectID id)
          Looks for the specified object id in the cache.
protected  SchemaObject findObject(java.lang.String type, Schema schema, java.lang.String name)
          Looks for the specified object in the cache.
 void fireObjectsAdded(Schema schema, SchemaObject[] objs)
          Notifies all listeners that objects have been added to the given schema.
protected  void fireObjectsRemoved(Schema schema, SchemaObject[] objs)
          Notifies all listeners that objects have been removed from the given schema.
protected  void fireProviderClosed()
          Fires a providerClosed event to all listeners.
 void fireProviderDeleted()
          Fires a providerClosed event to all listeners.
protected  void fireProviderOpened()
          Fires a providerOpened event to all listeners.
protected  void fireProviderReloaded()
          Fires a providerReloaded event to all listeners.
protected  void fireSchemaAdded(Schema schema)
          Notifies all listeners that the given Schema has been added to this provider.
protected  void fireSchemaObjectUpdated(DBObjectChange change)
          Notifies all listeners of an update to a SchemaObject.
protected  void fireSchemaRemoved(Schema schema)
          Notifies all listeners that the given Schema has been removed from this provider.
protected  void fireSchemaUpdated(DBObjectChange change)
          Notifies all listeners of an update to a Schema.
protected  DBObjectBuilder getBuilderForType(java.lang.String type)
          Retrieves the DBObjectBuilder registered for a type of object.
protected  int getCasePolicy()
          Retrieves the provider's case policy for unquoted names.
 DataType getDataType(java.lang.String typeName)
          Retrieves the datatype represented by a specific name.
 SchemaObject getDefaultTemplateForType(java.lang.String type)
          Returns the default template object for the given type, or null if none defined
 DiffEngine getDiffEngine()
          Returns a diff engine setup with the appropriate set of differs for object updating.
 java.lang.String getExternalName(java.lang.String name)
          Converts the specified name into the format used externally to represent the identifier.
 java.lang.String getExternalName(java.lang.String name, java.lang.String objectType)
          Converts the specified name into the format used externally to represent the identifier.
protected  java.lang.Long getExternalTimestamp(SchemaObject object)
          Retrieves the external timestamp for the specified object.
 java.lang.String getIdentifierQuoteString()
          Retrieves the string used to quote identifiers.
 java.lang.String getInternalName(java.lang.String name)
          Converts the specified name into the format used internally within the metadata.
 java.lang.String getInternalName(java.lang.String name, java.lang.String objectType)
          Converts the specified name into the format used internally within the metadata.
protected  java.util.logging.Logger getLogger()
          Gets the logger to use in this provider.
protected abstract  java.lang.String getName()
          Returns an identifier for this provider.
 SchemaObject getObject(java.lang.String objectType, Schema schema, java.lang.String name)
          Retrieves the SchemaObject representing a specific database object.
protected  SchemaObject getObjectImpl(java.lang.String objectType, Schema schema, java.lang.String name)
           
 SchemaObjectManager getObjectManager()
          Returns the object manager for dealing with dependencies in this provider.
 DataType getOrCreateDataType(java.lang.String typeName)
          Retrieves the datatype represented by a specific name.
 PropertyManager getPropertyManager()
          Returns the PropertyManager implementation for this provider.
protected  int getQuotedNameCasePolicy()
          Retrieves the provider's case policy for quoted names.
protected  SchemaObjectExpander[] getSchemaObjectExpanders()
           
 java.lang.Long getTimestamp(DBObjectID id)
           
 java.lang.Long getTimestamp(java.lang.String type, Schema schema, java.lang.String objectName)
          Retrieves the timestamp representing the last modification time of the specified object's metadata.
 java.lang.String getUniqueName(java.lang.String type, DBObject contextObject, java.lang.String base)
          Returns a unique name for an object of given type within contextObject using base name.
protected  DBObjectValidator getValidatorForType(java.lang.String type)
          Retrieves the DBObjectValidator registered for a type of object.
 boolean hasPriviledge(java.lang.String type, Schema schema, java.lang.String priv)
          Checks to see whether the user has the requisite permissions to perform the specified operation.
 boolean isEditable(DBObject object)
          Returns whether or not the object can be edited
 boolean isNewFromTemplateType(java.lang.String type)
           
protected  boolean isRequestedObject(SchemaObject object, java.lang.String type, Schema schema, java.lang.String name)
          Returns true if SchemaObject object is of type type, owned by schema schema, and named name.
 boolean isValidName(java.lang.String name)
          Deprecated. - use isValidName( String type, String name )
 boolean isValidName(java.lang.String type, java.lang.String name)
          Checks to see whether a name is valid.
 SchemaObject[] listObjects(java.lang.String[] objectTypes, Schema schema)
          Lists the objects of multiple types available from this provider.
 SchemaObject[] listObjects(java.lang.String[] objectTypes, Schema schema, java.lang.String ref)
          Lists the objects of multiple types available from this provider.
 java.lang.String[] listObjects(java.lang.String objectType, Schema schema)
          Lists the objects of a given type available from this provider.
 java.lang.String[] listObjects(java.lang.String objectType, Schema schema, java.lang.String ref)
          Lists the objects of a given type available from this provider.
protected  java.util.Collection<SchemaObject> listObjectsFromCache(java.lang.String[] objectTypes, Schema schema, java.lang.String ref)
          Lists the objects that are in the internal memory cache for this provider.
protected abstract  java.util.Collection<SchemaObject> listObjectsImpl(java.lang.String[] objectTypes, Schema schema, java.lang.String ref)
          Internal listObjects implementation.
protected  java.lang.String[] listObjectsImpl(java.lang.String type, Schema schema, java.lang.String ref)
          Retrieves the list of objects by using a registered builder.
 java.lang.String[] listObjectTypes()
          Returns a sorted array of the object types supported in this provider.
 DataType[] listSupportedDataTypes()
          Retrieves the list of datatypes supported by this provider.
protected  void logEvent(java.lang.String msg, java.lang.Object... params)
          Use to log provider events.
protected  void markForLazyInit(AbstractSchemaObject object)
           
protected  java.lang.String normaliseType(java.lang.String type)
           
 java.lang.String quoteIdentifier(java.lang.String internalName, boolean force)
          Determines if internalName needs quoting to make it a valid external name, and if so returns a quoted copy of it.
protected  void registerBuilder(java.lang.String type, DBObjectBuilder builder)
          Registers a Builder for a specific object type.
protected abstract  void registerExpanders()
           
protected  void registerSchemaObjectExpander(SchemaObjectExpander expander)
           
protected  void registerType(java.lang.String type, DBObjectBuilder builder, DBObjectValidator validator)
          Registers a Builder and Validator for a specific object type.
protected  void registerValidator(java.lang.String type, DBObjectValidator validator)
          Registers a Validator for a specific object type.
 void removeProviderListener(DBObjectProviderListener list)
          Removed the given listener from this provider.
protected  void resetSchemaObject(SchemaObject object, SchemaObject listed, java.lang.Long timestamp)
          If it has been noticed that the timestamp has changed on an object, or we have updated it in the database, we want to turn it back into an object that needs building again.
protected  void schemaUpdated(DBObjectChange change)
          Override to implement any functionality that needs to be fired when a schema has been updated in the provider.
 void setDefaultTemplateForType(java.lang.String type, SchemaObject template)
          Sets the default template object for the given type.
 boolean supportsObjectType(java.lang.String type)
          Convinience method to check whether this provider supports the given object type - i.e.
 boolean supportsTimestamps()
          Returns true if this provider supports object timestamping.
protected  void uncacheObject(SchemaObject object)
          Removes an object from the cache.
protected  void unregisterBuilder(java.lang.String type)
          Removes a registered Builder.
protected  void unregisterValidator(java.lang.String type)
          Removes a registered Validator.
 void updateObject(SchemaObject oldObject, SchemaObject newObject)
          Updates the definition of an object.
 void updateObjects(SchemaObject[] oldObjects, SchemaObject[] newObjects)
          Updates the definition of a set of objects.
 void validateName(java.lang.String name)
          Deprecated. - use validateName( String type, String name )
 void validateName(java.lang.String type, java.lang.String name)
          Checks to see whether a name is valid.
 void validateObject(DBObject object)
          Validates the given object using the DBObjectValidator registered against that object's type.
 void validateObject(DBObject original, DBObject update)
          Validates the given object update using the DBObjectValidator registered against that object's type.
 void validateObject(DBObject original, DBObject update, java.lang.String property)
          Deprecated. 
 void validateObject(DBObject object, java.lang.String property)
          Deprecated. 
 void validateObjectProperty(DBObject original, DBObject update, java.lang.Object property)
          Checks to see if the updated children of a given object are valid.
 void validateObjectProperty(DBObject object, java.lang.Object property)
          Checks to see if the children of a given object are valid.
 void validateSchema(Schema schema)
          Deprecated. - use validateObject( DBObject object )
 void validateSchema(Schema original, Schema update)
          Deprecated. use validateObject( DBObject original, DBObject update )
 void validateUniqueName(java.lang.String type, DBObject contextObject, java.lang.String name)
          Validates that a name is not used within the context DBObject, and throws NameInUseException if it is.
 
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.DBObjectProvider
canCreate, canCreate, canDelete, canDelete, createObjects, createSchema, deleteObjects, deleteSchema, getDefaultSchema, getDescriptor, getSchema, listSchemas, listSchemas, undeleteObject, undeleteObjects, updateObjects, updateSchema
 

Field Detail

MIXED_CASE_NAME_POLICY

public static final int MIXED_CASE_NAME_POLICY
Names are case insensitive and stored in mixed case

See Also:
Constant Field Values

LOWER_CASE_NAME_POLICY

public static final int LOWER_CASE_NAME_POLICY
Names are case insensitive and stored in lower case

See Also:
Constant Field Values

UPPER_CASE_NAME_POLICY

public static final int UPPER_CASE_NAME_POLICY
Names are case insensitive and stored in upper case

See Also:
Constant Field Values

CASE_SENSITIVE_NAME_POLICY

public static final int CASE_SENSITIVE_NAME_POLICY
Names are case sensitive and stored in mixed case

See Also:
Constant Field Values

TIMESTAMP_PROPERTY

public static final java.lang.String TIMESTAMP_PROPERTY
See Also:
Constant Field Values

EMPTY_LIST

protected static final java.lang.String[] EMPTY_LIST
Constructor Detail

AbstractDBObjectProvider

public AbstractDBObjectProvider()
Method Detail

removeProviderListener

public final void removeProviderListener(DBObjectProviderListener list)
Removed the given listener from this provider.

Specified by:
removeProviderListener in interface DBObjectProvider
Since:
10.1.3
See Also:
DBObjectProviderListener

addProviderListener

public final void addProviderListener(DBObjectProviderListener list)
Adds the given listener to this provider to listen for provider and schema events.

Specified by:
addProviderListener in interface DBObjectProvider
Since:
10.1.3
See Also:
DBObjectProviderListener

fireProviderClosed

protected final void fireProviderClosed()
Fires a providerClosed event to all listeners.


fireProviderDeleted

public final void fireProviderDeleted()
Fires a providerClosed event to all listeners.


fireProviderOpened

protected final void fireProviderOpened()
Fires a providerOpened event to all listeners.


fireProviderReloaded

protected final void fireProviderReloaded()
Fires a providerReloaded event to all listeners.


fireSchemaAdded

protected final void fireSchemaAdded(Schema schema)
Notifies all listeners that the given Schema has been added to this provider.


fireSchemaUpdated

protected final void fireSchemaUpdated(DBObjectChange change)
Notifies all listeners of an update to a Schema. This event is not fired for objects added to or removed from the Schema.


fireSchemaObjectUpdated

protected final void fireSchemaObjectUpdated(DBObjectChange change)
Notifies all listeners of an update to a SchemaObject.


fireSchemaRemoved

protected final void fireSchemaRemoved(Schema schema)
Notifies all listeners that the given Schema has been removed from this provider.


fireObjectsAdded

public final void fireObjectsAdded(Schema schema,
                                   SchemaObject[] objs)
Notifies all listeners that objects have been added to the given schema. Internal use only.


fireObjectsRemoved

protected final void fireObjectsRemoved(Schema schema,
                                        SchemaObject[] objs)
Notifies all listeners that objects have been removed from the given schema.


schemaUpdated

protected void schemaUpdated(DBObjectChange change)
Override to implement any functionality that needs to be fired when a schema has been updated in the provider.


registerType

protected final void registerType(java.lang.String type,
                                  DBObjectBuilder builder,
                                  DBObjectValidator validator)
Registers a Builder and Validator for a specific object type. If a Builder has already been registered for the specified type, the new builder will replace the previous builder (same with validator). If either parameter is null this will not remove the builder. Use unregisterBuilder() or unregisterValidator() to do this.

Parameters:
type - a string containing the object type
builder - the Builder instance to use for the specified type
validator - the Validator instance to use for the specified type
See Also:
DBObject.getType()

registerBuilder

protected final void registerBuilder(java.lang.String type,
                                     DBObjectBuilder builder)
Registers a Builder for a specific object type. If a Builder has already been registered for the specified type, the new builder will replace the previous builder.

Parameters:
type - a string containing the object type
builder - the Builder instance to use for the specified type
See Also:
DBObject.getType()

unregisterBuilder

protected final void unregisterBuilder(java.lang.String type)
Removes a registered Builder. If no Validator is registered for this object type then the object cache for this type will be cleared.

Parameters:
type - a string containing the object type whose builder should be removed
See Also:
registerBuilder(java.lang.String, oracle.javatools.db.DBObjectBuilder), DBObject.getType()

getBuilderForType

protected DBObjectBuilder getBuilderForType(java.lang.String type)
Retrieves the DBObjectBuilder registered for a type of object.

Parameters:
type - a string containing the object type
Returns:
the DBObjectBuilder registered for the type, or null if no builder is registered

registerValidator

protected final void registerValidator(java.lang.String type,
                                       DBObjectValidator validator)
Registers a Validator for a specific object type. If a Validator has already been registered for the specified type, the new validator will replace the previous validator.

Parameters:
type - a string containing the object type
validator - the Validator instance to use for the specified type
See Also:
DBObject.getType()

unregisterValidator

protected final void unregisterValidator(java.lang.String type)
Removes a registered Validator. If no Builder is registered for this object type then the object cache for this type will be cleared.

Parameters:
type - a string containing the object type whose validator should be removed
See Also:
registerValidator(java.lang.String, oracle.javatools.db.DBObjectValidator), DBObject.getType()

getValidatorForType

protected final DBObjectValidator getValidatorForType(java.lang.String type)
Retrieves the DBObjectValidator registered for a type of object.

Parameters:
type - a string containing the object type
Returns:
the DBObjectValidator registered for the type, or null if no validator is registered

findObject

protected SchemaObject findObject(java.lang.String type,
                                  Schema schema,
                                  java.lang.String name)
Looks for the specified object in the cache.

Parameters:
type - a string containing the type of object
schema - the schema owning the object
name - a string containing the name of the object
Returns:
the previously created SchemaObject representing the specified object, or null>/code> if the object does not exist in the cache

findObject

protected final SchemaObject findObject(DBObjectID id)
Looks for the specified object id in the cache.

Parameters:
id - the id of the object
Returns:
the previously created SchemaObject representing the specified object, or null if the object does not exist in the cache

destroyCache

public void destroyCache()
Destroys the object cache. Use clearCaches() unless you are changing the supported object types.


clearCache

protected final void clearCache(java.lang.String type)
Clears the cache of objects of the specified type.

Parameters:
type - a string containing the type of object for which the cache should be cleared

clearAllCaches

protected final void clearAllCaches()
Clears all the object caches.


getObjectManager

public SchemaObjectManager getObjectManager()
Returns the object manager for dealing with dependencies in this provider.

Specified by:
getObjectManager in interface DBObjectProvider
Returns:
the SchemaObjectManager for dealing with dependencies in this provider.

createObjectManager

protected SchemaObjectManager createObjectManager()
Creates the object manager for this provider. Override if a custom object manager is needed.


cacheObject

protected void cacheObject(SchemaObject object,
                           boolean loadOperation)
Adds an object to the cache. If an object of the same type, schema, and name as the specified object is already in the cache, it will be replaced.

Parameters:
object - the SchemaObject needing to be cached
loadOperation - this is a load of the object, not a create or update.

uncacheObject

protected final void uncacheObject(SchemaObject object)
Removes an object from the cache.

Parameters:
object - the SchemaObject needing to be removed from the cache

listObjectsImpl

protected java.lang.String[] listObjectsImpl(java.lang.String type,
                                             Schema schema,
                                             java.lang.String ref)
                                      throws DBException
Retrieves the list of objects by using a registered builder. If no builder has been registered for the object type, an empty array of names will be returned. Subclasses can use this method to delegate the list of objects to builders.

Parameters:
type - a string containg the type of object to list
schema - the schema
ref - a string containing a pattern to match object names against
Returns:
an array of object names
Throws:
DBException

listObjectsImpl

protected abstract java.util.Collection<SchemaObject> listObjectsImpl(java.lang.String[] objectTypes,
                                                                      Schema schema,
                                                                      java.lang.String ref)
                                                               throws DBException
Internal listObjects implementation. All listObjects methods call through to this.

Throws:
DBException
For internal use only. Application developers should not use this

listObjectsFromCache

protected final java.util.Collection<SchemaObject> listObjectsFromCache(java.lang.String[] objectTypes,
                                                                        Schema schema,
                                                                        java.lang.String ref)
Lists the objects that are in the internal memory cache for this provider. Not really useful as a listObjectsImpl implementation as you need to list what is in the actual dictionary for that.


getObjectImpl

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

supportsTimestamps

public boolean supportsTimestamps()
Returns true if this provider supports object timestamping. An object's timestamp is set in the property map ( getProperties() ) under the TIMESTAMP_PROPERTY key.

Returns false by default.

See Also:
TIMESTAMP_PROPERTY

getTimestamp

public final java.lang.Long getTimestamp(java.lang.String type,
                                         Schema schema,
                                         java.lang.String objectName)
                                  throws DBException
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:
type - a String containing the type of the object
schema - the Schema containing the object
objectName - a String containing the name of the object
Returns:
the timestamp as a Long value
Throws:
DBException - if an error is encountered listing the objects

getTimestamp

public final java.lang.Long getTimestamp(DBObjectID id)
                                  throws DBException
Specified by:
getTimestamp in interface DBObjectProvider
Throws:
DBException

findByID

protected DBObject findByID(DBObjectID id)
                     throws DBException
Throws:
DBException

resetSchemaObject

protected void resetSchemaObject(SchemaObject object,
                                 SchemaObject listed,
                                 java.lang.Long timestamp)
If it has been noticed that the timestamp has changed on an object, or we have updated it in the database, we want to turn it back into an object that needs building again. This method resets an object back to a pre-built state.

Parameters:
object - the object we want to have cached and reset
listed - an object returned by a list/find which is potentially in the cache, and potentially has a different id.
timestamp - the timestamp for the new object (can be null)

createSchemaObjectImpl

protected SchemaObject createSchemaObjectImpl(java.lang.String type,
                                              Schema schema,
                                              java.lang.String name)
                                       throws DBException
Uses listObjectsImpl to find or create an object with the given type, schema and name. If an object exists in the cache it will be returned (assuming it still exists in the underlying provider) otherwise a new object (lazy loaded) will be created.

Throws:
DBException

isRequestedObject

protected boolean isRequestedObject(SchemaObject object,
                                    java.lang.String type,
                                    Schema schema,
                                    java.lang.String name)
Returns true if SchemaObject object is of type type, owned by schema schema, and named name. This default implementation matches name exactly. It should be overridden when a looser name match is required, e.g. Oracle database links.

Parameters:
object - the object to be matched
type - the type of the requested object
schema - the owner of the requested object
name - the name of the requested object

createByIDImpl

protected SchemaObject createByIDImpl(DBObjectID id)
                               throws DBException
Throws:
DBException

getExternalTimestamp

protected java.lang.Long getExternalTimestamp(SchemaObject object)
                                       throws DBException
Retrieves the external timestamp for the specified object. The external timestamp represents the last modification time for the object in the backend store (database, file system, or whatever else this provider is representing).

Parameters:
object -
Returns:
Throws:
DBException

markForLazyInit

protected final void markForLazyInit(AbstractSchemaObject object)

convertObject

public static java.lang.String convertObject(DBObject obj)
Converts a DBObject into a String representation of the object name.

Parameters:
obj - the DBObject
Returns:
a String representing the object name; if the object is null, an empty String is returned.

getIdentifierQuoteString

public java.lang.String getIdentifierQuoteString()
Description copied from interface: DBObjectProvider
Retrieves the string used to quote identifiers. By default, the quote string is assumed to be ". If the quoting of identifiers is not supported by a subclass, that subclass should return null.

Specified by:
getIdentifierQuoteString in interface DBObjectProvider
Returns:
the string containing the character or characters used to quote an identifier.

listObjectTypes

public java.lang.String[] listObjectTypes()
Returns a sorted array of the object types supported in this provider. If overridden the returned array must be sorted by the natural ordering of the elements (i.e. so that Arrays.binarySearch will work).

Specified by:
listObjectTypes in interface DBObjectProvider
Returns:
an array of strings containing the supported types of objects
See Also:
DBObjectProvider.listObjects(java.lang.String, oracle.javatools.db.Schema)

supportsObjectType

public boolean supportsObjectType(java.lang.String type)
Description copied from interface: DBObjectProvider
Convinience method to check whether this provider supports the given object type - i.e. whether it is contained in the array returned by listObjectTypes().

Specified by:
supportsObjectType in interface DBObjectProvider
See Also:
DBObjectProvider.listObjectTypes()

listObjects

public java.lang.String[] listObjects(java.lang.String objectType,
                                      Schema schema)
                               throws DBException
Description copied from interface: DBObjectProvider
Lists the objects of a given type available from this provider.

Specified by:
listObjects in interface DBObjectProvider
Parameters:
objectType - the type of objects to list
schema - the schema to list from
Returns:
an array of object names
Throws:
DBException

listObjects

public final java.lang.String[] listObjects(java.lang.String objectType,
                                            Schema schema,
                                            java.lang.String ref)
                                     throws DBException
Description copied from interface: DBObjectProvider
Lists the objects of a given type available from this provider.

Specified by:
listObjects in interface DBObjectProvider
Parameters:
objectType - the type of objects to list
schema - the schema to list from
ref - a pattern to match against.
Returns:
an array of object names
Throws:
DBException

listObjects

public SchemaObject[] listObjects(java.lang.String[] objectTypes,
                                  Schema schema)
                           throws DBException
Description copied from interface: DBObjectProvider
Lists the objects of multiple types available from this provider.

Specified by:
listObjects in interface DBObjectProvider
Parameters:
objectTypes - an array of Strings representing the desired types
schema - the Schema to list from
Returns:
an array of SchemaObjects representing the objects
Throws:
DBException - if an error is encountered listing the objects

listObjects

public final SchemaObject[] listObjects(java.lang.String[] objectTypes,
                                        Schema schema,
                                        java.lang.String ref)
                                 throws DBException
Description copied from interface: DBObjectProvider
Lists the objects of multiple types available from this provider.

Specified by:
listObjects in interface DBObjectProvider
Parameters:
objectTypes - an array of Strings representing the desired types
schema - the Schema to list from
ref - a pattern to match against.
Returns:
an array of SchemaObjects representing the objects
Throws:
DBException - if an error is encountered listing the objects

getObject

public SchemaObject getObject(java.lang.String objectType,
                              Schema schema,
                              java.lang.String name)
                       throws DBException
Description copied from interface: DBObjectProvider
Retrieves the SchemaObject representing a specific database object.

Specified by:
getObject in interface DBObjectProvider
Parameters:
objectType - the type of object desired.
schema - the name of the schema containing the object
name - the name of the object
Returns:
the SchemaObject matching the specified criteria
Throws:
DBException - if an error is encountered retrieving the object
See Also:
DBObject.getType()

hasPriviledge

public boolean hasPriviledge(java.lang.String type,
                             Schema schema,
                             java.lang.String priv)
Checks to see whether the user has the requisite permissions to perform the specified operation. For example, whether the user has permission to create a new table in a specific schema. The default implementation is to permit all priviledges.

Specified by:
hasPriviledge in interface DBObjectProvider
Parameters:
type - the object type on which the operation is being performed.
schema - the schema to check. A value of null checks for the current schema.
priv - a pre-defined operation.
Returns:
whether the specified operation can be completed.

createObject

public void createObject(SchemaObject obj,
                         boolean replace)
                  throws DBException
Description copied from interface: DBObjectProvider
Causes the creation of the object described by the specified meta data.

Specified by:
createObject in interface DBObjectProvider
Parameters:
obj - the SchemaObject describing the object to create.
replace - whether to replace an existing object. If replace is false and the object exists, createObject will fail.
Throws:
DBException - if an error is encountered creating the object.

deleteObject

public void deleteObject(SchemaObject obj,
                         boolean cascade)
                  throws DBException
Description copied from interface: DBObjectProvider
Deletes the object.

Specified by:
deleteObject in interface DBObjectProvider
Parameters:
obj - the object to delete
cascade - whether to delete dependent objects
Throws:
DBException - if an error is encountered performing the delete

updateObject

public void updateObject(SchemaObject oldObject,
                         SchemaObject newObject)
                  throws DBException
Description copied from interface: DBObjectProvider
Updates the definition of an object.

Specified by:
updateObject in interface DBObjectProvider
Parameters:
oldObject - the old version of the object
newObject - the new version of the object
Throws:
DBException - if the update fails

updateObjects

public void updateObjects(SchemaObject[] oldObjects,
                          SchemaObject[] newObjects)
                   throws DBException
Description copied from interface: DBObjectProvider
Updates the definition of a set of objects.

Specified by:
updateObjects in interface DBObjectProvider
Throws:
DBException - if the update fails

getPropertyManager

public PropertyManager getPropertyManager()
Returns the PropertyManager implementation for this provider. Will promote to DBObjectProvider when the PropertyManager API is finalised.


getCasePolicy

protected final int getCasePolicy()
Retrieves the provider's case policy for unquoted names.

Returns:
the Database's case policy for unquoted names.
See Also:
LOWER_CASE_NAME_POLICY, MIXED_CASE_NAME_POLICY, UPPER_CASE_NAME_POLICY, CASE_SENSITIVE_NAME_POLICY

getQuotedNameCasePolicy

protected final int getQuotedNameCasePolicy()
Retrieves the provider's case policy for quoted names.

Returns:
the Database's case policy for quoted names.
See Also:
LOWER_CASE_NAME_POLICY, MIXED_CASE_NAME_POLICY, UPPER_CASE_NAME_POLICY, CASE_SENSITIVE_NAME_POLICY

isValidName

@Deprecated
public final boolean isValidName(java.lang.String name)
Deprecated. - use isValidName( String type, String name )

Checks to see whether a name is valid. Note that a valid name does not guarantee uniqueness. The default implementation is allow all names.

Specified by:
isValidName in interface DBObjectProvider
Parameters:
name - the name to check
Returns:
whether the name is valid
See Also:
DBObjectProvider.isValidName(java.lang.String, java.lang.String)

isValidName

public final boolean isValidName(java.lang.String type,
                                 java.lang.String name)
Checks to see whether a name is valid. Note that a valid name does not guarantee uniqueness. The default implementation is allow all names.

Specified by:
isValidName in interface DBObjectProvider
Parameters:
name - the name to check
type - the type of object the name is intended for
Returns:
whether the name is valid

validateName

@Deprecated
public final void validateName(java.lang.String name)
                        throws InvalidNameException
Deprecated. - use validateName( String type, String name )

Checks to see whether a name is valid. Note that a valid name does not guarantee uniqueness. Override validateName( String type, String name ) to customise validation.

Specified by:
validateName in interface DBObjectProvider
Parameters:
name - the name to check
Throws:
InvalidNameException - with appropriate message if the name is invalid.
See Also:
DBObjectProvider.validateName(java.lang.String, java.lang.String)

validateName

public final void validateName(java.lang.String type,
                               java.lang.String name)
                        throws InvalidNameException
Checks to see whether a name is valid. Note that a valid name does not guarantee uniqueness. The default implementation is allow all names.

Specified by:
validateName in interface DBObjectProvider
Parameters:
type - the type of object the name is itended for
name - the name to check
Throws:
InvalidNameException - with appropriate message if the name is invalid.

quoteIdentifier

public final java.lang.String quoteIdentifier(java.lang.String internalName,
                                              boolean force)
                                       throws DBException
Determines if internalName needs quoting to make it a valid external name, and if so returns a quoted copy of it. If it doesn't need quoting, it returns the name unquoted. If internalName is empty, or quoted names aren't supported by the provider and the name isn't valid, it returns null.

Specified by:
quoteIdentifier in interface DBObjectProvider
Parameters:
internalName -
force - Always quote the name
Returns:
Throws:
DBException

getInternalName

public final java.lang.String getInternalName(java.lang.String name,
                                              java.lang.String objectType)
Description copied from interface: DBObjectProvider
Converts the specified name into the format used internally within the metadata. Generally, internal names are not quoted; quoted names have the quotes removed. Unquoted names may be converted to a single case if the underlying provider does not support mixed case identifiers.

Specified by:
getInternalName in interface DBObjectProvider
Parameters:
name - a String containing the name to convert
objectType - a String containing the type of object being named
Returns:
the internal version of the name

getInternalName

public final java.lang.String getInternalName(java.lang.String name)
Description copied from interface: DBObjectProvider
Converts the specified name into the format used internally within the metadata. Generally, internal names are not quoted; quoted names have the quotes removed. Unquoted names may be converted to a single case if the underlying provider does not support mixed case identifiers.

Specified by:
getInternalName in interface DBObjectProvider
Parameters:
name - a String containing the name to convert
Returns:
the internal version of the name

getExternalName

public final java.lang.String getExternalName(java.lang.String name,
                                              java.lang.String objectType)
Description copied from interface: DBObjectProvider
Converts the specified name into the format used externally to represent the identifier. In most case, this is equivalent to calling quoteIdentifier, specifying false for the force argument. Note, however, that exceptions are not thrown; rather, the original name will be returned.

Specified by:
getExternalName in interface DBObjectProvider
Parameters:
name - a String containing the name to externalize
objectType - a String containing the type of object being named
Returns:
a String containing the externalized name

getExternalName

public final java.lang.String getExternalName(java.lang.String name)
Description copied from interface: DBObjectProvider
Converts the specified name into the format used externally to represent the identifier. In most case, this is equivalent to calling quoteIdentifier, specifying false for the force argument. Note, however, that exceptions are not thrown; rather, the original name will be returned.

Specified by:
getExternalName in interface DBObjectProvider
Parameters:
name - a String containing the name to externalize
Returns:
a String containing the externalized name

listSupportedDataTypes

public DataType[] listSupportedDataTypes()
Description copied from interface: DBObjectProvider
Retrieves the list of datatypes supported by this provider.

Specified by:
listSupportedDataTypes in interface DBObjectProvider
Returns:
an array of DataType objects representing the supported datatypes.

getDataType

public DataType getDataType(java.lang.String typeName)
Description copied from interface: DBObjectProvider
Retrieves the datatype represented by a specific name.

Specified by:
getDataType in interface DBObjectProvider
Parameters:
typeName - a String containing the name of the datatype.
Returns:
the DataType represented by the specified name or null if none can be found.

getOrCreateDataType

public DataType getOrCreateDataType(java.lang.String typeName)
Description copied from interface: DBObjectProvider
Retrieves the datatype represented by a specific name.

Specified by:
getOrCreateDataType in interface DBObjectProvider
Parameters:
typeName - a String containing the name of the datatype.
Returns:
the DataType represented by the specified name. If none can be found, creates a UserDataType and registers this with the provider.

validateObject

public void validateObject(DBObject object)
                    throws ValidationException
Validates the given object using the DBObjectValidator registered against that object's type. A ValidationException is thrown if the object fails to validate, or if no DBObjectValidator is registered for that object type.

Specified by:
validateObject in interface DBObjectProvider
Parameters:
object - The object to validate
Throws:
ValidationException - if the object is not valid. The exception will describe the validation failure. A MissingValidatorException is thrown if the provider has no validator for the given object type.

validateObject

@Deprecated
public final void validateObject(DBObject object,
                                            java.lang.String property)
                          throws ValidationException
Deprecated. 

Specified by:
validateObject in interface DBObjectProvider
Throws:
ValidationException

validateObjectProperty

public void validateObjectProperty(DBObject object,
                                   java.lang.Object property)
                            throws ValidationException
Description copied from interface: DBObjectProvider
Checks to see if the children of a given object are valid. If the object has no children of the given type a MissingValidatorException will be thrown. This is a convinience method to perform validation to a specific property on an object - all properties will be validated if DBObjectProvider.validateObject(DBObject) is called.

Specified by:
validateObjectProperty in interface DBObjectProvider
Parameters:
object - The object to validate
property - An identifier for a specific property to validate
Throws:
ValidationException - if the object is not valid. The exception will describe the validation failure. A MissingValidatorException is thrown if the provider has no validator for the given object type, or property.

validateSchema

@Deprecated
public void validateSchema(Schema schema)
                    throws ValidationException
Deprecated. - use validateObject( DBObject object )

Description copied from interface: DBObjectProvider
Checks to see if the Schema is valid.

Specified by:
validateSchema in interface DBObjectProvider
Parameters:
schema - The Schema to validate
Throws:
ValidationException - if the Schema is not valid. The exception will describe the validation failure.

validateObject

public void validateObject(DBObject original,
                           DBObject update)
                    throws ValidationException
Validates the given object update using the DBObjectValidator registered against that object's type. A ValidationException is thrown if the update fails to validate, or if no DBObjectValidator is registered for that object type.

Specified by:
validateObject in interface DBObjectProvider
Throws:
ValidationException - if the updated object is not valid. The exception will describe the validation failure. A MissingValidatorException is thrown if the provider has no validator for the given object type.

validateObject

@Deprecated
public final void validateObject(DBObject original,
                                            DBObject update,
                                            java.lang.String property)
                          throws ValidationException
Deprecated. 

Specified by:
validateObject in interface DBObjectProvider
Throws:
ValidationException

validateObjectProperty

public void validateObjectProperty(DBObject original,
                                   DBObject update,
                                   java.lang.Object property)
                            throws ValidationException
Description copied from interface: DBObjectProvider
Checks to see if the updated children of a given object are valid. If the object has no children of the given type a MissingValidatorException will be thrown. This is a convinience method to perform validation to a specific property on an object - all properties will be validated if DBObjectProvider.validateObject(DBObject,DBObject) is called.

Specified by:
validateObjectProperty in interface DBObjectProvider
Parameters:
original - The original version of the edited object
update - The edited object to validate
property - An identifier for a specific property to validate
Throws:
ValidationException - if the object is not valid. The exception will describe the validation failure. A MissingValidatorException is thrown if the provider has no validator for the given object type, or property.

validateSchema

@Deprecated
public void validateSchema(Schema original,
                                      Schema update)
                    throws ValidationException
Deprecated. use validateObject( DBObject original, DBObject update )

Description copied from interface: DBObjectProvider
Checks to see if the schema update is valid.

Specified by:
validateSchema in interface DBObjectProvider
Throws:
ValidationException - if the updated schema is not valid. The exception will describe the validation failure.

validateUniqueName

public void validateUniqueName(java.lang.String type,
                               DBObject contextObject,
                               java.lang.String name)
                        throws NameInUseException
Validates that a name is not used within the context DBObject, and throws NameInUseException if it is. This default implementation throws the exception if : 1. type is a SchemaObject and name matches the name of one of contextObject's owned objects. 2. type is an Index and name matches the name of an index of one of contextObject's owned objects. 3. type is a Constraint and name matches the name of a contraint of one of contextObject's owned objects. In all cases NameInUseException.getUserObject() will return the matching owned object.

Specified by:
validateUniqueName in interface DBObjectProvider
Parameters:
type - : the type of name being validated
contextObject - : the database object context to use when determining the uniqueness of the name
name - : the name to be checked
Throws:
NameInUseException

getUniqueName

public java.lang.String getUniqueName(java.lang.String type,
                                      DBObject contextObject,
                                      java.lang.String base)
Returns a unique name for an object of given type within contextObject using base name. This default implementation ensures that you cannot have two SchemaObjects of any type with the same name, two indexes with the same name or two constraints with the same name, within contextObject.

Specified by:
getUniqueName in interface DBObjectProvider
Parameters:
type - is the type of object to get the name for
contextObject - is the database object context to use when determining the uniqueness of the name
base - is the base name to use. If base is null or zero length, the type name suffixed with 1 is used.
Returns:
a unique name for the given object type.

normaliseType

protected java.lang.String normaliseType(java.lang.String type)

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

getLogger

protected java.util.logging.Logger getLogger()
Gets the logger to use in this provider.


logEvent

protected void logEvent(java.lang.String msg,
                        java.lang.Object... params)
Use to log provider events.


getName

protected abstract java.lang.String getName()
Returns an identifier for this provider.


isEditable

public boolean isEditable(DBObject object)
Description copied from interface: DBObjectProvider
Returns whether or not the object can be edited

Specified by:
isEditable in interface DBObjectProvider

getDefaultTemplateForType

public SchemaObject getDefaultTemplateForType(java.lang.String type)
Returns the default template object for the given type, or null if none defined

Specified by:
getDefaultTemplateForType in interface DBObjectProvider

setDefaultTemplateForType

public void setDefaultTemplateForType(java.lang.String type,
                                      SchemaObject template)
Sets the default template object for the given type. Default (online) implementation throws a RuntimeException.

Specified by:
setDefaultTemplateForType in interface DBObjectProvider

isNewFromTemplateType

public boolean isNewFromTemplateType(java.lang.String type)
Specified by:
isNewFromTemplateType in interface DBObjectProvider

registerExpanders

protected abstract void registerExpanders()

registerSchemaObjectExpander

protected void registerSchemaObjectExpander(SchemaObjectExpander expander)

getSchemaObjectExpanders

protected SchemaObjectExpander[] getSchemaObjectExpanders()

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

E13403-02

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