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>, DataSource, Closeable

 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
 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, removeDecorator
 
Methods inherited from class org.apache.openjpa.lib.jdbc.DelegatingDataSource
appendInfo, close, equals, getDelegate, getInnermostDelegate, hashCode, toString
 
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

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 DataSource
Overrides:
getLogWriter in class DelegatingDataSource
Throws:
SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws SQLException
Specified by:
getLoginTimeout in interface DataSource
Overrides:
getLoginTimeout in class DelegatingDataSource
Throws:
SQLException

setLogWriter

public void setLogWriter(PrintWriter out)
                  throws SQLException
Specified by:
setLogWriter in interface DataSource
Overrides:
setLogWriter in class DelegatingDataSource
Throws:
SQLException

setLoginTimeout

public void setLoginTimeout(int seconds)
                     throws SQLException
Specified by:
setLoginTimeout in interface DataSource
Overrides:
setLoginTimeout in class DelegatingDataSource
Throws:
SQLException


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.