|
Extension SDK 9.0.5 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.jdeveloper.cm.ds.db.AbstractDBObjectProvider
Provides a base implementation of the DBObjectProvider
interface. AbstractDBObjectProvider
provides support for
registering DBObjectBuilder
instances for building specific
types of DBObject
s. 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.
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.jdeveloper.cm.ds.db.DBObjectProvider |
CREATE_PRIVILEDGE, DELETE_PRIVILEDGE, MODIFY_PRIVILEDGE |
Constructor Summary | |
AbstractDBObjectProvider()
|
Method Summary | |
protected void |
addDataType(DataType type)
Adds a supported datatype. |
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 objec name. |
protected java.lang.String |
convertToExternal(java.lang.String name)
|
protected java.lang.String |
convertToInternal(java.lang.String name)
|
abstract void |
createObject(SchemaObject object,
boolean replace)
Causes the creation of the object described by the specified meta data. |
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. |
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. |
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. |
protected DataType |
findSupportedDataType(java.lang.String typeName)
|
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. |
SchemaObject |
getObject(java.lang.String objectType,
Schema schema,
java.lang.String name)
Retrieves the SchemaObject representing a specific database object. |
abstract Schema |
getSchema(java.lang.String name)
Retrieves the Schema object associated with a specific name. |
abstract 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. |
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. |
protected void |
initializeDataTypes(DataType[] types)
Initialized the list of supported DataTypes. |
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. |
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 boolean |
needsQuoting(java.lang.String name)
|
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 |
registerValidator(java.lang.String type,
DBObjectValidator validator)
Registers a Validator for a specific object type. |
protected void |
removeDataType(DataType type)
Removes a supported datatype. |
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 |
validateObject(SchemaObject object)
Validates the given object using the DBObjectValidator registered against that object's type. |
void |
validateObject(SchemaObject original,
SchemaObject update)
Validates the given object update using the DBObjectValidator registered against that object's type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int MIXED_CASE_NAME_POLICY
protected static final int LOWER_CASE_NAME_POLICY
protected static final int UPPER_CASE_NAME_POLICY
public static final java.lang.String TIMESTAMP_PROPERTY
protected static final java.lang.String[] EMPTY_LIST
Constructor Detail |
public AbstractDBObjectProvider()
Method Detail |
public void registerBuilder(java.lang.String type, DBObjectBuilder builder)
type
- a string containing the object typebuilder
- the Builder instance to use for the specified typeDBObject.getType()
public void unregisterBuilder(java.lang.String type)
type
- a string containing the object type whose builder should
be removedregisterBuilder(java.lang.String, oracle.jdeveloper.cm.ds.db.DBObjectBuilder)
,
DBObject.getType()
protected DBObjectBuilder getBuilderForType(java.lang.String type)
type
- a string containing the object type
null
if no builder is registeredpublic void registerValidator(java.lang.String type, DBObjectValidator validator)
type
- a string containing the object typevalidator
- the Validator instance to use for the specified typeDBObject.getType()
public void unregisterValidator(java.lang.String type)
type
- a string containing the object type whose validator should
be removedregisterValidator(java.lang.String, oracle.jdeveloper.cm.ds.db.DBObjectValidator)
,
DBObject.getType()
protected DBObjectValidator getValidatorForType(java.lang.String type)
type
- a string containing the object type
null
if no validator is registeredprotected final SchemaObject findObject(java.lang.String type, Schema schema, java.lang.String name)
type
- a string containing the type of objectschema
- the schema owning the objectname
- a string containing the name of the object
SchemaObject
representing
the specified object, or null>/code> if the object does
not exist in the cache
protected final void clearCache(java.lang.String type)
type
- a string containing the type of object for which the
cache should be clearedprotected final void clearAllCaches()
protected final void cacheObject(SchemaObject object)
object
- the SchemaObject needing to be cachedprotected final void uncacheObject(SchemaObject object)
object
- the SchemaObject needing to be removed from the cacheprotected final void initializeDataTypes(DataType[] types)
types
- the list of supported DataTypesprotected final void addDataType(DataType type)
type
- the DataType to addprotected final void removeDataType(DataType type)
type
- the DataType to removeprotected final DataType findSupportedDataType(java.lang.String typeName)
protected final java.lang.String[] listObjectsImpl(java.lang.String type, Schema schema, java.lang.String ref) throws DBException
type
- a string containg the type of object to listschema
- the schemaref
- a string containing a pattern to match object names against
DBException
protected abstract int getCasePolicy()
LOWER_CASE_NAME_POLICY
,
MIXED_CASE_NAME_POLICY
,
UPPER_CASE_NAME_POLICY
protected boolean needsQuoting(java.lang.String name)
public static java.lang.String convertObject(DBObject obj)
null
, an empty String is returned.public java.lang.String getIdentifierQuoteString()
DBObjectProvider
null
.
getIdentifierQuoteString
in interface DBObjectProvider
public java.lang.String[] listObjectTypes()
DBObjectProvider
listObjectTypes
in interface DBObjectProvider
DBObjectProvider.listObjects(java.lang.String, oracle.jdeveloper.cm.ds.db.Schema)
public java.lang.String[] listObjects(java.lang.String objectType, Schema schema) throws DBException
DBObjectProvider
listObjects
in interface DBObjectProvider
objectType
- the type of objects to listschema
- the schema to list from
DBException
public java.lang.String[] listObjects(java.lang.String objectType, Schema schema, java.lang.String ref) throws DBException
DBObjectProvider
listObjects
in interface DBObjectProvider
objectType
- the type of objects to listschema
- the schema to list fromref
- a pattern to match against.
DBException
public SchemaObject getObject(java.lang.String objectType, Schema schema, java.lang.String name) throws DBException
DBObjectProvider
getObject
in interface DBObjectProvider
objectType
- the type of object desired.schema
- the name of the schema containing the objectname
- the name of the object
DBException
- if an error is encountered retrieving the objectDBObject.getType()
public boolean hasPriviledge(java.lang.String type, Schema schema, java.lang.String priv)
hasPriviledge
in interface DBObjectProvider
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.
public boolean isValidName(java.lang.String name)
isValidName
in interface DBObjectProvider
name
- the name to check
public java.lang.String quoteIdentifier(java.lang.String name, boolean force) throws DBException
DBObjectProvider
quoteIdentifier
in interface DBObjectProvider
name
- the name to quoteforce
- whether to quote even if the identifier is valid already.
DBException
- if the name when quoted is still invalidpublic java.lang.String getInternalName(java.lang.String name, java.lang.String objectType)
DBObjectProvider
getInternalName
in interface DBObjectProvider
name
- a String containing the name to convertobjectType
- a String containing the type of object being named
public java.lang.String getInternalName(java.lang.String name)
DBObjectProvider
getInternalName
in interface DBObjectProvider
name
- a String containing the name to convert
protected java.lang.String convertToInternal(java.lang.String name)
public java.lang.String getExternalName(java.lang.String name, java.lang.String objectType)
DBObjectProvider
quoteIdentifier
, specifying false
for the
force argument. Note, however, that exceptions are not thrown; rather, the
original name will be returned.
getExternalName
in interface DBObjectProvider
name
- a String containing the name to externalizeobjectType
- a String containing the type of object being named
public java.lang.String getExternalName(java.lang.String name)
DBObjectProvider
quoteIdentifier
, specifying false
for the
force argument. Note, however, that exceptions are not thrown; rather, the
original name will be returned.
getExternalName
in interface DBObjectProvider
name
- a String containing the name to externalize
protected java.lang.String convertToExternal(java.lang.String name)
public DataType[] listSupportedDataTypes()
DBObjectProvider
listSupportedDataTypes
in interface DBObjectProvider
DataType
objects representing the
supported datatypes.public DataType getDataType(java.lang.String typeName)
DBObjectProvider
getDataType
in interface DBObjectProvider
typeName
- a String containing the name of the datatype.
public void validateObject(SchemaObject object) throws ValidationException
validateObject
in interface DBObjectProvider
object
- The object to validate
ValidationException
- if the object is not valid. The exception will
describe the validation failure.public void validateObject(SchemaObject original, SchemaObject update) throws ValidationException
validateObject
in interface DBObjectProvider
ValidationException
- if the updated object is not valid. The
exception will describe the validation failure.protected DBObject findByID(DBObjectID id) throws DBException
DBException
public abstract java.lang.String getUniqueName(java.lang.String type, Schema schema, java.lang.String base)
DBObjectProvider
getUniqueName
in interface DBObjectProvider
type
- the type of object to get the name forschema
- a string containing the schema to use when determining
the uniqueness of the namebase
- the base name to use.
public abstract boolean canCreate(SchemaObject object, boolean replace)
DBObjectProvider
canCreate
in interface DBObjectProvider
object
- the SchemaObject describing the object to createreplace
- whether to replace an existing object. If
replace
is false and the object exists, canCreate must
return false.
public abstract void createObject(SchemaObject object, boolean replace) throws DBException
DBObjectProvider
createObject
in interface DBObjectProvider
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.
DBException
- if an error is encountered creating the object.public abstract void createObjects(SchemaObject[] objects, boolean replace) throws DBException
DBObjectProvider
createObjects
in interface DBObjectProvider
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.
DBException
- if an error is encountered creating the objects.public abstract boolean canDelete(SchemaObject object, boolean cascade)
DBObjectProvider
canDelete
in interface DBObjectProvider
object
- the object to checkcascade
- whether to assume a cascading delete should be used.
public abstract void deleteObject(SchemaObject object, boolean cascade) throws DBException
DBObjectProvider
deleteObject
in interface DBObjectProvider
object
- the object to deletecascade
- whether to delete dependent objects
DBException
- if an error is encountered performing the deletepublic abstract void deleteObjects(SchemaObject[] objects, boolean cascade) throws DBException
DBObjectProvider
deleteObjects
in interface DBObjectProvider
objects
- the objects to deletecascade
- whether to delete dependent objects
DBException
- if an error is encountered performing the deletepublic abstract void updateObject(SchemaObject oldObject, SchemaObject newObject) throws DBException
DBObjectProvider
updateObject
in interface DBObjectProvider
oldObject
- the old version of the objectnewObject
- the new version of the object
DBException
- if the update failspublic abstract void updateObjects(SchemaObject[] oldObjects, SchemaObject[] newObjects) throws DBException
DBObjectProvider
updateObjects
in interface DBObjectProvider
DBException
- if the update failspublic abstract Schema[] listSchemas() throws DBException
DBObjectProvider
listSchemas
in interface DBObjectProvider
DBException
public abstract Schema getSchema(java.lang.String name) throws DBException
DBObjectProvider
getSchema
in interface DBObjectProvider
name
- a string containing the name of the schema
DBException
- if an error is encountered getting the schemapublic abstract boolean canCreate(Schema schema, boolean replace)
DBObjectProvider
canCreate
in interface DBObjectProvider
schema
- the Schema describing the object to createreplace
- whether to replace an existing schema. If
replace
is false and the schema exists, canCreate must
return false.
public abstract void createSchema(Schema schema, boolean replace) throws DBException
DBObjectProvider
createSchema
in interface DBObjectProvider
schema
- the schema being createdreplace
- whether to replace an existing schema
DBException
- if an error is encountered creating the schemapublic abstract boolean canDelete(Schema schema, boolean cascade)
DBObjectProvider
canDelete
in interface DBObjectProvider
schema
- the object to checkcascade
- whether to assume a cascading delete should be used.
public abstract void deleteSchema(Schema schema, boolean cascade) throws DBException
DBObjectProvider
deleteSchema
in interface DBObjectProvider
schema
- the schema to deletecascade
- whether to delete dependent objects (i.e. all SchemaObjects
contained in the Schema).
DBException
- if an error is encountered performing the deletepublic abstract void updateSchema(Schema oldOSchema, Schema newSchema) throws DBException
DBObjectProvider
updateSchema
in interface DBObjectProvider
oldOSchema
- the old version of the schemanewSchema
- the new version of the schema
DBException
- if the update fails
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.