[ 
https://issues.apache.org/jira/browse/FELIX-992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12693616#action_12693616
 ] 

Pierre De Rop commented on FELIX-992:
-------------------------------------

Oops, yes Marcel, sorry, I should have inserted at the end of the array.

However, I saw that you have added the callback at the end of the arrays, but 
only with a Map parameter (and not also with the service):
->
  new Class[][] {{ServiceReference.class, trackedServiceName}, 
{ServiceReference.class, Object.class}, {ServiceReference.class}, 
{trackedServiceName}, {Object.class}, {}, 
                       {Map.class}},
  new Object[][] {{reference, service}, {reference, service}, {reference}, 
{service}, {service}, {}, 
                         {new ServicePropertiesMap(reference)}},

-> but I think it should be like the following, in order to be able to invoke 
"MyCallback(Map, TheService)" 

  new Class[][] {{ServiceReference.class, trackedServiceName}, 
{ServiceReference.class, Object.class}, {ServiceReference.class}, 
{trackedServiceName}, {Object.class}, {}, 
                       {Map.class, trackedServiceName}},
  new Object[][] {{reference, service}, {reference, service}, {reference}, 
{service}, {service}, {}, 
                        {new ServicePropertiesMap(reference), service}},

By the way, I also notice that, in my original proposed patch, I typed "behing" 
instead of "behind" (see the two comments on top of
the ServicePropertiesMapEntry/ServicePropertiesMap inner classes).

thanks
/pierre


> Allow DM to inject service properties using a Map
> -------------------------------------------------
>
>                 Key: FELIX-992
>                 URL: https://issues.apache.org/jira/browse/FELIX-992
>             Project: Felix
>          Issue Type: Improvement
>          Components: Dependency Manager
>    Affects Versions: dependencymanager-2.0.0
>         Environment: linux
>            Reporter: Pierre De Rop
>            Assignee: Marcel Offermans
>            Priority: Minor
>         Attachments: ServiceDependency.java
>
>
> We would like to improve DependencyManager in the following way:
> Currently, when injecting dependencies with callbacks, DM searches for method 
> signatures in this order:
>  1. ServiceReference, TheService
>  2. ServiceReference, Object
>  3. ServiceReference
>  4. TheService
>  5. Object
>  6. (void)
> I propose to add the following signature, which provides service properties 
> wrapped behing a basic Map:
>  7. (Map, TheService)
> The purpose of this modification is to be able to inject service properties 
> without coupling my POJOs
> with the OSGi API (that is: ServiceReference class, and 
> ServiceReference.getProperty method).
> I have attached to this issue a proposed patch, which concerns the 
> ServiceDependency.java file.
> Marcel, what do you think ?
> /pierre

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

Reply via email to