Extension SDK 9.0.5

oracle.jdeveloper.cm.ds.db
Interface DBObjectProvider

All Known Subinterfaces:
Database
All Known Implementing Classes:
AbstractDatabase, AbstractDBObjectProvider

public interface DBObjectProvider

The DBObjectProvider interface provides clients with access to database objects. Depending on the implementation, these objects may be defined in an existing database or locally.

The services provided by DBObjectProvider include:


Field Summary
static java.lang.String CREATE_PRIVILEDGE
          Permission to create an object.
static java.lang.String DELETE_PRIVILEDGE
          Permission to delete an object.
static java.lang.String MODIFY_PRIVILEDGE
          Permission to modify an object.
 
Method Summary
 boolean canCreate(Schema schema, boolean replace)
          Whether an attempt to create the specified schema is likely to succeed.
 boolean canCreate(SchemaObject object, boolean replace)
          Whether an attempt to create the specified object is likely to succeed.
 boolean canDelete(Schema schema, boolean cascade)
          Checks to see whether a specific schema can be deleted.
 boolean canDelete(SchemaObject object, boolean cascade)
          Checks to see whether a specific object can be deleted.
 void createObject(SchemaObject object, boolean replace)
          Causes the creation of the object described by the specified meta data.
 void createObjects(SchemaObject[] objects, boolean replace)
          Causes the creation of the objects described by the specified meta data.
 void createSchema(Schema schema, boolean replace)
          Causes the creation of a new Schema in the persistent storage.
 void deleteObject(SchemaObject object, boolean cascade)
          Deletes the object.
 void deleteObjects(SchemaObject[] objects, boolean cascade)
          Deletes the objects.
 void deleteSchema(Schema schema, boolean cascade)
          Deletes the schema.
 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.
 SchemaObject getObject(java.lang.String objectType, Schema schema, java.lang.String name)
          Retrieves the SchemaObject representing a specific database object.
 Schema getSchema(java.lang.String name)
          Retrieves the Schema object associated with a specific name.
 java.lang.String getUniqueName(java.lang.String type, Schema schema, java.lang.String base)
          Retrieves a unique name for an object of a specific type.
 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.
 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.
 java.lang.String[] listObjectTypes()
          Lists the database object types supported by this DBObjectProvider.
 Schema[] listSchemas()
          Retrieves the list of schemas available from this provider.
 DataType[] listSupportedDataTypes()
          Retrieves the list of datatypes supported by this provider.
 java.lang.String quoteIdentifier(java.lang.String name, boolean force)
          Quotes the specified identifier name, if needed.
 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 updateSchema(Schema oldSchema, Schema newSchema)
          Updates the definition of a Schema.
 void validateObject(SchemaObject object)
          Checks to see if the object is valid.
 void validateObject(SchemaObject original, SchemaObject updated)
          Checks to see if the object update is valid.
 

Field Detail

CREATE_PRIVILEDGE

public static final java.lang.String CREATE_PRIVILEDGE
Permission to create an object.

See Also:
hasPriviledge(java.lang.String, oracle.jdeveloper.cm.ds.db.Schema, java.lang.String), Constant Field Values

DELETE_PRIVILEDGE

public static final java.lang.String DELETE_PRIVILEDGE
Permission to delete an object.

See Also:
hasPriviledge(java.lang.String, oracle.jdeveloper.cm.ds.db.Schema, java.lang.String), Constant Field Values

MODIFY_PRIVILEDGE

public static final java.lang.String MODIFY_PRIVILEDGE
Permission to modify an object.

See Also:
hasPriviledge(java.lang.String, oracle.jdeveloper.cm.ds.db.Schema, java.lang.String), Constant Field Values
Method Detail

canCreate

public boolean canCreate(SchemaObject object,
                         boolean replace)
Whether an attempt to create the specified object is likely to succeed.

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 void createObject(SchemaObject object,
                         boolean replace)
                  throws DBException
Causes the creation of the object described by the specified meta data.

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 void createObjects(SchemaObject[] objects,
                          boolean replace)
                   throws DBException
Causes the creation of the objects described by the specified meta data.

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.

deleteObject

public void deleteObject(SchemaObject object,
                         boolean cascade)
                  throws DBException
Deletes the object.

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

deleteObjects

public void deleteObjects(SchemaObject[] objects,
                          boolean cascade)
                   throws DBException
Deletes the objects.

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

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.

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.

getUniqueName

public java.lang.String getUniqueName(java.lang.String type,
                                      Schema schema,
                                      java.lang.String base)
Retrieves a unique name for an object of a specific type.

Parameters:
type - the type of object to get the name for
schema - a string containing the schema to use when determining the uniqueness of the name
base - the base name to use.
Returns:
a unique name for the given object type.

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.

Parameters:
name - the name to check
Returns:
whether the name is valid

quoteIdentifier

public java.lang.String quoteIdentifier(java.lang.String name,
                                        boolean force)
                                 throws DBException
Quotes the specified identifier name, if needed.

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)
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.

Parameters:
name - a String containing the name to convert
Returns:
the internal version of the name

getInternalName

public java.lang.String getInternalName(java.lang.String name,
                                        java.lang.String objectType)
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.

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

getExternalName

public java.lang.String getExternalName(java.lang.String name)
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.

Parameters:
name - a String containing the name to externalize
Returns:
a String containing the externalized name

getExternalName

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

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

getIdentifierQuoteString

public java.lang.String getIdentifierQuoteString()
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.

Returns:
the string containing the character or characters used to quote an identifier.

canDelete

public boolean canDelete(SchemaObject object,
                         boolean cascade)
Checks to see whether a specific object can be deleted.

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

validateObject

public void validateObject(SchemaObject object)
                    throws ValidationException
Checks to see if the object is valid.

Parameters:
object - The object to validate
Throws:
ValidationException - if the object is not valid. The exception will describe the validation failure.

validateObject

public void validateObject(SchemaObject original,
                           SchemaObject updated)
                    throws ValidationException
Checks to see if the object update is valid.

Throws:
ValidationException - if the updated object is not valid. The exception will describe the validation failure.

getObject

public SchemaObject getObject(java.lang.String objectType,
                              Schema schema,
                              java.lang.String name)
                       throws DBException
Retrieves the SchemaObject representing a specific database object.

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()

updateObject

public void updateObject(SchemaObject oldObject,
                         SchemaObject newObject)
                  throws DBException
Updates the definition of an object.

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
Updates the definition of a set of objects.

Throws:
DBException - if the update fails

listObjects

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

Parameters:
objectType - the type of objects to list
schema - the schema to list from
Returns:
an array of object names
Throws:
DBException

listObjects

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

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

listObjectTypes

public java.lang.String[] listObjectTypes()
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.

Returns:
an array of strings containing the supported types of objects
See Also:
listObjects(java.lang.String, oracle.jdeveloper.cm.ds.db.Schema)

listSupportedDataTypes

public DataType[] listSupportedDataTypes()
Retrieves the list of datatypes supported by this provider.

Returns:
an array of DataType objects representing the supported datatypes.

getDataType

public DataType getDataType(java.lang.String typeName)
Retrieves the datatype represented by a specific name.

Parameters:
typeName - a String containing the name of the datatype.
Returns:
the DataType represented by the specified name.

listSchemas

public Schema[] listSchemas()
                     throws DBException
Retrieves the list of schemas available from this provider.

Returns:
an array of schemas
Throws:
DBException

getSchema

public Schema getSchema(java.lang.String name)
                 throws DBException
Retrieves the Schema object associated with a specific name.

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 boolean canCreate(Schema schema,
                         boolean replace)
Whether an attempt to create the specified schema is likely to succeed.

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 void createSchema(Schema schema,
                         boolean replace)
                  throws DBException
Causes the creation of a new Schema in the persistent storage.

Parameters:
schema - the schema being created
replace - whether to replace an existing schema
Throws:
DBException - if an error is encountered creating the schema

updateSchema

public void updateSchema(Schema oldSchema,
                         Schema newSchema)
                  throws DBException
Updates the definition of a Schema.

Parameters:
oldSchema - the old version of the schema
newSchema - the new version of the schema
Throws:
DBException - if the update fails

canDelete

public boolean canDelete(Schema schema,
                         boolean cascade)
Checks to see whether a specific schema can be deleted.

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 void deleteSchema(Schema schema,
                         boolean cascade)
                  throws DBException
Deletes the schema.

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

Extension SDK

 

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