| Summary: | [ds] Reference service's target cannot be specified by a property | ||
|---|---|---|---|
| Product: | [Eclipse Project] Equinox | Reporter: | Simon Archer <sja.eclipse> |
| Component: | Compendium | Assignee: | Stoyan Boshev <s.boshev> |
| Status: | RESOLVED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | caniszczyk, hargrave, s.boshev, tjwatson |
| Version: | 3.4 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Good description Simon. In short, the target attribute of the reference element is a shorthand for a property element specifying the target property. The target property for a reference can come from the reference's target attribute, a property element, a properties file referenced by a properties element or a Configuration. Simon, which was the version of DS you were using? Was it M2? I think this is already fixed in M3. This bug seems to be duplicate of bug #246757 I was using Eclipse 3.5M2, so yes this could be a duplicate of 246757. Let's assume that it is a duplicate and I'll re-test using 3.5M3. Thanks Stoyan. *** This bug has been marked as a duplicate of bug 246757 *** |
The Equinox implementation of DS does not allow a Target Property to be set using a <property> or <properties> element. Consider the following component XML declaration: <?xml version="1.0" encoding="UTF-8"?> <component name="my.component"> <implementation class="my.Component"/> <reference name="log" interface="org.osgi.service.log.LogService" target="(size>=100)"/> </component> The following alternative, where the <reference> element's target attribute is omitted, is currently NOT handled: <?xml version="1.0" encoding="UTF-8"?> <component name="my.component"> <implementation class="my.Component"/> <reference name="log" interface="org.osgi.service.log.LogService"/> <property name="log.target" value="(size>=100)"/> </component> This approach is not as crazy as you might think, especially when you consider that a <properties> element could be used instead of a <property> element to allow the "log" referenced service's target to be stored in a properties file rather than in the component's XML description. The following should also work, since it simply follows the rule that later property declarations override earlier property declarations. <?xml version="1.0" encoding="UTF-8"?> <component name="my.component"> <implementation class="my.Component"/> <reference name="log" interface="org.osgi.service.log.LogService" target="(size>=100)"/> <property name="log.target" value="(size>=500)"/> </component> Today, this case results in the <property> being quietly ignored by the SCR. Again, the <property> element could have been replaced by a <properties> element.