Package org.apache.openjpa.slice.jdbc
Class DistributedDataSource
- java.lang.Object
-
- org.apache.openjpa.lib.jdbc.DelegatingDataSource
-
- org.apache.openjpa.lib.jdbc.DecoratingDataSource
-
- org.apache.openjpa.slice.jdbc.DistributedDataSource
-
- All Implemented Interfaces:
Iterable<DataSource>,Wrapper,CommonDataSource,DataSource,Closeable
public class DistributedDataSource extends DecoratingDataSource implements Iterable<DataSource>
A virtual datasource that contains many physical datasources.- Author:
- Pinaki Poddar
-
-
Constructor Summary
Constructors Constructor Description DistributedDataSource(List<DataSource> dataSources)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDataSource(DataSource ds)ConnectiongetConnection()ConnectiongetConnection(String username, String password)intgetLoginTimeout()PrintWritergetLogWriter()LoggergetParentLogger()Iterator<DataSource>iterator()voidsetLoginTimeout(int seconds)voidsetLogWriter(PrintWriter out)-
Methods inherited from class org.apache.openjpa.lib.jdbc.DecoratingDataSource
addDecorator, addDecorators, clearDecorators, getDecorators, removeDecorator
-
Methods inherited from class org.apache.openjpa.lib.jdbc.DelegatingDataSource
appendInfo, close, equals, getDelegate, getInnermostDelegate, hashCode, isWrapperFor, 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
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
DistributedDataSource
public DistributedDataSource(List<DataSource> dataSources)
-
-
Method Detail
-
addDataSource
public void addDataSource(DataSource ds)
-
iterator
public Iterator<DataSource> iterator()
- Specified by:
iteratorin interfaceIterable<DataSource>
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnectionin interfaceDataSource- Overrides:
getConnectionin classDecoratingDataSource- Throws:
SQLException
-
getConnection
public Connection getConnection(String username, String password) throws SQLException
- Specified by:
getConnectionin interfaceDataSource- Overrides:
getConnectionin classDecoratingDataSource- Throws:
SQLException
-
getLogWriter
public PrintWriter getLogWriter() throws SQLException
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Overrides:
getLogWriterin classDelegatingDataSource- Throws:
SQLException
-
getLoginTimeout
public int getLoginTimeout() throws SQLException- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Overrides:
getLoginTimeoutin classDelegatingDataSource- Throws:
SQLException
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Overrides:
setLogWriterin classDelegatingDataSource- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws SQLException- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Overrides:
setLoginTimeoutin classDelegatingDataSource- Throws:
SQLException
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLoggerin interfaceCommonDataSource- Overrides:
getParentLoggerin classDelegatingDataSource- Throws:
SQLFeatureNotSupportedException
-
-