org.ow2.jonas.ee.jdbc
Class DataSourceImpl

java.lang.Object
  extended by org.ow2.jonas.ee.jdbc.DataSourceImpl
All Implemented Interfaces:
java.io.Serializable, java.sql.Wrapper, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.DataSource

public class DataSourceImpl
extends java.lang.Object
implements javax.sql.DataSource, java.io.Serializable, javax.resource.Referenceable

Description of the DataSourceImpl. This is the dataSource for the JDBC RA.

Author:
Eric Hardesty
See Also:
Serialized Form

Constructor Summary
DataSourceImpl(ManagedConnectionFactoryImpl _mcf, javax.resource.spi.ConnectionManager _cm)
           
 
Method Summary
 java.sql.Connection getConnection()
           
 java.sql.Connection getConnection(java.lang.String user, java.lang.String pwd)
           
 int getLoginTimeout()
           
 java.io.PrintWriter getLogWriter()
           
 java.lang.String getMapperName()
           
 javax.naming.Reference getReference()
           
 boolean isWrapperFor(java.lang.Class<?> iface)
          Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does.
 void setLoginTimeout(int _loginTimeout)
           
 void setLogWriter(java.io.PrintWriter _pw)
           
 void setReference(javax.naming.Reference _ref)
           
<T> T
unwrap(java.lang.Class<T> iface)
          Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSourceImpl

public DataSourceImpl(ManagedConnectionFactoryImpl _mcf,
                      javax.resource.spi.ConnectionManager _cm)
Method Detail

getConnection

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

getConnection

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

getLoginTimeout

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

getLogWriter

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

getReference

public javax.naming.Reference getReference()
Specified by:
getReference in interface javax.naming.Referenceable

setLoginTimeout

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

setLogWriter

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

setReference

public void setReference(javax.naming.Reference _ref)

getMapperName

public java.lang.String getMapperName()

isWrapperFor

public boolean isWrapperFor(java.lang.Class<?> iface)
                     throws java.sql.SQLException
Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does. Returns false otherwise. If this implements the interface then return true, else if this is a wrapper then return the result of recursively calling isWrapperFor on the wrapped object. If this does not implement the interface and is not a wrapper, return false. This method should be implemented as a low-cost operation compared to unwrap so that callers can use this method to avoid expensive unwrap calls that may fail. If this method returns true then calling unwrap with the same argument should succeed.

Specified by:
isWrapperFor in interface java.sql.Wrapper
Parameters:
iface - a Class defining an interface.
Throws:
java.sql.SQLException - if an error occurs while determining whether this is a wrapper for an object with the given interface.

unwrap

public <T> T unwrap(java.lang.Class<T> iface)
         throws java.sql.SQLException
Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy. If the receiver implements the interface then the result is the receiver or a proxy for the receiver. If the receiver is a wrapper and the wrapped object implements the interface then the result is the wrapped object or a proxy for the wrapped object. Otherwise return the the result of calling unwrap recursively on the wrapped object or a proxy for that result. If the receiver is not a wrapper and does not implement the interface, then an SQLException is thrown.

Specified by:
unwrap in interface java.sql.Wrapper
Parameters:
iface - A Class defining an interface that the result must implement.
Throws:
java.sql.SQLException - If no object found that implements the interface


Copyright © 2012 OW2 Consortium. All Rights Reserved.