Hi,

On 25.11.10 10:41, "Bigard Olivier" <[email protected]> wrote:

>Hi,
>
> 
>
>I'm trying to find a way to implement following need with Felix and
>iPojo.
>
> 
>
>Imagine you have an iPojo instance of Bundle A calling an OSGi Service
>provided by an iPojo instance of Bundle B.
>
>Imagine this Bundle B iPojo instance is calling an OSGi Service provided
>by an iPojo instance of Bundle C.
>
> 
>
>class A {
>
>@Requires
>
>B b;
>
> 
>
>public doSomething() {
>
>                                ...
>
>                                b.doSomethingInB();
>
>}
>
>}
>
> 
>
>class B {
>
>@Requires
>
>C c;
>
> 
>
>public doSomethingInB() {
>
>                                ...
>
>                                c.doSomethingInC();
>
>}
>
>}
>
> 
>
>class C {
>
>public doSomethingInC() {
>
>                                ...
>
>}
>
>}
>
> 
>
>What I want is to be able to send some "contextual" information from
>method "doSomething()" in class A to method "doSomethingInC()" in class
>C without being intrusive in the method signature.
>
>For example, this contextual information could be created by class A
>with the username.
>
>This context could be enriched by class B by adding the user email for
>example.
>
>And finally the class C could get the username and user email from the
>contextual information without adding this data as parameter of its
>method.
>
> 
>
>Do you have an idea how I can do that with iPojo?

You can probably define a service giving the context to the components.
The service implementation can use ThreadLocal to get a thread-centric
context.

Regards,

Clement


>
> 
>
>Thanks
>
>Olivier
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to