Re: question about @Reference and @Component
Hi JB! Yes, It's the same question you answered me as private.I didn't know there's a users list, then I'm suscribing. Thanks! El miércoles, 7 de junio de 2023, 06:13:54 ART, Jean-Baptiste Onofré escribió: Hi Nick, Please use the users mailing list for this kind of question (dev mailing list is more for discussions between Karaf developers). FYI,, I think I already replied to you as private message :) Regards JB On Tue, Jun 6, 2023 at 3:31 PM z8...@yahoo.com.ar.INVALID wrote: > > I'm trying to understand how those annotations work.I have the following > Activator.class and MyConf.class in the same bundle. > The Activator code: > @Component@Slf4jpublic class Activator implements BundleActivator, > ManagedService { > private static Logger logger = > LoggerFactory.getLogger(Activator.class);private static final String > CONFIG_PID = "mytest";private ServiceRegistration serviceReg; > @Referenceprivate MyConf conf; public void start(BundleContext context) { > Hashtable properties = new Hashtable Object>();properties.put(Constants.SERVICE_PID, CONFIG_PID);serviceReg = > context.registerService(ManagedService.class.getName(), this , properties); } > public void stop(BundleContext context) {serviceReg.unregister(); } > @SuppressWarnings("rawtypes") @Override public void > updated(Dictionary config) throws ConfigurationException {if (config == null) > {return;}conf.setFoo((String) config.get("foo"));conf.refresh(); } > > and MyConf: > @Componentpublic class MyConf {private String foo = "bar";public MyConf() > {}public String getFoo() {return foo;} > public void setFoo(String foo) {this.foo = foo;}public void refresh() > {System.out.println("foo=" + this.foo);} > } > It seems pretty basic, but when I deploy it in Karaf says: > Status: WaitingDeclarative > Servicesar.com.aerolineas.esb.operaciones.pruebas.Activator (21) missing > references: conf > and in the log, there's a NullPointerException at conf.setFoo in the > Activator, as if the framework never instantiate + inject MyConf. Am I > missing something? > Thanks in advaced.Nick. >
Re: Board Report for June 2023
The report has been submitted to the board. Thanks all ! Regards JB On Wed, Jun 7, 2023 at 5:54 PM Grzegorz Grzybek wrote: > > +1 > > regards > Grzegorz Grzybek > > śr., 7 cze 2023 o 17:13 Francois Papon > napisał(a): > > > Look good to me! > > > > Thanks JB! > > > > regards, > > > > On 06/06/2023 10:53, Jean-Baptiste Onofré wrote: > > > Hi guys, > > > > > > I prepared the board report for this month: > > > > > > https://cwiki.apache.org/confluence/display/KARAF/Board+Reports > > > > > > Please take a look and update if needed. I would like to send the report > > asap. > > > > > > Thanks ! > > > Regards > > > JB > >
Re: Board Report for June 2023
+1 regards Grzegorz Grzybek śr., 7 cze 2023 o 17:13 Francois Papon napisał(a): > Look good to me! > > Thanks JB! > > regards, > > On 06/06/2023 10:53, Jean-Baptiste Onofré wrote: > > Hi guys, > > > > I prepared the board report for this month: > > > > https://cwiki.apache.org/confluence/display/KARAF/Board+Reports > > > > Please take a look and update if needed. I would like to send the report > asap. > > > > Thanks ! > > Regards > > JB >
Re: Board Report for June 2023
Look good to me! Thanks JB! regards, On 06/06/2023 10:53, Jean-Baptiste Onofré wrote: Hi guys, I prepared the board report for this month: https://cwiki.apache.org/confluence/display/KARAF/Board+Reports Please take a look and update if needed. I would like to send the report asap. Thanks ! Regards JB
Re: Board Report for June 2023
If no objection, I will send the report tonight my time. Regards JB On Tue, Jun 6, 2023 at 10:53 AM Jean-Baptiste Onofré wrote: > > Hi guys, > > I prepared the board report for this month: > > https://cwiki.apache.org/confluence/display/KARAF/Board+Reports > > Please take a look and update if needed. I would like to send the report asap. > > Thanks ! > Regards > JB
Re: question about @Reference and @Component
Hi Nick, Please use the users mailing list for this kind of question (dev mailing list is more for discussions between Karaf developers). FYI,, I think I already replied to you as private message :) Regards JB On Tue, Jun 6, 2023 at 3:31 PM z8...@yahoo.com.ar.INVALID wrote: > > I'm trying to understand how those annotations work.I have the following > Activator.class and MyConf.class in the same bundle. > The Activator code: > @Component@Slf4jpublic class Activator implements BundleActivator, > ManagedService { > private static Logger logger = > LoggerFactory.getLogger(Activator.class);private static final String > CONFIG_PID = "mytest";private ServiceRegistration serviceReg; > @Referenceprivate MyConf conf;public void start(BundleContext context) { > Hashtable properties = new Hashtable Object>();properties.put(Constants.SERVICE_PID, CONFIG_PID);serviceReg = > context.registerService(ManagedService.class.getName(), this , properties); } >public void stop(BundleContext context) {serviceReg.unregister();} > @SuppressWarnings("rawtypes")@Overridepublic void > updated(Dictionary config) throws ConfigurationException {if (config == null) > {return;}conf.setFoo((String) config.get("foo"));conf.refresh();} > > and MyConf: > @Componentpublic class MyConf {private String foo = "bar";public MyConf() > {}public String getFoo() {return foo;} > public void setFoo(String foo) {this.foo = foo;}public void refresh() > {System.out.println("foo=" + this.foo);} > } > It seems pretty basic, but when I deploy it in Karaf says: > Status: WaitingDeclarative > Servicesar.com.aerolineas.esb.operaciones.pruebas.Activator (21) missing > references: conf > and in the log, there's a NullPointerException at conf.setFoo in the > Activator, as if the framework never instantiate + inject MyConf. Am I > missing something? > Thanks in advaced.Nick. >