|
Extension SDK 10.1.3.36.73 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectoracle.javatools.db.AbstractDBObjectProvider
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.
| 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 |
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 final void removeProviderListener(DBObjectProviderListener list)
removeProviderListener in interface DBObjectProviderDBObjectProviderListenerpublic final void addProviderListener(DBObjectProviderListener list)
addProviderListener in interface DBObjectProviderDBObjectProviderListenerprotected final void fireProviderClosed()
protected final void fireProviderOpened()
protected final void fireProviderReloaded()
protected final void fireSchemaAdded(Schema schema)
protected final void fireSchemaUpdated(DBObjectChange change)
protected void schemaUpdated(DBObjectChange change)
protected final void fireSchemaRemoved(Schema schema)
public final void fireObjectsAdded(Schema schema,
SchemaObject[] objs)
protected final void fireObjectsRemoved(Schema schema,
SchemaObject[] objs)
public void registerType(java.lang.String type,
DBObjectBuilder builder,
DBObjectValidator validator)
type - a string containing the object typebuilder - the Builder instance to use for the specified typevalidator - the Validator instance to use for the specified typeDBObject.getType()
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.javatools.db.DBObjectBuilder),
DBObject.getType()protected DBObjectBuilder getBuilderForType(java.lang.String type)
type - a string containing the object type
null
if no builder is registered
public 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.javatools.db.DBObjectValidator),
DBObject.getType()protected DBObjectValidator getValidatorForType(java.lang.String type)
type - a string containing the object type
null
if no validator is registered
protected 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 cachepublic void destroyCache()
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 SchemaObjectManager getObjectManager()
protected SchemaObjectManager createObjectManager()
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 cache
protected 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 SchemaObject[] listObjectsImpl(java.lang.String[] objectTypes,
Schema schema,
java.lang.String ref)
throws DBException
DBException
protected SchemaObject getObjectImpl(java.lang.String objectType,
Schema schema,
java.lang.String name)
throws DBException
DBException
protected DBObject findByID(DBObjectID id)
throws DBException
DBException
protected SchemaObject createSchemaObjectImpl(java.lang.String type,
Schema schema,
java.lang.String name)
throws DBException
DBException
protected SchemaObject createByIDImpl(DBObjectID id)
throws DBException
DBExceptionprotected final void markForLazyInit(AbstractSchemaObject object)
protected abstract int getCasePolicy()
LOWER_CASE_NAME_POLICY,
MIXED_CASE_NAME_POLICY,
UPPER_CASE_NAME_POLICYprotected 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()
DBObjectProvidernull.
getIdentifierQuoteString in interface DBObjectProviderpublic java.lang.String[] listObjectTypes()
DBObjectProvider
listObjectTypes in interface DBObjectProviderDBObjectProvider.listObjects(java.lang.String, oracle.javatools.db.Schema)
public java.lang.String[] listObjects(java.lang.String objectType,
Schema schema)
throws DBException
DBObjectProvider
listObjects in interface DBObjectProviderobjectType - the type of objects to listschema - the schema to list from
DBException
public final java.lang.String[] listObjects(java.lang.String objectType,
Schema schema,
java.lang.String ref)
throws DBException
DBObjectProvider
listObjects in interface DBObjectProviderobjectType - the type of objects to listschema - the schema to list fromref - a pattern to match against.
DBException
public SchemaObject[] listObjects(java.lang.String[] objectTypes,
Schema schema)
throws DBException
DBObjectProvider
listObjects in interface DBObjectProviderobjectTypes - an array of Strings representing the desired typesschema - the Schema to list from
DBException - if an error is encountered listing the objects
public final SchemaObject[] listObjects(java.lang.String[] objectTypes,
Schema schema,
java.lang.String ref)
throws DBException
DBObjectProvider
listObjects in interface DBObjectProviderobjectTypes - an array of Strings representing the desired typesschema - the Schema to list fromref - a pattern to match against.
DBException - if an error is encountered listing the objects
public SchemaObject getObject(java.lang.String objectType,
Schema schema,
java.lang.String name)
throws DBException
DBObjectProvider
getObject in interface DBObjectProviderobjectType - 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 DBObjectProvidertype - 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 DBObjectProvidername - the name to check
public void validateName(java.lang.String name)
throws InvalidNameException
validateName in interface DBObjectProvidername - the name to check
InvalidNameException
public java.lang.String quoteIdentifier(java.lang.String name,
boolean force)
throws DBException
DBObjectProvider
quoteIdentifier in interface DBObjectProvidername - the name to quoteforce - whether to quote even if the identifier is valid already.
DBException - if the name when quoted is still invalid
public java.lang.String getInternalName(java.lang.String name,
java.lang.String objectType)
DBObjectProvider
getInternalName in interface DBObjectProvidername - 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 DBObjectProvidername - 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)
DBObjectProviderquoteIdentifier, specifying false for the
force argument. Note, however, that exceptions are not thrown; rather, the
original name will be returned.
getExternalName in interface DBObjectProvidername - 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)
DBObjectProviderquoteIdentifier, specifying false for the
force argument. Note, however, that exceptions are not thrown; rather, the
original name will be returned.
getExternalName in interface DBObjectProvidername - a String containing the name to externalize
protected java.lang.String convertToExternal(java.lang.String name)
public DataType[] listSupportedDataTypes()
DBObjectProvider
listSupportedDataTypes in interface DBObjectProviderDataType objects representing the
supported datatypes.public DataType getDataType(java.lang.String typeName)
DBObjectProvider
getDataType in interface DBObjectProvidertypeName - a String containing the name of the datatype.
public void validateObject(DBObject object)
throws ValidationException
validateObject in interface DBObjectProviderobject - The object to validate
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.
public void validateObject(DBObject object,
java.lang.String childType)
throws ValidationException
validateObject in interface DBObjectProviderobject - The object to validate
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.
public void validateSchema(Schema schema)
throws ValidationException
DBObjectProvider
validateSchema in interface DBObjectProviderschema - The Schema to validate
ValidationException - if the Schema is not valid. The exception will
describe the validation failure.
public void validateObject(DBObject original,
DBObject update)
throws ValidationException
validateObject in interface DBObjectProviderValidationException - 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.
public void validateObject(DBObject original,
DBObject update,
java.lang.String childType)
throws ValidationException
validateObject in interface DBObjectProviderValidationException - 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.
public void validateSchema(Schema original,
Schema update)
throws ValidationException
DBObjectProvider
validateSchema in interface DBObjectProviderValidationException - if the updated schema is not valid. The
exception will describe the validation failure.
public void validateUniqueName(java.lang.String type,
DBObject contextObject,
java.lang.String name)
throws NameInUseException
validateUniqueName in interface DBObjectProvidertype - : the type of name being validatedcontextObject - : the database object context to use when determining
the uniqueness of the namename - : the name to be checked
NameInUseException
public java.lang.String getUniqueName(java.lang.String type,
DBObject contextObject,
java.lang.String base)
getUniqueName in interface DBObjectProvidertype - is the type of object to get the name forcontextObject - is the database object context to use when determining
the uniqueness of the namebase - is the base name to use. If base is null or zero length,
the type name suffixed with 1 is used.
protected java.lang.String normaliseType(java.lang.String type)
protected abstract java.lang.String getName()
public abstract boolean canCreate(SchemaObject object,
boolean replace)
DBObjectProvider
canCreate in interface DBObjectProviderobject - 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 DBObjectProviderobject - 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 DBObjectProviderobjects - 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 DBObjectProviderobject - 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 DBObjectProviderobject - the object to deletecascade - whether to delete dependent objects
DBException - if an error is encountered performing the delete
public abstract void deleteObjects(SchemaObject[] objects,
boolean cascade)
throws DBException
DBObjectProvider
deleteObjects in interface DBObjectProviderobjects - the objects to deletecascade - whether to delete dependent objects
DBException - if an error is encountered performing the delete
public abstract void updateObject(SchemaObject oldObject,
SchemaObject newObject)
throws DBException
DBObjectProvider
updateObject in interface DBObjectProvideroldObject - the old version of the objectnewObject - the new version of the object
DBException - if the update fails
public abstract void updateObjects(SchemaObject[] oldObjects,
SchemaObject[] newObjects)
throws DBException
DBObjectProvider
updateObjects in interface DBObjectProviderDBException - if the update fails
public abstract Schema[] listSchemas()
throws DBException
DBObjectProvider
listSchemas in interface DBObjectProviderDBException
public abstract Schema getSchema(java.lang.String name)
throws DBException
DBObjectProvider
getSchema in interface DBObjectProvidername - a string containing the name of the schema
DBException - if an error is encountered getting the schema
public abstract boolean canCreate(Schema schema,
boolean replace)
DBObjectProvider
canCreate in interface DBObjectProviderschema - 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 DBObjectProviderschema - the schema being createdreplace - whether to replace an existing schema
DBException - if an error is encountered creating the schema
public abstract boolean canDelete(Schema schema,
boolean cascade)
DBObjectProvider
canDelete in interface DBObjectProviderschema - 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 DBObjectProviderschema - 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 delete
public abstract void updateSchema(Schema oldOSchema,
Schema newSchema)
throws DBException
DBObjectProvider
updateSchema in interface DBObjectProvideroldOSchema - the old version of the schemanewSchema - the new version of the schema
DBException - if the update fails
|
Extension SDK 10.1.3.36.73 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Copyright © 1997, 2005, Oracle.All rights reserved.