You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Thomas Joseph <op...@gmail.com> on 2012/08/02 15:52:43 UTC
iPOJO & Config Admin
Hello All,
I am new to using iPOJO and wanted to solve a particular problem that I
have already done with native OSGi.
I have a class like this
@Component(managedservice="my.config")
@Provides
@Instantiate
public class MyConfigImpl {
private final Logger log = LoggerFactory.getLogger(this.getClass());
@Property(name="property1")
private String property1;
public String getProperty1() {
return property1;
}
@Updated
public void updated(final Dictionary properties) {
// do something with all the properties recieved
}
}
All I want to do is that apart from getting the properties populated from
the OSGi config, I would like to get a callback on the updated method with
"all" the properties provided in the configuration and not just "
property1".
How can I achieve this?
Any help would be appreciated.
--
Thanks and Regards,
/Thomas Joseph
------------------------------------------------------------
Promote Open Source - Promote Liberty of Ideas and Software.
------------------------------------------------------------
Re: iPOJO & Config Admin
Posted by Thomas Joseph <op...@gmail.com>.
Thanks Gokturk!
That was along the same line I was thinking, but somehow when I
added propagation=true to the Component annotation, the whole setup started
working as expected.
Its not documented anywhere though.
/TJ
On Thu, Aug 2, 2012 at 8:17 PM, Göktürk Gezer <go...@gmail.com>wrote:
> Hi,
>
> iPOJO's updated method is called for iPOJO managed properties. Non-matching
> properties are propagated to services published by iPOJO instance as
> service properties.
>
> To catch all properties published by ConfigAdmin, you should rather try to
> register your own ManagedService interface in your component's
> initialization method with the same PID("my.config" in your case) and use
> that ManagedService.updated() method without @Updated annotation. So there
> will be two ManagedService for a PID in this case, one is the iPOJO's own
> registered ManagedService for binding published properties by ConfigAdmin
> to actual iPOJO Property declerations, and the other one will be your
> ManagedService.
>
> Regards,
> Gokturk
>
> On Thu, Aug 2, 2012 at 4:52 PM, Thomas Joseph <op...@gmail.com>
> wrote:
>
> > Hello All,
> >
> > I am new to using iPOJO and wanted to solve a particular problem that I
> > have already done with native OSGi.
> >
> > I have a class like this
> >
> >
> > @Component(managedservice="my.config")
> > @Provides
> > @Instantiate
> > public class MyConfigImpl {
> > private final Logger log = LoggerFactory.getLogger(this.getClass());
> > @Property(name="property1")
> > private String property1;
> > public String getProperty1() {
> > return property1;
> > }
> >
> > @Updated
> > public void updated(final Dictionary properties) {
> > // do something with all the properties recieved
> > }
> > }
> >
> > All I want to do is that apart from getting the properties populated from
> > the OSGi config, I would like to get a callback on the updated method
> with
> > "all" the properties provided in the configuration and not just "
> > property1".
> >
> > How can I achieve this?
> >
> > Any help would be appreciated.
> >
> > --
> > Thanks and Regards,
> > /Thomas Joseph
> >
> >
> > ------------------------------------------------------------
> > Promote Open Source - Promote Liberty of Ideas and Software.
> > ------------------------------------------------------------
> >
>
--
--
Thanks and Regards,
/Thomas Joseph
LinkedIn: http://www.linkedin.com/in/ethomasjoseph
Twitter: http://twitter.com/ethomasjoseph
Blog: http://openthoughtworks.blogspot.com
------------------------------------------------------------
Promote Open Source - Promote Liberty of Ideas and Software.
------------------------------------------------------------
Re: iPOJO & Config Admin
Posted by Göktürk Gezer <go...@gmail.com>.
Hi,
iPOJO's updated method is called for iPOJO managed properties. Non-matching
properties are propagated to services published by iPOJO instance as
service properties.
To catch all properties published by ConfigAdmin, you should rather try to
register your own ManagedService interface in your component's
initialization method with the same PID("my.config" in your case) and use
that ManagedService.updated() method without @Updated annotation. So there
will be two ManagedService for a PID in this case, one is the iPOJO's own
registered ManagedService for binding published properties by ConfigAdmin
to actual iPOJO Property declerations, and the other one will be your
ManagedService.
Regards,
Gokturk
On Thu, Aug 2, 2012 at 4:52 PM, Thomas Joseph <op...@gmail.com> wrote:
> Hello All,
>
> I am new to using iPOJO and wanted to solve a particular problem that I
> have already done with native OSGi.
>
> I have a class like this
>
>
> @Component(managedservice="my.config")
> @Provides
> @Instantiate
> public class MyConfigImpl {
> private final Logger log = LoggerFactory.getLogger(this.getClass());
> @Property(name="property1")
> private String property1;
> public String getProperty1() {
> return property1;
> }
>
> @Updated
> public void updated(final Dictionary properties) {
> // do something with all the properties recieved
> }
> }
>
> All I want to do is that apart from getting the properties populated from
> the OSGi config, I would like to get a callback on the updated method with
> "all" the properties provided in the configuration and not just "
> property1".
>
> How can I achieve this?
>
> Any help would be appreciated.
>
> --
> Thanks and Regards,
> /Thomas Joseph
>
>
> ------------------------------------------------------------
> Promote Open Source - Promote Liberty of Ideas and Software.
> ------------------------------------------------------------
>