Converting existing code to DS in an EMF environment where we have models starting with core and being extended at different levels by different applications, and those providing various type of "features". Trying to determine the best approach that allows for specialization, inheritance of injected service, including specialization, etc.
I now have a small test bed that works as expected, but looking to apply best practices. Let's say I start with this service: @Component(service=ICoreUtils.class) public class CoreUtils implements ICoreUtils { protected ISay another; @Reference( policy=ReferencePolicy.STATIC, policyOption=ReferencePolicyOption.GREEDY ) protected void setAnother(ISay another) { this.another = another; } And now I can have an extension like so: @Component( property="service.ranking:Integer=10", service= { IExtUtils.class, ICoreUtils.class } ) public class ExtUtils extends CoreUtils implements IExtUtils { @Reference( policy=ReferencePolicy.STATIC, policyOption=ReferencePolicyOption.GREEDY ) protected void setAnother(ISayMore another) { this.another = another; } Since @Reference are not inherited, so far I have found that using a field reference at each level with a protected field holding the value seems to be the way to go. Also the extended service registers all interfaces it implements. The referenced service as shown here can also be provided in the same way, either providing an extended interface or just a different implementation that is more specific. Thanks Alain
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev