public final class DatabaseFactory extends DBObjectProviderFactory.Creator
It is unlikely that the DatabaseFactory would be needed in the product. For the vast majority of cases, the oracle.jdeveloper.db.DatabaseConnections API (and associated classes) should be used.
Database
,
DBObjectProviderFactory
Modifier and Type | Class and Description |
---|---|
static class |
DatabaseFactory.ConnectionCreator
A connection creator should be registered for each connection store that
exists.
|
static class |
DatabaseFactory.ConnectionCreatorFactory
Provide ConnectionCreatorFactory implementations to provide
ConnectionCreators for different stores in the product.
|
static class |
DatabaseFactory.DatabaseCreator
Plugin to the DatabaseFactory for creating Databases and
DatabaseDescriptors.
|
Modifier and Type | Method and Description |
---|---|
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
valid Database identifier.
|
static Database |
createStandaloneDatabase(java.lang.String name,
java.sql.Connection conn)
Creates a standalone Database for the given Connection.
|
static java.lang.String[] |
decodeIdentifier(java.lang.String id)
Decodes the store name and connection name from the given encoded
identifier.
|
static java.lang.String |
encodeIdentifier(java.lang.String storeName,
java.lang.String connName)
Encodes the given store name and connection name into a valid factory
identifier.
|
static <T extends DatabaseFactory.ConnectionCreator> |
findConnectionCreator(java.lang.Class<T> ccc)
Deprecated.
|
static DatabaseFactory.ConnectionCreator |
findConnectionCreator(Database db)
Deprecated.
|
static DatabaseFactory.ConnectionCreator |
findConnectionCreator(java.lang.String storeName) |
static Database |
findOrCreateDatabase(java.lang.String name,
java.sql.Connection conn)
Deprecated.
- use
createStandaloneDatabase(java.lang.String, java.sql.Connection) to create a Database
for an isolated connection. If a Database is required for a given
connection name in the product use the appropriate connection store (e.g.
Application Connections, or central IDE Connections). |
static Database |
findOrCreateDatabase(java.lang.String storeName,
java.lang.String connName)
Utility method that calls DBObjectProvider.findOrCreateProvider with the
correcty provider type for Databases, and a fully qualified name encoded
from the given store name and connection name.
|
protected DBObjectProvider |
findProvider(java.lang.Object identifier) |
static java.util.Collection<java.lang.Class<? extends Database>> |
getClasses()
Deprecated.
use
DatabaseRegistry instead. This loads all
the extensions that plug Database implementations in to the api which
is bad. |
static DatabaseDescriptor |
getDatabaseDescriptor(java.lang.Class<? extends Database> 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)
Deprecated.
use
DatabaseRegistry instead. |
protected java.lang.String |
getDescription(java.lang.Object identifier)
Gets a displayable string to represent the database with the given
identifier.
|
protected java.lang.String |
getIdentifier(DBObjectProvider provider)
Returns an identifier for the given provider that is used when notifying
listeners of provider events.
|
java.lang.String |
getProviderType()
This method must return a String unique to the Creator that identifies
the type of DBObjectProvider that will be created.
|
static void |
registerConnectionCreator(java.lang.String storeName,
DatabaseFactory.ConnectionCreator cc)
Registers a Connection creator that can duplicate connections for the
Databases provided by the factory.
|
static void |
registerDatabaseCreator(DatabaseFactory.DatabaseCreator dc)
Deprecated.
to allow lazy class loading use the
DatabaseRegistry |
static void |
registerProviderClass(java.lang.Class<? extends Database> clz,
java.lang.String name)
Deprecated.
use
DatabaseRegistry instead. |
static void |
setJdbcDatabaseCreator(DatabaseFactory.DatabaseCreator dc)
Deprecated.
with no public replacement.
|
protected DBObjectProvider |
uncacheProvider(java.lang.Object identifier) |
static void |
unregisterConnectionCreator(java.lang.String storeName,
DatabaseFactory.ConnectionCreator cc) |
fireProviderDeleted
public java.lang.String getProviderType()
DBObjectProviderFactory.Creator
getProviderType
in class DBObjectProviderFactory.Creator
protected java.lang.String getDescription(java.lang.Object identifier)
DBObjectProviderFactory.Creator
getDescription
in class DBObjectProviderFactory.Creator
public static java.lang.String[] decodeIdentifier(java.lang.String id)
encodeIdentifier
.encodeIdentifier(String,String)
public static java.lang.String encodeIdentifier(java.lang.String storeName, java.lang.String connName)
decodeIdentifier(String)
protected java.lang.String getIdentifier(DBObjectProvider provider)
DBObjectProviderFactory.Creator
DBObjectProviderFactory.Creator.findProvider(java.lang.Object)
etc.getIdentifier
in class DBObjectProviderFactory.Creator
protected final DBObjectProvider createProviderImpl(java.lang.Object identifier) throws DBException
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 storeName, java.lang.String connName) throws DBException
storeName
- the connection store the database connection is inconnName
- the name of the connection within the storeDBException
- if the connection details are found but a connection
to the database cannot be established.@Deprecated public static final Database findOrCreateDatabase(java.lang.String name, java.sql.Connection conn) throws DBException
createStandaloneDatabase(java.lang.String, java.sql.Connection)
to create a Database
for an isolated connection. If a Database is required for a given
connection name in the product use the appropriate connection store (e.g.
Application Connections, or central IDE Connections).DBException
public static final Database createStandaloneDatabase(java.lang.String name, java.sql.Connection conn) throws DBException
name
- the name to give the Databaseconn
- the Connection to a databaseDBException
public static final DatabaseDescriptor getDatabaseDescriptor(java.lang.Class<? extends Database> providerClass)
providerClass
- the Database implementation to create a descriptor
for.getDatabaseDescriptor(Database)
@Deprecated public static void setJdbcDatabaseCreator(DatabaseFactory.DatabaseCreator dc)
public static final DatabaseDescriptor getDatabaseDescriptor(Database db)
the
- Database to create a descriptor for.getDatabaseDescriptor(Class)
public static final void registerConnectionCreator(java.lang.String storeName, DatabaseFactory.ConnectionCreator cc)
public static final void unregisterConnectionCreator(java.lang.String storeName, DatabaseFactory.ConnectionCreator cc)
@Deprecated public static final void registerDatabaseCreator(DatabaseFactory.DatabaseCreator dc)
DatabaseRegistry
public static DatabaseFactory.ConnectionCreator findConnectionCreator(java.lang.String storeName)
@Deprecated public static final <T extends DatabaseFactory.ConnectionCreator> T findConnectionCreator(java.lang.Class<T> ccc)
@Deprecated 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
@Deprecated public static void registerProviderClass(java.lang.Class<? extends Database> clz, java.lang.String name)
DatabaseRegistry
instead.@Deprecated public static java.util.Collection<java.lang.Class<? extends Database>> getClasses()
DatabaseRegistry
instead. This loads all
the extensions that plug Database implementations in to the api which
is bad.@Deprecated public static java.lang.String getDatabaseName(java.lang.Class<? extends Database> dbClz)
DatabaseRegistry
instead.