dev@jax-ws.java.net

Re: scratch _at_Stateful, welcome 'feature'

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 11 Oct 2006 14:10:00 -0700

Ryan Shoemaker - JavaSoft East wrote:
> Kohsuke Kawaguchi wrote:
>>
>> Based on feedback, I removed @Stateful annotation from the service and
>> replaced that with a feature:
>>
>> OLD:
>>
>> > @WebService
>> > @Stateful
>> > public class Account {
>>
>> NEW:
>>
>>> @WebService
>>> @BindingType(features={_at_Feature(ServerFeatures.STATEFUL),_at_Feature(AddressingFeature.ID)})
>>>
>>> public class Account {
>>
>
> Thanks Kohsuke. Suddenly @Stateful doesn't look so bad ;8-)

I know. This @Feature thing is really, err, ugly. But other people
commented that this is suppoed to be "the" way to get extensions
enabled, so I followed it.

Personally, I think a meta annotation would have been nicer. So we'd say:

        @interface WebServiceFeatureAnnotation {}

and then

        @WebServiceFeatureAnnotation
        @interface StatefulWebService {
          // mandatory property
          boolean enabled() default true;
        }

and

        @WebServiceFeatureAnnotation
        @interface Addressing {
          // mandatory property
          boolean enabled() default true;
          ... other parameter ...
        }

then you'd say:

        @StatefulWebService
        @Addressing
        @WebService
        class FooBarService { ... }



> Please do consider adding @Webservice.stateful in a future version
> of the spec if this feature is ever considered for standardization.
> Adding a property on the Webservice annotation seems like the most
> natural place for it.

Yeah. I'm writing a proposal to do something along this line in EE6.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com