|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 Contextualizable
context
- the supplied context object
ContextException
- if context is invalidpublic void configure(Configuration configuration)
Configurable
Configuration
to the Configurable
class.
configure
in interface Configurable
configuration
- the class configurations. Must not be null
.public void initialize() throws java.lang.Exception
Initializable
initialize
in interface Initializable
java.lang.Exception
- if an error occurspublic void dispose()
Disposable
dispose
in interface Disposable
public boolean isSelectable(java.lang.Object hint)
ServiceSelector
Object
exists relative to the supplied policy.
isSelectable
in interface ServiceSelector
hint
- a Object
containing the selection criteria
public java.lang.Object select(java.lang.Object hint) throws ServiceException
ServiceSelector
Object
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 ServiceSelector
hint
- A criteria against which a Object
is selected.
Object
value
ServiceException
- If the requested Object
cannot be suppliedpublic void release(java.lang.Object component)
ServiceSelector
Object
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 ServiceSelector
component
- 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 |