You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by fahim salim <sa...@gmail.com> on 2008/12/05 16:25:03 UTC

Re: questions about @Context

Hello All

Are there any informations about this topic ?

Thanks
Fahim

2008/11/28 fahim salim <sa...@gmail.com>

> 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
>
>

Re: questions about @Context

Posted by SALIM Fahim <sa...@gmail.com>.
Simon Laws a écrit :
>
>
> On Fri, Dec 5, 2008 at 3:25 PM, fahim salim <salim.fa@gmail.com 
> <ma...@gmail.com>> wrote:
>
>     Hello All
>
>     Are there any informations about this topic ?
>
>     Thanks
>     Fahim
>
>     2008/11/28 fahim salim <salim.fa@gmail.com
>     <ma...@gmail.com>>
>
>         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
Hi Simon

I will try to use this annotation and the corresponding APIs in some 
application to get services and references.

Thanks a lot for you answers.

Fahim


Re: questions about @Context

Posted by Simon Laws <si...@googlemail.com>.
On Fri, Dec 5, 2008 at 3:25 PM, fahim salim <sa...@gmail.com> wrote:

> Hello All
>
> Are there any informations about this topic ?
>
> Thanks
> Fahim
>
> 2008/11/28 fahim salim <sa...@gmail.com>
>
> 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