public abstract class AbstractDataSourceCluster
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.thread.ThreadSafe
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String[] |
m_dataSourceNames |
private DataSourceComponent[] |
m_dataSources |
private org.apache.avalon.framework.service.ServiceSelector |
m_dbSelector |
protected int |
m_size |
| Constructor and Description |
|---|
AbstractDataSourceCluster() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(org.apache.avalon.framework.configuration.Configuration configuration)
Called by the Container to configure the component.
|
void |
dispose()
Called by the Container to dispose the component.
|
int |
getClusterSize()
Returns the number of DataSources in the cluster.
|
java.sql.Connection |
getConnectionForIndex(int index)
Gets a Connection to a database given an index.
|
void |
initialize()
Called by the Container to initialize the component.
|
void |
service(org.apache.avalon.framework.service.ServiceManager manager)
Called by the Container to tell the component which ComponentLocator
is controlling it.
|
protected int m_size
private java.lang.String[] m_dataSourceNames
private org.apache.avalon.framework.service.ServiceSelector m_dbSelector
private DataSourceComponent[] m_dataSources
public int getClusterSize()
public java.sql.Connection getConnectionForIndex(int index)
throws java.sql.SQLException
index - Index of the DataSource for which a connection is to be returned.NoValidConnectionException - when there is no valid Connection wrapper
available in the classloader or when the index is not valid.NoValidConnectionException - when there are no more available
Connections in the pool.java.sql.SQLExceptionpublic void service(org.apache.avalon.framework.service.ServiceManager manager)
throws org.apache.avalon.framework.service.ServiceException
service in interface org.apache.avalon.framework.service.Serviceablemanager - which curently owns the component.org.apache.avalon.framework.service.ServiceExceptionpublic void configure(org.apache.avalon.framework.configuration.Configuration configuration)
throws org.apache.avalon.framework.configuration.ConfigurationException
configure in interface org.apache.avalon.framework.configuration.Configurableconfiguration - configuration info used to setup the component.org.apache.avalon.framework.configuration.ConfigurationException - if there are any problems with the configuration.public void initialize()
throws java.lang.Exception
initialize in interface org.apache.avalon.framework.activity.Initializablejava.lang.Exception - if there were any problems durring initialization.public void dispose()
dispose in interface org.apache.avalon.framework.activity.Disposable