uk.co.kimble.cobra
Class ConnectionBroker

java.lang.Object
  |
  +--uk.co.kimble.cobra.ConnectionBroker

public final class ConnectionBroker
extends java.lang.Object

Singleton class, the init() method loads the data dictionary from the database. A single instance of this class can be accessed by the getConnectionBroker method.


Method Summary
 PersistentConnection getConnection(java.lang.String database)
          Get a connection to the specified database
static ConnectionBroker getConnectionBroker()
          Return the single instance of connection broker
static void init(PersistentConnection pc, java.lang.String table)
          Bootstrap method to initialise the ConnectionBroker
 void printDatabases()
          Debug method to print out the available databases
 void releaseConnection(PersistentConnection pc)
          Release a database connection, frees for reuse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConnectionBroker

public static ConnectionBroker getConnectionBroker()
                                            throws PersistentException
Return the single instance of connection broker
Throws:
PersistentException - when the broker has not been initialised

getConnection

public PersistentConnection getConnection(java.lang.String database)
                                   throws PersistentException
Get a connection to the specified database
Parameters:
database - is the COBRA database name
Throws:
PersistentException - when the database doesn't exist

releaseConnection

public void releaseConnection(PersistentConnection pc)
Release a database connection, frees for reuse
Parameters:
pc - is the database connection to be releaqse

printDatabases

public void printDatabases()
Debug method to print out the available databases

init

public static void init(PersistentConnection pc,
                        java.lang.String table)
                 throws PersistentException
Bootstrap method to initialise the ConnectionBroker
Parameters:
pc - A PersistentConection instance connected to the main system database.
table - The name of the table containing information about the available databases
Throws:
PersistentException - when the database table cannot be read from backing store