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 ofConnectionDecorator
s.- 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 void
addDecorator(ConnectionDecorator decorator)
Add a connection decorator.void
addDecorators(java.util.Collection<ConnectionDecorator> decorators)
Add multiple connection decorators efficiently.void
clearDecorators()
Clear all decorators.java.sql.Connection
getConnection()
java.sql.Connection
getConnection(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.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, 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:
getConnection
in interfacejavax.sql.DataSource
- Overrides:
getConnection
in 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:
getConnection
in interfacejavax.sql.DataSource
- Overrides:
getConnection
in classDelegatingDataSource
- Throws:
java.sql.SQLException
-
-