|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.1.0) E13403-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.javatools.db.DBObjectProviderFactory.Creator
oracle.javatools.db.DatabaseFactory
public final class DatabaseFactory
DatabaseFactory extends DBObjectProviderFactory. It provides an extra ability to create new Connections for a given connection name. This provision requires a DatabaseFactory plugin that supports such an operation, by default the API does not contain one. The JDeveloper connection architecture provides such functionality and if used with jdeveloper this functionality will be available.
The DatabaseFactory should be used over the DBObjectProviderFactory when a Database specifically is required, and the name and Connection of that Database are available.
e.g.
java.sql.Connection conn = // the Connection to the db
Database db = DatabaseFactory.findOrCreateDatabase( "ora10g", conn );
If a Database is required given a connection name, the DBObjectProviderFactory can be used directly.
e.g.
DBObjectProviderFactory.findOrCreateProvider( "ora10g" );
Database
,
DBObjectProviderFactory
Nested Class Summary | |
---|---|
static class |
DatabaseFactory.ConnectionCreator
A connection creator should be registered for each connection store that exists. |
static class |
DatabaseFactory.DatabaseCreator
Plugin to the DatabaseFactory for creating Databases and DatabaseDescriptors. |
Method Summary | ||
---|---|---|
static java.sql.Connection |
createConnection(Database db)
This will return a new Connection for the given database if possible. |
|
static Database |
createDatabase(java.lang.String connName,
DatabaseFactory.ConnectionCreator factory)
Creates a Database using the given ConnectionCreator to create a connection for the given connection name. |
|
protected DBObjectProvider |
createProviderImpl(java.lang.Object identifier)
Creates a provider for the given identifier if that identifier is a DatabaseFactory.Descriptor . |
|
static
|
findConnectionCreator(java.lang.Class<T> ccc)
Looks for a registered connection creator of the given class. |
|
static DatabaseFactory.ConnectionCreator |
findConnectionCreator(Database db)
Finds the connection creator (if one exists) that is responsible for this database instance. |
|
static Database |
findOrCreateDatabase(java.lang.String name,
java.sql.Connection conn)
Find or create a Database implementation with the given name and Connection. |
|
protected DBObjectProvider |
findProvider(java.lang.Object identifier)
|
|
protected java.lang.Object |
getCacheKey(java.lang.Object identifier,
DBObjectProvider pro)
We don't allow the DBObjectProviderFactory to cache Databases because their names are not globally unique. |
|
static java.util.Collection<java.lang.Class<? extends Database>> |
getClasses()
Gets the supported Database implementations from the API. |
|
static DatabaseDescriptor |
getDatabaseDescriptor(java.lang.Class providerClass)
Returns a DatabaseDescriptor for the given provider class. |
|
static DatabaseDescriptor |
getDatabaseDescriptor(Database db)
Returns a DatabaseDescriptor for the given database. |
|
static java.lang.String |
getDatabaseName(java.lang.Class<? extends Database> dbClz)
Gets a translated string that describes the given database class to the nearest supported version. |
|
static void |
registerConnectionCreator(DatabaseFactory.ConnectionCreator cc)
Registers a Connection creator that can duplicate connections for the Databases provided by the factory. |
|
static void |
registerDatabaseCreator(DatabaseFactory.DatabaseCreator dc)
Registers a Connection creator that can duplicate connections for the Databases provided by the factory. |
|
protected DBObjectProvider |
uncacheProvider(java.lang.Object identifier)
|
Methods inherited from class oracle.javatools.db.DBObjectProviderFactory.Creator |
---|
fireProviderDeleted |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
protected java.lang.Object getCacheKey(java.lang.Object identifier, DBObjectProvider pro)
getCacheKey
in class DBObjectProviderFactory.Creator
protected final DBObjectProvider createProviderImpl(java.lang.Object identifier) throws DBException
DatabaseFactory.Descriptor
. If no registered factory
implementation can create a Database the generic Jdbc impelmentation.
createProviderImpl
in class DBObjectProviderFactory.Creator
DBException
public static Database createDatabase(java.lang.String connName, DatabaseFactory.ConnectionCreator factory) throws DBException
DBException
protected DBObjectProvider findProvider(java.lang.Object identifier)
findProvider
in class DBObjectProviderFactory.Creator
protected DBObjectProvider uncacheProvider(java.lang.Object identifier)
uncacheProvider
in class DBObjectProviderFactory.Creator
public static final Database findOrCreateDatabase(java.lang.String name, java.sql.Connection conn) throws DBException
DBException
public static final DatabaseDescriptor getDatabaseDescriptor(java.lang.Class providerClass)
public static final DatabaseDescriptor getDatabaseDescriptor(Database db)
public static final void registerConnectionCreator(DatabaseFactory.ConnectionCreator cc)
public static final void registerDatabaseCreator(DatabaseFactory.DatabaseCreator dc)
public static final <T extends DatabaseFactory.ConnectionCreator> T findConnectionCreator(java.lang.Class<T> ccc)
ccc
- the ConnectionCreator subclass to look for
public static final DatabaseFactory.ConnectionCreator findConnectionCreator(Database db)
public static final java.sql.Connection createConnection(Database db) throws DBException
This method is designed to create a duplicate Connection - the Database must have been setup with a Connection in the first place.
DBException
public static java.util.Collection<java.lang.Class<? extends Database>> getClasses()
getDatabaseName(java.lang.Class extends oracle.javatools.db.Database>)
public static java.lang.String getDatabaseName(java.lang.Class<? extends Database> dbClz)
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.1.0) E13403-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |