Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.javatools.db
Class AbstractDBObjectProvider

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

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

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

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

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

Since:
9.0.5

Field Summary
static int CASE_SENSITIVE_NAME_POLICY
          Unquoted Names are case sensitive and stored in mixed case
protected static java.lang.String[] EMPTY_LIST
           
static int LOWER_CASE_NAME_POLICY
          Unquoted Names are case insensitive and stored in lower case
static int MIXED_CASE_NAME_POLICY
          Unquoted Names are case insensitive and stored in mixed case
static java.lang.String NEW_FROM_TEMPLATE_TYPE
           
static java.lang.String TIMESTAMP_PROPERTY
           
static int UPPER_CASE_NAME_POLICY
          Unquoted Names are case insensitive and stored in upper case
 
Fields inherited from interface oracle.javatools.db.DBObjectProvider
CREATE_PRIVILEDGE, DELETE_PRIVILEDGE, MODIFY_PRIVILEDGE
 
Constructor Summary
protected AbstractDBObjectProvider()
           
protected AbstractDBObjectProvider(boolean weakCaching)
           
 
Method Summary
 void addObjectListener(DBObjectListener list, DBObjectCriteria crit)
          Adds a listener that is notified of any updates to objects that match the given criteria.
 void addObjectListener(DBObjectListener list, SystemObject obj)
          Adds a listener that is notified of any updates to the given object.
 void addProviderListener(DBObjectProviderListener list)
          Adds the given listener to the list of registered listener for events on this provider.
 void addProviderListener(DBObjectProviderListener list)
          Deprecated. use addProviderListener(DBObjectProviderListener)
protected  void cacheObject(SystemObject object, boolean loadOperation)
          Adds an object to the cache.
protected
<T extends SystemObject>
T
checkCachedObject(T object)
          Use by getObjectImpl to verify that the given object in the cache is still valid.
protected  void clearAllCaches()
          Clears all the object caches.
static java.lang.String convertObject(DBObject obj)
          Converts a DBObject into a String representation of the object name.
protected  SystemObject createByIDImpl(DBObjectID id)
           
 void createObject(SystemObject obj, boolean replace)
          Causes the creation of the object described by the specified meta data.
protected  SystemObject createObjectImpl(java.lang.String type, Schema schema, java.lang.String name)
          Uses listObjectsImpl to find or create an object with the given type, schema and name.
protected  SchemaObjectManager createObjectManager()
          Creates the object manager for this provider.
 void createSchema(Schema schema, boolean replace)
          Causes the creation of a new Schema in the persistent storage.
 void deleteObject(SystemObject obj, boolean cascade)
          Deletes the object.
 void deleteSchema(Schema schema, boolean cascade)
          Deletes the schema.
protected  void destroyCache()
          Destroys the object cache.
protected  DBObject findByID(DBObjectID id)
           
protected  SystemObject findObject(DBObjectID id)
          Looks for the specified object id in the cache.
protected  SystemObject findObject(java.lang.String type, Schema schema, java.lang.String name)
          Looks for the specified object in the cache.
protected  Schema findSchema(java.lang.String name)
          Method for use within the provider that retrieves a schema and doesn't check the database if the schema is found in the cache.
protected  void fireObjectsAdded(java.util.Collection<? extends SystemObject> sysObjs)
           
 void fireObjectsAdded(Schema schema, SchemaObject[] objs)
          Deprecated. 
protected  void fireObjectsRemoved(java.util.Collection<? extends SystemObject> sysObjs)
           
protected  void fireObjectsRemoved(Schema schema, SchemaObject[] objs)
          Deprecated. 
protected  void fireObjectUpdated(DBObjectChange change)
          Notifies all listeners of an update to a SystemObject.
protected  void fireProviderClosed()
          Fires a providerClosed event to all listeners.
 void fireProviderDeleted()
          Deprecated. 
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)
          Deprecated. 
protected  void fireSchemaObjectUpdated(DBObjectChange change)
          Deprecated. 
protected  void fireSchemaRemoved(Schema schema)
          Deprecated. 
protected  void fireSchemaUpdated(DBObjectChange change)
          Deprecated. 
protected  DBObjectBuilder getBuilderForType(java.lang.String type)
          Retrieves the DBObjectBuilder registered for a type of object.
protected  java.lang.Object getCachedTimestamp(java.lang.Object obj)
          Use to check whether timestamps are suspended and that the given object is a key in the cache of timestamp values.
 SchemaObjectManager getCascadeManager()
          By default creates a SchemaObjectManager.
protected  int getCasePolicy()
          Retrieves the provider's case policy for unquoted names.
 DataType getDataType(java.lang.String typeName)
          Retrieves the datatype represented by a specific name.
 DDLGenerator getDDLGenerator()
          Convinience method that wrap DatabaseDescriptor.getDDLGenerator
 DBObject getDefaultTemplateForType(java.lang.String type)
          Returns the default template object for the given type, or null if none defined
 DiffEngine getDiffEngine()
          Returns a diff engine setup with the appropriate set of differs for object updating.
protected  java.lang.Long getExistingTimestamp(SystemObject object)
           
 java.lang.String getExternalName(java.lang.String name)
          Converts the specified name into the format used externally to represent the identifier.
 java.lang.String getExternalName(java.lang.String name, java.lang.String objectType)
          Converts the specified name into the format used externally to represent the identifier.
protected  java.lang.Long getExternalTimestamp(SystemObject object)
           
protected  java.lang.Long getExternalTimestampImpl(SystemObject object)
          Retrieves the external timestamp for the specified object.
 java.lang.String getIdentifierQuoteString()
          Retrieves the string used to quote identifiers.
 java.lang.String getInternalName(java.lang.String name)
          Converts the specified name into the format used internally within the metadata.
 java.lang.String getInternalName(java.lang.String name, java.lang.String objectType)
          Converts the specified name into the format used internally within the metadata.
protected  java.util.logging.Logger getLogger()
          Gets the logger to use in this provider.
<T extends SystemObject>
T
getObject(DBObjectCriteria<T> criteria)
          Retrieves the SystemObject representing a specific database object.
 SchemaObject getObject(java.lang.String objectType, Schema schema, java.lang.String name)
          Retrieves the SchemaObject representing a specific database object.
 DBObjectFactory getObjectFactory()
          Get the object factory for this provider.
protected
<T extends SystemObject>
T
getObjectImpl(DBObjectCriteria<T> criteria)
           
 SchemaObjectManager getObjectManager()
          Deprecated. 
 DataType getOrCreateDataType(java.lang.String typeName)
          Retrieves the datatype represented by a specific name.
 PropertyManager getPropertyManager()
          Gets the PropertyManager (if available) for this provider.
protected  int getQuotedNameCasePolicy()
          Retrieves the provider's case policy for quoted names.
 Schema getSchema(java.lang.String name)
          Retrieves the Schema object associated with a specific name.
 SchemaObjectExpander[] getSchemaObjectExpanders()
           
 java.lang.Long getTimestamp(DBObjectID id)
          Retrieves the timestamp for the object represented by the given ID.
 java.lang.Long getTimestamp(java.lang.String type, Schema schema, java.lang.String objectName)
          Retrieves the timestamp representing the last modification time of the specified object's metadata.
 java.lang.String getUniqueName(java.lang.String type, DBObject contextObject, java.lang.String base)
          Returns a unique name for an object of given type within contextObject using base name.
protected  DBObjectValidator getValidatorForType(java.lang.String type)
          Retrieves the DBObjectValidator registered for a type of object.
 boolean hasObjectPrivilege(SystemObject object, java.lang.String priv)
          Checks to see whether the user has the requisite permissions to perform the specified operation on the given object.
 boolean hasPriviledge(java.lang.String type, Schema schema, java.lang.String priv)
          Deprecated. - use hasSystemPrivilege(java.lang.String, oracle.javatools.db.Schema, java.lang.String)
 boolean hasSystemPrivilege(java.lang.String type, Schema schema, java.lang.String priv)
          Checks to see whether the user has the requisite permissions to perform the specified operation.
 boolean isEditable(DBObject object)
          Returns whether or not the object can be edited
 boolean isNewFromTemplateType(java.lang.String type)
          Test whether the given type is the pseudo type used for new objects that are being created from a template.
protected  boolean isRequestedObject(SystemObject object, java.lang.String type, Schema schema, java.lang.String name)
          Returns true if SchemaObject object is of type type, owned by schema schema, and named name.
 boolean isValidName(java.lang.String name)
          Deprecated. - use isValidName( String type, String name )
 boolean isValidName(java.lang.String type, java.lang.String name)
          Checks to see whether a name is valid.
<T extends SystemObject>
java.util.Collection<T>
listObjects(DBObjectCriteria<T> criteria)
          Lists the objects from this provider that match the given criteria.
 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
<T extends SystemObject>
java.util.Collection<T>
listObjectsFromCache(DBObjectCriteria<T> criteria)
          Lists the objects that are in the internal memory cache for this provider.
protected abstract
<T extends SystemObject>
java.util.Collection<T>
listObjectsImpl(DBObjectCriteria<T> criteria)
          Internal listObjects implementation.
protected  java.util.Collection<SystemObject> listObjectsImpl(java.lang.String[] objectTypes, Schema schema, java.lang.String ref)
          Internal listObjects implementation.
protected  java.lang.String[] listObjectsImpl(java.lang.String type, Schema schema, java.lang.String ref)
          Retrieves the list of objects by using a registered builder.
 java.lang.String[] listObjectTypes()
          Returns a sorted array of the object types supported in this provider.
 Schema[] listSchemas()
          Retrieves the list of schemas available from this provider regardless of their visibility to the user.
 Schema[] listSchemas(boolean showAll)
          Retrieves the list of schemas available from this provider.
 DataType[] listSupportedDataTypes()
          Retrieves the list of datatypes supported by this provider.
protected  void logEvent(java.lang.String msg, java.lang.Object... params)
          Use to log provider events.
protected  void markForLazyInit(AbstractBuildableObject object)
           
protected  void markForLazyInit(AbstractBuildableObject object, DBObjectBuilder builder)
           
protected  java.lang.String normaliseType(java.lang.String type)
           
protected  java.lang.Object putCachedTimestampKey(java.lang.Object obj, java.lang.Object value)
          Checks that timestamps are suspended, and if they are caches the given key and value in the timestamp cache.
 java.lang.String quoteIdentifier(java.lang.String internalName, boolean force)
          Determines if internalName needs quoting to make it a valid external name, and if so returns a quoted copy of it.
protected  void registerBuilder(java.lang.String type, DBObjectBuilder builder)
          Registers a Builder for a specific object type.
protected abstract  void registerExpanders()
           
protected  void registerSchemaObjectExpander(SchemaObjectExpander expander)
           
protected  void registerType(java.lang.String type, DBObjectBuilder builder, DBObjectValidator validator)
          Registers a Builder and Validator for a specific object type.
protected  void registerValidator(java.lang.String type, DBObjectValidator validator)
          Registers a Validator for a specific object type.
 void removeObjectListener(DBObjectListener list)
          Removes the given object listener that had been added using DBObjectProvider.addObjectListener(DBObjectListener,SystemObject) or DBObjectProvider.addObjectListener(DBObjectListener,DBObjectCriteria).
 void removeProviderListener(DBObjectProviderListener list)
          Removes the given listener from the list of registered listener for events on this provider.
 void removeProviderListener(DBObjectProviderListener list)
          Deprecated. use removeProviderListener(DBObjectProviderListener)
protected  void resetObject(SystemObject object, SystemObject listed, java.lang.Long timestamp)
          If it has been noticed that the timestamp has changed on an object, or we have updated it in the database, we want to turn it back into an object that needs building again.
protected  void resetObject(SystemObject object, SystemObject listed, java.lang.Long timestamp, boolean updated)
          If it has been noticed that the timestamp has changed on an object, or we have updated it in the database, we want to turn it back into an object that needs building again.
 void resumeTimestampQueries(java.lang.String key)
          Resumes the calls to get the external timestamp for a given object.
 void setDefaultTemplateForType(java.lang.String type, DBObject template)
          Sets the default template object for the given type.
 boolean supportsObjectType(java.lang.String type)
          Convinience method to check whether this provider supports the given object type - i.e.
 boolean supportsTimestamps()
          Deprecated. replaced by supportsTimestamps(String)
 boolean supportsTimestamps(java.lang.String objectType)
          Returns true if this provider supports object timestamping for the given object type.
 void suspendTimestampQueries(java.lang.String key)
          Limits the call to get the external timestamp for a given object to once until resumeTimestampQueries() is called.
protected  void uncacheObject(SystemObject object)
          Removes an object from the cache.
 void updateObject(SystemObject oldObject, SystemObject newObject)
          Updates the definition of an object.
 void updateObjects(SystemObject[] oldObjects, SystemObject[] newObjects)
          Updates the definition of a set of objects.
 void updateSchema(Schema oldSchema, Schema newSchema)
          Updates the definition of a Schema.
 void validateName(java.lang.String name)
          Deprecated. - use validateName( String type, String name )
 void validateName(java.lang.String type, java.lang.String name)
          Checks to see whether a name is valid.
 void validateObject(DBObject object)
          Validates the given object using the DBObjectValidator registered against that object's type.
 void validateObject(DBObject original, DBObject update)
          Validates the given object update using the DBObjectValidator registered against that object's type.
 void validateObject(DBObject original, DBObject update, java.lang.String property)
          Deprecated. 
 void validateObject(DBObject object, java.lang.String property)
          Deprecated. 
 void validateObjectProperty(DBObject original, DBObject updated, java.lang.Object property)
          Deprecated. 
 void validateObjectProperty(DBObject original, DBObject update, java.lang.String property)
          Checks to see if the updated children of a given object are valid.
 void validateObjectProperty(DBObject object, java.lang.Object property)
          Deprecated. 
 void validateObjectProperty(DBObject object, java.lang.String property)
          Checks to see if the children of a given object are valid.
 void validateSchema(Schema schema)
          Deprecated. - use validateObject( DBObject object )
 void validateSchema(Schema original, Schema update)
          Deprecated. use validateObject( DBObject original, DBObject update )
 void validateUniqueName(java.lang.String type, DBObject contextObject, java.lang.String name)
          Validates that a name is not used within the context DBObject, and throws NameInUseException if it is.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.javatools.db.DBObjectProvider
canCreate, canDelete, createObjects, deleteObjects, getDefaultSchema, getDescriptor, getName, getProviderIdentifier, getProviderType, undeleteObject, undeleteObjects, updateObjects
 

Field Detail

MIXED_CASE_NAME_POLICY

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

See Also:
Constant Field Values

LOWER_CASE_NAME_POLICY

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

See Also:
Constant Field Values

UPPER_CASE_NAME_POLICY

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

See Also:
Constant Field Values

CASE_SENSITIVE_NAME_POLICY

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

See Also:
Constant Field Values

TIMESTAMP_PROPERTY

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

NEW_FROM_TEMPLATE_TYPE

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

EMPTY_LIST

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

AbstractDBObjectProvider

protected AbstractDBObjectProvider()

AbstractDBObjectProvider

protected AbstractDBObjectProvider(boolean weakCaching)
Method Detail

removeProviderListener

public final void removeProviderListener(DBObjectProviderListener list)
Description copied from interface: DBObjectProvider
Removes the given listener from the list of registered listener for events on this provider.

Specified by:
removeProviderListener in interface DBObjectProvider
See Also:
DBObjectProviderListener

removeProviderListener

@Deprecated
public final void removeProviderListener(DBObjectProviderListener list)
Deprecated. use removeProviderListener(DBObjectProviderListener)

Specified by:
removeProviderListener in interface DBObjectProvider

addProviderListener

public final void addProviderListener(DBObjectProviderListener list)
Description copied from interface: DBObjectProvider
Adds the given listener to the list of registered listener for events on this provider.

Specified by:
addProviderListener in interface DBObjectProvider
See Also:
DBObjectProviderListener

addProviderListener

@Deprecated
public final void addProviderListener(DBObjectProviderListener list)
Deprecated. use addProviderListener(DBObjectProviderListener)

Specified by:
addProviderListener in interface DBObjectProvider

addObjectListener

public final void addObjectListener(DBObjectListener list,
                                    DBObjectCriteria crit)
Description copied from interface: DBObjectProvider
Adds a listener that is notified of any updates to objects that match the given criteria. If the given criteria is null, updates on all objects will be published to the given listener.

Specified by:
addObjectListener in interface DBObjectProvider
Parameters:
list - the listener to register
crit - a criteria object to use to match objects that update messages are published for

addObjectListener

public final void addObjectListener(DBObjectListener list,
                                    SystemObject obj)
Description copied from interface: DBObjectProvider
Adds a listener that is notified of any updates to the given object. This differs from SystemObject.addObjectListener(DBObjectListener) because that listens to a specific object instance. Registering the listener with the provider through this method ensures that events will be received for the lifetime of the provider (as the particular object instance could be lost - e.g. gc'd).

Specified by:
addObjectListener in interface DBObjectProvider
Parameters:
list - the listener to register
obj - the object to receive update events for
See Also:
DBObjectProvider.addObjectListener(DBObjectListener,DBObjectCriteria)

removeObjectListener

public final void removeObjectListener(DBObjectListener list)
Description copied from interface: DBObjectProvider
Removes the given object listener that had been added using DBObjectProvider.addObjectListener(DBObjectListener,SystemObject) or DBObjectProvider.addObjectListener(DBObjectListener,DBObjectCriteria).

Specified by:
removeObjectListener in interface DBObjectProvider
Parameters:
list - the registered listener to remove

fireProviderClosed

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


fireProviderDeleted

@Deprecated
public final void fireProviderDeleted()
Deprecated. 

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

@Deprecated
protected final void fireSchemaAdded(Schema schema)
Deprecated. 

Notifies all listeners that the given Schema has been added to this provider.


fireObjectsAdded

protected final void fireObjectsAdded(java.util.Collection<? extends SystemObject> sysObjs)

fireSchemaUpdated

@Deprecated
protected final void fireSchemaUpdated(DBObjectChange change)
Deprecated. 


fireSchemaObjectUpdated

@Deprecated
protected final void fireSchemaObjectUpdated(DBObjectChange change)
Deprecated. 


fireObjectUpdated

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


fireSchemaRemoved

@Deprecated
protected final void fireSchemaRemoved(Schema schema)
Deprecated. 

Notifies all listeners that the given Schema has been removed from this provider.


fireObjectsRemoved

protected final void fireObjectsRemoved(java.util.Collection<? extends SystemObject> sysObjs)

fireObjectsAdded

@Deprecated
public final void fireObjectsAdded(Schema schema,
                                              SchemaObject[] objs)
Deprecated. 

Notifies all listeners that objects have been added to the given schema. Internal use only.


fireObjectsRemoved

@Deprecated
protected final void fireObjectsRemoved(Schema schema,
                                                   SchemaObject[] objs)
Deprecated. 

Notifies all listeners that objects have been removed from the given schema.


registerType

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

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

registerBuilder

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

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

getBuilderForType

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

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

registerValidator

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

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

getValidatorForType

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

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

findObject

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

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

findObject

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

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

destroyCache

protected void destroyCache()
Destroys the object cache. Use clearCaches() unless you are changing the supported object types. Destroying the cache removes all registered builders and validators as well as the objects themselves.


clearAllCaches

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


getCascadeManager

public SchemaObjectManager getCascadeManager()
By default creates a SchemaObjectManager. Override to customise.

Specified by:
getCascadeManager in interface DBObjectProvider

getObjectManager

@Deprecated
public final SchemaObjectManager getObjectManager()
Deprecated. 

Specified by:
getObjectManager in interface DBObjectProvider

createObjectManager

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


cacheObject

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

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

uncacheObject

protected final void uncacheObject(SystemObject 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 java.util.Collection<SystemObject> listObjectsImpl(java.lang.String[] objectTypes,
                                                             Schema schema,
                                                             java.lang.String ref)
                                                      throws DBException
Internal listObjects implementation. By default this simply calls listObjectsImpl(DBObjectCriteria) and shouldn't be overridden.

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

listObjectsImpl

protected abstract <T extends SystemObject> java.util.Collection<T> listObjectsImpl(DBObjectCriteria<T> criteria)
                                                                         throws DBException
Internal listObjects implementation. All listObjects methods call through to this.

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

listObjectsFromCache

protected final <T extends SystemObject> java.util.Collection<T> listObjectsFromCache(DBObjectCriteria<T> criteria)
Lists the objects that are in the internal memory cache for this provider. Not really useful as a listObjectsImpl implementation as you need to list what is in the actual dictionary for that.


getObjectImpl

protected <T extends SystemObject> T getObjectImpl(DBObjectCriteria<T> criteria)
                                        throws DBException
Throws:
DBException

getExistingTimestamp

protected final java.lang.Long getExistingTimestamp(SystemObject object)

checkCachedObject

protected <T extends SystemObject> T checkCachedObject(T object)
                                            throws DBException
Use by getObjectImpl to verify that the given object in the cache is still valid. By default timestamping is used to check the object if available.

Parameters:
object - the cached object to check
schema -
Returns:
an object ready to return from getObjectImpl, or null if the cached object was invalid and has been removed.
Throws:
DBException

listSchemas

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

Specified by:
listSchemas in interface DBObjectProvider
Returns:
an array of schemas
Throws:
DBException
See Also:
DBObjectProvider.listSchemas(boolean)

listSchemas

public Schema[] listSchemas(boolean showAll)
                     throws DBException
Description copied from interface: DBObjectProvider
Retrieves the list of schemas available from this provider. The list is optionally restricted to those schemas containing objects belonging (or visible to) the user.

Specified by:
listSchemas in interface DBObjectProvider
Parameters:
showAll - if false, only schemas containing objects belonging to (or visible to) the user are returned
Returns:
an array of schemas
Throws:
DBException - if an error is encountered listing the schemas.

getSchema

public 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

findSchema

protected Schema findSchema(java.lang.String name)
                     throws DBException
Method for use within the provider that retrieves a schema and doesn't check the database if the schema is found in the cache. This should only be used withing operations where the existence of the schema is implied or unnecessary.

Throws:
DBException

resumeTimestampQueries

public final void resumeTimestampQueries(java.lang.String key)
Resumes the calls to get the external timestamp for a given object. The key passed in must match that passed into suspendTimestampQueries and the number of keys must reach zero before timestamping will resume.


suspendTimestampQueries

public final void suspendTimestampQueries(java.lang.String key)
Limits the call to get the external timestamp for a given object to once until resumeTimestampQueries() is called. This means that once queried the first time, if an object is changed in the database the API will not notice.


getCachedTimestamp

protected final java.lang.Object getCachedTimestamp(java.lang.Object obj)
Use to check whether timestamps are suspended and that the given object is a key in the cache of timestamp values. If it is a key, its value is returned.

Parameters:
the - key in the timestamp cache to lookup
Returns:
the value from the timestamp cache for the given key if there was one, and only if timestamps are currently suspended

putCachedTimestampKey

protected final java.lang.Object putCachedTimestampKey(java.lang.Object obj,
                                                       java.lang.Object value)
Checks that timestamps are suspended, and if they are caches the given key and value in the timestamp cache. Access to the cache is only possible while timestamps are suspended, and the cache is cleared when timestamps are not suspended.

Parameters:
obj - the key for the timstamp cache
value - the value to put against the given key
Returns:
any existing value that was in the cache already for the given key

supportsTimestamps

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

Returns false by default.


supportsTimestamps

@Deprecated
public boolean supportsTimestamps()
Deprecated. replaced by supportsTimestamps(String)


getTimestamp

public final java.lang.Long getTimestamp(java.lang.String type,
                                         Schema schema,
                                         java.lang.String objectName)
                                  throws DBException
Description copied from interface: DBObjectProvider
Retrieves the timestamp representing the last modification time of the specified object's metadata. If the provider does not provide timestamp information for metadata, a null value should be returned.

Specified by:
getTimestamp in interface DBObjectProvider
Parameters:
type - a String containing the type of the object
schema - the Schema containing the object
objectName - a String containing the name of the object
Returns:
the timestamp as a Long value
Throws:
DBException - if an error is encountered getting the timestamp

getTimestamp

public final java.lang.Long getTimestamp(DBObjectID id)
                                  throws DBException
Description copied from interface: DBObjectProvider
Retrieves the timestamp for the object represented by the given ID.

Specified by:
getTimestamp in interface DBObjectProvider
Parameters:
id - the ID for the object
Returns:
the timestamp
Throws:
DBException - if an error is encountered getting the timestamp
See Also:
DBObjectProvider.getTimestamp(String,Schema,String)

findByID

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

resetObject

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

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

resetObject

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

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

createObjectImpl

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

Throws:
DBException

isRequestedObject

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

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

createByIDImpl

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

getExternalTimestampImpl

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

Parameters:
object -
Returns:
Throws:
DBException

getExternalTimestamp

protected final java.lang.Long getExternalTimestamp(SystemObject object)
                                             throws DBException
Throws:
DBException

markForLazyInit

protected final void markForLazyInit(AbstractBuildableObject object)

markForLazyInit

protected final void markForLazyInit(AbstractBuildableObject object,
                                     DBObjectBuilder builder)

convertObject

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

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

getIdentifierQuoteString

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

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

listObjectTypes

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

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

supportsObjectType

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

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

listObjects

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

listObjects

public final <T extends SystemObject> java.util.Collection<T> listObjects(DBObjectCriteria<T> criteria)
                                                               throws DBException
Description copied from interface: DBObjectProvider
Lists the objects from this provider that match the given criteria.

Examples:

   // list Tables beginning with E in a given schema
   DBObjectProvider pro = ...
   Schema schema = ...
   SystemObject obj = pro.listObjects(
     DBObjectCriteria.createCriteria( Table.TYPE, schema, "E%" ) );

   // list all objects that have columns and constraints in schema HR
   DBObjectCriteria c = new DBObjectCriteria(Relation.class);
   c.setSchemaName( "HR" );
   Collection rels = pro.listObjects( c );

   // list all the schemas in this provider
   Collection schemas = pro.listObjects(
      new DBObjectCriteria(Schema.class) );
 

Specified by:
listObjects in interface DBObjectProvider
Parameters:
criteria - the filter to use for listing objects (cannot be null)
Returns:
a collection of objects
Throws:
DBException - if an error is encountered listing the objects

getObject

public final <T extends SystemObject> T getObject(DBObjectCriteria<T> criteria)
                                       throws DBException
Description copied from interface: DBObjectProvider
Retrieves the SystemObject representing a specific database object. The given criteria must match only one object.

Examples:

   // find EMP in a given provider and schema
   DBObjectProvider pro = ...
   Schema schema = ...
   SystemObject obj = pro.getObject(
     DBObjectCriteria.createCriteria( Table.TYPE, schema, "EMP" ) );

   // find Table HR.EMPLOYEES
   DBObjectCriteria c = new DBObjectCriteria
(Table.class); c.setNameLike( "EMPLOYEES" ); c.setSchemaName( "HR" ); Table employees = pro.getObject( c );

Specified by:
getObject in interface DBObjectProvider
Returns:
the SystemObject matching the specified criteria
Throws:
DBException - if an error is encountered retrieving the object

getObject

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

@Deprecated
public boolean hasPriviledge(java.lang.String type,
                                        Schema schema,
                                        java.lang.String priv)
Deprecated. - use hasSystemPrivilege(java.lang.String, oracle.javatools.db.Schema, java.lang.String)

Specified by:
hasPriviledge in interface DBObjectProvider

hasSystemPrivilege

public boolean hasSystemPrivilege(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. NB The return value should be used as guide only and is not guarenteed to truely reflect the current set of privileges. The default implementation will always return true, and other implementations may choose to cache the result.

Specified by:
hasSystemPrivilege 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.

hasObjectPrivilege

public boolean hasObjectPrivilege(SystemObject object,
                                  java.lang.String priv)
Checks to see whether the user has the requisite permissions to perform the specified operation on the given object. For example, whether the user has permission to alter a table. NB The return value should be used as guide only and is not guarenteed to truely reflect the current set of privileges. The default implementation will always return true, and other implementations may choose to cache the result.

Specified by:
hasObjectPrivilege in interface DBObjectProvider
Parameters:
object - the object on which the operation is being performed.
priv - a pre-defined operation.
Returns:
whether the specified operation can be completed.

createObject

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

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

deleteObject

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

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

updateObject

public final void updateObject(SystemObject oldObject,
                               SystemObject 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 final void updateObjects(SystemObject[] oldObjects,
                                SystemObject[] 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

createSchema

public 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

deleteSchema

public 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 void updateSchema(Schema oldSchema,
                         Schema newSchema)
                  throws DBException
Description copied from interface: DBObjectProvider
Updates the definition of a Schema.

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

getPropertyManager

public PropertyManager getPropertyManager()
Description copied from interface: DBObjectProvider
Gets the PropertyManager (if available) for this provider. The property manager provides information about which properties are supported on which objects, and what operations (create/replace/update/delete) are supported for any particular object or property.

Specified by:
getPropertyManager in interface DBObjectProvider
Returns:
this provider's property manager, or null if no property manager exists.

getDDLGenerator

public final DDLGenerator getDDLGenerator()
Convinience method that wrap DatabaseDescriptor.getDDLGenerator

Specified by:
getDDLGenerator in interface DBObjectProvider

getCasePolicy

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

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

getQuotedNameCasePolicy

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

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

isValidName

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

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

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

isValidName

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

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

validateName

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

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

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

validateName

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

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

quoteIdentifier

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

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

getInternalName

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

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

getInternalName

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

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

getExternalName

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

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

getExternalName

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

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

listSupportedDataTypes

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

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

getDataType

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

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

getOrCreateDataType

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

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

validateObject

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

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

validateObject

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

Specified by:
validateObject in interface DBObjectProvider
Throws:
ValidationException

validateObjectProperty

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

Specified by:
validateObjectProperty in interface DBObjectProvider
Throws:
ValidationException

validateObjectProperty

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

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

validateSchema

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

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

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

validateObject

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

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

validateObject

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

Specified by:
validateObject in interface DBObjectProvider
Throws:
ValidationException

validateObjectProperty

@Deprecated
public final void validateObjectProperty(DBObject original,
                                                    DBObject updated,
                                                    java.lang.Object property)
                                  throws ValidationException
Deprecated. 

Specified by:
validateObjectProperty in interface DBObjectProvider
Throws:
ValidationException

validateObjectProperty

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

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

validateSchema

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

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

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

validateUniqueName

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

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

getUniqueName

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

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

normaliseType

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

getDiffEngine

public DiffEngine getDiffEngine()
Description copied from interface: DBObjectProvider
Returns a diff engine setup with the appropriate set of differs for object updating.

Providers which do not support object updating should return null.

Specified by:
getDiffEngine in interface DBObjectProvider

getLogger

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


logEvent

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


isEditable

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

Specified by:
isEditable in interface DBObjectProvider

getDefaultTemplateForType

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

Specified by:
getDefaultTemplateForType in interface DBObjectProvider

setDefaultTemplateForType

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

Specified by:
setDefaultTemplateForType in interface DBObjectProvider

isNewFromTemplateType

public boolean isNewFromTemplateType(java.lang.String type)
Description copied from interface: DBObjectProvider
Test whether the given type is the pseudo type used for new objects that are being created from a template.

Specified by:
isNewFromTemplateType in interface DBObjectProvider
Parameters:
type - the type to test
Returns:
true if the type is a "new from template" type

registerExpanders

protected abstract void registerExpanders()

registerSchemaObjectExpander

protected void registerSchemaObjectExpander(SchemaObjectExpander expander)

getSchemaObjectExpanders

public SchemaObjectExpander[] getSchemaObjectExpanders()

getObjectFactory

public DBObjectFactory getObjectFactory()
Description copied from interface: DBObjectProvider
Get the object factory for this provider.

Specified by:
getObjectFactory in interface DBObjectProvider

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

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