Package org.apache.openjpa.lib.jdbc
Class DecoratingDataSource
- java.lang.Object
-
- org.apache.openjpa.lib.jdbc.DelegatingDataSource
-
- org.apache.openjpa.lib.jdbc.DecoratingDataSource
-
- All Implemented Interfaces:
java.sql.Wrapper,javax.sql.CommonDataSource,javax.sql.DataSource,Closeable
- Direct Known Subclasses:
DistributedDataSource
public class DecoratingDataSource extends DelegatingDataSource
Delegating data source that maintains a list ofConnectionDecorators.- Author:
- Abe White
-
-
Constructor Summary
Constructors Constructor Description DecoratingDataSource(javax.sql.DataSource ds)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDecorator(ConnectionDecorator decorator)Add a connection decorator.voidaddDecorators(java.util.Collection<ConnectionDecorator> decorators)Add multiple connection decorators efficiently.voidclearDecorators()Clear all decorators.java.sql.ConnectiongetConnection()java.sql.ConnectiongetConnection(java.lang.String user, java.lang.String pass)java.util.Collection<ConnectionDecorator>getDecorators()Return a read-only list of connection decorators in the order they were added.booleanremoveDecorator(ConnectionDecorator decorator)Remove a connection decorator.-
Methods inherited from class org.apache.openjpa.lib.jdbc.DelegatingDataSource
appendInfo, close, equals, getDelegate, getInnermostDelegate, getLoginTimeout, getLogWriter, getParentLogger, hashCode, isWrapperFor, setLoginTimeout, setLogWriter, toString, unwrap
-
-
-
-
Method Detail
-
getDecorators
public java.util.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(java.util.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 java.sql.Connection getConnection() throws java.sql.SQLException- Specified by:
getConnectionin interfacejavax.sql.DataSource- Overrides:
getConnectionin classDelegatingDataSource- Throws:
java.sql.SQLException
-
getConnection
public java.sql.Connection getConnection(java.lang.String user, java.lang.String pass) throws java.sql.SQLException- Specified by:
getConnectionin interfacejavax.sql.DataSource- Overrides:
getConnectionin classDelegatingDataSource- Throws:
java.sql.SQLException
-
-