On Fri, Dec 5, 2008 at 3:25 PM, fahim salim <[EMAIL PROTECTED]> wrote:

> Hello All
>
> Are there any informations about this topic ?
>
> Thanks
> Fahim
>
> 2008/11/28 fahim salim <[EMAIL PROTECTED]>
>
> Hello All
>>
>> I have some questions concerning @Context annotation
>>
>> 1/ What kind of informations are stored in such an object ?
>>
>> 2/ when is it instanciated ?
>>
>> 3/ Is there an exemple showing how to use @Context in an SCA client ?
>>
>> Thanks
>> Fahim
>>
>>
>
Hi Fahim

Sorry about that, must have missed this main in my reader. The @Context
annotation is used to inject either a component context or a reference
context into a component instance. Which one depends on the type of the
filed that is annotated, e.g.

@Context
protected ComponentContext myContext;

@Context
protected RequestContext myContext;

You can see the interfaces for these objects in the SCA API here (
http://svn.apache.org/repos/asf/tuscany/java/sca/modules/sca-api/src/main/java/org/osoa/sca/
)

The component context gives you access to the information about the
component itself such as the properties and references that the component
defined. You can, for example, retrieve a reference proxy from the component
context and then use it to call the referenced service.

The request context gives you access to the information about the current
request, for example, information about any active callback endpoints.

Our itests use the @Context annotation in various places. For example,
http://svn.apache.org/repos/asf/tuscany/java/sca/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java

Hope this helps

Simon

Reply via email to