org.synchronoss.cpo.jdbc
Class ClassDataSourceInfo

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

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

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
ClassDataSourceInfo(java.lang.String className)
          Creates a ClassDataSourceInfo from a Jdbc Driver
ClassDataSourceInfo(java.lang.String className, java.util.Map<java.lang.String,java.lang.String> properties)
          Creates a ClassDataSourceInfo from a Jdbc Driver
ClassDataSourceInfo(java.lang.String className, java.util.Map<java.lang.String,java.lang.String> properties, java.lang.String tablePrefix)
          Creates a ClassDataSourceInfo from a Jdbc Driver
ClassDataSourceInfo(java.lang.String className, java.lang.String tablePrefix)
          Creates a ClassDataSourceInfo from a Jdbc Driver
 
Method Summary
 void connectionClosed(javax.sql.ConnectionEvent ce)
           
 void connectionErrorOccurred(javax.sql.ConnectionEvent ce)
           
 void finalize()
           
 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, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassDataSourceInfo

public ClassDataSourceInfo(java.lang.String className)
                    throws CpoException
Creates a ClassDataSourceInfo from a Jdbc Driver

Parameters:
classname - The classname of a class that implements datasource
Throws:
CpoException

ClassDataSourceInfo

public ClassDataSourceInfo(java.lang.String className,
                           java.lang.String tablePrefix)
                    throws CpoException
Creates a ClassDataSourceInfo from a Jdbc Driver

Parameters:
classname - The classname of a class that implements datasource
tablePrefix - The prefix added to the cpo tables in the metadata source
Throws:
CpoException

ClassDataSourceInfo

public ClassDataSourceInfo(java.lang.String className,
                           java.util.Map<java.lang.String,java.lang.String> properties)
                    throws CpoException
Creates a ClassDataSourceInfo from a Jdbc Driver

Parameters:
classname - The classname of a class that implements datasource
properties - - The connection properties for connecting to the database
Throws:
CpoException

ClassDataSourceInfo

public ClassDataSourceInfo(java.lang.String className,
                           java.util.Map<java.lang.String,java.lang.String> properties,
                           java.lang.String tablePrefix)
                    throws CpoException
Creates a ClassDataSourceInfo from a Jdbc Driver

Parameters:
classname - The classname of a class that implements datasource
properties - - The connection properties for connecting to the database
tablePrefix - The prefix added to the cpo tables in the metadata source
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

connectionClosed

public void connectionClosed(javax.sql.ConnectionEvent ce)
Specified by:
connectionClosed in interface javax.sql.ConnectionEventListener

connectionErrorOccurred

public void connectionErrorOccurred(javax.sql.ConnectionEvent ce)
Specified by:
connectionErrorOccurred in interface javax.sql.ConnectionEventListener

finalize

public void finalize()
              throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable


Copyright © 2011. All Rights Reserved.