|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.avalon.cornerstone.blocks.datasources.DefaultDataSourceSelector
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>
| Field Summary |
| Fields inherited from interface org.apache.avalon.cornerstone.services.datasources.DataSourceSelector |
ROLE |
| Constructor Summary | |
DefaultDataSourceSelector()
|
|
| Method Summary | |
void |
configure(Configuration configuration)
Pass the Configuration to the Configurable
class. |
void |
contextualize(Context context)
Contextualization of the component by the container. |
void |
dispose()
The dispose operation is called at the end of a components lifecycle. |
void |
initialize()
Initialize the component. |
boolean |
isSelectable(java.lang.Object hint)
Check to see if a Object exists relative to the supplied policy. |
void |
release(java.lang.Object component)
Return the Object when you are finished with it. |
java.lang.Object |
select(java.lang.Object hint)
Select the Object associated with the given policy. |
| 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 |
public DefaultDataSourceSelector()
| Method Detail |
public void contextualize(Context context)
throws ContextException
contextualize in interface Contextualizablecontext - the supplied context object
ContextException - if context is invalidpublic void configure(Configuration configuration)
ConfigurableConfiguration to the Configurable
class.
configure in interface Configurableconfiguration - the class configurations. Must not be null.
public void initialize()
throws java.lang.Exception
Initializable
initialize in interface Initializablejava.lang.Exception - if an error occurspublic void dispose()
Disposable
dispose in interface Disposablepublic boolean isSelectable(java.lang.Object hint)
ServiceSelectorObject exists relative to the supplied policy.
isSelectable in interface ServiceSelectorhint - a Object containing the selection criteria
public java.lang.Object select(java.lang.Object hint)
throws ServiceException
ServiceSelectorObject associated with the given policy.
For instance, If the ServiceSelector has a
Generator stored and referenced by a URL, the
following call could be used:
try
{
Generator input;
input = (Generator)selector.select( new URL("foo://demo/url") );
}
catch (...)
{
...
}
select in interface ServiceSelectorhint - A criteria against which a Object is selected.
Object value
ServiceException - If the requested Object cannot be suppliedpublic void release(java.lang.Object component)
ServiceSelectorObject when you are finished with it. This
allows the ServiceSelector to handle the End-Of-Life Lifecycle
events associated with the Object. Please note, that no
Exception should be thrown at this point. This is to allow easy use of the
ServiceSelector system without having to trap Exceptions on a release.
release in interface ServiceSelectorcomponent - The Object we are releasing, may also be a
null reference
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||