Extension SDK 10.1.3.36.73

oracle.javatools.db
Class AbstractDBObjectProvider

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

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
protected static java.lang.String[] EMPTY_LIST
           
protected static int LOWER_CASE_NAME_POLICY
           
protected static int MIXED_CASE_NAME_POLICY
           
static java.lang.String TIMESTAMP_PROPERTY
           
protected static int UPPER_CASE_NAME_POLICY
           
 
Fields inherited from interface oracle.javatools.db.DBObjectProvider
CREATE_PRIVILEDGE, DELETE_PRIVILEDGE, MODIFY_PRIVILEDGE
 
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)
          Adds an object to the cache.
abstract  boolean canCreate(Schema schema, boolean replace)
          Whether an attempt to create the specified schema is likely to succeed.
abstract  boolean canCreate(SchemaObject object, boolean replace)
          Whether an attempt to create the specified object is likely to succeed.
abstract  boolean canDelete(Schema schema, boolean cascade)
          Checks to see whether a specific schema can be deleted.
abstract  boolean canDelete(SchemaObject object, boolean cascade)
          Checks to see whether a specific object can be deleted.
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  java.lang.String convertToExternal(java.lang.String name)
           
protected  java.lang.String convertToInternal(java.lang.String name)
           
protected  SchemaObject createByIDImpl(DBObjectID id)
           
abstract  void createObject(SchemaObject object, boolean replace)
          Causes the creation of the object described by the specified meta data.
protected  SchemaObjectManager createObjectManager()
          Creates the object manager for this provider.
abstract  void createObjects(SchemaObject[] objects, boolean replace)
          Causes the creation of the objects described by the specified meta data.
abstract  void createSchema(Schema schema, boolean replace)
          Causes the creation of a new Schema in the persistent storage.
protected  SchemaObject createSchemaObjectImpl(java.lang.String type, Schema schema, java.lang.String name)
           
abstract  void deleteObject(SchemaObject object, boolean cascade)
          Deletes the object.
abstract  void deleteObjects(SchemaObject[] objects, boolean cascade)
          Deletes the objects.
abstract  void deleteSchema(Schema schema, boolean cascade)
          Deletes the schema.
 void destroyCache()
          Destroys the object cache.
protected  DBObject findByID(DBObjectID id)
           
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.
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 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 abstract  int getCasePolicy()
          Retrieves the case policy in effect for this Database.
 DataType getDataType(java.lang.String typeName)
          Retrieves the datatype represented by a specific name.
 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.
 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 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)
           
protected  SchemaObjectManager getObjectManager()
          Returns the object manager for dealing with dependencies in this provider.
abstract  Schema getSchema(java.lang.String name)
          Retrieves the Schema object associated with a specific name.
 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 an DBObject using the base name provided.
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 isValidName(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  SchemaObject[] listObjectsImpl(java.lang.String[] objectTypes, Schema schema, java.lang.String ref)
           
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()
          Lists the database object types supported by this DBObjectProvider.
abstract  Schema[] listSchemas()
          Retrieves the list of schemas available from this provider.
 DataType[] listSupportedDataTypes()
          Retrieves the list of datatypes supported by this provider.
protected  void markForLazyInit(AbstractSchemaObject object)
           
protected  boolean needsQuoting(java.lang.String name)
           
protected  java.lang.String normaliseType(java.lang.String type)
           
 java.lang.String quoteIdentifier(java.lang.String name, boolean force)
          Quotes the specified identifier name, if needed.
 void registerBuilder(java.lang.String type, DBObjectBuilder builder)
          Registers a Builder for a specific object type.
 void registerType(java.lang.String type, DBObjectBuilder builder, DBObjectValidator validator)
          Registers a Builder and Validator for a specific object type.
 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 schemaUpdated(DBObjectChange change)
          Override to implement any functionality that needs to be fired when a schema has been updated in the provider.
protected  void uncacheObject(SchemaObject object)
          Removes an object from the cache.
 void unregisterBuilder(java.lang.String type)
          Removes a registered Builder.
 void unregisterValidator(java.lang.String type)
          Removes a registered Validator.
abstract  void updateObject(SchemaObject oldObject, SchemaObject newObject)
          Updates the definition of an object.
abstract  void updateObjects(SchemaObject[] oldObjects, SchemaObject[] newObjects)
          Updates the definition of a set of objects.
abstract  void updateSchema(Schema oldOSchema, Schema newSchema)
          Updates the definition of a Schema.
 void validateName(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 childType)
          Checks to see if the updated children of a given object are valid.
 void validateObject(DBObject object, java.lang.String childType)
          Checks to see if the children of a given object are valid.
 void validateSchema(Schema schema)
          Checks to see if the Schema is valid.
 void validateSchema(Schema original, Schema update)
          Checks to see if the schema update is valid.
 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
getDefaultSchema, getTimestamp
 

Field Detail

MIXED_CASE_NAME_POLICY

protected static final int MIXED_CASE_NAME_POLICY
See Also:
Constant Field Values

LOWER_CASE_NAME_POLICY

protected static final int LOWER_CASE_NAME_POLICY
See Also:
Constant Field Values

UPPER_CASE_NAME_POLICY

protected static final int UPPER_CASE_NAME_POLICY
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.


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.


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.


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.


registerType

public 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

public 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

public 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

public 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

public 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 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 final 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

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

protected SchemaObjectManager getObjectManager()
Returns the object manager 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 final void cacheObject(SchemaObject object)
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

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 SchemaObject[] listObjectsImpl(java.lang.String[] objectTypes,
                                         Schema schema,
                                         java.lang.String ref)
                                  throws DBException
Throws:
DBException

getObjectImpl

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

findByID

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

createSchemaObjectImpl

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

createByIDImpl

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

markForLazyInit

protected final void markForLazyInit(AbstractSchemaObject object)

getCasePolicy

protected abstract int getCasePolicy()
Retrieves the case policy in effect for this Database.

Returns:
the Database's case policy
See Also:
LOWER_CASE_NAME_POLICY, MIXED_CASE_NAME_POLICY, UPPER_CASE_NAME_POLICY

needsQuoting

protected boolean needsQuoting(java.lang.String name)

convertObject

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

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()
Description copied from interface: DBObjectProvider
Lists the database object types supported by this DBObjectProvider. These types can then be used with listObjects to retrieve the objects of a given type.

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)

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.

isValidName

public boolean isValidName(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
Returns:
whether the name is valid

validateName

public void validateName(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:
name - the name to check
Returns:
1 if name is valid, or a negative error code
Throws:
InvalidNameException

quoteIdentifier

public java.lang.String quoteIdentifier(java.lang.String name,
                                        boolean force)
                                 throws DBException
Description copied from interface: DBObjectProvider
Quotes the specified identifier name, if needed.

Specified by:
quoteIdentifier in interface DBObjectProvider
Parameters:
name - the name to quote
force - whether to quote even if the identifier is valid already.
Returns:
the quoted name
Throws:
DBException - if the name when quoted is still invalid

getInternalName

public 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 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

convertToInternal

protected java.lang.String convertToInternal(java.lang.String name)

getExternalName

public 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 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

convertToExternal

protected java.lang.String convertToExternal(java.lang.String 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.

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

public void validateObject(DBObject object,
                           java.lang.String childType)
                    throws ValidationException
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 child set of an object - child objects are automatically validated if the parent is validated.

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.

validateSchema

public void validateSchema(Schema schema)
                    throws ValidationException
Deprecated. - use validatObject( 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

public void validateObject(DBObject original,
                           DBObject update,
                           java.lang.String childType)
                    throws ValidationException
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 child set of an object - child objects are automatically validated if the parent is validated.

Specified by:
validateObject in interface DBObjectProvider
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.

validateSchema

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 an DBObject using the base name provided. 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)

getName

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


canCreate

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

Specified by:
canCreate in interface DBObjectProvider
Parameters:
object - the SchemaObject 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.

createObject

public abstract void createObject(SchemaObject object,
                                  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:
object - 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.

createObjects

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

Specified by:
createObjects in interface DBObjectProvider
Parameters:
objects - the SchemaObject[] 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.

canDelete

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

Specified by:
canDelete in interface DBObjectProvider
Parameters:
object - the object to check
cascade - whether to assume a cascading delete should be used.
Returns:
whether the delete, if attempted, would succeed.

deleteObject

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

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

deleteObjects

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

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

updateObject

public abstract 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 abstract 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

listSchemas

public abstract Schema[] listSchemas()
                              throws DBException
Description copied from interface: DBObjectProvider
Retrieves the list of schemas available from this provider.

Specified by:
listSchemas in interface DBObjectProvider
Returns:
an array of schemas
Throws:
DBException

getSchema

public abstract Schema getSchema(java.lang.String name)
                          throws DBException
Description copied from interface: DBObjectProvider
Retrieves the Schema object associated with a specific name.

Specified by:
getSchema in interface DBObjectProvider
Parameters:
name - a string containing the name of the schema
Returns:
a Schema representing the schema
Throws:
DBException - if an error is encountered getting the schema

canCreate

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

Specified by:
canCreate in interface DBObjectProvider
Parameters:
schema - the Schema describing the object to create
replace - whether to replace an existing schema. If replace is false and the schema exists, canCreate must return false.
Returns:
whether the create will succeed.

createSchema

public abstract 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
Parameters:
schema - the schema being created
replace - whether to replace an existing schema
Throws:
DBException - if an error is encountered creating the schema

canDelete

public abstract boolean canDelete(Schema schema,
                                  boolean cascade)
Description copied from interface: DBObjectProvider
Checks to see whether a specific schema can be deleted.

Specified by:
canDelete in interface DBObjectProvider
Parameters:
schema - the object to check
cascade - whether to assume a cascading delete should be used.
Returns:
whether the delete, if attempted, would succeed.

deleteSchema

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

Specified by:
deleteSchema in interface DBObjectProvider
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 abstract void updateSchema(Schema oldOSchema,
                                  Schema newSchema)
                           throws DBException
Description copied from interface: DBObjectProvider
Updates the definition of a Schema.

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

Extension SDK 10.1.3.36.73

 

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