You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Alin Dreghiciu (JIRA)" <ji...@apache.org> on 2009/07/20 04:31:14 UTC

[jira] Updated: (FELIX-927) Allow bind and unbind methods to receive the service properties

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

Alin Dreghiciu updated FELIX-927:
---------------------------------

    Attachment: FELIX-927.patch

I attached a patch that implements the bind/unbind method resolution (beside case 5 marked with TODO), which I may do next.
The patch extracts the functionality out of DependencyManager into a Bind/UnbindMethod.
It also implements the actual call to found methods (in current code base only the call with a service reference is handled)
+ unit tests (more to come)

I started from existing code but I'm pretty much sure that yet it does not fulfill all the rules about method accessibility, so this should be a next step. At least add some more tests to verify.

Unfortunately I could not do an integration test as in current state components does not get activated. I manually tested by starting up Pax Shell that uses DS with released 1.0.8 and 1.0.9-SNAPSHOT before my changes and after changes.

Having the patch committed will be a step forward and further patches could be based on it.

> Allow bind and unbind methods to receive the service properties
> ---------------------------------------------------------------
>
>                 Key: FELIX-927
>                 URL: https://issues.apache.org/jira/browse/FELIX-927
>             Project: Felix
>          Issue Type: New Feature
>          Components: Declarative Services (SCR), Specification compliance
>    Affects Versions: scr-1.0.6
>         Environment: OSGi RFC-0134, OSGi R4.2 Early Draft 2 (http://www.osgi.org/download/osgi-4.2-early-draft2.pdf) 
>            Reporter: Felix Meschberger
>             Fix For: scr-1.2.0
>
>         Attachments: FELIX-927.patch
>
>
> A bind or unbind method must have one of the following prototypes:
>     protected void <method-name>(ServiceReference);
>     protected void <method-name>(<parameter-type>);
>     protected void <method-name>(<parameter-type>, Map);
> If the bind or unbind method has the third prototype, then the service object of the bound service is passed to the method as the first argument and a Map containing the service properties of the bound service is passed as the second argument. The method's first parameter type must be assignable from the type specified by the reference's interface attribute. That is, the service object of the bound service must be castable to the method's first parameter type.
> When searching for the bind or unbind method to call, SCR must look through the component implementation class hierarchy. The declared methods of each class are searched for a method with the specified name that takes one or two parameters. The method is searched for using the following priority:
> 1.The method takes a single parameter and the type of the parameter is org.osgi.framework.ServiceReference.
> 2.The method takes a single parameter and the type of the parameter is the type specified by the reference's interface attribute.
> 3.The method takes a single parameter and the type of the parameter is assignable from the type specified by the reference's interface attribute. If multiple methods match this rule, this implies the method name is overloaded and SCR may choose any of the methods to call.
> 4.The method takes two parameters and the type of the first parameter is the type specified by the reference's interface attribute and the type of the second parameter is java.util.Map
> 5.The method takes two parameters and the type of the first parameter is assignable from the type specified by the reference's interface attribute and the type of the second parameter is java.util.Map. If multiple methods match this rule, this implies the method name is overloaded and SCR may choose any of the methods to call.

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