avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: Resolver package--Please post your thoughts
Date Wed, 13 Feb 2002 20:36:12 GMT
Berin Loritsch wrote:

> Antti Koivunen wrote:
>
>> 4. Loose Token?
>>
>> As I see it, it's mainly a matter of
>>
>>   Token token = resolver.lookup(MY_URI);
>>   MyComponent mc = (MyComponent) token.reference();
>>   token.release();
>>
>> vs.
>>
>>   MyComponent mc = (MyComponent) resolver.lookup(MY_URI);
>>   resolver.release(MY_URI, mc);
>>
>> And the same thing for String[] + Object[]. Which one do you like best?
>
>
>
> For the time being, I think we settled on the direct approach:
>
> interface ServiceManager
> {
>     /**
>      * Return component for the specified role.  If there are more than
>      * one components for the role, return the default.
>      */
>     Object lookup(String role);
>
>     /**
>      * Return component for the specified role.  If there are more than
>      * one components for the role, use the supplied parameters to 
> determine
>      * which one.  If the parameters do not help, return the default.
>      */
>     Object lookup(String role, Parameters params);
>
>     /**
>      * Returns true if the ServiceManager has at least one instance of a
>      * role.
>      */
>     boolean hasComponent( String role );
>
>     /**
>      * Release a sepecific component.
>      */
>     void release(Object component);
> }

To have the equivalent of ComponentSelector.hasComponent(Object hint), 
you also need :

    boolean hasComponent( String role, Parameters params);

This also applies to Stephen's last proposal in the "[VOTE] Re: 
ComponentManager interface" thread. I also like better his replacement 
of Parameter by Map because, being an interface, Map allows the use of 
efficient specialized implementations, e.g. singleton Map for CS hints.

Sylvain

-- 
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com




--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message