public abstract class AbstractDBObjectProvider extends java.lang.Object implements DBObjectProvider
DBObjectProvider
interface. AbstractDBObjectProvider
provides support for
registering DBObjectBuilder
instances for building specific
types of DBObject
s. The list of builders is used to determine
the types of objects supported by the DBObjectProvider
implementation, to list the available objects of a specific type, and to
retrieve the SchemaObject representations of the objects.
Subclasses are responsible for ensuring that DBObjectBuilder and DBObjectValidator instances are registered for the types of objects that will be supported. AbstractDBObjectProvider is abstract; sublasses are also responsible for providing implementations of those methods that do not have a generic implementation.
AbstractDBObjectProvider
also handles caching of
DBObject
instances. When new instances are created, they are
cached (optionally this caching is weak, that is specified by the
constructor). Subsequent requests for the same metadata will
result in the same DBObject
instance being returned.
Modifier and Type | Field and Description |
---|---|
static int |
CASE_SENSITIVE_NAME_POLICY
Both quoted and unquoted names are case sensitive, and kept
internally in the original case used when they were defined.
|
protected static java.lang.String[] |
EMPTY_LIST |
static int |
LOWER_CASE_NAME_POLICY
Unquoted Names are case insensitive and converted to lower case
internally.
|
static int |
MIXED_CASE_NAME_POLICY
Both quoted and unquoted names are case insensitive, and kept
internally in the original case used when they were defined.
|
static java.lang.String |
NEW_FROM_TEMPLATE_TYPE |
static java.lang.String |
TIMESTAMP_PROPERTY
The timestamp of the object - i.e.
|
static int |
UPPER_CASE_NAME_POLICY
Unquoted Names are case insensitive and converted to upper case
internally.
|
CREATE_PRIVILEDGE, DELETE_PRIVILEDGE, MODIFY_PRIVILEDGE
Modifier | Constructor and Description |
---|---|
protected |
AbstractDBObjectProvider()
Create a new provider that uses normal (i.e not weak) caching for its
objects.
|
protected |
AbstractDBObjectProvider(boolean weakCaching)
Creates a new provider specifing whether the caching of object
instances should be weak or not.
|
Modifier and Type | Method and Description |
---|---|
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,
DBObjectID id)
Adds a listener that is notified of any updates to the object
represented by the given DBObjectID.
|
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.
|
protected void |
cacheObject(SystemObject object,
boolean loadOperation)
Adds an object to the cache.
|
void |
canUpdate(Difference listDiff,
boolean replace,
boolean cascade)
Tests whether the given update can be performed.
|
protected <T extends SystemObject> |
checkCachedObject(T object)
Use by getObjectImpl to verify that the given object in the cache is still
valid.
|
void |
clearAllCaches()
Clears all cached information in this provider that has been loaded
from the underlying database.
|
void |
commitTransaction(DBObjectTransaction txn)
Commits a transaction of object changes.
|
protected abstract java.util.Collection<DBObjectChange> |
commitTransaction(DBObjectTransaction txn,
Difference listDiff)
Implement to commit the given transaction's difference.
|
static java.lang.String |
convertObject(DBObject obj)
Converts a DBObject into a String representation of the object name.
|
void |
createObject(SystemObject obj,
boolean replace)
Causes the creation of the object described by the specified meta data.
|
protected DBObjectFactory |
createObjectFactory()
Called once to create a factory for creating objects, and ensuring IDs,
etc in this provider.
|
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 Difference |
ensureSystemObjectListDifference(Difference diff)
Call this to ensure that the caller of an API method that takes a
Difference of SystemObject[] objects has a correct Difference arg.
|
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)
Notifies all listeners that the given objects have been added to this
provider.
|
void |
fireObjectsAdded(Schema schema,
SchemaObject[] objs)
Deprecated.
|
protected void |
fireObjectsRemoved(java.util.Collection<? extends SystemObject> sysObjs)
Notifies all listeners that the given objects have been removed from
this provider.
|
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.
with no replacement - the "provider deleted" event no
longer exists.
|
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()
Gets the DDLGenerator for this provider.
|
java.lang.String |
getDefaultSchemaName(DatabaseLink link)
The default schema of a database link may be different from the username associated with
that link.
|
DBObject |
getDefaultTemplateForType(java.lang.String type)
Returns the default template object for the given type, or null if none
defined.
|
java.lang.String |
getDescription()
Gets a short description of the provider.
|
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> |
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> |
getObjectImpl(DBObjectCriteria<T> criteria)
getObject implementation for looking up a single object in the
provider.
|
SchemaObjectManager |
getObjectManager()
Deprecated.
|
DataType |
getOrCreateDataType(java.lang.String typeName)
Gets (or creates) the datatype represented by a specific name.
|
PropertyManager |
getPropertyManager()
Gets the PropertyManager (if available) for this provider.
|
protected int |
getQuotedNameCasePolicy()
Deprecated.
getCasePolicy() covers both quoted and unquoted
names. |
Schema |
getSchema(java.lang.String name)
Retrieves the Schema object associated with a specific name.
|
SchemaObjectExpander[] |
getSchemaObjectExpanders()
Deprecated.
|
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. |
java.lang.String |
getUniqueName(java.lang.String type,
DBObject contextObject,
java.lang.String base,
java.util.Collection<java.lang.String> bannedNames)
Returns a unique name for an object of given type within
contextObject
using base name. |
protected boolean |
getUniqueNameTreatIndexAsSchemaObject()
Deprecated.
this limited mechanism has been superceeded by
DBObjectValidator#getNamespaceType |
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)
|
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 |
isClosed()
Tests whether the provider has been closed (e.g.
|
boolean |
isEditable(DBObject object)
Tests 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)
Deprecated.
no longer called - use
isRequestedObject(SystemObject,DBObjectCriteria) . |
protected <T extends SystemObject> |
isRequestedObject(T object,
DBObjectCriteria<T> criteria)
Checks whether the object that has been returned by a list operation
matches the given criteria.
|
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> |
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> |
listObjectsFromCache(DBObjectCriteria<T> criteria)
Lists the objects that are in the internal memory cache for this provider.
|
protected abstract <T extends SystemObject> |
listObjectsImpl(DBObjectCriteria<T> criteria)
Internal listObjects implementation.
|
protected java.util.Collection<SystemObject> |
listObjectsImpl(java.lang.String[] objectTypes,
Schema schema,
java.lang.String ref)
Deprecated.
listObjectsImpl(DBObjectCriteria) is the list
implementation. This method will be removed in a future release. If
you override this method it will not be called. |
protected java.lang.String[] |
listObjectsImpl(java.lang.String type,
Schema schema,
java.lang.String ref)
List implementation for listing only object names.
|
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 SystemObject |
loadObjectImpl(BaseObjectID id)
This is called when an id is resolved, and there is no object cached
for it.
|
protected <T extends SystemObject> |
loadObjectImpl(DBObjectCriteria<T> criteria)
Loads a SystemObject definition from the underlying metadata.
|
protected SystemObject |
loadObjectImpl(java.lang.String type,
Schema schema,
java.lang.String name)
Deprecated.
no longer used - replaced by
loadObjectImpl(DBObjectCriteria) |
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 void |
registerSchemaObjectExpander(SchemaObjectExpander expander)
Deprecated.
|
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.
|
protected DBObjectChange |
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 DBObjectChange |
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.
|
protected DBObject |
resolveID(DBObjectID id)
Finds an object that matches the given id.
|
protected SystemObject |
resolveIDImpl(BaseObjectID id)
Gets an object that is respresented by the given id.
|
protected SystemObject |
resolveReferenceID(ReferenceID id)
Resolves a given reference by trying to find an object with matching
details.
|
protected SystemObject |
resolveUnspecifiedTypeID(ReferenceID id)
Resolves a given type-less reference by trying to find an object with
matching name details.
|
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(Difference listDiff,
boolean replace,
boolean cascade)
Updates the definition of a set of objects.
|
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)
Final implementation delegates to the registered DBObjectValidator
for the given type.
|
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(DBObject object,
DBObject contextObject)
Validates that a name is not used within a context DBObject, and throws
NameInUseException if it is.
|
void |
validateUniqueName(java.lang.String type,
DBObject contextObject,
java.lang.String name)
Validates that a name is not used within a context DBObject, and throws
NameInUseException if it is.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canCreate, canDelete, createObjects, deleteObjects, getDefaultSchema, getDescriptor, getName, getProviderIdentifier, getProviderType, undeleteObject, undeleteObjects
public static final int MIXED_CASE_NAME_POLICY
public static final int LOWER_CASE_NAME_POLICY
public static final int UPPER_CASE_NAME_POLICY
public static final int CASE_SENSITIVE_NAME_POLICY
public static final java.lang.String TIMESTAMP_PROPERTY
public static final java.lang.String NEW_FROM_TEMPLATE_TYPE
protected static final java.lang.String[] EMPTY_LIST
protected AbstractDBObjectProvider()
protected AbstractDBObjectProvider(boolean weakCaching)
weakCaching
- if true cached DBObject implementations are held by
a weak reference so that they are eligible for garbage collection.public final java.lang.String getDescription()
DBObjectProvider
getDescription
in interface DBObjectProvider
DBObjectProviderFactory.getDescription(String,Object)
public boolean isClosed()
public final void removeProviderListener(DBObjectProviderListener list)
DBObjectProvider
removeProviderListener
in interface DBObjectProvider
DBObjectProviderListener
@Deprecated public final void removeProviderListener(DBObjectProviderListener list)
removeProviderListener(DBObjectProviderListener)
removeProviderListener
in interface DBObjectProvider
public final void addProviderListener(DBObjectProviderListener list)
DBObjectProvider
addProviderListener
in interface DBObjectProvider
DBObjectProviderListener
@Deprecated public final void addProviderListener(DBObjectProviderListener list)
addProviderListener(DBObjectProviderListener)
addProviderListener
in interface DBObjectProvider
public final void addObjectListener(DBObjectListener list, DBObjectCriteria crit)
DBObjectProvider
addObjectListener
in interface DBObjectProvider
list
- the listener to registercrit
- a criteria object to use to match objects that update
messages are published forDBObjectProvider.addObjectListener(DBObjectListener,SystemObject)
,
DBObjectProvider.addObjectListener(DBObjectListener,DBObjectID)
public final void addObjectListener(DBObjectListener list, SystemObject obj)
DBObjectProvider
This mechanism 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).
addObjectListener
in interface DBObjectProvider
list
- the listener to registerobj
- the object to receive update events forDBObjectProvider.addObjectListener(DBObjectListener,DBObjectCriteria)
,
DBObjectProvider.addObjectListener(DBObjectListener,DBObjectID)
public final void addObjectListener(DBObjectListener list, DBObjectID id)
DBObjectProvider
This mechanism 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).
addObjectListener
in interface DBObjectProvider
list
- the listener to registerid
- the id of obj the object to receive update events forDBObjectProvider.addObjectListener(DBObjectListener,DBObjectCriteria)
,
DBObjectProvider.addObjectListener(DBObjectListener,SystemObject)
public final void removeObjectListener(DBObjectListener list)
DBObjectProvider
DBObjectProvider.addObjectListener(DBObjectListener,SystemObject)
or
DBObjectProvider.addObjectListener(DBObjectListener,DBObjectCriteria)
.removeObjectListener
in interface DBObjectProvider
list
- the registered listener to removepublic java.lang.String getDefaultSchemaName(DatabaseLink link)
link
- The DatabaseLinkprotected final void fireProviderClosed()
@Deprecated public final void fireProviderDeleted()
protected final void fireProviderOpened()
protected final void fireProviderReloaded()
@Deprecated protected final void fireSchemaAdded(Schema schema)
fireObjectsAdded(Collection)
protected final void fireObjectsAdded(java.util.Collection<? extends SystemObject> sysObjs)
sysObjs
- a collecton of objects that have been added to this
provider@Deprecated protected final void fireSchemaUpdated(DBObjectChange change)
fireObjectUpdated(DBObjectChange)
@Deprecated protected final void fireSchemaObjectUpdated(DBObjectChange change)
fireObjectUpdated(DBObjectChange)
protected final void fireObjectUpdated(DBObjectChange change)
@Deprecated protected final void fireSchemaRemoved(Schema schema)
protected final void fireObjectsRemoved(java.util.Collection<? extends SystemObject> sysObjs)
sysObjs
- a collecton of objects that have been removed from this
provider@Deprecated public final void fireObjectsAdded(Schema schema, SchemaObject[] objs)
fireObjectsAdded(Collection)
@Deprecated protected final void fireObjectsRemoved(Schema schema, SchemaObject[] objs)
fireObjectsRemoved(Collection)
protected final 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()
protected final 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()
protected DBObjectBuilder getBuilderForType(java.lang.String type)
type
- a string containing the object typenull
if no builder is registeredprotected final 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 final DBObjectValidator getValidatorForType(java.lang.String type)
type
- a string containing the object typenull
if no validator is registeredprotected SystemObject 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 objectSchemaObject
representing
the specified object, or null>/code> if the object does
not exist in the cache
protected final SystemObject findObject(DBObjectID id)
id
- the id of the objectSystemObject
representing
the specified object, or null
if the object does
not exist in the cacheprotected void destroyCache()
public void clearAllCaches()
public SchemaObjectManager getCascadeManager()
getCascadeManager
in interface DBObjectProvider
@Deprecated public final SchemaObjectManager getObjectManager()
getObjectManager
in interface DBObjectProvider
protected SchemaObjectManager createObjectManager()
getCascadeManager()
which is synchronized.protected void cacheObject(SystemObject object, boolean loadOperation)
object
- the SchemaObject needing to be cachedloadOperation
- this is a load of the object, not a create or update.protected final void uncacheObject(SystemObject object)
object
- the SchemaObject needing to be removed from the cacheprotected java.lang.String[] listObjectsImpl(java.lang.String type, Schema schema, java.lang.String ref) throws DBException
listObjects(DBObjectCriteria)
(thereby
creating and caching SystemObjects) and then returns their names.type
- a string containg the type of object to listschema
- the schemaref
- a string containing a pattern to match object names againstDBException
@Deprecated protected java.util.Collection<SystemObject> listObjectsImpl(java.lang.String[] objectTypes, Schema schema, java.lang.String ref) throws DBException
listObjectsImpl(DBObjectCriteria)
is the list
implementation. This method will be removed in a future release. If
you override this method it will not be called.DBException
protected abstract <T extends SystemObject> java.util.Collection<T> listObjectsImpl(DBObjectCriteria<T> criteria) throws DBException
criteria
- the listing criteriaDBException
protected final <T extends SystemObject> java.util.Collection<T> listObjectsFromCache(DBObjectCriteria<T> criteria)
protected <T extends SystemObject> T getObjectImpl(DBObjectCriteria<T> criteria) throws DBException
criteria
- the lookup criteriaDBException
protected final java.lang.Long getExistingTimestamp(SystemObject object)
protected <T extends SystemObject> T checkCachedObject(T object) throws DBException
object
- the cached object to checkDBException
public Schema[] listSchemas() throws DBException
DBObjectProvider
listSchemas
in interface DBObjectProvider
DBException
- if an error is encountered listing the schemasDBObjectProvider.listSchemas(boolean)
public Schema[] listSchemas(boolean showAll) throws DBException
DBObjectProvider
listSchemas
in interface DBObjectProvider
showAll
- if false, only schemas containing objects belonging
to (or visible to) the user are returnedDBException
- if an error is encountered listing the schemas.public Schema getSchema(java.lang.String name) throws DBException
DBObjectProvider
getSchema
in interface DBObjectProvider
name
- a string containing the name of the schemaDBException
- if an error is encountered getting the schemaprotected Schema findSchema(java.lang.String name) throws DBException
name
- the name of the schema to findDBException
public final void resumeTimestampQueries(java.lang.String key)
public final void suspendTimestampQueries(java.lang.String key)
protected final java.lang.Object getCachedTimestamp(java.lang.Object obj)
obj
- the key in the timestamp cache to lookupprotected final java.lang.Object putCachedTimestampKey(java.lang.Object obj, java.lang.Object value)
obj
- the key for the timstamp cachevalue
- the value to put against the given keypublic boolean supportsTimestamps(java.lang.String objectType)
getProperties()
) under the TIMESTAMP_PROPERTY
key.
Returns false by default.
supportsTimestamps
in interface DBObjectProvider
@Deprecated public boolean supportsTimestamps()
supportsTimestamps(String)
public final java.lang.Long getTimestamp(java.lang.String type, Schema schema, java.lang.String objectName) throws DBException
DBObjectProvider
null
value should be returned.getTimestamp
in interface DBObjectProvider
type
- a String containing the type of the objectschema
- the Schema containing the objectobjectName
- a String containing the name of the objectDBException
- if an error is encountered getting the timestamppublic final java.lang.Long getTimestamp(DBObjectID id) throws DBException
DBObjectProvider
getTimestamp
in interface DBObjectProvider
id
- the ID for the objectDBException
- if an error is encountered getting the timestampDBObjectProvider.getTimestamp(String,Schema,String)
protected DBObject resolveID(DBObjectID id) throws DBException
The id must be for a SystemObject, child ids resolve themselves by resolving their parent first.
id
- the id to resolve by finding an object that matches it.DBException
protected SystemObject resolveIDImpl(BaseObjectID id) throws DBException
The id must be the returned object's actual DBObjectID, i.e. for a
returned SystemObject object
the following it true:
object.getID().equals( id, true )
id
- the id to resolve (it will not be a ReferenceID)DBException
protected SystemObject resolveReferenceID(ReferenceID id) throws DBException
id
- the reference to resolveDBException
protected SystemObject resolveUnspecifiedTypeID(ReferenceID id) throws DBException
id
- the reference to resolveDBException
protected DBObjectChange resetObject(SystemObject object, SystemObject listed, java.lang.Long timestamp)
object
- the object we want to have cached and resetlisted
- 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)protected DBObjectChange resetObject(SystemObject object, SystemObject listed, java.lang.Long timestamp, boolean updated)
If the object is already being reset and this method is called again
(e.g. recursively) then this method will do nothing but log a warning,
and return null
.
object
- the object we want to have cached and resetlisted
- 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)null
is returned if the object is already being reset.protected <T extends SystemObject> T loadObjectImpl(DBObjectCriteria<T> criteria) throws DBException
listObjects(DBObjectCriteria)
to list the objects with the given type/schema/name and then selects
one using isRequestedObject(SystemObject,DBObjectCriteria)
.
If the object is already cached (which can happen during an update operation) then if it still exists in the underlying metadata it will simply be returned without resetting it (i.e. checking the timestamp). The calling code is expected to deal with timestamps if it needs to.
criteria
- the criteria for the object we want to loadDBException
@Deprecated protected SystemObject loadObjectImpl(java.lang.String type, Schema schema, java.lang.String name) throws DBException
loadObjectImpl(DBObjectCriteria)
DBException
@Deprecated protected boolean isRequestedObject(SystemObject object, java.lang.String type, Schema schema, java.lang.String name)
isRequestedObject(SystemObject,DBObjectCriteria)
.protected <T extends SystemObject> boolean isRequestedObject(T object, DBObjectCriteria<T> criteria)
DBObjectCriteria.accept(SystemObject)
.object
- the listed objectcriteria
- the criteria used to list the objectprotected SystemObject loadObjectImpl(BaseObjectID id) throws DBException
The returned object should be marked for lazy loading if appropriate.
The default implementaion calls
loadObjectImpl(DBObjectCriteria)
with a criteria matching the
name information for the given id. To support identifier based ids this
method must be overridden.
It is expected that the object will not be in the cache already when this method is called.
id
- the id to load an object for - not a ReferenceIDDBException
protected java.lang.Long getExternalTimestampImpl(SystemObject object) throws DBException
object
- DBException
protected final java.lang.Long getExternalTimestamp(SystemObject object) throws DBException
DBException
protected final void markForLazyInit(AbstractBuildableObject object)
protected final void markForLazyInit(AbstractBuildableObject object, DBObjectBuilder builder)
public static java.lang.String convertObject(DBObject obj)
obj
- the DBObjectnull
, an empty String is returned.public java.lang.String getIdentifierQuoteString()
DBObjectProvider
null
.getIdentifierQuoteString
in interface DBObjectProvider
public java.lang.String[] listObjectTypes()
listObjectTypes
in interface DBObjectProvider
DBObjectProvider.listObjects(oracle.javatools.db.DBObjectCriteria<T>)
public boolean supportsObjectType(java.lang.String type)
DBObjectProvider
supportsObjectType
in interface DBObjectProvider
DBObjectProvider.listObjectTypes()
public final java.lang.String[] listObjects(java.lang.String objectType, Schema schema) throws DBException
DBObjectProvider
listObjects
in interface DBObjectProvider
objectType
- the type of objects to listschema
- the schema to list fromDBException
public final java.lang.String[] listObjects(java.lang.String objectType, Schema schema, java.lang.String ref) throws DBException
DBObjectProvider
listObjects
in interface DBObjectProvider
objectType
- the type of objects to listschema
- the schema to list fromref
- a pattern to match against.DBException
public final SchemaObject[] listObjects(java.lang.String[] objectTypes, Schema schema) throws DBException
DBObjectProvider
listObjects
in interface DBObjectProvider
objectTypes
- an array of Strings representing the desired typesschema
- the Schema to list fromDBException
- if an error is encountered listing the objectspublic final SchemaObject[] listObjects(java.lang.String[] objectTypes, Schema schema, java.lang.String ref) throws DBException
DBObjectProvider
listObjects
in interface DBObjectProvider
objectTypes
- 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 objectspublic final <T extends SystemObject> java.util.Collection<T> listObjects(DBObjectCriteria<T> criteria) throws DBException
DBObjectProvider
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<Relation> c = new DBObjectCriteria<Relation>(Relation.class); c.setSchemaName( "HR" ); Collection<Relation> rels = pro.listObjects( c ); // list all the schemas in this provider Collection<Schema> schemas = pro.listObjects( new DBObjectCriteria<Schema>(Schema.class) );
listObjects
in interface DBObjectProvider
criteria
- the filter to use for listing objects (cannot be null)DBException
- if an error is encountered listing the objectspublic final <T extends SystemObject> T getObject(DBObjectCriteria<T> criteria) throws DBException
DBObjectProvider
Examples:
// find EMP in a given provider and schema DBObjectProvider pro = ... Schema schema = ... SystemObject obj = pro.getObject( DBObjectCriteria.createSingleObjectCriteria( Table.TYPE, schema, "EMP" ) ); // find Table HR.EMPLOYEES DBObjectCriteria<Table> c = new DBObjectCriteria<Table>(Table.class); c.setName( "EMPLOYEES" ); c.setSchemaName( "HR" ); Table employees = pro.getObject( c );
getObject
in interface DBObjectProvider
criteria
- the criteria to match the object requiredDBException
- if an error is encountered retrieving the objectpublic final SchemaObject getObject(java.lang.String objectType, Schema schema, java.lang.String name) throws DBException
DBObjectProvider
DBObjectProvider.getObject(DBObjectCriteria)
.getObject
in interface DBObjectProvider
objectType
- the type of object desired.schema
- the name of the schema containing the objectname
- the name of the objectDBException
- if an error is encountered retrieving the objectDBObject.getType()
@Deprecated public boolean hasPriviledge(java.lang.String type, Schema schema, java.lang.String priv)
hasSystemPrivilege(java.lang.String, oracle.javatools.db.Schema, java.lang.String)
hasPriviledge
in interface DBObjectProvider
public boolean hasSystemPrivilege(java.lang.String type, Schema schema, java.lang.String priv)
hasSystemPrivilege
in interface DBObjectProvider
type
- the object type on which the operation is being performed.schema
- the schema to check. A value of null
checks for the
current schema.priv
- a pre-defined operation.public boolean hasObjectPrivilege(SystemObject object, java.lang.String priv)
hasObjectPrivilege
in interface DBObjectProvider
object
- the object on which the operation is being performed.priv
- a pre-defined operation.public void canUpdate(Difference listDiff, boolean replace, boolean cascade) throws DBException
DBObjectProvider
canCreate
and canDelete
methods which return
a simple boolean so the reason cannot be determined.canUpdate
in interface DBObjectProvider
listDiff
- a LIST Difference containing new and old schema objectsreplace
- whether existing objects can be replacedcascade
- whether to cascade any changes. If this is false and
there are dependent objects a CascadeRequiredException will be thrown.DBException
DBObjectProvider.updateObjects(Difference,boolean,boolean)
public final void createObject(SystemObject obj, boolean replace) throws DBException
DBObjectProvider
createObject
in interface DBObjectProvider
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.DBException
- if an error is encountered creating the object.public final void deleteObject(SystemObject obj, boolean cascade) throws DBException
DBObjectProvider
deleteObject
in interface DBObjectProvider
obj
- the object to deletecascade
- whether to delete dependent objectsDBException
- if an error is encountered performing the deletepublic final void updateObject(SystemObject oldObject, SystemObject newObject) throws DBException
DBObjectProvider
updateObject
in interface DBObjectProvider
oldObject
- the old version of the objectnewObject
- the new version of the objectDBException
- if the update failsDBObjectProvider.updateObjects(Difference,boolean,boolean)
public final void updateObjects(SystemObject[] oldObjects, SystemObject[] newObjects) throws DBException
DBObjectProvider
updateObjects
in interface DBObjectProvider
oldObjects
- the old version of the objectsnewObjects
- the new version of the objectsDBException
- if the update failsDBObjectProvider.updateObjects(Difference,boolean,boolean)
public void createSchema(Schema schema, boolean replace) throws DBException
DBObjectProvider
createSchema
in interface DBObjectProvider
schema
- the schema being createdreplace
- whether to replace an existing schemaDBException
- if an error is encountered creating the schemapublic void deleteSchema(Schema schema, boolean cascade) throws DBException
DBObjectProvider
deleteSchema
in interface DBObjectProvider
schema
- the schema to deletecascade
- whether to delete dependent objects (i.e. all SchemaObjects
contained in the Schema).DBException
- if an error is encountered performing the deletepublic void updateSchema(Schema oldSchema, Schema newSchema) throws DBException
DBObjectProvider
updateSchema
in interface DBObjectProvider
oldSchema
- the old version of the schemanewSchema
- the new version of the schemaDBException
- if the update failspublic PropertyManager getPropertyManager()
DBObjectProvider
getPropertyManager
in interface DBObjectProvider
public final DDLGenerator getDDLGenerator()
DatabaseDescriptor.getDDLGenerator(oracle.javatools.db.DBObjectProvider)
.getDDLGenerator
in interface DBObjectProvider
protected final int getCasePolicy()
LOWER_CASE_NAME_POLICY
,
MIXED_CASE_NAME_POLICY
,
UPPER_CASE_NAME_POLICY
,
CASE_SENSITIVE_NAME_POLICY
@Deprecated protected final int getQuotedNameCasePolicy()
getCasePolicy()
covers both quoted and unquoted
names.@Deprecated public final boolean isValidName(java.lang.String name)
isValidName
in interface DBObjectProvider
name
- the name to checkpublic final boolean isValidName(java.lang.String type, java.lang.String name)
isValidName
in interface DBObjectProvider
name
- the name to checktype
- the type of object the name is intended for@Deprecated public final void validateName(java.lang.String name) throws InvalidNameException
DBObjectProvider
validateName
in interface DBObjectProvider
name
- the name to checkInvalidNameException
- with appropriate message if the name is
invalid.public final void validateName(java.lang.String type, java.lang.String name) throws InvalidNameException
validateName
in interface DBObjectProvider
type
- the type of object that the name is intended for
(e.g. Table.TYPE
)name
- the external name to checkInvalidNameException
- with appropriate message if the name is
invalid.DBObjectValidator#validateName(String,String)
,
DatabaseDescriptor.validateName(String,String)
public final java.lang.String quoteIdentifier(java.lang.String internalName, boolean force) throws DBException
quoteIdentifier
in interface DBObjectProvider
internalName
- force
- Always quote the nameDBException
public final java.lang.String getInternalName(java.lang.String name, java.lang.String objectType)
DBObjectProvider
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.
getInternalName
in interface DBObjectProvider
name
- a String containing the name to convertobjectType
- a String containing the type of object being namedDBObjectProvider.getExternalName(String,String)
,
DBObjectProvider.validateName(String,String)
public final java.lang.String getInternalName(java.lang.String name)
DBObjectProvider
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.
getInternalName
in interface DBObjectProvider
name
- a String containing the name to convertDBObjectProvider.getInternalName(String,String)
public final java.lang.String getExternalName(java.lang.String name, java.lang.String objectType)
DBObjectProvider
quoteIdentifier
, specifying false
for the
force argument. Note, however, that exceptions are not thrown; rather, the
original name will be returned.getExternalName
in interface DBObjectProvider
name
- a String containing the name to externalizeobjectType
- a String containing the type of object being namedDBObjectProvider.getInternalName(String,String)
public final java.lang.String getExternalName(java.lang.String name)
DBObjectProvider
quoteIdentifier
, specifying false
for the
force argument. Note, however, that exceptions are not thrown; rather, the
original name will be returned.getExternalName
in interface DBObjectProvider
name
- a String containing the name to externalizepublic DataType[] listSupportedDataTypes()
DBObjectProvider
listSupportedDataTypes
in interface DBObjectProvider
DataType
objects representing the
supported datatypes.public DataType getDataType(java.lang.String typeName)
DBObjectProvider
getDataType
in interface DBObjectProvider
typeName
- a String containing the name of the datatype.public DataType getOrCreateDataType(java.lang.String typeName)
DBObjectProvider
DBObjectProvider.getDataType(String)
.getOrCreateDataType
in interface DBObjectProvider
typeName
- a String containing the name of the datatype.public void validateObject(DBObject object) throws ValidationException
validateObject
in interface DBObjectProvider
object
- The object to validateValidationException
- 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.@Deprecated public final void validateObject(DBObject object, java.lang.String property) throws ValidationException
validateObject
in interface DBObjectProvider
ValidationException
@Deprecated public final void validateObjectProperty(DBObject object, java.lang.Object property) throws ValidationException
validateObjectProperty
in interface DBObjectProvider
ValidationException
public void validateObjectProperty(DBObject object, java.lang.String property) throws ValidationException
DBObjectProvider
DBObjectProvider.validateObject(DBObject)
is called.validateObjectProperty
in interface DBObjectProvider
object
- The object to validateproperty
- An identifier for a specific property to validateValidationException
- 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.@Deprecated public void validateSchema(Schema schema) throws ValidationException
DBObjectProvider
validateSchema
in interface DBObjectProvider
schema
- The Schema to validateValidationException
- 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 DBObjectProvider
original
- the original objectupdate
- the updated object to validateValidationException
- 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.@Deprecated public final void validateObject(DBObject original, DBObject update, java.lang.String property) throws ValidationException
validateObject
in interface DBObjectProvider
ValidationException
@Deprecated public final void validateObjectProperty(DBObject original, DBObject updated, java.lang.Object property) throws ValidationException
validateObjectProperty
in interface DBObjectProvider
ValidationException
public void validateObjectProperty(DBObject original, DBObject update, java.lang.String property) throws ValidationException
DBObjectProvider
DBObjectProvider.validateObject(DBObject,DBObject)
is called.validateObjectProperty
in interface DBObjectProvider
original
- The original version of the edited objectupdate
- The edited object to validateproperty
- An identifier for a specific property to validateValidationException
- 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.@Deprecated public void validateSchema(Schema original, Schema update) throws ValidationException
DBObjectProvider
validateSchema
in interface DBObjectProvider
original
- the original schemaupdate
- the updated schema to validateValidationException
- if the updated schema is not valid. The
exception will describe the validation failure.public final void validateUniqueName(java.lang.String type, DBObject contextObject, java.lang.String name) throws NameInUseException
This implementation creates a dummy DBObject with the given type and
name and calls validateUniqueName(DBObject,DBObject)
.
validateUniqueName
in interface DBObjectProvider
type
- the type of name being validatedcontextObject
- the database object context to use when
determining the uniqueness of the name (can be a parent, or a Schema,
or null).name
- the name to be checkedjava.lang.IllegalStateException
- if type is not a recognised or valid
(instantiable) object type.NameInUseException
- if the name is in use.public void validateUniqueName(DBObject object, DBObject contextObject) throws NameInUseException
DBObjectProvider
validateUniqueName
in interface DBObjectProvider
object
- the object whose name is to be validated as uniquecontextObject
- the database object context to use when
determining the uniqueness of the name (can be a parent, or a Schema,
or null).NameInUseException
- if the name is in use.public java.lang.String getUniqueName(java.lang.String type, DBObject contextObject, java.lang.String base)
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.getUniqueName
in interface DBObjectProvider
type
- the type of the objectcontextObject
- the context object, e.g. the owning schema or the
parent objectbase
- a candidate base namepublic java.lang.String getUniqueName(java.lang.String type, DBObject contextObject, java.lang.String base, java.util.Collection<java.lang.String> bannedNames)
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.getUniqueName
in interface DBObjectProvider
type
- the type of the objectcontextObject
- the context object, e.g. the owning schema or the
parent objectbase
- a candidate base namebannedNames
- a collection of names not to be used when determining
a unique name. This collection is in addition to any existing objects in
the provider.@Deprecated protected boolean getUniqueNameTreatIndexAsSchemaObject()
DBObjectValidator#getNamespaceType
protected java.lang.String normaliseType(java.lang.String type)
public DiffEngine getDiffEngine()
DBObjectProvider
Providers which do not support object updating should return null.
getDiffEngine
in interface DBObjectProvider
protected Difference ensureSystemObjectListDifference(Difference diff) throws java.lang.IllegalArgumentException
diff
- the diff to checkjava.lang.IllegalArgumentException
- if the diff isn't a SystemObject[]
diff and can't be turned in to one.protected java.util.logging.Logger getLogger()
protected void logEvent(java.lang.String msg, java.lang.Object... params)
public boolean isEditable(DBObject object)
DBObjectProvider
isEditable
in interface DBObjectProvider
public DBObject getDefaultTemplateForType(java.lang.String type)
getDefaultTemplateForType
in interface DBObjectProvider
public void setDefaultTemplateForType(java.lang.String type, DBObject template)
setDefaultTemplateForType
in interface DBObjectProvider
public boolean isNewFromTemplateType(java.lang.String type)
DBObjectProvider
isNewFromTemplateType
in interface DBObjectProvider
type
- the type to test@Deprecated protected void registerSchemaObjectExpander(SchemaObjectExpander expander)
@Deprecated public SchemaObjectExpander[] getSchemaObjectExpanders()
public DBObjectFactory getObjectFactory()
DBObjectProvider
getObjectFactory
in interface DBObjectProvider
protected DBObjectFactory createObjectFactory()
public final void updateObjects(Difference listDiff, boolean replace, boolean cascade) throws DBException
DBObjectProvider
Difference
which
must have been created using the DiffEngine
returned by
DBObjectProvider.getDiffEngine()
The 'change' maybe to create, alter, or delete
objects.
Example usage to rename a simple table and cascade the change:
final Table orig = provider.getObject( Table.TYPE, schema, "OLD_NAME" ); // create a temporary copy that can be used to update final Table update = (Table)orig.copyTo( null, true ); update.setName( "NEW_NAME" ); // create a LIST Difference containing the new and old objects final Difference diff = provider.getDiffEngine().difference( new SystemObject[]{ orig }, new SystemObject[]{ update } ); provider.updateObjects( diff , false, true );
updateObjects
in interface DBObjectProvider
listDiff
- the changes described as a Difference
- this
should be a LIST Difference with the old objects as a() and the new
objects as b().replace
- true if existing objects can be replaced (used when
creating - i.e. the "old" update in the Difference is null)cascade
- true if changes can be cascaded throughout the provider
(e.g. deletes cascaded, renames propogated etc). If this is false and
the operation cannot continue without cascading a
CascadeRequiredException will be thrown. Some DBObjectProvider
implementations will automatically cascade some changes - for example
an Oracle Database will propogate a Table rename to its Triggers.DBException
public final void commitTransaction(DBObjectTransaction txn) throws DBException
DBObjectProvider
commitTransaction
in interface DBObjectProvider
txn
- the transaction to commitDBException
- if the operation fails.protected abstract java.util.Collection<DBObjectChange> commitTransaction(DBObjectTransaction txn, Difference listDiff) throws DBException
txn
- the transaction (create/update/delete of objects) to commitlistDiff
- the difference detailing the changes that the are in
the transaction and that require commitingDBException
- if the commit could not be performed