Predictions 4.10.0.0

hirondelle.web4j.config
Class ConnectionSrc

Object
  extended by ConnectionSrc
All Implemented Interfaces:
ConnectionSource

public class ConnectionSrc
extends Object
implements ConnectionSource

Implementation of ConnectionSource, required by WEB4J.

This application talks only to a single database.

This implementation uses a Connection pool managed by the container. Only one method can be overridden - getConnectionByName(String).


Field Summary
static String DEFAULT
          Value - "DEFAULT".
static String DEFAULT_CONN_STRING
          Value "DefaultDbConnectionString".
 
Constructor Summary
ConnectionSrc()
           
 
Method Summary
 Connection getConnection()
          Return a Connection for the default database.
 Connection getConnection(String aDatabaseName)
          Return a Connection for the identified database.
protected  Connection getConnectionByName(String aDbName)
          Return a connection the named database.
protected  String getConnectionString(String aDbName)
          This item is protected, in order to make it visible to any subclasses created for testing outside of the normal runtime environment.
 Set<String> getDatabaseNames()
          Return value contains only DEFAULT.
 void init(Map<String,String> aConfig)
          Read in connection strings from web.xml.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONN_STRING

public static final String DEFAULT_CONN_STRING
Value "DefaultDbConnectionString". Name of init-param in web.xml used by this class.

See Also:
Constant Field Values

DEFAULT

public static final String DEFAULT
Value - "DEFAULT". Name used to identify the default database. In this case, there is only one database.

See Also:
Constant Field Values
Constructor Detail

ConnectionSrc

public ConnectionSrc()
Method Detail

init

public final void init(Map<String,String> aConfig)
Read in connection strings from web.xml.

Specified by:
init in interface ConnectionSource

getDatabaseNames

public final Set<String> getDatabaseNames()
Return value contains only DEFAULT.

Specified by:
getDatabaseNames in interface ConnectionSource

getConnection

public final Connection getConnection()
                               throws DAOException
Return a Connection for the default database.

Specified by:
getConnection in interface ConnectionSource
Throws:
DAOException

getConnection

public final Connection getConnection(String aDatabaseName)
                               throws DAOException
Return a Connection for the identified database.

Specified by:
getConnection in interface ConnectionSource
Parameters:
aDatabaseName - single value DEFAULT
Throws:
DAOException

getConnectionByName

protected Connection getConnectionByName(String aDbName)
                                  throws DAOException
Return a connection the named database.

This method can be overridden by a subclass. Such overrides are intended for testing.

Throws:
DAOException

getConnectionString

protected String getConnectionString(String aDbName)
This item is protected, in order to make it visible to any subclasses created for testing outside of the normal runtime environment.


Predictions 4.10.0.0

Copyright Hirondelle Systems - Generated 2013Oct19.12.27