Stephen McConnell wrote:
> 
> 
> >>The ECM implementation locates a role entry based on the interface 
> >>name, maps that to a implementation class (based on the role and/or 
> >>config attributes), maps the implementation class to a handler and 
> >>returns an instance from the handler.
> >>
> > 
> > Perhaps we are meaning the same, but for safety I describe 
> how I think 
> > it works. The lookup uses a role which is just a name.
> > In most cases it's the interface name of the component to 
> lookup but 
> > that's not required.
> 
> Assuming we have this <role> declaration:
> 
>    <role name="org.apache.cocoon....PortalManager"
>        shorthand="portal-manager"
>        default-class="org.apache.cocoon....PortalManagerImpl"/>
> 
> Are you saying that the String passed to lookup is simply the 
> value of the "name" attribute?
> 
Yes.

> > This role name is searched in the roles config, the implementation 
> > class is found, mapped to a handler and an instance is 
> returned from 
> > the handler.
> > In addition, the central configuration file is searched first, as 
> > there could either be a <component name= class= definition or the 
> > default implementation in the roles file could be overwritten there 
> > using the shorthand: <portal-manager 
> class="org.package.AnotherImpl"/> 
> > The configuration has precedence over the roles.
> 
> Yep - were on the same track (or at least heading in the same 
> direction).  One question - if the role name attribute is the 
> lookup key, what is the logic for identifying the service 
> interface(s) that should be returned from the lookup operation?
> 
> E.g. consider the following:
> 
>    <role name="widget"
>        shorthand="portal-manager"
>        default-class="org.apache.cocoon....PortalManagerImpl"/>
> 
> In the case I have to shorthand name which lets me resolve 
> the class from the configs and I have the lookup key.  But 
> I'm missing the declaration of the services that the 
> component class is providing.
> 
Yes, that is missing. It's a convention that the role name should be
the interface name. In addition the interface contains in most
cases the role name as a String:
interface PortalManager {
 String ROLE = PortalManager.class.getName();

 ...
}


I have to leave right now, so I will take my time to read the
rest and answer then :)

Thanks
Carsten 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to