org.apache.openjpa.lib.jdbc
Class DelegatingDataSource

java.lang.Object
  extended by org.apache.openjpa.lib.jdbc.DelegatingDataSource
All Implemented Interfaces:
DataSource, Closeable
Direct Known Subclasses:
DecoratingDataSource

public class DelegatingDataSource
extends Object
implements DataSource, Closeable

Wrapper around an existing data source. Subclasses can override the methods whose behavior they mean to change. The equals and hashCode methods pass through to the base underlying data store.

Author:
Abe White

Constructor Summary
DelegatingDataSource(DataSource ds)
          Constructor.
 
Method Summary
protected  void appendInfo(StringBuffer buf)
           
 void close()
           
 boolean equals(Object other)
           
 Connection getConnection()
           
 Connection getConnection(String user, String pass)
           
 DataSource getDelegate()
          Return the wrapped data source.
 DataSource getInnermostDelegate()
          Return the inner-most wrapped delegate.
 int getLoginTimeout()
           
 PrintWriter getLogWriter()
           
 int hashCode()
           
 void setLoginTimeout(int timeout)
           
 void setLogWriter(PrintWriter out)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DelegatingDataSource

public DelegatingDataSource(DataSource ds)
Constructor. Supply wrapped data source.

Method Detail

getDelegate

public DataSource getDelegate()
Return the wrapped data source.


getInnermostDelegate

public DataSource getInnermostDelegate()
Return the inner-most wrapped delegate.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

appendInfo

protected void appendInfo(StringBuffer buf)

getLogWriter

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

setLogWriter

public void setLogWriter(PrintWriter out)
                  throws SQLException
Specified by:
setLogWriter in interface DataSource
Throws:
SQLException

getLoginTimeout

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

setLoginTimeout

public void setLoginTimeout(int timeout)
                     throws SQLException
Specified by:
setLoginTimeout in interface DataSource
Throws:
SQLException

getConnection

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

getConnection

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

close

public void close()
           throws Exception
Specified by:
close in interface Closeable
Throws:
Exception


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.