org.ow2.jonas.ee.jdbc
Class DataSourceImpl

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

public class DataSourceImpl
extends Object
implements DataSource, Serializable, 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, ConnectionManager _cm)
           
 
Method Summary
 Connection getConnection()
           
 Connection getConnection(String user, String pwd)
           
 int getLoginTimeout()
           
 PrintWriter getLogWriter()
           
 String getMapperName()
           
 Reference getReference()
           
 boolean isWrapperFor(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(PrintWriter _pw)
           
 void setReference(Reference _ref)
           
<T> T
unwrap(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,
                      ConnectionManager _cm)
Method Detail

getConnection

public Connection getConnection()
                         throws SQLException
Specified by:
getConnection in interface DataSource
Throws:
SQLException

getConnection

public Connection getConnection(String user,
                                String pwd)
                         throws SQLException
Specified by:
getConnection in interface DataSource
Throws:
SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws SQLException
Specified by:
getLoginTimeout in interface CommonDataSource
Throws:
SQLException

getLogWriter

public PrintWriter getLogWriter()
                         throws SQLException
Specified by:
getLogWriter in interface CommonDataSource
Throws:
SQLException

getReference

public Reference getReference()
Specified by:
getReference in interface Referenceable

setLoginTimeout

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

setLogWriter

public void setLogWriter(PrintWriter _pw)
                  throws SQLException
Specified by:
setLogWriter in interface CommonDataSource
Throws:
SQLException

setReference

public void setReference(Reference _ref)

getMapperName

public String getMapperName()

isWrapperFor

public boolean isWrapperFor(Class<?> iface)
                     throws 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 Wrapper
Parameters:
iface - a Class defining an interface.
Throws:
SQLException - if an error occurs while determining whether this is a wrapper for an object with the given interface.

unwrap

public <T> T unwrap(Class<T> iface)
         throws 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 Wrapper
Parameters:
iface - A Class defining an interface that the result must implement.
Throws:
SQLException - If no object found that implements the interface


Copyright © 2013 OW2 Consortium. All Rights Reserved.