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)
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
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.