excalibur-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: Need some help with Sources
Date Mon, 09 May 2005 16:23:00 GMT
Torsten Schlabach wrote:

>Pete,
>
>  
>
>>>this 'hint', "myxmldatabase", would be the protocol. so a URL you
>>>pass to the source resolver would be myxmldatabase://my/custom/path
>>>      
>>>
>
>But aren't hints usually placed in .roles files? This is where I loose
>track. Taking a look at the cocoon.roles for example, there is not a
>single hint in the <role
>name="org.apache.excalibur.source.SourceFactorySelector"> part of the
>file. I would have expected to find hints for "cocoon:" and "sitemap:"
>there for example.
>
>Instead, there is a couple of <component-instance> tags in cocoon.xconf
>where I find this information. Why is it there and not in the .roles file?
>My understanding so far was that if I need to choose one out of many
>components implementing the same role, I would use hints in the .roles
>file?
>  
>

Hints in the roles file can be used to define notation shorthands in the 
xconf file. They are the equivalent for selectors to what shorthands are 
for regular components.

If you look e.g. at the datasource-related roles, you'll see the following:

<role 
name="org.apache.avalon.excalibur.datasource.DataSourceComponentSelector"
      shorthand="datasources"
      
default-class="org.apache.cocoon.components.ExtendedComponentSelector">
  <hint shorthand="jdbc" 
class="org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource"/>
  <hint shorthand="j2ee" 
class="org.apache.avalon.excalibur.datasource.J2eeDataSource"/>
  <hint shorthand="informix" 
class="org.apache.avalon.excalibur.datasource.InformixDataSource"/>
</role>

This allows to write the following in cocoon.xconf:
<datasources>
  <jdbc name="foo">
    ...
  </jdbc>
  <j2ee name="bar">
    ...
  </jdbc>
</datasources>

But this could equally be written:
<datasources>
  <component-instance name="foo" 
class="org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource">
    ...
  </component-instance>
  <component-instance name="foo" 
class="org.apache.avalon.excalibur.datasource.J2eeDataSource">
    ...
  </component-instance>
</datasources>

There are no such hints for source factories, certainly because it's 
unlikely for one implementation to be used several times.

Hope this helps,
Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org


Mime
View raw message