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
Component:
name="data-source-selector" lifestyle="singleton"
Service Export:
type="org.apache.avalon.cornerstone.services.datasources.DataSourceSelector"

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)
          Contextualization of the component by the container.
 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
Contextualization of the component by the container.

Specified by:
contextualize in interface Contextualizable
Parameters:
context - the supplied context object
Throws:
ContextException
Context Entry:
key="urn:avalon:name" alias="block.name"

configure

public void configure(Configuration configuration)
Specified by:
configure in interface Configurable
Configuration Schema:
schema="relax-ng"

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.