rabbit.filter
Class DataSourceHelper

java.lang.Object
  extended by rabbit.filter.DataSourceHelper

public class DataSourceHelper
extends java.lang.Object

A helper class for dealing with DataSource:s

Author:
Robert Olofsson

Constructor Summary
DataSourceHelper(SProperties props, java.lang.String defaultSelect)
          Create a new DataSourceHelper
 
Method Summary
 java.sql.Connection getConnection()
          Get a database connection
 java.lang.String getSelect()
          Get the select statement for this helper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSourceHelper

public DataSourceHelper(SProperties props,
                        java.lang.String defaultSelect)
                 throws javax.naming.NamingException
Create a new DataSourceHelper

Parameters:
props - the properties to read configuration from
defaultSelect - the default sql statement to use if not configured
Throws:
javax.naming.NamingException - if the DataSource can not be found
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Get a database connection

Returns:
a database connection
Throws:
java.sql.SQLException - if the database connection can not be established

getSelect

public java.lang.String getSelect()
Get the select statement for this helper.

Returns:
the sql statement