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
DistributedDataSource
public DistributedDataSource(List<DataSource> dataSources)
addDataSource
public void addDataSource(DataSource ds)
iterator
public Iterator<DataSource> iterator()
- Specified by:
iterator
in interface Iterable<DataSource>
getConnection
public Connection getConnection()
throws SQLException
- Specified by:
getConnection
in interface DataSource
- Overrides:
getConnection
in class DecoratingDataSource
- Throws:
SQLException
getConnection
public Connection getConnection(String username,
String password)
throws SQLException
- Specified by:
getConnection
in interface DataSource
- Overrides:
getConnection
in class DecoratingDataSource
- Throws:
SQLException
getLogWriter
public PrintWriter getLogWriter()
throws SQLException
- Specified by:
getLogWriter
in interface CommonDataSource
- Overrides:
getLogWriter
in class DelegatingDataSource
- Throws:
SQLException
getLoginTimeout
public int getLoginTimeout()
throws SQLException
- Specified by:
getLoginTimeout
in interface CommonDataSource
- Overrides:
getLoginTimeout
in class DelegatingDataSource
- Throws:
SQLException
setLogWriter
public void setLogWriter(PrintWriter out)
throws SQLException
- Specified by:
setLogWriter
in interface CommonDataSource
- Overrides:
setLogWriter
in class DelegatingDataSource
- Throws:
SQLException
setLoginTimeout
public void setLoginTimeout(int seconds)
throws SQLException
- Specified by:
setLoginTimeout
in interface CommonDataSource
- Overrides:
setLoginTimeout
in class DelegatingDataSource
- Throws:
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
Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.