Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

oracle.jdeveloper.db
Interface Connections

All Known Implementing Classes:
DatabaseConnections

public interface Connections

Interface for a store of connection information.


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)
          If the connection store has a cached connection for this connection name then disconnect it.
 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.util.Collection<java.lang.String> listConnections()
          Lists the names of the available connections.
 java.util.Collection<java.lang.String> listConnections(java.util.Properties props)
          Lists any connections whose properties match the values in the given set.
 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 this connection store.
 void testConnection(java.util.Properties props)
          Takes the given properties for a connection and attempts to create an actual connection to test the properties are valid.
 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.
 

Method Detail

addListener

void addListener(ConnectionsListener l)
Adds a listener to be notified of add/remove/update events in this connection store.


removeListener

boolean removeListener(ConnectionsListener l)
Removes the given listener from this store if it was registered.


addDisconnectListener

void addDisconnectListener(DisconnectListener l)
Adds a listener to be asked about and notified of disconnect events.


removeDisconnectListener

boolean removeDisconnectListener(DisconnectListener l)
Removes the given listener from this store if it was registered.


listConnections

java.util.Collection<java.lang.String> listConnections()
Lists the names of the available connections.


listConnections

java.util.Collection<java.lang.String> listConnections(java.util.Properties props)
Lists any connections whose properties match the values in the given set. The connections can have extra properties, but they must have the key/value pairs in the given object.


getReferenceable

javax.naming.Referenceable getReferenceable(java.lang.String connName)
                                            throws ConnectionException
Returns the Referenceable for the given connection name, containing the details about the connection. The returned object is the object stored in the underlying namespace.

Throws:
ConnectionException - if an error occurs locating the given connection name.

getProperties

java.util.Properties getProperties(java.lang.String connName)
                                   throws ConnectionException
Returns a Properties object containing the properties for the given connection name. The Properties are a copy of those stored in the underlying Referenceable.

Throws:
ConnectionException - if an error occurs locating the given connection name.

addConnection

void addConnection(java.lang.String connName,
                   java.util.Properties props)
                   throws ConnectionException
Creates a connection in the underlying namespace with the given name and properties.

Throws:
ConnectionException

removeConnection

boolean removeConnection(java.lang.String connName)
                         throws ConnectionException
Removes the connection with the given name. It will return true if the operation succeeded, and false if no such connection exists to remove.

Parameters:
connName - the name of the connection to remove
Returns:
true if successful, false if connName not found
Throws:
ConnectionException - if an error is encountered removing the connection

disconnect

void disconnect(java.lang.String connName)
                throws ConnectionException
If the connection store has a cached connection for this connection name then disconnect it. Will do nothing if no connection is cached.

Parameters:
connName - the connection to disconnect
Throws:
ConnectionException - if an error is encountered getting or disconnecting the connection.

updateConnection

boolean updateConnection(java.lang.String connName,
                         java.lang.String newName,
                         java.util.Properties newProps)
                         throws ConnectionException
Updates the definition of the given connection with the new set of properties.

Parameters:
connName - the name of the connection as already defined
newName - the new name for the connection. if null the old name is kept
newProps - the new Properties for the connection.
Returns:
true if the update operation suceeded. Possible reasons for failure include a veto of the existing connection being closed before the update.
Throws:
ConnectionException

testConnection

void testConnection(java.util.Properties props)
                    throws ConnectionException
Takes the given properties for a connection and attempts to create an actual connection to test the properties are valid.

Throws:
ConnectionException

saveConnections

void saveConnections()
                     throws ConnectionException
Saves this connection store.

Throws:
IOException
ConnectionException

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

Copyright © 1997, 2011, Oracle. All rights reserved.