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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>