public abstract class OfflineDBObjectProvider extends AbstractDBObjectProvider
See DBObjectProvider for a full list of the methods available. Where the offline database has specific behaviour for a method it will have doc included (overriden) for this class.
For more information on using the offlinedb read the package documentation.
oracle.jdeveloper.offlinedb
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROVIDER_TYPE
Used to identify OfflineDBObjectProvider implementations when
using
DBObjectProviderFactory . |
CASE_SENSITIVE_NAME_POLICY, EMPTY_LIST, LOWER_CASE_NAME_POLICY, MIXED_CASE_NAME_POLICY, NEW_FROM_TEMPLATE_TYPE, TIMESTAMP_PROPERTY, UPPER_CASE_NAME_POLICY
CREATE_PRIVILEDGE, DELETE_PRIVILEDGE, MODIFY_PRIVILEDGE
Modifier | Constructor and Description |
---|---|
protected |
OfflineDBObjectProvider(java.net.URL url) |
Modifier and Type | Method and Description |
---|---|
boolean |
canCreate(SystemObject object,
boolean replace)
Returns true if the schema for this object exists, and the file
representing this object can be saved.
|
boolean |
canDelete(SystemObject object,
boolean cascade)
Returns true if a delete operation on the given schema object is likely
to succeed.
|
void |
createObjects(SystemObject[] objects,
boolean replace)
Used to create (or replace) the given SystemObjects.
|
void |
deleteObjects(SystemObject[] objects,
boolean cascade)
Deletes a set of objects together.
|
protected abstract boolean |
ensureOpen()
Tests whether this provider is closed, and therefore will not function.
|
protected abstract java.net.URL |
findObjectURL(DBObjectID id)
Finds the URL containing the given object ID.
|
static OfflineDBObjectProvider |
findOrCreateProvider(Project p,
java.net.URL url)
Finds an existing, or creates a new, OfflineDBObjectProvider instance
for the given URL.
|
static OfflineDBObjectProvider |
findProvider(Project project,
BaseObjectID objID)
Iterates through the project's providers, and see if any contain a matching
object id.
|
static OfflineDBObjectProvider |
findProvider(Project p,
java.lang.String id)
Deprecated.
replaced by
findProviderByID(Project,String) . |
static OfflineDBObjectProvider |
findProviderByID(Project p,
java.lang.String id)
Finds a provider by its ID in the given Project.
|
static OfflineDBObjectProvider |
findProviderByName(Context c,
java.lang.String name)
Finds an Offline Database with the given name in the given Context.
|
static OfflineDBObjectProvider |
findProviderByName(Project p,
java.lang.String name)
Finds an Offline Database with the given name in the context of the given
Project.
|
static OfflineDBObjectProvider |
getDBObjectProvider(Context c)
Returns the provider for the given ide context.
|
abstract Schema |
getDefaultSchema()
Returns the default schema for this provider - this schema may not (yet)
exist in the provider.
|
DBObject |
getDefaultTemplateForType(java.lang.String type)
Returns the default template object for the given type, or null if none
defined.
|
protected java.util.logging.Logger |
getLogger()
Gets the logger to use in this provider.
|
java.lang.String |
getName()
Returns the name of this provider (from the provider's settings).
|
DBObject |
getObject(OfflineDBObjectNode node)
Retrieves the object from the given node ensuring that the object's
ID is correctly setup for this provider.
|
SchemaObject |
getObject(SchemaObjectNode node)
Retrieves the SchemaObject from the given node ensuring that the object's
ID is correctly setup for this provider.
|
abstract SystemObject |
getObject(java.net.URL url)
Retrieves the SchemaObject from the given URL ensuring that the object's
ID is correctly setup for this provider.
|
protected <T extends SystemObject> |
getObjectImpl(DBObjectCriteria<T> criteria)
getObject implementation for looking up a single object in the
provider.
|
Node |
getObjectNode(DBObjectID id)
Gets the Node for the given object id if it exists within the current
provider.
|
Node |
getObjectNode(SystemObject obj)
Gets the Node for the given object id if it exists within the current
provider.
|
java.net.URL |
getObjectURL(DBObjectID id)
Gets the URL for the given object id if it exists within the current
provider.
|
java.net.URL |
getObjectURL(SystemObject obj)
Gets the URL for the given object id if it exists within the current
provider.
|
java.lang.Object |
getProviderIdentifier()
Gets the String that identifies this DBObjectProvider uniquely (within
providers of the same type).
|
static java.util.Iterator<OfflineDBObjectProvider> |
getProviderIterator(Project p)
Returns an iterator over the providers in a project.
|
static java.util.Iterator<OfflineDBObjectProvider> |
getProviderIterator(Project p,
boolean incProjDeps)
Returns an iterator over the providers in a project.
|
java.lang.String |
getProviderType()
Gets the String that identifies the type of DBObjectProvider this is an
instance of.
|
Schema |
getSchema(java.lang.String name,
boolean incBuiltInSchemas)
Offline specific method for retrieving the schema with a given name without
looking through the built-in schemas.
|
abstract ProviderSettings |
getSettings()
Returns the current settings for this offline provider.
|
static java.lang.String |
getUniqueProviderName(Project p,
java.lang.String name)
Returns a unique provier name for the given provider within the project
based on the given base name.
|
abstract java.lang.String |
getUniqueSchemaName(java.lang.String base)
Returns a unique name for a schema within this provider given the base
name.
|
java.net.URL |
getURL()
Returns the URL for this offline provider.
|
boolean |
isDependentProvider(OfflineDBObjectProvider provider)
Determines whether the given provider is in the dependency chain for this
provider, i.e.
|
boolean |
isEditable(DBObject object)
Tests whether or not the object can be edited.
|
protected abstract <T extends SystemObject> |
listAllObjects(DBObjectCriteria<T> criteria)
Lists the objects by type, schema and name (can include wildcard '%') from
this provide only, not its dependencies.
|
static java.util.List<OfflineDBObjectProvider> |
listDBObjectProviders(Project p)
Lists the providers that already exist on the given project's offline
database source path.
|
static java.util.List<OfflineDBObjectProvider> |
listDBObjectProviders(Project p,
boolean incProjDeps)
Lists the providers that already exist on the given project's offline
database source path.
|
static java.lang.Iterable<java.net.URL> |
listDBObjectProviderURLs(Project p,
boolean incProjDeps)
Lists the URLs of any OfflineDBObjectProviders in the given project.
|
protected <T extends SystemObject> |
listObjectsImpl(DBObjectCriteria<T> criteria)
Internal listObjects implementation.
|
protected <T extends SystemObject> |
loadObjectImpl(DBObjectCriteria<T> criteria)
Creates a schema object by looking on the filesystem (using listAllObjects)
for the appropriate filename.
|
protected DBObject |
resolveID(DBObjectID id)
Finds a given object by ID.
|
void |
setDefaultTemplateForType(java.lang.String type,
DBObject so)
Sets the default template object for the given type.
|
protected void |
setURL(java.net.URL newURL) |
java.lang.String |
toString() |
void |
undeleteObject(SchemaObject object)
This method is not currently supported in the offline provider.
|
void |
undeleteObjects(SchemaObject[] objects)
This method is not currently supported in the offline provider.
|
void |
updateSchema(Schema oldSchema,
Schema newSchema)
Updates the definition of a Schema.
|
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 |
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.String property)
Checks to see if the children of a given object are valid.
|
addObjectListener, addObjectListener, addObjectListener, addProviderListener, addProviderListener, cacheObject, canUpdate, checkCachedObject, clearAllCaches, commitTransaction, commitTransaction, convertObject, createObject, createObjectFactory, createObjectManager, createSchema, deleteObject, deleteSchema, destroyCache, ensureSystemObjectListDifference, findObject, findObject, findSchema, fireObjectsAdded, fireObjectsAdded, fireObjectsRemoved, fireObjectsRemoved, fireObjectUpdated, fireProviderClosed, fireProviderDeleted, fireProviderOpened, fireProviderReloaded, fireSchemaAdded, fireSchemaObjectUpdated, fireSchemaRemoved, fireSchemaUpdated, getBuilderForType, getCachedTimestamp, getCascadeManager, getCasePolicy, getDataType, getDDLGenerator, getDefaultSchemaName, getDescription, getDiffEngine, getExistingTimestamp, getExternalName, getExternalName, getExternalTimestamp, getExternalTimestampImpl, getIdentifierQuoteString, getInternalName, getInternalName, getObject, getObject, getObjectFactory, getObjectManager, getOrCreateDataType, getPropertyManager, getQuotedNameCasePolicy, getSchema, getSchemaObjectExpanders, getTimestamp, getTimestamp, getUniqueName, getUniqueName, getUniqueNameTreatIndexAsSchemaObject, getValidatorForType, hasObjectPrivilege, hasPriviledge, hasSystemPrivilege, isClosed, isNewFromTemplateType, isRequestedObject, isRequestedObject, isValidName, isValidName, listObjects, listObjects, listObjects, listObjects, listObjects, listObjectsFromCache, listObjectsImpl, listObjectsImpl, listObjectTypes, listSchemas, listSchemas, listSupportedDataTypes, loadObjectImpl, loadObjectImpl, logEvent, markForLazyInit, markForLazyInit, normaliseType, putCachedTimestampKey, quoteIdentifier, registerBuilder, registerSchemaObjectExpander, registerType, registerValidator, removeObjectListener, removeProviderListener, removeProviderListener, resetObject, resetObject, resolveIDImpl, resolveReferenceID, resolveUnspecifiedTypeID, resumeTimestampQueries, supportsObjectType, supportsTimestamps, supportsTimestamps, suspendTimestampQueries, uncacheObject, updateObject, updateObjects, updateObjects, validateName, validateName, validateObject, validateObject, validateObjectProperty, validateObjectProperty, validateSchema, validateSchema, validateUniqueName, validateUniqueName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDescriptor
public static final java.lang.String PROVIDER_TYPE
DBObjectProviderFactory
.public final java.lang.String getProviderType()
DBObjectProvider
public final java.lang.Object getProviderIdentifier()
DBObjectProvider
getName()
for a displayable String).public abstract ProviderSettings getSettings()
public final java.net.URL getURL()
protected final void setURL(java.net.URL newURL)
public final java.lang.String getName()
getSettings()
protected java.util.logging.Logger getLogger()
AbstractDBObjectProvider
getLogger
in class AbstractDBObjectProvider
public java.lang.String toString()
toString
in class java.lang.Object
public final SchemaObject getObject(SchemaObjectNode node) throws DBException
DBException
- is this is not possible - e.g. the given node is a
duplicate on the database path for this provider.public final DBObject getObject(OfflineDBObjectNode node) throws DBException
DBException
- is this is not possible - e.g. the given node is a
duplicate on the database path for this provider.public abstract SystemObject getObject(java.net.URL url) throws DBException
DBException
- if this is not possible.protected abstract java.net.URL findObjectURL(DBObjectID id) throws CancelledException
CancelledException
public final java.net.URL getObjectURL(DBObjectID id)
id
- the DBObjectID to lookupgetObjectURL(SystemObject)
public final java.net.URL getObjectURL(SystemObject obj)
obj
- the object to lookupgetObjectURL(DBObjectID)
public final Node getObjectNode(SystemObject obj)
obj
- the object to lookupgetObjectNode(DBObjectID)
,
getObjectURL(SystemObject)
public final Node getObjectNode(DBObjectID id)
id
- the DBObjectID to lookupgetObjectNode(SystemObject)
,
getObjectURL(DBObjectID)
public boolean isEditable(DBObject object)
DBObjectProvider
isEditable
in interface DBObjectProvider
isEditable
in class AbstractDBObjectProvider
public boolean canCreate(SystemObject object, boolean replace)
true
is only returned if replace is also true, and the
object's file is writable.object
- the SystemObject describing the object to createreplace
- whether to replace an existing object. If
replace
is false and the object exists, canCreate must
return false.public boolean canDelete(SystemObject object, boolean cascade)
object
- the object to checkcascade
- whether to assume a cascading delete should be used.public final void createObjects(SystemObject[] objects, boolean replace) throws DBException
Update messages are fired to any observers following the outcome of the operation.
Note: if you call this method with an object whose Schema hasn't
explicitly been retrieved from the getSchema()
method then one
of two things will happen:
objects
- the SystemObject[] describing the objects to create.replace
- whether to replace an existing objects. If
replace
is false and the object exists, createObjects will
fail.DBException
- if an error is encountered creating the objects.DBObjectProvider.createObjects(oracle.javatools.db.SystemObject[], boolean)
public final void deleteObjects(SystemObject[] objects, boolean cascade) throws DBException
objects
- the objects to deletecascade
- whether to delete dependent objectsDBException
- if an error is encountered performing the deletepublic final void updateSchema(Schema oldSchema, Schema newSchema) throws DBException
DBObjectProvider
updateSchema
in interface DBObjectProvider
updateSchema
in class AbstractDBObjectProvider
oldSchema
- the old version of the schemanewSchema
- the new version of the schemaDBException
- if the update failspublic void undeleteObject(SchemaObject object) throws DBException
object
- the object to be undeletedDBException
- if an error is encountered performing the undeletepublic void undeleteObjects(SchemaObject[] objects) throws DBException
objects
- the objects to be undeletedDBException
- if an error is encountered performing the undeletepublic void validateObject(DBObject object) throws ValidationException
validateObject
in interface DBObjectProvider
validateObject
in class AbstractDBObjectProvider
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.public void validateObject(DBObject original, DBObject update) throws ValidationException
validateObject
in interface DBObjectProvider
validateObject
in class AbstractDBObjectProvider
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.public void validateObjectProperty(DBObject original, DBObject update, java.lang.String property) throws ValidationException
DBObjectProvider
DBObjectProvider.validateObject(DBObject,DBObject)
is called.validateObjectProperty
in interface DBObjectProvider
validateObjectProperty
in class AbstractDBObjectProvider
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.public void validateObjectProperty(DBObject object, java.lang.String property) throws ValidationException
DBObjectProvider
DBObjectProvider.validateObject(DBObject)
is called.validateObjectProperty
in interface DBObjectProvider
validateObjectProperty
in class AbstractDBObjectProvider
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.public boolean isDependentProvider(OfflineDBObjectProvider provider)
Given the dependency chain PARENT and CHILD, where CHILD lists PARENT as one of its dependencies, calling isDependentProvider on CHILD and passing in PARENT will return true. Calling it on PARENT and passing in CHILD will return false.
provider
- the provider to compare withpublic final Schema getSchema(java.lang.String name, boolean incBuiltInSchemas) throws DBException
name
- the schema to search forincBuiltInSchemas
- whether to search the built-in schemas, e.g.
complex type schemas, PUBLIC schema for synonyms etc.DBException
AbstractDBObjectProvider.getSchema(java.lang.String)
public abstract Schema getDefaultSchema()
public abstract java.lang.String getUniqueSchemaName(java.lang.String base)
protected <T extends SystemObject> T getObjectImpl(DBObjectCriteria<T> criteria) throws DBException
AbstractDBObjectProvider
getObjectImpl
in class AbstractDBObjectProvider
criteria
- the lookup criteriaDBException
protected DBObject resolveID(DBObjectID id) throws DBException
resolveID
in class AbstractDBObjectProvider
id
- the id to resolve by finding an object that matches it.DBException
DBObjectID.resolveID()
protected <T extends SystemObject> T loadObjectImpl(DBObjectCriteria<T> criteria) throws DBException
loadObjectImpl
in class AbstractDBObjectProvider
criteria
- the criteria for the object we want to loadDBException
protected <T extends SystemObject> java.util.Collection<T> listObjectsImpl(DBObjectCriteria<T> criteria) throws DBException
AbstractDBObjectProvider
listObjectsImpl
in class AbstractDBObjectProvider
criteria
- the listing criteriaDBException
protected abstract <T extends SystemObject> java.util.Collection<T> listAllObjects(DBObjectCriteria<T> criteria)
If the accepts parameter is not null then each object is tested using it once opened. If the object is aceepted then the iteration is stopped and just that object is returned in the Collection. This allows a "search" for an object to jump out and not load all the objects.
AbstractDBObjectProvider.listObjects(DBObjectCriteria)
protected abstract boolean ensureOpen()
Calling this method will attempt to reinitialize the provider. Do not call it unless the provider is expected to function.
public DBObject getDefaultTemplateForType(java.lang.String type)
AbstractDBObjectProvider
getDefaultTemplateForType
in interface DBObjectProvider
getDefaultTemplateForType
in class AbstractDBObjectProvider
public void setDefaultTemplateForType(java.lang.String type, DBObject so)
AbstractDBObjectProvider
setDefaultTemplateForType
in interface DBObjectProvider
setDefaultTemplateForType
in class AbstractDBObjectProvider
public static final OfflineDBObjectProvider getDBObjectProvider(Context c)
ProviderWizard.showMissingProviderError(oracle.ide.Context, java.lang.String)
public static final java.util.List<OfflineDBObjectProvider> listDBObjectProviders(Project p)
getProviderIterator(Project)
public static final java.util.List<OfflineDBObjectProvider> listDBObjectProviders(Project p, boolean incProjDeps)
p
- the project to look inincProjDeps
- whether to search the project's dependencies as well.getProviderIterator(Project)
public static final java.util.Iterator<OfflineDBObjectProvider> getProviderIterator(Project p)
listDBObjectProviders(Project)
public static final java.util.Iterator<OfflineDBObjectProvider> getProviderIterator(Project p, boolean incProjDeps)
p
- the project to look inincProjDeps
- whether to search the project's dependencies as well.listDBObjectProviders(Project)
public static final java.lang.String getUniqueProviderName(Project p, java.lang.String name)
@Deprecated public static final OfflineDBObjectProvider findProvider(Project p, java.lang.String id)
findProviderByID(Project,String)
.public static final OfflineDBObjectProvider findProviderByName(Context c, java.lang.String name)
c
- the context to searchname
- the name of the offline database to findpublic static final OfflineDBObjectProvider findProviderByName(Project p, java.lang.String name)
p
- the project to searchname
- the name of the offline database to findpublic static final OfflineDBObjectProvider findProviderByID(Project p, java.lang.String id)
The ID isn't used by the DBObjectProviderFactory - because the URL is required to retrieve the provider succefully. The ID is provider as a mechanism to uniquely identify a provider within the context of a project.
p
- the project to search inid
- the id of the providerProviderSettings.getID()
,
getProviderIterator(oracle.ide.model.Project)
public static final OfflineDBObjectProvider findProvider(Project project, BaseObjectID objID)
project
- the project to search inobjID
- the id of an object you expect to find in your provider. This
needs its type and guid set, but not the provider obviously.findProvider(oracle.ide.model.Project, java.lang.String)
public static java.lang.Iterable<java.net.URL> listDBObjectProviderURLs(Project p, boolean incProjDeps)
p
- the project to look inincProjDeps
- whether to include dependencies of the projectpublic static OfflineDBObjectProvider findOrCreateProvider(Project p, java.net.URL url) throws DBException
p
- the containing Projecturl
- the url for the offline databaseDBException
ProviderWizard