See: Description
Interface | Description |
---|---|
OfflineDBUpdateManager.Processor | |
OfflineDBValidationManager.Validator |
Interface to be implemented for any class wishing to be registered to
provide extra validation in the offlinedb.
|
Class | Description |
---|---|
OfflineDBObjectFactory |
Factory class with methods for creating DBObjects for use in the
offline API.
|
OfflineDBObjectID | Deprecated
use IdentifierBasedID if a subclass of DBObjectID is *really*
needed.
|
OfflineDBObjectProvider |
Extension of DBObjectProvider for the offline projects.
|
OfflineDBPropertyInitializationManager | Deprecated |
OfflineDBUpdateManager |
Manager that can be used to extend the offline databases's update logic.
|
OfflineDBUtil |
Utility class for the offline database project.
|
OfflineDBValidationManager |
Manager that can be used to extend the offline databases's validation logic.
|
Exception | Description |
---|---|
DependentProviderUpdateException |
If an attempt is made to update or delete an object that exists in a
dependent offline provider, rather than the current provider then this
exception is thrown.
|
Since JDeveloper 9.0.5 you have been able to store database object definitions in a Project using XML files. This support started as just Tables, and has now grown to support many database objects. It is known as the "Offline Database" (offlinedb). The reason for the name is to avoid user confusion with a live database connection (to a running database) in the database navigator.
The offlinedb is built on top of the underlying JDeveloper database metadata
API which from 10.1.3 is found in the oracle.javatools.db
package.
(The examples in this document contain code that does no error handling. This makes it easier to read for the purposes of this document but proper error handling should be included in real code.)
DBObjectProvider
)
The starting point for using the oracle.javatools.db
api is
the DBObjectProvider
interface.
Once you have a DBObjectProvider
(provider) you can list,
create, update and delete object definitions in that provider, be it a live
Database or a Project containing xml files.
An offline database exists as an XML file within a project with the
extension ".offlinedb". To retrieve the DBObjectProvider
for
that file you use the DBOBjectProviderFactory
and pass the URL
in as the identifier.
import java.net.URL; import oracle.javatools.db.DBObjectProviderFactory; import oracle.jdeveloper.offlinedb.OfflineDBObjectProvider; ... URL url = ... OfflineDBObjectProvider provider = (OfflineDBObjectProvider)DBObjectProviderFactory.findOrCreateProvider( url );
To list the providers in a given project, there are static methods on
OfflineDBObjectProvider
for searching the project's content set:
java.util.Iterator<OfflineDBObjectProvider> getProviderIterator(Project p)
java.util.List<OfflineDBObjectProvider> listDBObjectProviders(Project p)
Any database object xml file in an Offline Database should be a
DBObjectNode
from which you can also access the
DBObjectProvider
.
For examples of using a DBObjectProvider see the
DBObjectProvider
documentation from the core
database API.
In the offlinedb specifically you can also do:
URL url = ... // url to fred.table xml file Table fred = (Table)( (OfflineDBObjectProvider)provider ).getObject( url );
The ProviderWizard
class
provides the ability to fire create/edit/chooser dialogs for the user to
manage their OfflineDBObjectProvider
instances. These can be
used by an extension to prompt the user.
For example the following code will prompt the user to choose (or create) a provider in the given project and return you the result:
final OfflineDBObjectProvider provider = ProviderWizard.chooseProvider( project, true );
To provide this choice as part of a wizard process, the panel to use is
OfflineDBChooserPanel
.
All objects in the API extend the DBObject
interface which
includes the method getID()
. This returns a DBObjectID
which is used to uniquely identify objects. The resolveID()
method on DBObjectID
returns the original object. All objects
that reference other objects in the API (FKConstraints, Synonyms, etc) use
DBObjectID
s to store the reference.
oracle.javatools.db
,
OfflineDBObjectProvider