Stefan Kolb wrote:
Hi,

I would totally agree with Simon there, but surprisingly enough I found this in 
the JavaAnnotations Spec:

S.30 1.8.16 @Scope

The following snippet shows a sample for a scoped service interface definition.

@Scope(“CONVERSATION”)
public interface ShoppingCartService {
void addToCart(Item item);
}

Though I think Simon is still right in practical approaches. At least I would 
stick to the same rules he outlined in his answer.

Thanks for pointing this out.  In the SCA 1.1 specs from OASIS, the
description of @Scope says:

 The @Scope annotation MUST only be used on a service's implementation class.
 It is an error to use this annotation on an interface. [JCA90041]

I wasn't aware that the older OSOA specs allowed @Scope to appear on
interfaces as well.  I think the reason this was changed by OASIS is
that it is very hard to define a sensible meaning or purpose for using
an implementation concept such as scope in an interface definition.

  Simon

Regards

Stefan

-----Ursprüngliche Nachricht-----
Von: Simon Nash <[email protected]>
Gesendet: 21.03.2010 19:27:31
An: [email protected]
Betreff: Re: Conversational or Conversation Scope

Antonio Mirarchi wrote:
Hi i have some questions about SCA assembly specification and Java annotation. 1) What is the difference betwenn use a Java interface marked with @Conversational annotation and use the same Java interface marked with @Scope("Conversation") ?
You can't mark a Java interface with @Scope("Conversation").  The @Scope
annotation is only used for implementation classes.

2) If i have a java interface marked with @Conversational annotation the implementation class must be annotated with @Scope("conversation")?

Not "must be" but "should be".  There are some obscure cases where the
implementation class can be given a different scope such as Composite.
Although this is legal, I don't think it's very useful.

3) What is the difference between annotation @Conversational and annotation @Scope("Conversation")?

@Conversational is only used on interfaces and @Scope is only used on
implementation classes.

  Simon

thanks for your answers.
___________________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de



Reply via email to