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

E13403-05

oracle.jdeveloper.db
Class ConnectionInfo

java.lang.Object
  extended by oracle.javatools.data.HashStructureAdapter
      extended by oracle.jdeveloper.db.ConnectionInfo
Direct Known Subclasses:
GlobalConnectionPanelUI.ChosenConnection

public class ConnectionInfo
extends HashStructureAdapter

Wrapper for information about a chosen connection. A connection in the FCP involves both a store name and a connection name for the connection within that store. When picking a connection globally both pieces of information are necessary. This class wraps the two and provides some utility methods for getting the name information and the underlying Referenceable that represents the connection.

Since:
11

Field Summary
 
Fields inherited from class oracle.javatools.data.HashStructureAdapter
_hash
 
Constructor Summary
ConnectionInfo(java.lang.String store, java.lang.String conn)
          Creates a new, standalone connection info.
 
Method Summary
 java.sql.Connection getConnection()
          Returns a JDBC Connection for the connection.
static ConnectionInfo getConnectionInfo(PropertyStorage ps)
          Retrieves the connection information from the given property storage.
static ConnectionInfo getConnectionInfo(PropertyStorage ps, java.lang.String key)
          Retrieves the ConnectionInfo from the given PropertyStorage using the given key.
 java.lang.String getConnectionName()
          Gets the name of the connection.
 Database getDatabase()
          Returns a Database for the connection.
 java.lang.String getQualifiedName()
          Gets the qualified name of the connection - i.e.
 DatabaseProvider getReferenceable()
          Gets the Referenceable implementation for the chosen database connection from the underlying naming context.
 java.lang.String getStoreName()
          Gets the name of the connection store the connection is from.
 boolean isValid()
          Returns true if the encapsulated connection information points to an actual connection (i.e.
 void setConnectionName(java.lang.String conn)
          Sets the name of the connection.
 void setStoreName(java.lang.String store)
          Sets the name of the connection store the connection is from.
 
Methods inherited from class oracle.javatools.data.HashStructureAdapter
addStructureChangeListener, containsKey, copyTo, copyToImpl, equals, equalsImpl, findOrCreate, forcedCopyTo, getHashStructure, removeStructureChangeListener, useObjectEquals
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionInfo

public ConnectionInfo(java.lang.String store,
                      java.lang.String conn)
Creates a new, standalone connection info. For storing connection information within an existing property storage use the static methods getConnectionInfo(PropertyStorage) and getConnectionInfo(PropertyStorage,String).

Parameters:
store - the name of the store the connection is in
conn - the name of the connection
Method Detail

getStoreName

public java.lang.String getStoreName()
Gets the name of the connection store the connection is from.


setStoreName

public void setStoreName(java.lang.String store)
Sets the name of the connection store the connection is from.


getConnectionName

public java.lang.String getConnectionName()
Gets the name of the connection.


setConnectionName

public void setConnectionName(java.lang.String conn)
Sets the name of the connection.


getQualifiedName

public java.lang.String getQualifiedName()
Gets the qualified name of the connection - i.e. storeName#connName encoded for inclusion in a URL.


isValid

public boolean isValid()
Returns true if the encapsulated connection information points to an actual connection (i.e. there is an underlying referenceable).


getReferenceable

public DatabaseProvider getReferenceable()
Gets the Referenceable implementation for the chosen database connection from the underlying naming context.


getConnection

public java.sql.Connection getConnection()
                                  throws ConnectionException
Returns a JDBC Connection for the connection.

Throws:
ConnectionException

getDatabase

public Database getDatabase()
                     throws DBException
Returns a Database for the connection.

Throws:
DBException

getConnectionInfo

public static ConnectionInfo getConnectionInfo(PropertyStorage ps)
Retrieves the connection information from the given property storage. For example in a wizard onEntry code:
 public void onEntry( TraversableContext traversableContext )
 {
   ConnectionInfo connInfo = ConnectionInfo.getConnectionInfo( traversableContext.getPropertyStorage() );
   String connName = connInfo.getConnectionName();
   ...
 }
 

Parameters:
ps - the PropertyStorage to retrieve/store the connection info in.
Returns:
a ConnectionInfo stored in the PropertyStorage under the default key.

getConnectionInfo

public static ConnectionInfo getConnectionInfo(PropertyStorage ps,
                                               java.lang.String key)
Retrieves the ConnectionInfo from the given PropertyStorage using the given key. If connection information for more than one connection is required in the same PropertyStorage this allows flexibility to store multiple objects. If only one connection is required it is suggested that #getConnectionInfo(PropertyStore) is used.

Parameters:
ps - the PropertyStorage to retrieve/store the connection info in.
key - the key under which to store the connection information.
Returns:
a ConnectionInfo stored in the PropertyStorage under the given key.

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

E13403-05

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