com.xenonsoft.bridgetown.aop.transaction.jdbc
Class PropertyJDBCDataSourceImpl

java.lang.Object
  extended bycom.xenonsoft.bridgetown.aop.transaction.jdbc.PropertyJDBCDataSourceImpl
All Implemented Interfaces:
javax.sql.DataSource

public class PropertyJDBCDataSourceImpl
extends java.lang.Object
implements javax.sql.DataSource

An implementation of a data source that makes a traditional JDBC connection to a database using a input list of properties or through set bean properties.

Version:
$Id: PropertyJDBCDataSourceImpl.java,v 1.3 2005/02/23 01:27:28 peter_pilgrim Exp $
Author:
Peter Pilgrim, 02-Nov-2004 21:12:08

Field Summary
static java.lang.String DRIVER_CLASS_PROPERTY
           
protected  java.lang.String driverClass
          Driver class
static java.lang.String JDBC_URL_PROPERTY
           
protected  java.lang.String jdbcUrl
          Jdbc Url for database connection
protected  int loginTimeout
          Login time out
protected  java.io.PrintWriter logWriter
          log writer for this data source connection
protected  ConnectionModeEnum mode
          Connection mode
protected  java.lang.String password
          Security credential
static java.lang.String PASSWORD_PROPERTY
           
protected  java.lang.String username
          Security principal
static java.lang.String USERNAME_PROPERTY
           
 
Constructor Summary
PropertyJDBCDataSourceImpl()
          Default constructor is useful if you need construct the bean then use setter injection
PropertyJDBCDataSourceImpl(java.util.Properties properties)
          Standard constructor
PropertyJDBCDataSourceImpl(java.lang.String prefix, java.util.Properties properties)
          Standard constructor
PropertyJDBCDataSourceImpl(java.lang.String driverClass, java.lang.String jdbcUrl)
          A standard constructor to suppert constructor injection
PropertyJDBCDataSourceImpl(java.lang.String driverClass, java.lang.String jdbcUrl, java.lang.String username, java.lang.String password)
          A standard constructor to suppert constructor injection
 
Method Summary
 java.sql.Connection getConnection()
          Implements / overrides getConnection
 java.sql.Connection getConnection(java.lang.String requestUser, java.lang.String requestPass)
          Implements / overrides getConnection
 java.lang.String getDriverClass()
          Gets the driverClass
 java.lang.String getJdbcUrl()
          Gets the jdbcUrl
 int getLoginTimeout()
          Implements / overrides getLoginTimeout
 java.io.PrintWriter getLogWriter()
          Implements / overrides getLogWriter
 ConnectionModeEnum getMode()
          Gets the connection mode
 java.lang.String getPassword()
          Gets the password (the database security credential)
 java.lang.String getUsername()
          Gets the username (the database security principal)
 void readDetailFromProperties(java.lang.String prefix, java.util.Properties properties)
          Read the JDBC configuration detail from the supplied properties
 void setDriverClass(java.lang.String driverClass)
          Sets the driverClass
 void setJdbcUrl(java.lang.String jdbcUrl)
          Sets the jdbcUrl
 void setLoginTimeout(int arg0)
          Implements / overrides setLoginTimeout
 void setLogWriter(java.io.PrintWriter arg0)
          Implements / overrides setLogWriter
 void setMode(ConnectionModeEnum mode)
          Sets the connection mode
 void setMode(java.lang.String modeValue)
          Sets the connection mode from a text string
 void setPassword(java.lang.String password)
          Sets the password (the database security credential)
 void setUsername(java.lang.String username)
          Sets the username (the database security principal)
 java.lang.String toString()
          Debuggable human output
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DRIVER_CLASS_PROPERTY

public static final java.lang.String DRIVER_CLASS_PROPERTY
See Also:
Constant Field Values

JDBC_URL_PROPERTY

public static final java.lang.String JDBC_URL_PROPERTY
See Also:
Constant Field Values

USERNAME_PROPERTY

public static final java.lang.String USERNAME_PROPERTY
See Also:
Constant Field Values

PASSWORD_PROPERTY

public static final java.lang.String PASSWORD_PROPERTY
See Also:
Constant Field Values

driverClass

protected java.lang.String driverClass
Driver class


jdbcUrl

protected java.lang.String jdbcUrl
Jdbc Url for database connection


username

protected java.lang.String username
Security principal


password

protected java.lang.String password
Security credential


loginTimeout

protected int loginTimeout
Login time out


logWriter

protected java.io.PrintWriter logWriter
log writer for this data source connection


mode

protected ConnectionModeEnum mode
Connection mode

Constructor Detail

PropertyJDBCDataSourceImpl

public PropertyJDBCDataSourceImpl()
Default constructor is useful if you need construct the bean then use setter injection


PropertyJDBCDataSourceImpl

public PropertyJDBCDataSourceImpl(java.lang.String driverClass,
                                  java.lang.String jdbcUrl)
A standard constructor to suppert constructor injection

Parameters:
driverClass - the JDBC driver
jdbcUrl - the JDBC URL for connection

PropertyJDBCDataSourceImpl

public PropertyJDBCDataSourceImpl(java.lang.String driverClass,
                                  java.lang.String jdbcUrl,
                                  java.lang.String username,
                                  java.lang.String password)
A standard constructor to suppert constructor injection

Parameters:
driverClass - the JDBC driver
jdbcUrl - the JDBC URL for connection
username - the security principal
password - the security credential

PropertyJDBCDataSourceImpl

public PropertyJDBCDataSourceImpl(java.util.Properties properties)
Standard constructor

Parameters:
properties - the Java properties to retrieve JDBC login

PropertyJDBCDataSourceImpl

public PropertyJDBCDataSourceImpl(java.lang.String prefix,
                                  java.util.Properties properties)
Standard constructor

Parameters:
prefix - the prefix for the property name during retrieval of JDBC configuration
properties - the Java properties to retrieve JDBC login
Method Detail

getDriverClass

public java.lang.String getDriverClass()
Gets the driverClass

Returns:
Returns the driverClass.

setDriverClass

public void setDriverClass(java.lang.String driverClass)
Sets the driverClass

Parameters:
driverClass - the new value for driverClass

getJdbcUrl

public java.lang.String getJdbcUrl()
Gets the jdbcUrl

Returns:
Returns the jdbcUrl.

setJdbcUrl

public void setJdbcUrl(java.lang.String jdbcUrl)
Sets the jdbcUrl

Parameters:
jdbcUrl - the new value for jdbcUrl

getPassword

public java.lang.String getPassword()
Gets the password (the database security credential)

Returns:
Returns the password.

setPassword

public void setPassword(java.lang.String password)
Sets the password (the database security credential)

Parameters:
password - the new value for password

getUsername

public java.lang.String getUsername()
Gets the username (the database security principal)

Returns:
Returns the username.

setUsername

public void setUsername(java.lang.String username)
Sets the username (the database security principal)

Parameters:
username - the new value for username

readDetailFromProperties

public void readDetailFromProperties(java.lang.String prefix,
                                     java.util.Properties properties)
Read the JDBC configuration detail from the supplied properties

Parameters:
prefix - the prefix for the property name during retrieval of JDBC configuration
properties - the Java properties

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Implements / overrides getConnection

Specified by:
getConnection in interface javax.sql.DataSource
Returns:
Throws:
java.sql.SQLException
See Also:
DataSource.getConnection()

getConnection

public java.sql.Connection getConnection(java.lang.String requestUser,
                                         java.lang.String requestPass)
                                  throws java.sql.SQLException
Implements / overrides getConnection

Specified by:
getConnection in interface javax.sql.DataSource
Parameters:
requestUser - the requested username (sic security principal)
requestPass - the requested password (sic security credential)
Returns:
Throws:
java.sql.SQLException
See Also:
DataSource.getConnection(java.lang.String, java.lang.String)

getLoginTimeout

public int getLoginTimeout()
                    throws java.sql.SQLException
Implements / overrides getLoginTimeout

Specified by:
getLoginTimeout in interface javax.sql.DataSource
Returns:
Throws:
java.sql.SQLException
See Also:
DataSource.getLoginTimeout()

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws java.sql.SQLException
Implements / overrides getLogWriter

Specified by:
getLogWriter in interface javax.sql.DataSource
Returns:
Throws:
java.sql.SQLException
See Also:
DataSource.getLogWriter()

setLoginTimeout

public void setLoginTimeout(int arg0)
                     throws java.sql.SQLException
Implements / overrides setLoginTimeout

Specified by:
setLoginTimeout in interface javax.sql.DataSource
Parameters:
arg0 -
Throws:
java.sql.SQLException
See Also:
DataSource.setLoginTimeout(int)

setLogWriter

public void setLogWriter(java.io.PrintWriter arg0)
                  throws java.sql.SQLException
Implements / overrides setLogWriter

Specified by:
setLogWriter in interface javax.sql.DataSource
Parameters:
arg0 -
Throws:
java.sql.SQLException
See Also:
DataSource.setLogWriter(java.io.PrintWriter)

getMode

public ConnectionModeEnum getMode()
Gets the connection mode

Returns:
Returns the mode.

setMode

public void setMode(ConnectionModeEnum mode)
Sets the connection mode

Parameters:
mode - the new value for mode

setMode

public void setMode(java.lang.String modeValue)
Sets the connection mode from a text string


toString

public java.lang.String toString()
Debuggable human output



Copyright © 2005 XeNoNSoFT.com. All Rights Reserved.