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:
java.lang.Iterable<javax.sql.DataSource>,java.sql.Wrapper,javax.sql.CommonDataSource,javax.sql.DataSource,Closeable
public class DistributedDataSource extends DecoratingDataSource implements java.lang.Iterable<javax.sql.DataSource>
A virtual datasource that contains many physical datasources.- Author:
- Pinaki Poddar
-
-
Constructor Summary
Constructors Constructor Description DistributedDataSource(java.util.List<javax.sql.DataSource> dataSources)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDataSource(javax.sql.DataSource ds)java.sql.ConnectiongetConnection()java.sql.ConnectiongetConnection(java.lang.String username, java.lang.String password)intgetLoginTimeout()java.io.PrintWritergetLogWriter()java.util.logging.LoggergetParentLogger()java.util.Iterator<javax.sql.DataSource>iterator()voidsetLoginTimeout(int seconds)voidsetLogWriter(java.io.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
-
-
-
-
Method Detail
-
addDataSource
public void addDataSource(javax.sql.DataSource ds)
-
iterator
public java.util.Iterator<javax.sql.DataSource> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<javax.sql.DataSource>
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException- Specified by:
getConnectionin interfacejavax.sql.DataSource- Overrides:
getConnectionin classDecoratingDataSource- Throws:
java.sql.SQLException
-
getConnection
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException- Specified by:
getConnectionin interfacejavax.sql.DataSource- Overrides:
getConnectionin classDecoratingDataSource- Throws:
java.sql.SQLException
-
getLogWriter
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException- Specified by:
getLogWriterin interfacejavax.sql.CommonDataSource- Specified by:
getLogWriterin interfacejavax.sql.DataSource- Overrides:
getLogWriterin classDelegatingDataSource- Throws:
java.sql.SQLException
-
getLoginTimeout
public int getLoginTimeout() throws java.sql.SQLException- Specified by:
getLoginTimeoutin interfacejavax.sql.CommonDataSource- Specified by:
getLoginTimeoutin interfacejavax.sql.DataSource- Overrides:
getLoginTimeoutin classDelegatingDataSource- Throws:
java.sql.SQLException
-
setLogWriter
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException- Specified by:
setLogWriterin interfacejavax.sql.CommonDataSource- Specified by:
setLogWriterin interfacejavax.sql.DataSource- Overrides:
setLogWriterin classDelegatingDataSource- Throws:
java.sql.SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws java.sql.SQLException- Specified by:
setLoginTimeoutin interfacejavax.sql.CommonDataSource- Specified by:
setLoginTimeoutin interfacejavax.sql.DataSource- Overrides:
setLoginTimeoutin classDelegatingDataSource- Throws:
java.sql.SQLException
-
getParentLogger
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException- Specified by:
getParentLoggerin interfacejavax.sql.CommonDataSource- Overrides:
getParentLoggerin classDelegatingDataSource- Throws:
java.sql.SQLFeatureNotSupportedException
-
-