org.apache.avalon.cornerstone.blocks.datasources
Class DefaultDataSourceSelector

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.cornerstone.blocks.datasources.DefaultDataSourceSelector
All Implemented Interfaces:
Configurable, Contextualizable, DataSourceSelector, Disposable, Initializable, LogEnabled, ServiceSelector

public class DefaultDataSourceSelector
extends AbstractLogEnabled
implements DataSourceSelector, Contextualizable, Configurable, Initializable, Disposable

A default implementation for DataSourceSelector. The Configuration is like this:

 <myBlock>
   <data-source name="default"
     class="org.apache.avalon.excalibur.datasource.JdbcDataSource">
     <!-- configuration for JdbcDataSource -->
     <pool-controller min="5" max="10" connection-class="my.overrided.ConnectionClass">
       <keep-alive>select 1</keep-alive>
     </pool-controller>
     <driver>com.database.jdbc.JdbcDriver</driver>
     <dburl>jdbc:driver://host/mydb</dburl>
     <user>username</user>
     <password>password</password>
   </data-source>
 </myBlock>
 

Author:
Avalon Development Team

Field Summary
 
Fields inherited from interface org.apache.avalon.cornerstone.services.datasources.DataSourceSelector
ROLE
 
Constructor Summary
DefaultDataSourceSelector()
           
 
Method Summary
 void configure(Configuration configuration)
           
 void contextualize(Context context)
           
 void dispose()
           
 void initialize()
           
 boolean isSelectable(Object hint)
           
 void release(Object component)
           
 Object select(Object hint)
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDataSourceSelector

public DefaultDataSourceSelector()
Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Throws:
ContextException

configure

public void configure(Configuration configuration)
Specified by:
configure in interface Configurable

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable
Throws:
Exception

dispose

public void dispose()
Specified by:
dispose in interface Disposable

isSelectable

public boolean isSelectable(Object hint)
Specified by:
isSelectable in interface ServiceSelector

select

public Object select(Object hint)
              throws ServiceException
Specified by:
select in interface ServiceSelector
Throws:
ServiceException

release

public void release(Object component)
Specified by:
release in interface ServiceSelector


Copyright © Apache Software Foundation. All Rights Reserved.