FileDocCategorySizeDatePackage
DataSourceImpl.javaAPI DocGlassfish v2 API6065Tue May 22 16:54:24 BST 2007oracle.toplink.essentials.internal.ejb.cmp3.jdbc.base

DataSourceImpl

public class DataSourceImpl extends Object implements DataSource
A stubbed out impl of DataSource that can be used for testing. Does not support multiple threads or multiple usernames/passwords.

Fields Summary
String
dsName
String
url
String
userName
String
password
TransactionManagerImpl
tm
Constructors Summary
public DataSourceImpl(String dsName, String url, String userName, String password)
/ private void debug(String s) { System.out.println(s); } /* Use this constructor to create a new datasource

        this.dsName = dsName;
        this.url = url;
        this.userName = userName;
        this.password = password;
    
Methods Summary
public java.sql.ConnectiongetConnection()
/ /* Forward to the other method.

        return getConnection(this.userName, this.password);
    
public java.sql.ConnectiongetConnection(java.lang.String userName, java.lang.String password)

        if (isTransactional() && tm.isTransactionActive()) {
            // This will actually eventually call back into this class, but allows
            // the connection to be cached in the transaction first
            return tm.getConnection(this, userName, password);
        } else {//{
            debug("Ds - Allocating new non-tx connection");
        }
        return internalGetConnection(userName, password);
    
public java.io.PrintWritergetLogWriter()

        return DriverManager.getLogWriter();
    
public intgetLoginTimeout()

        return DriverManager.getLoginTimeout();
    
public java.lang.StringgetName()

        return this.dsName;
    
public java.sql.ConnectioninternalGetConnection(java.lang.String userName, java.lang.String password)

        return DriverManager.getConnection(this.url, userName, password);
    
public java.sql.ConnectioninternalGetConnection()

        return internalGetConnection(this.userName, this.password);
    
public booleanisTransactional()

        return tm != null;
    
public booleanisWrapperFor(java.lang.Class iface)

        return false;
    
public voidsetLogWriter(java.io.PrintWriter out)

        DriverManager.setLogWriter(out);
    
public voidsetLoginTimeout(int seconds)

        DriverManager.setLoginTimeout(seconds);
    
public voidsetTransactionManager(oracle.toplink.essentials.internal.ejb.cmp3.transaction.base.TransactionManagerImpl tm)

        this.tm = tm;
    
public Tunwrap(java.lang.Class iface)

        throw new SQLException();