org.apache.openjpa.lib.jdbc
Class DecoratingDataSource

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

public class DecoratingDataSource
extends DelegatingDataSource

Delegating data source that maintains a list of ConnectionDecorators.

Author:
Abe White

Constructor Summary
DecoratingDataSource(DataSource ds)
          Constructor.
 
Method Summary
 void addDecorator(ConnectionDecorator decorator)
          Add a connection decorator.
 void addDecorators(Collection decorators)
          Add multiple connection decorators efficiently.
 void clearDecorators()
          Clear all decorators.
 Connection getConnection()
           
 Connection getConnection(String user, String pass)
           
 Collection getDecorators()
          Return a read-only list of connection decorators in the order they were added.
 boolean removeDecorator(ConnectionDecorator decorator)
          Remove a connection decorator.
 
Methods inherited from class org.apache.openjpa.lib.jdbc.DelegatingDataSource
appendInfo, close, equals, getDelegate, getInnermostDelegate, getLoginTimeout, getLogWriter, hashCode, setLoginTimeout, setLogWriter, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DecoratingDataSource

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

Method Detail

getDecorators

public Collection getDecorators()
Return a read-only list of connection decorators in the order they were added.


addDecorator

public void addDecorator(ConnectionDecorator decorator)
Add a connection decorator.


addDecorators

public void addDecorators(Collection decorators)
Add multiple connection decorators efficiently.


removeDecorator

public boolean removeDecorator(ConnectionDecorator decorator)
Remove a connection decorator.


clearDecorators

public void clearDecorators()
Clear all decorators.


getConnection

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

getConnection

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


Copyright © 2006 Apache Software Foundation. All Rights Reserved.