So the hints become valid tags...

Genius!

-Mark

Leif Mortenson wrote:

> Mark Woon wrote:
>
> >Leif Mortenson wrote:
> >
> >>Let me know if you still have questions.
> >>
> >
> >More questions:
> >
> >What are hints used for?  I see them declared in roles.xml for the
> >DataSourceComponentSelector but don't see where they're actually being used.
> >
> In the roles.xml file, you see the following:
>     <role
> name="org.apache.avalon.excalibur.datasource.DataSourceComponentSelector"
>           shorthand="datasources"
>
> default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
>
>         <hint shorthand="jdbc"
> class="org.apache.avalon.excalibur.datasource.JdbcDataSource"/>
>         <hint shorthand="j2ee"
> class="org.apache.avalon.excalibur.datasource.J2eeDataSource"/>
>     </role>
>
> And in configuration.xml, you have this section:
>     <datasources>
>         <jdbc name="test-db" logger="app.jdbc">
>             <pool-controller min="1" max="1">
>                 <keep-alive disable="true"/>
>             </pool-controller>
>             <auto-commit>true</auto-commit>
>             <driver>org.hsqldb.jdbcDriver</driver>
>             <dburl>jdbc:hsqldb:..\sqldata\example</dburl>
>             <user>sa</user>
>             <password></password>
>         </jdbc>
>     </datasources>
>
> The shorthand in the DataSourceComponentSelector element is how the
> datasources element in the configuration.xml file is able to be
> resolved.  The hints are used to define what the jdbc element is under
> datasources.
>
> You could do something like the following;
>     <role
> name="org.apache.avalon.excalibur.datasource.DataSourceComponentSelector"
>           shorthand="datasources"
>
> default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
>
>         <hint shorthand="jdbc"
> class="org.apache.avalon.excalibur.datasource.JdbcDataSource"/>
>         <hint shorthand="rl-jdbc"
>
> class="org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource"/>
>         <hint shorthand="j2ee"
> class="org.apache.avalon.excalibur.datasource.J2eeDataSource"/>
>     </role>
>
>     <datasources>
>         <jdbc name="test-db" logger="app.jdbc">
>             <pool-controller min="1" max="1">
>                 <keep-alive disable="true"/>
>             </pool-controller>
>             <auto-commit>true</auto-commit>
>             <driver>org.hsqldb.jdbcDriver</driver>
>             <dburl>jdbc:hsqldb:..\sqldata\example</dburl>
>             <user>sa</user>
>             <password></password>
>         </jdbc>
>
>         <rl-jdbc name="test-rl-db" logger="app.jdbc">
>             <pool-controller min="1" max="1">
>                 <keep-alive disable="true"/>
>             </pool-controller>
>             <auto-commit>true</auto-commit>
>             <driver>org.hsqldb.jdbcDriver</driver>
>             <dburl>jdbc:hsqldb:..\sqldata\example</dburl>
>             <user>sa</user>
>             <password></password>
>         </rl-jdbc>
>     </datasources>
>
> to Get 2 different datasources.  One of each implementation type.
>
> You could then try each one out by changing the dbpool name from:
>     <hello-db logger="app">
>         <dbpool>test-db</dbpool>
>     </hello-db>
> to:
>     <hello-db logger="app">
>         <dbpool>test-rl-db</dbpool>
>     </hello-db>
>
> Make sense?  It really quite powerful once you get used to it.  You can
> use Component Selectors for all kinds of components, not just data sources.
>
> Cheers,
> Leif
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
~~Mark Woon~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you're not part of the solution, you're part of the precipitate.


Reply via email to