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

E13403-03

oracle.jdeveloper.db
Class DatabaseConnectionStores

java.lang.Object
  extended by oracle.jdeveloper.db.DatabaseConnectionStores

public final class DatabaseConnectionStores
extends java.lang.Object

Central API to access the available database connection stores in JDeveloper (or equivalent FCP product).

Within the product there are potentially multiple places where database connections can be defined - i.e. multiple database connection stores. There is always a central store (e.g. Resource Palette) and then potentially many others. This class gives access to the full list of available stores, and the ability to retrieve a store (a DatabaseConnections object) given its unique name.

A store name is not a displayable String, there are displayable methods for getting the short label, tooltip and icon for a given store.

Since:
11
See Also:
DatabaseConnections

Field Summary
static java.lang.String CENTRAL_STORE
          The store name for the central store of connections in the IDE.
 
Method Summary
 void addStoreListener(StoreListener l)
           
 java.lang.String getCurrentConnection(Context ideContext)
          Will return the current connection that is selected in the IDE.
 ConnectionInfo getCurrentConnectionInfo(Context ideContext)
          Returns the connection information for the connection that is currently selected in the IDE.
 Database getCurrentDatabase(Context ideContext)
          Will return the current Database that is selected in the IDE.
 DatabaseConnections getCurrentStore()
          Gets the current store.
 DatabaseConnections getCurrentStore(Context ideContext)
          Gets the current store.
 javax.swing.Icon getIcon(java.lang.String storeName)
          Gets an icon for the given store.
static DatabaseConnectionStores getInstance()
           
static DatabaseProvider getReferenceable(java.lang.String storeName, java.lang.String connName)
          Utility method to get a connection's details given its store and connection name.
 java.lang.String getShortLabel(java.lang.String storeName)
          Gets a displayable (translated) label for the given store name.
 DatabaseConnections getStore(java.lang.String storeName)
          Retrieves a store with the given unique name.
 java.lang.String getToolTipText(java.lang.String storeName)
          Gets a translated tooltip text to use for the given store if it is displayed in UI.
 java.util.Collection<java.lang.String> listStores()
          Lists all the available stores in the product.
 java.util.Collection<java.lang.String> listStores(Context ideContext)
          Lists all the stores the user should be allowed to use in the given IDE Context.
 void registerStoreProvider(StoreProvider provider)
          Registers a provider of stores which will be queried whenever listStores or getStore are called on the central instance.
 void removeStoreListener(StoreListener l)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CENTRAL_STORE

public static final java.lang.String CENTRAL_STORE
The store name for the central store of connections in the IDE. This is not a displayable String, use getShortLabel() to retrieve a label for any given connection store.

See Also:
Constant Field Values
Method Detail

getInstance

public static final DatabaseConnectionStores getInstance()

addStoreListener

public void addStoreListener(StoreListener l)

removeStoreListener

public void removeStoreListener(StoreListener l)

listStores

public java.util.Collection<java.lang.String> listStores()
Lists all the available stores in the product. This will always list ALL stores regardless of the context. For a context sensitive list of stores that the user should be allowed to use see listStores(Context).


listStores

public java.util.Collection<java.lang.String> listStores(Context ideContext)
Lists all the stores the user should be allowed to use in the given IDE Context.


getCurrentStore

public DatabaseConnections getCurrentStore()
Gets the current store. This will ask each registered provider in turn whether they have a current store (using the IDE Context). If none return the central connection store is returned.

Returns:
the current store.

getCurrentStore

public DatabaseConnections getCurrentStore(Context ideContext)
Gets the current store. This will ask each registered provider in turn whether they have a current store (using the IDE Context). If none return the central connection store is returned.

Returns:
the current store.

getCurrentConnection

public java.lang.String getCurrentConnection(Context ideContext)
Will return the current connection that is selected in the IDE. The connection will be from the connection store returned by getCurrentStore(). The database connection does not need to be valid/connected for this to return.


getCurrentConnectionInfo

public ConnectionInfo getCurrentConnectionInfo(Context ideContext)
Returns the connection information for the connection that is currently selected in the IDE.


getCurrentDatabase

public Database getCurrentDatabase(Context ideContext)
Will return the current Database that is selected in the IDE. The Database will be from the connection store returned by getCurrentStore().

This is arguably more powerful than DBObjectProviderFactory.findOrCreateProvider(java.lang.Object) because you can pass the context in directly. When fired from a context menu listener, findOrCreateProvider may fail because the ide context returned by Context.newIdeContext() can differ from the context passed into a context menu listener. This method relies on the nodes in the context implementing the oracle.ide.db.model interfaces.

If the connection is not already made, calling this method will connect to the database. Furthermore, if a connection to the db cannot be made the exception is logged and null is returned.

Context menu listeners should use this for any database specific work in the product.

See Also:
getCurrentConnection(oracle.ide.Context)

getStore

public DatabaseConnections getStore(java.lang.String storeName)
Retrieves a store with the given unique name. The central store has the name CENTRAL_STORE.

Returns:
null if no store can be found with the given name

getShortLabel

public java.lang.String getShortLabel(java.lang.String storeName)
Gets a displayable (translated) label for the given store name.


getIcon

public javax.swing.Icon getIcon(java.lang.String storeName)
Gets an icon for the given store.


getToolTipText

public java.lang.String getToolTipText(java.lang.String storeName)
Gets a translated tooltip text to use for the given store if it is displayed in UI.


registerStoreProvider

public void registerStoreProvider(StoreProvider provider)
Registers a provider of stores which will be queried whenever listStores or getStore are called on the central instance.


getReferenceable

public static DatabaseProvider getReferenceable(java.lang.String storeName,
                                                java.lang.String connName)
Utility method to get a connection's details given its store and connection name.

Parameters:
storeName - the store to look in
connName - the connection name to look for
Returns:
the connection details if the store and connection could be found

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

E13403-03

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