felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bengt Rodehav <be...@rodehav.com>
Subject iPojo: Default configuration and @Update
Date Mon, 09 Dec 2013 15:20:47 GMT
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.

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.

/Bengt

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message