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
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
DistributedDataSource
public DistributedDataSource(java.util.List<javax.sql.DataSource> dataSources)
addDataSource
public void addDataSource(javax.sql.DataSource ds)
iterator
public java.util.Iterator<javax.sql.DataSource> iterator()
- Specified by:
iterator
in interface java.lang.Iterable<javax.sql.DataSource>
getConnection
public java.sql.Connection getConnection()
throws java.sql.SQLException
- Specified by:
getConnection
in interface javax.sql.DataSource
- Overrides:
getConnection
in class DecoratingDataSource
- 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 interface javax.sql.DataSource
- Overrides:
getConnection
in class DecoratingDataSource
- Throws:
java.sql.SQLException
getLogWriter
public java.io.PrintWriter getLogWriter()
throws java.sql.SQLException
- Specified by:
getLogWriter
in interface javax.sql.CommonDataSource
- Overrides:
getLogWriter
in class DelegatingDataSource
- Throws:
java.sql.SQLException
getLoginTimeout
public int getLoginTimeout()
throws java.sql.SQLException
- Specified by:
getLoginTimeout
in interface javax.sql.CommonDataSource
- Overrides:
getLoginTimeout
in class DelegatingDataSource
- Throws:
java.sql.SQLException
setLogWriter
public void setLogWriter(java.io.PrintWriter out)
throws java.sql.SQLException
- Specified by:
setLogWriter
in interface javax.sql.CommonDataSource
- Overrides:
setLogWriter
in class DelegatingDataSource
- Throws:
java.sql.SQLException
setLoginTimeout
public void setLoginTimeout(int seconds)
throws java.sql.SQLException
- Specified by:
setLoginTimeout
in interface javax.sql.CommonDataSource
- Overrides:
setLoginTimeout
in class DelegatingDataSource
- Throws:
java.sql.SQLException
enforceAbstract
protected void enforceAbstract()
- Description copied from class:
DelegatingDataSource
- Marker to enforce that subclasses of this class are abstract.
- Specified by:
enforceAbstract
in class DelegatingDataSource
getParentLogger
public java.util.logging.Logger getParentLogger()
throws java.sql.SQLFeatureNotSupportedException
- Throws:
java.sql.SQLFeatureNotSupportedException