public class DatabaseConnections extends java.lang.Object implements Connections
DatabaseConnectionStores| Modifier | Constructor and Description | 
|---|---|
protected | 
DatabaseConnections(java.lang.String storeName, DatabaseContextManager.ContextWrapper contextWrapper, DatabaseFactory.ConnectionCreator connCreator)  | 
| Modifier and Type | Method and Description | 
|---|---|
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. 
 | 
void | 
addListener(DatabaseConnectionsListener dcl)
Adds a listener to be notified of operations within this DatabaseConnections instance. 
 | 
protected void | 
closeOpenConnections()
Forces all open Connections made by this instance to be closed. 
 | 
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<? extends DisconnectListener> | 
getDisconnectListeners()
Deprecated. 
 
use  
getListeners() | 
static DatabaseConnections | 
getInstance()
Returns the central instance of database connections for the current session. 
 | 
static DatabaseConnections | 
getLegacyPrivateInstance(java.net.URL url)
Creates a private DatabaseConnections instance that exclusively uses legacy encryption. 
 | 
protected java.util.Collection<DatabaseConnectionsListener> | 
getListeners()
Gets the listeners to this set of connections. 
 | 
static DatabaseConnections | 
getPrivateInstance(java.net.URL url)
Deprecated. 
 
use  
getPrivateInstance(URL,String) to provide the passphrase for encryption/decryption of credentials. | 
static DatabaseConnections | 
getPrivateInstance(java.net.URL url, java.lang.String key)
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()
Lists the names of the connections that have been opened in this store. 
 | 
boolean | 
removeConnection(java.lang.String connName)
Removes the connection with the given name. 
 | 
boolean | 
removeDisconnectListener(DisconnectListener l)
Removes a DisconnectionListener that has been previously added. 
 | 
boolean | 
removeListener(ConnectionsListener l)
Removes the given listener from this store if it was registered. 
 | 
boolean | 
removeListener(DatabaseConnectionsListener dcl)
Removed a DatabaseConnectionsListener that has been previously added. 
 | 
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. 
 | 
protected DatabaseConnections(java.lang.String storeName,
                   DatabaseContextManager.ContextWrapper contextWrapper,
                   DatabaseFactory.ConnectionCreator connCreator)
protected void closeStore()
protected void closeOpenConnections()
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 Connectionsl - the listener to addpublic boolean removeListener(ConnectionsListener l)
ConnectionsremoveListener in interface Connectionsprotected java.util.Collection<DatabaseConnectionsListener> 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 Connectionsl - the listener to addpublic boolean removeDisconnectListener(DisconnectListener l)
removeDisconnectListener in interface Connectionsl - the listener to removeaddDisconnectListener(DisconnectListener)public void addListener(DatabaseConnectionsListener dcl)
dcl - the listener to addpublic boolean removeListener(DatabaseConnectionsListener dcl)
dcl - the listener to removeaddListener(DatabaseConnectionsListener)@Deprecated protected java.util.Collection<? extends DisconnectListener> getDisconnectListeners()
getListeners()public final java.util.Collection<java.lang.String> listConnections()
listConnections in interface Connectionspublic 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 Connectionspublic 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 existsDBException - 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 ConnectionsConnectionException - if an error occurs locating the given connection name.
public final java.util.Properties getProperties(java.lang.String connName)
                                         throws ConnectionException
getProperties in interface ConnectionsConnectionException - 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 ConnectionsConnectionException
public boolean removeConnection(java.lang.String connName)
                         throws ConnectionException
removeConnection in interface ConnectionsconnName - the name of the connection to removeConnectionException - if an error is encountered removing the connection
public boolean updateConnection(java.lang.String connName,
                       java.lang.String newName,
                       java.util.Properties newProps)
                         throws ConnectionException
updateConnection in interface ConnectionsconnName - 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 ConnectionsConnectionException
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 ConnectionsconnName - the connection to disconnectConnectionException - 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 listenersConnectionException
public void saveConnections()
                     throws ConnectionException
saveConnections in interface ConnectionsConnectionExceptionpublic java.lang.String getStoreName()
DatabaseConnectionStorespublic boolean isCentralStore()
DatabaseConnectionStores.CENTRAL_STOREpublic static DatabaseConnections getInstance()
@Deprecated public static DatabaseConnections getPrivateInstance(java.net.URL url)
getPrivateInstance(URL,String) to provide the passphrase for encryption/decryption of credentials.public static DatabaseConnections getLegacyPrivateInstance(java.net.URL url)
public static DatabaseConnections getPrivateInstance(java.net.URL url, java.lang.String key)
url - the location of the connections xml filekey - the key/passphrase to encrypt/decrypt credentials to the file. If null the system key will be used.@Deprecated public static void useStandaloneConnectionStore()