Antti Koivunen wrote:
> Stephen McConnell wrote:
> <skip/>
> 
>>
>>   interface ServiceManager
>>   {
>>      Object lookup( final String role );
>>      Object lookup( final String role, Map policy );
>>
>>      boolean hasService( final String role );
>>      boolean hasService( final String role, Map policy );  <-- addition ?
>>
>>      void release( Object key );
>>   }
>>
>> The addition of hasXxxxx( key, policy ) ensures that your not going on 
>> a blind date.
> 
> 
> I agree, it's more consistent and required for something like:
> 
>   map.put("mime-type", "video/mpeg");
>   boolean ok = sm.hasService(Codec.ROLE, map);
> 
> There are many other cases where the policy/hint would just be a simple 
> string. As the use of a Map has some performance implications, I might 
> consider adding also:
> 
>   Object lookup( String role, String hint );
>   boolean hasService( String role, String hint );
> 
> The hint could be something simple, such as a mime-type, protocol or 
> URL, but it would also allow the use of string queries, if necessary.
> 
> What do you think?


The hint if anything should match the ComponentSelector idea, and be an
Object.  Map (as an interface) provides a flexible N-dimensional lookup.
Of course with a Simple object reference, we can have the second dimension
(usually String hint) as well as any N-dimensional lookups (I haven't
run accross any real requirement for this yet....).


-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


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

Reply via email to