Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [osgi-users] Trying to apply Capabilities and Requirements in another context

Hi Erwin,

You’re correct that there is a substantial overlap between the interfaces, however by doing what you’re suggesting we would be violating the type system and cause ourselves much more pain elsewhere.

A Requirement fails the *is a* test for being a Capability, mostly because it isn’t a capability. As you’ve noticed a requirement has differences, for example it always contains a filter (which a capability does not). It also has different rules about what the mandatory directive means.

By having a separate type it is possible to build structures like a resolver wiring, where requirements are matched by capabilities. A small amount of implementation convenience is very little to sacrifice. I suggest that you try reading up on the resolver specification which will help to provide some concrete use cases for capabilities and requirements.

Best Regards,

Tim

On 8 Apr 2021, at 16:41, <erwindl0@xxxxxxxxx> <erwindl0@xxxxxxxxx> wrote:

I would like to apply the Resource/Capability/Requirement model (and the Resolver implementation) outside of an OSGi bundle/resource resolution context.
I.e. to describe capabilities and requirements in an application domain model and use the Resolver to validate/obtain a consistent set of application things.
 
When looking at the interface definitions of Capability and Requirement, I was wondering why they both exist separately, as their structure is identical.
I.e. an alternative would be to have one type "Capability" and on Resource have :
 
       List<Capability> getCapabilities(String namespace);
       List<Capability> getRequirements(String namespace);
 
I didn't find too much info on actual implementations of both interfaces. 
Filters seem to be specific for Requirements but are also stored in the attributes map which exists on Capability as well.
 
Can anyone give some more info on why they both exist and if there are some guidelines on how to implement/apply them?
 
thanks
erwin
 
 
_______________________________________________
osgi-users mailing list
osgi-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/osgi-users


Back to the top