users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: No way to disable a Feature

From: Bill Burke <bburke_at_redhat.com>
Date: Tue, 13 Dec 2011 09:55:53 -0500

On 12/13/11 9:44 AM, Marek Potociar wrote:
>
>
> On Tue 13 Dec 2011 03:20:15 PM CET, Bill Burke wrote:
>>
>>
>> On 12/13/11 6:11 AM, Marek Potociar wrote:
>>>
>>>
>>> On 12/12/2011 03:48 PM, Bill Burke wrote:
>>>> While the Feature interface has a onDisable() method, there's no way for the onDisable() method to be able to
>>>> unregister
>>>> providers. The Configuration.getProviderXXXX() methods return immutable sets.
>>>
>>> Please clarify - are you suggesting to remove onDisable() and deffer the disabling mechanism to the Feature
>>> implementation or to add a common API for feature disabling?
>>>
>>
>> I'll clarify. The Configuration interface has no way to unregister a provider at the moment.
>
> That's what I am trying to get at - do you want to be able to do this
> via a common API set of methods or do you think that deferring the
> means of disabling features or providers (e.g. via a custom property,
> static method) work for you?
>

Not sure what you mean. You mean remove the disable() methods of the
API? Personally I always thought it was weird that you could disable a
feature once the Client was configured. Also, the Configuration
interface, as it stands now, is a bit hard to implement for a user.
Specifically all the Feature and enable/disable logic. We'll either
have to change Configuration to a class, or greatly simplify it.

I know I suggested Feature, but maybe its not the best idea to have.
Maybe removing disable() is a good idea as well (we don't have these
capabilities now in JAX-RS on the server side). Maybe a better approach
is to greatly simplify Configuration.

interface Configuration {
      Set<Class<?>> getProviderClasses();
      Set<Object> getProviderInstances();
      Map<String, Object> getProperties();
}

and move register() to the Client interface and not expose Configuration
there:

interface Client {

    setProperty(...);
    register(...);
}

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com