cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: [C2]: Avalon Component Configuration
Date Tue, 10 Apr 2001 13:56:12 GMT
Carsten Ziegeler wrote:
> 
> Hi,
> 
> I am trying to add new avalon components to the
> cocoon.xconf (yes, for caching of course....) and am
> now a little bit confused about the format.
> 
> E.g. the parser has the following entries:
>   <parser class="org.apache.cocoon.components.parser.JaxpParser"/>
> 
>  <role name="org.apache.cocoon.components.parser.Parser"
>        shorthand="parser"
>        default-class="org.apache.cocoon.components.parser.JaxpParser"/>

The role entry describes the real role name (name attribute), the XML
element alias (shorthand attribute), and the default class (default-
class attribte).  It is necessary for Cocoon to function if the explicit
Component has not been added.  In fact, if the <parser class="@{class}"/>
entry uses the same class, the <parser/> element is not needed at all.

> Is the first one obsolete? I thought the second declaration adds
> a component with the role name "parser".

No.  The second declaration tells the Avalon component management framework
what to do with the convenience element "parser".  There is no role named
"parser".  The role is named "org.apache.cocoon.components.parser.Parser".

> For the URL Factory I found:
>   <url-factory>
>     <protocol name="resource" class="org.apache.cocoon.components.url.ResourceURLFactory"/>
>     <protocol name="context"  class="org.apache.cocoon.components.url.ContextURLFactory"/>
>   </url-factory>
> 
>  <role name="org.apache.cocoon.components.url.URLFactory"
>        shorthand="url-factory"
>        default-class="org.apache.cocoon.components.url.URLFactoryImpl"/>
> 
> Is the second one the definition for the role and the first one the
> configuration for this role?

Again, the "role" element is the prototype for the Avalon component management
framework so that it knows what to do with the "url-factory" element.  The
"url-factory" element is the Configuration element for the
"org.apache.cocoon.components.url.URLFactory" role.

This is instead of the long-hand version of the Component entry:

<component role="org.apache.cocoon.components.url.URLFactory"
           class="org.apache.cocoon.components.url.URLFactoryImpl">
    <protocol name="resource" class="org.apache.cocoon.components.url.ResourceURLFactory"/>
    <protocol name="context" class="org.apache.cocoon.components.url.ContextURLFactory"/>
</component>

I am debating on whether to separate the role definitions from Cocoon.xconf.  I think
it would alleviate allot of confusion--especially since the role definition entries
are developer concerns.

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


Mime
View raw message