You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Pierre De Rop (JIRA)" <ji...@apache.org> on 2009/06/06 10:56:07 UTC

[jira] Updated: (FELIX-1201) Issue with DM and CM

     [ https://issues.apache.org/jira/browse/FELIX-1201?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pierre De Rop updated FELIX-1201:
---------------------------------

    Attachment: ConfigurationDependency.java

attached the proposed patch.

> Issue with DM and CM
> --------------------
>
>                 Key: FELIX-1201
>                 URL: https://issues.apache.org/jira/browse/FELIX-1201
>             Project: Felix
>          Issue Type: Bug
>          Components: Dependency Manager
>    Affects Versions: dependencymanager-2.0.1
>         Environment: linux FC10, jdk 1.5, 1.6
>            Reporter: Pierre De Rop
>         Attachments: ConfigurationDependency.java
>
>
> I am using DM for configuring my POJOs from Configuration Admin Service.
> This issue is actually about a bug, but also ask for a change request:.
> 1/ first, I think there are two bugs in ConfigurationDependency.java:
> - When the configuration is not currently available from CM, POJOs are invoked in their "updated" method with a null Dictionary
> - Morover, DM requires POJO to implement the ManagedService interface, while in the online doc, it is stated that POJOs just have 
>   to provide an "updated(Dictionary)" method signature.
> Concerning the null dictionary passed to my updated method: for example:
> dm.add(createService()
>            .setImplementation(new Log4jConfigurator(property))
>            .add(createConfigurationDependency()
>                 .setPid("log4j")));
> -> My Pojo "Log4jConfigurator" is invoked in its "updated" method with a null Dictionary if the configuration is not yet available from CM.
> I have attached to this issue a proposed patch (in ConfigurationDependency.java).
> I just check if CM provides a null Dictionary and I just don't activate the dependencies ...
> 2/ Now, there is something I would like you to add concerning configuration callbacks (I also have implemeted it in the proposed patch):
> Indeed, by default, DM assumes that the pojo implements the org.osgi.service.cm.ManagedService interface.
> But the point is: I need my POJOs to be reused outside OSGi; and I don't want to introduce a dependency over the OSGi CM managed service interface.
> Moreover, I need to get injected with several PIDS.
> That's why I would like to be able to invoke a method "setCallback" in the ConfigurationDependency class (like in ServiceDependency.java).
> This callback would match a method which takes as parameter a Dictionary.
> So, adding such setCallback method would also let me listen to more than one PID like this:
> For example:
>     dm.add(createService()
>            .setImplementation(new Log4jConfigurator(property))
>            .add(createConfigurationDependency()
>                 .setPid("log4j")
>                 .setCallback("updateLog4jConfig"))
>            .add(createConfigurationDependency()
>                 .setPid("system")
>                 .setCallback("updateSystemConfig")));
> The patch attached to this issue sounds like to work fine.
> Marcel, WDYT ? 
> Could you please commit this patch (and then make a new release of DM) ?
> Thanks a lot for your help;
> /pierre

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.