|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| 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 be asked about and notified of disconnect events. |
void |
addListener(ConnectionsListener l)Adds a listener to be notified of add/remove/update events in this connection store. |
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. |
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()This can be called in the initialize method of an Addin to make the database connection support use a standalone connection store, with simple password encryption. |
| 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 |
|---|
public void addListener(ConnectionsListener l)
ConnectionsaddListener in interface Connectionspublic boolean removeListener(ConnectionsListener l)
ConnectionsremoveListener in interface Connectionsprotected java.util.Collection<ConnectionsListener> getListeners()
public void addDisconnectListener(DisconnectListener l)
ConnectionsaddDisconnectListener in interface Connectionspublic boolean removeDisconnectListener(DisconnectListener l)
ConnectionsremoveDisconnectListener in interface Connectionsprotected java.util.Collection<DisconnectListener> getDisconnectListeners()
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 Connections
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(java.lang.String)
public final java.sql.Connection getConnection(java.util.Properties props)
throws ConnectionException
ConnectionException - if the connection cannot be created
public 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()
public static DatabaseConnections getPrivateInstance(java.net.URL url)
public static void useStandaloneConnectionStore()
Calling this method in JDeveloper will result in an IllegalStateException. This is to protect the JDeveloper product from an rogue addin illegally setting the context.
Furthermore this method should be called before the IDE's addinsLoaded event is fired (i.e. called from within the initialize of a downstream Addin). This is to protect from the connection store being switched once the product is running. If called after the addins are loaded this method will log a SEVERE message and do nothing.
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||