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:
Wrapper
,CommonDataSource
,DataSource
,Closeable
public class DecoratingDataSource extends DelegatingDataSource
Delegating data source that maintains a list ofConnectionDecorator
s.- Author:
- Abe White
-
-
Constructor Summary
Constructors Constructor Description DecoratingDataSource(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(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.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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder
-
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
-
-
-
Constructor Detail
-
DecoratingDataSource
public DecoratingDataSource(DataSource ds)
Constructor. Supply wrapped data source.
-
-
Method Detail
-
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 interfaceDataSource
- Overrides:
getConnection
in classDelegatingDataSource
- Throws:
SQLException
-
getConnection
public Connection getConnection(String user, String pass) throws SQLException
- Specified by:
getConnection
in interfaceDataSource
- Overrides:
getConnection
in classDelegatingDataSource
- Throws:
SQLException
-
-