felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcel Offermans (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (FELIX-1201) Issue with DM and CM
Date Wed, 07 Oct 2009 18:49:36 GMT

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

Marcel Offermans resolved FELIX-1201.

    Resolution: Fixed

Applied the 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
>            Assignee: Marcel Offermans
>         Attachments: ConfigurationDependency-2.java, 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
> 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
> 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.

View raw message