org.synchronoss.cpo.jdbc
Class DriverDataSourceInfo

Package class diagram package DriverDataSourceInfo
java.lang.Object
  extended by org.synchronoss.cpo.jdbc.DriverDataSourceInfo
All Implemented Interfaces:
javax.sql.DataSource, DataSourceInfo

public class DriverDataSourceInfo
extends java.lang.Object
implements DataSourceInfo, javax.sql.DataSource

Collects the info required to instantiate a DataSource from a JDBC Driver Provides the DataSourceInfo factory method getDataSource which instantiates the DataSource

Author:
dberry

Constructor Summary
DriverDataSourceInfo(java.lang.String driver, java.lang.String url)
          Creates a DriverDataSourceInfo from a Jdbc Driver
DriverDataSourceInfo(java.lang.String driver, java.lang.String url, java.util.Properties properties)
          Creates a DriverDataSourceInfo from a Jdbc Driver
DriverDataSourceInfo(java.lang.String driver, java.lang.String url, java.util.Properties properties, java.lang.String tablePrefix)
          Creates a DriverDataSourceInfo from a Jdbc Driver
DriverDataSourceInfo(java.lang.String driver, java.lang.String url, java.lang.String tablePrefix)
          Creates a DriverDataSourceInfo from a Jdbc Driver
DriverDataSourceInfo(java.lang.String driver, java.lang.String url, java.lang.String username, java.lang.String password)
          Creates a DriverDataSourceInfo from a Jdbc Driver
DriverDataSourceInfo(java.lang.String driver, java.lang.String url, java.lang.String username, java.lang.String password, java.lang.String tablePrefix)
          Creates a DriverDataSourceInfo from a Jdbc Driver
 
Method Summary
 java.sql.Connection getConnection()
           
 java.sql.Connection getConnection(java.lang.String userName, java.lang.String password)
           
 javax.sql.DataSource getDataSource()
           
 java.lang.String getDataSourceName()
           
 int getLoginTimeout()
           
 java.io.PrintWriter getLogWriter()
           
 java.lang.String getTablePrefix()
          Returns the tablePrefix or an empty string if no table prefix exists.
 boolean isWrapperFor(java.lang.Class<?> iface)
           
 void setLoginTimeout(int seconds)
           
 void setLogWriter(java.io.PrintWriter out)
           
 java.lang.String toString()
           
<T> T
unwrap(java.lang.Class<T> iface)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DriverDataSourceInfo

public DriverDataSourceInfo(java.lang.String driver,
                            java.lang.String url)
                     throws CpoException
Creates a DriverDataSourceInfo from a Jdbc Driver

Parameters:
driver - The text name of the driver
url - - The url that points to the database.
Throws:
CpoException

DriverDataSourceInfo

public DriverDataSourceInfo(java.lang.String driver,
                            java.lang.String url,
                            java.lang.String tablePrefix)
                     throws CpoException
Creates a DriverDataSourceInfo from a Jdbc Driver

Parameters:
driver - The text name of the driver
url - - The url that points to the database.
Throws:
CpoException

DriverDataSourceInfo

public DriverDataSourceInfo(java.lang.String driver,
                            java.lang.String url,
                            java.util.Properties properties)
                     throws CpoException
Creates a DriverDataSourceInfo from a Jdbc Driver

Parameters:
driver - The text name of the driver
url - - The url that points to the database.
properties - - The connection properties for connecting to the database
Throws:
CpoException

DriverDataSourceInfo

public DriverDataSourceInfo(java.lang.String driver,
                            java.lang.String url,
                            java.util.Properties properties,
                            java.lang.String tablePrefix)
                     throws CpoException
Creates a DriverDataSourceInfo from a Jdbc Driver

Parameters:
driver - The text name of the driver
url - - The url that points to the database.
properties - - The connection properties for connecting to the database
Throws:
CpoException

DriverDataSourceInfo

public DriverDataSourceInfo(java.lang.String driver,
                            java.lang.String url,
                            java.lang.String username,
                            java.lang.String password)
                     throws CpoException
Creates a DriverDataSourceInfo from a Jdbc Driver

Parameters:
driver - The text name of the driver
url - - The url that points to the database.
username - - The username for connecting to the database
password - - The password for connectinf to the database
Throws:
CpoException

DriverDataSourceInfo

public DriverDataSourceInfo(java.lang.String driver,
                            java.lang.String url,
                            java.lang.String username,
                            java.lang.String password,
                            java.lang.String tablePrefix)
                     throws CpoException
Creates a DriverDataSourceInfo from a Jdbc Driver

Parameters:
driver - The text name of the driver
url - - The url that points to the database.
username - - The username for connecting to the database
password - - The password for connectinf to the database
Throws:
CpoException
Method Detail

getDataSourceName

public java.lang.String getDataSourceName()
Specified by:
getDataSourceName in interface DataSourceInfo
Returns:
Returns the dataSourceName.

getTablePrefix

public java.lang.String getTablePrefix()
Description copied from interface: DataSourceInfo
Returns the tablePrefix or an empty string if no table prefix exists.

Specified by:
getTablePrefix in interface DataSourceInfo
Returns:
Returns the tablePrefix to be used on the CPO Tables

getDataSource

public javax.sql.DataSource getDataSource()
                                   throws CpoException
Specified by:
getDataSource in interface DataSourceInfo
Returns:
Returns the DataSource
Throws:
CpoException

getConnection

public java.sql.Connection getConnection(java.lang.String userName,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.sql.SQLException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws java.sql.SQLException
Specified by:
getLogWriter in interface javax.sql.DataSource
Throws:
java.sql.SQLException

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws java.sql.SQLException
Specified by:
setLogWriter in interface javax.sql.DataSource
Throws:
java.sql.SQLException

setLoginTimeout

public void setLoginTimeout(int seconds)
                     throws java.sql.SQLException
Specified by:
setLoginTimeout in interface javax.sql.DataSource
Throws:
java.sql.SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws java.sql.SQLException
Specified by:
getLoginTimeout in interface javax.sql.DataSource
Throws:
java.sql.SQLException

unwrap

public <T> T unwrap(java.lang.Class<T> iface)
         throws java.sql.SQLException
Throws:
java.sql.SQLException

isWrapperFor

public boolean isWrapperFor(java.lang.Class<?> iface)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException


Copyright © 2011. All Rights Reserved.