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 void
addDataSource(javax.sql.DataSource ds)
java.sql.Connection
getConnection()
java.sql.Connection
getConnection(java.lang.String username, java.lang.String password)
int
getLoginTimeout()
java.io.PrintWriter
getLogWriter()
java.util.logging.Logger
getParentLogger()
java.util.Iterator<javax.sql.DataSource>
iterator()
void
setLoginTimeout(int seconds)
void
setLogWriter(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:
iterator
in interfacejava.lang.Iterable<javax.sql.DataSource>
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
- Specified by:
getConnection
in interfacejavax.sql.DataSource
- Overrides:
getConnection
in 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:
getConnection
in interfacejavax.sql.DataSource
- Overrides:
getConnection
in classDecoratingDataSource
- Throws:
java.sql.SQLException
-
getLogWriter
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
- Specified by:
getLogWriter
in interfacejavax.sql.CommonDataSource
- Specified by:
getLogWriter
in interfacejavax.sql.DataSource
- Overrides:
getLogWriter
in classDelegatingDataSource
- Throws:
java.sql.SQLException
-
getLoginTimeout
public int getLoginTimeout() throws java.sql.SQLException
- Specified by:
getLoginTimeout
in interfacejavax.sql.CommonDataSource
- Specified by:
getLoginTimeout
in interfacejavax.sql.DataSource
- Overrides:
getLoginTimeout
in classDelegatingDataSource
- Throws:
java.sql.SQLException
-
setLogWriter
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
- Specified by:
setLogWriter
in interfacejavax.sql.CommonDataSource
- Specified by:
setLogWriter
in interfacejavax.sql.DataSource
- Overrides:
setLogWriter
in classDelegatingDataSource
- Throws:
java.sql.SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws java.sql.SQLException
- Specified by:
setLoginTimeout
in interfacejavax.sql.CommonDataSource
- Specified by:
setLoginTimeout
in interfacejavax.sql.DataSource
- Overrides:
setLoginTimeout
in classDelegatingDataSource
- Throws:
java.sql.SQLException
-
getParentLogger
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
- Specified by:
getParentLogger
in interfacejavax.sql.CommonDataSource
- Overrides:
getParentLogger
in classDelegatingDataSource
- Throws:
java.sql.SQLFeatureNotSupportedException
-
-