Ok, I'll check with disabled proxy on C2. -----Message d'origine----- De : Clement Escoffier [mailto:clement.escoff...@gmail.com] Envoyé : lundi 13 décembre 2010 15:57 À : users@felix.apache.org Objet : Re: iPojo inner class instrumentation
Hi, Just a quick check, Could you try to disable 'proxy' on c2 @Requires(proxy=false) C2 c2; Regards, Clement On 13.12.10 15:43, "Bigard Olivier" <obig...@axway.com> wrote: >Hi Clement, > >We are using iPojo Core 1.6.4 (with Annotations). >We are also using the Maven plugin version 1.4.2. Maybe this version is >too old and there is a compatibility problem. I'll check with an earlier >version... > >Regards, >Olivier > >-----Message d'origine----- >De : Clement Escoffier [mailto:clement.escoff...@gmail.com] >Envoyé : lundi 13 décembre 2010 14:52 >À : users@felix.apache.org >Objet : Re: iPojo inner class instrumentation > >Hello, > >On 13.12.10 11:41, "Bigard Olivier" <obig...@axway.com> wrote: > >>Hello, >> >> >> >>We have an interrogation regarding iPojo instrumentation. We read >>somewhere in the forum that iPopo can instrument inner classes, but we >>are facing a problem when using them in our project. >> >>Here is our use case: >> >> >> >>A first component C1 provides a service with a method "callMe()". >>Another component C2 requires this service. >> >> >> >>Class C2 >> >>{ >> >> @Requires >> >> Private C1 c1; >> >> >> >> public boolean authenticate() >> >> { >> >> c1.callMe(); >> >> return true; >> >> } >> >>} >> >> >> >>A third component C3 requires the component C2. This component C2 is >>used inside an inner class MyFilter. >> >> >> >>Class C3 >> >>{ >> >> @Requires >> >> private C2 c2; >> >> >> >> @Override >> >> public MyFilter getFilter() >> >> { >> >> return new MyFilter() >> >> { >> >> >> >> @Override >> >> public boolean authenticate() >> >> { >> >> return c2.authenticate(); >> >> } >> >> }; >> >> } >> >>} >> >> >> >>At last, a component C4 listens for arrival and removal of C3 component >>instances with @Bind/@Unbind methods. >> >> >> >>Class C4 >> >>{ >> >> @Requires(id = "apis", optional = true) >> >> C3[] apis; >> >> >> >> @Bind(id = "apis") >> >> public void addApi(ServiceReference ref) >> >> { >> >> C3 api = (C3) bundleCtxt.getService(ref); >> >> filter = api.getFilter(); >> >> filter.authenticate(); >> >> } >> >>} >> >> >> >>Everything works perfectly the first time all the components are >>started. But when we stop and restart the C1 and C2 instances, a >>NullPointerException occurs when calling the method authenticate() of >>the C2 component, because c1 is null. All the iPojo are present and >>valid after the restart, but it seems c1 reference is not updated in c2. >> >> >> >>We manage to make it work by modifiying a little bit the getFilter() >>implementation in the C3 component: >> >> >> >>Class C3 >> >>{ >> >> public MyFilter getFilter() >> >> { >> >> return new MyFilterImpl(c2); >> >> } >> >>} >> >> >> >>where MyFilterImpl is an implementation of the MyFilter interface. >> >> >> >>Does it trouble iPojo instrumentation when we instantiate inner classes >>like we do or are we misusing iPojo in another way ? > > >Normally this should work, but I will test it because it looks pretty >strange. >Which version of iPOJO and of the manipulator are you using? > >Regards, > >Clement > >> >> >> >>Thanks >> >>Olivier >> > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: users-unsubscr...@felix.apache.org >For additional commands, e-mail: users-h...@felix.apache.org > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: users-unsubscr...@felix.apache.org >For additional commands, e-mail: users-h...@felix.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org