Ciprian Ciubotariu created KARAF-7437:
-----------------------------------------

             Summary: Karaf Cellar DOSGi service.exported.interfaces should 
support all property types in OSGi specs
                 Key: KARAF-7437
                 URL: https://issues.apache.org/jira/browse/KARAF-7437
             Project: Karaf
          Issue Type: Improvement
          Components: cellar
    Affects Versions: cellar-4.2.1
            Reporter: Ciprian Ciubotariu


I came upon this issue by using the {{ExportedService}} interface from osgi 
spec jars, trying to get a service exported by cellar-dosgi. However, this 
caused cellar to NPE when attempting to use the declared service property. Upon 
investigation, I found the following:

Cellar expects the {{service.exported.interfaces}} service property to be of 
type {{{}String{}}}, but OSGi specs refer to the *String+* type in the text 
specification in section 
[100.2|https://docs.osgi.org/specification/osgi.enterprise/7.0.0/service.remoteservices.html#i1710847].
 This is later expressed as code comments in the OSGi specs code as a type 
constraint to any of {{{}String{}}}, {{String[]}} or {{Collection<String>}} - 
link 
[here|https://github.com/osgi/osgi/blob/23800640013b03b595f5a780b276ba1626351dbd/org.osgi.framework/src/org/osgi/framework/Constants.java#L1543]

However, the {{ExportedService}} property in osgi compendium jar use 
{{Class<?>[]}} for the property type - both 
[DS|https://github.com/osgi/osgi/blob/main/org.osgi.service.component/src/org/osgi/service/component/propertytypes/ExportedService.java#L56]
 and 
[CDI|https://github.com/osgi/osgi/blob/main/org.osgi.service.cdi/src/org/osgi/service/cdi/propertytypes/ExportedService.java#L56].
 Here are respective doc links for 
[DS|https://docs.osgi.org/specification/osgi.enterprise/7.0.0/service.component.html#org.osgi.service.component.propertytypes.ExportedService]
 and 
[CDI|https://docs.osgi.org/specification/osgi.enterprise/7.0.0/service.cdi.html#org.osgi.service.cdi.propertytypes.ExportedService]

I've prepared a commit that aligns Cellar's handling of this service property 
to the String property types enumerated above.

I am uncertain how the discrepancy between Java spec jars and the text should 
be handled: allow Cellar (and others) to parse {{{}Class<?>[]{}}}? Change the 
{{ExportedService}} annotations to match the OSGi text specification?



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to