Created the following JIRA: https://issues.apache.org/jira/browse/FELIX-4351
/Bengt 2013/12/9 Bengt Rodehav <[email protected]> > OK. I do use managed service factories quite a lot but primarily when > multiple instances must be supported. In this case it's a singleton but > some properties do not have sensible default values. It seems then that, > unless I use the factory pattern, all properties must either be optional or > have default values. It seems kind of limiting. > > Will create a JIRA for the other issue. > > /Bengt > Den 9 dec 2013 18:55 skrev "Clement Escoffier" < > [email protected]>: > > Hi, >> >> On 9 déc. 2013, at 16:20, Bengt Rodehav <[email protected]> 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: [email protected] >> For additional commands, e-mail: [email protected] >> >>

