felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clement Escoffier <clement.escoff...@gmail.com>
Subject Re: iPojo: Default configuration and @Update
Date Mon, 09 Dec 2013 17:54:38 GMT
Hi,

On 9 déc. 2013, at 16:20, Bengt Rodehav <bengt@rodehav.com> wrote:

> I have a iPojo component singleton defined as follows:
> 
> @Component(managedservice = "connect.fm.notifier", name =
> "connect.fm.notifier", publicFactory = false)
> @Provides(specifications = INotificationProvider.class)
> @Instantiate
> public class NotifierService implements INotifier, INotificationProvider {
> ...
>  @Property(name = "defaultLogTypeId", mandatory = true)
>  private String mDefaultLogTypeId;
> 
>  @Updated
>  public void updated(Dictionary conf) {
>    System.out.println("Updated");
>    Enumeration en = conf.keys();
>    while (en.hasMoreElements()) {
>      Object key = en.nextElement();
>      System.out.println("  " + key.toString() + " -> " + conf.get(key));
>    }
>  }
> 
> ....
> 
> I have two questions regarding this:
> 
> a) When I have a mandatory property ("defaultLogTypeId" above) with no
> default value, it seems like no component instance will be created. I feed
> ConfigAdmin with a proper configuration using FileInstall but it seems that
> it is "too late". If the default configuration was not valid then no
> instance will be created regardless if I provide a correct installation
> later on. Is this as designed or have I misunderstood this? I was expecting
> the instance creation to be delayed until a correct configuration was
> provided. Note that if I have a correct default configuration then the
> instance will be created and it will be automatically reconfigured via
> FileInstall.

You should remove the @Instantiate and create a ManagedServiceFactory configuration using
the configuration admin.

> 
> b) The Dictionary passed into the updated() method always seem to reflect
> the default configuration - not the current configuration. This looks like
> a bug to me.
> 

Looks like it. Could you open an issue ?

Regards,

Clement

> /Bengt


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message