org.apache.openjpa.slice.jdbc
Class DistributedDataSource

java.lang.Object
  extended by org.apache.openjpa.lib.jdbc.DelegatingDataSource
      extended by org.apache.openjpa.lib.jdbc.DecoratingDataSource
          extended by 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
DistributedDataSource(List<DataSource> dataSources)
           
 
Method Summary
 void addDataSource(DataSource ds)
           
protected  void enforceAbstract()
          Marker to enforce that subclasses of this class are abstract.
 Connection getConnection()
           
(package private)  Connection getConnection(DataSource ds)
           
(package private)  Connection getConnection(DataSource ds, String user, String pwd)
           
 Connection getConnection(String username, String password)
           
 int getLoginTimeout()
           
 PrintWriter getLogWriter()
           
 Iterator<DataSource> iterator()
           
 void setLoginTimeout(int seconds)
           
 void setLogWriter(PrintWriter out)
           
 
Methods inherited from class org.apache.openjpa.lib.jdbc.DecoratingDataSource
addDecorator, addDecorators, clearDecorators, getDecorators, newDecoratingDataSource, removeDecorator
 
Methods inherited from class org.apache.openjpa.lib.jdbc.DelegatingDataSource
appendInfo, close, equals, getDelegate, getInnermostDelegate, hashCode, isWrapperFor, newInstance, toString, unwrap
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DistributedDataSource

public DistributedDataSource(List<DataSource> dataSources)
Method Detail

addDataSource

public void addDataSource(DataSource ds)

getConnection

Connection getConnection(DataSource ds)
                   throws SQLException
Throws:
SQLException

getConnection

Connection getConnection(DataSource ds,
                         String user,
                         String pwd)
                   throws SQLException
Throws:
SQLException

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-2011 Apache Software Foundation. All Rights Reserved.