|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.1.0) E17493-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.jdeveloper.db.DatabaseConnections
public class DatabaseConnections
API to retrieve information about the database connections available in a given connection store in JDeveloper (or related FCP product).
DatabaseConnectionStores
Constructor Summary | |
---|---|
protected |
DatabaseConnections(java.lang.String storeName,
DatabaseContextManager.ContextWrapper contextWrapper,
DatabaseFactory.ConnectionCreator connCreator)
|
Method Summary | |
---|---|
void |
addConnection(java.lang.String connName,
java.util.Properties props)
Creates a connection in the underlying namespace with the given name and properties. |
void |
addDisconnectListener(DisconnectListener l)
Adds a listener to this store of connections to be notified of (and be able to veto) disconnection events. |
void |
addListener(ConnectionsListener l)
Adds a listener to this store of connections to be notified of connection events. |
protected void |
closeStore()
Used by DatabaseConnectionStores when a store is removed to close the store down, and remove any listeners or state it is using. |
void |
disconnect(java.lang.String connName)
Disconnect the cached JDBC connections for the given connection name, and closes the associated Database as well. |
boolean |
disconnect(java.lang.String connName,
boolean force)
Disconnect the cached JDBC connections for the given connection name, and closes the associated Database as well. |
java.sql.Connection |
getConnection(java.util.Properties props)
Returns a new JDBC connection for the given connection Properties. |
java.sql.Connection |
getConnection(java.lang.String connName)
Returns a JDBC connection for the given connection name. |
Database |
getDatabase(java.lang.String connName)
Returns a Database for the given connection name. |
Database |
getDatabase(java.lang.String connName,
boolean create)
Returns a Database for the given connection name if one is already cached and only creates a new one if create is true. |
protected java.util.Collection<DisconnectListener> |
getDisconnectListeners()
Gets the listeners to this set of connections. |
static DatabaseConnections |
getInstance()
Returns the central instance of database connections for the current session. |
protected java.util.Collection<ConnectionsListener> |
getListeners()
Gets the listeners to this set of connections. |
static DatabaseConnections |
getPrivateInstance(java.net.URL url)
Returns a private instance of database connections for the given URL. |
java.util.Properties |
getProperties(java.lang.String connName)
Returns a Properties object containing the properties for the given connection name. |
javax.naming.Referenceable |
getReferenceable(java.lang.String connName)
Returns the Referenceable for the given connection name, containing the details about the connection. |
java.lang.String |
getStoreName()
Returns the name (unique identifier) for this store of database connections. |
java.sql.Connection |
getUniqueConnection(java.lang.String connName)
Returns a JDBC connection for the given connection name. |
boolean |
isCentralStore()
Convinience method to determine whether this is the central IDE connections database store. |
java.util.Collection<java.lang.String> |
listConnections()
Lists the names of the available database connections. |
java.util.Collection<java.lang.String> |
listConnections(boolean oracleOnly)
Lists the available database connections, optionally limiting the returned names to connections to Oracle databases (not including Lite). |
java.util.Collection<java.lang.String> |
listConnections(java.util.Properties filter)
Lists all database connections whose properties match the given filter. |
java.util.Collection<java.lang.String> |
listConnections(java.lang.String[] subTypes)
List the available database connections that have a connection subtype in the given list. |
java.util.Collection<java.lang.String> |
listOpenConnections()
|
boolean |
removeConnection(java.lang.String connName)
Removes the connection with the given name. |
boolean |
removeDisconnectListener(DisconnectListener l)
Removes the given listener from this store if it was registered. |
boolean |
removeListener(ConnectionsListener l)
Removes the given listener from this store if it was registered. |
void |
saveConnections()
Saves the database connection store. |
void |
testConnection(java.util.Properties props)
Takes the given properties for a connection and attempts to connect to the database. |
boolean |
updateConnection(java.lang.String connName,
java.lang.String newName,
java.util.Properties newProps)
Updates the definition of the given connection with the new set of properties. |
static void |
useStandaloneConnectionStore()
Deprecated. with no replacement. This is configured automatically if a product other than JDeveloper has no jndi context wrapper set up using the appropriate singleton hook. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DatabaseConnections(java.lang.String storeName, DatabaseContextManager.ContextWrapper contextWrapper, DatabaseFactory.ConnectionCreator connCreator)
Method Detail |
---|
protected void closeStore()
public void addListener(ConnectionsListener l)
To add connection listeners generically to any or all database connection
stores, add a StoreProvider
using the appropriate extension.xml
hook and use the events passed to that provider to add and remove
listeners to the DatabaseConnections store(s) required.
addListener
in interface Connections
l
- the listener to addpublic boolean removeListener(ConnectionsListener l)
Connections
removeListener
in interface Connections
protected java.util.Collection<ConnectionsListener> getListeners()
public void addDisconnectListener(DisconnectListener l)
To add disconnect listeners generically to any or all database connection
stores, add a StoreProvider
using the appropriate extension.xml
hook and use the events passed to that provider to add and remove listeners
to the DatabaseConnections store(s) required.
addDisconnectListener
in interface Connections
l
- the listener to addpublic boolean removeDisconnectListener(DisconnectListener l)
Connections
removeDisconnectListener
in interface Connections
protected java.util.Collection<DisconnectListener> getDisconnectListeners()
public final java.util.Collection<java.lang.String> listConnections()
listConnections
in interface Connections
public final java.util.Collection<java.lang.String> listConnections(boolean oracleOnly)
public java.util.Collection<java.lang.String> listConnections(java.lang.String[] subTypes)
public final java.util.Collection<java.lang.String> listConnections(java.util.Properties filter)
listConnections
in interface Connections
public java.util.Collection<java.lang.String> listOpenConnections()
public final java.sql.Connection getConnection(java.lang.String connName) throws ConnectionException
ConnectionException
- if the connection cannot be createdgetUniqueConnection(java.lang.String)
public final java.sql.Connection getUniqueConnection(java.lang.String connName) throws ConnectionException
ConnectionException
- if the connection cannot be createdgetConnection(String)
public final java.sql.Connection getConnection(java.util.Properties props) throws ConnectionException
ConnectionException
- if the connection cannot be createdpublic final Database getDatabase(java.lang.String connName) throws DBException
This will NOT work with a private instance, only the central instance returned by DatabaseConnections.getInstance().
DBException
- if a connection cannot be made.DBObjectProviderFactory.findOrCreateProvider(java.lang.Object)
public final Database getDatabase(java.lang.String connName, boolean create) throws DBException
This will NOT work with a private instance, only the central instance returned by DatabaseConnections.getInstance().
connName
- the connection name to look forcreate
- whether to create a Database if one exists
DBException
- if a connection cannot be made or the Database fails to
initialise.DBObjectProviderFactory.findProvider(java.lang.Object)
,
DBObjectProviderFactory.findOrCreateProvider(java.lang.Object)
public javax.naming.Referenceable getReferenceable(java.lang.String connName) throws ConnectionException
getReferenceable
in interface Connections
ConnectionException
- if an error occurs locating the given connection name.public final java.util.Properties getProperties(java.lang.String connName) throws ConnectionException
getProperties
in interface Connections
ConnectionException
- if an error occurs locating the given connection name.public void addConnection(java.lang.String connName, java.util.Properties props) throws ConnectionException
addConnection
in interface Connections
ConnectionException
public boolean removeConnection(java.lang.String connName) throws ConnectionException
removeConnection
in interface Connections
connName
- the name of the connection to remove
ConnectionException
- if an error is encountered removing the connectionpublic boolean updateConnection(java.lang.String connName, java.lang.String newName, java.util.Properties newProps) throws ConnectionException
updateConnection
in interface Connections
connName
- the name of the connection as already definednewName
- the new name for the connection. if null the old name is
keptnewProps
- the new Properties for the connection.
ConnectionException
public final void testConnection(java.util.Properties props) throws ConnectionException
testConnection
in interface Connections
ConnectionException
public final void disconnect(java.lang.String connName) throws ConnectionException
Any registered DisconnectListeners can veto this operation. If the result
of the disconnect is required the use disconnect(String,boolean)
.
disconnect
in interface Connections
connName
- the connection to disconnect
ConnectionException
- if an error is encountered getting or
disconnecting the connection.public final boolean disconnect(java.lang.String connName, boolean force) throws ConnectionException
Any registered DisconnectListeners can veto this operation. If the result
of the disconnect is required the use disconnect(String,boolean)
.
connName
- the connection to disconnectforce
- whether to ignore the veto attempts of any disconnect
listeners
ConnectionException
public void saveConnections() throws ConnectionException
saveConnections
in interface Connections
ConnectionException
public java.lang.String getStoreName()
DatabaseConnectionStores
public boolean isCentralStore()
DatabaseConnectionStores.CENTRAL_STORE
public static DatabaseConnections getInstance()
public static DatabaseConnections getPrivateInstance(java.net.URL url)
@Deprecated public static void useStandaloneConnectionStore()
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.1.0) E17493-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |