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:
Wrapper, CommonDataSource, DataSource, Closeable
Direct Known Subclasses:
DistributedDataSource

public abstract class DecoratingDataSource
extends DelegatingDataSource

Delegating data source that maintains a list of ConnectionDecorators.

Author:
Abe White

Field Summary
 
Fields inherited from class org.apache.openjpa.lib.jdbc.DelegatingDataSource
concreteImpl
 
Constructor Summary
DecoratingDataSource(DataSource ds)
          Constructor.
 
Method Summary
 void addDecorator(ConnectionDecorator decorator)
          Add a connection decorator.
 void addDecorators(Collection<ConnectionDecorator> decorators)
          Add multiple connection decorators efficiently.
 void clearDecorators()
          Clear all decorators.
 Connection getConnection()
           
 Connection getConnection(String user, String pass)
           
 Collection<ConnectionDecorator> getDecorators()
          Return a read-only list of connection decorators in the order they were added.
static DecoratingDataSource newDecoratingDataSource(DataSource ds)
           
 boolean removeDecorator(ConnectionDecorator decorator)
          Remove a connection decorator.
 
Methods inherited from class org.apache.openjpa.lib.jdbc.DelegatingDataSource
appendInfo, close, enforceAbstract, equals, getDelegate, getInnermostDelegate, getLoginTimeout, getLogWriter, hashCode, isWrapperFor, newInstance, setLoginTimeout, setLogWriter, toString, unwrap
 
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

newDecoratingDataSource

public static DecoratingDataSource newDecoratingDataSource(DataSource ds)

getDecorators

public Collection<ConnectionDecorator> 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<ConnectionDecorator> 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-2010 Apache Software Foundation. All Rights Reserved.