You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Carsten Ziegeler <cz...@apache.org> on 2019/06/07 15:17:11 UTC

[RT][feature model] Adding matching method to feature requirement

Hi,

a feature can have requirements and capabilities, we use the OSGi 
interfaces for this. However, there is currently no easy way to match 
requirements and capabilities as these interfaces do not provide a 
method for it.

For example, if you want to know whether a requirement is met by the 
available capabilities, that's not possible. While the OSGi specs 
provide a resolver that approach is way too heavy and not really suited 
for simple use cases. The resolver is used by the framework for bundle 
wiring.

Therefore I propose we add a simple interface like
MatchingRequirement extends Requirement {
    boolean match(Capability cap);
}

and this allows to match requirements and capabilities. As we're using 
Apache Felix utils for our reqs/caps, this method is already available 
there, so we don't have to implement this ourselves. Its just making it 
available

WDYT?

Regards
Carsten

--
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: [RT][feature model] Adding matching method to feature requirement

Posted by David Bosschaert <da...@gmail.com>.
Hi Carsten,

Yes I think this makes sense. Interestingly enough in OSGi there is a
matches() on the BundleRequirement (extends Requirement) which matches a
BundleCapability (extends Capability) which is close but not quite general
enough:
https://osgi.org/javadoc/osgi.core/7.0.0/org/osgi/framework/wiring/BundleRequirement.html#matches-org.osgi.framework.wiring.BundleCapability-

Best regards,

David

On Fri, 7 Jun 2019 at 16:17, Carsten Ziegeler <cz...@apache.org> wrote:

> Hi,
>
> a feature can have requirements and capabilities, we use the OSGi
> interfaces for this. However, there is currently no easy way to match
> requirements and capabilities as these interfaces do not provide a
> method for it.
>
> For example, if you want to know whether a requirement is met by the
> available capabilities, that's not possible. While the OSGi specs
> provide a resolver that approach is way too heavy and not really suited
> for simple use cases. The resolver is used by the framework for bundle
> wiring.
>
> Therefore I propose we add a simple interface like
> MatchingRequirement extends Requirement {
>     boolean match(Capability cap);
> }
>
> and this allows to match requirements and capabilities. As we're using
> Apache Felix utils for our reqs/caps, this method is already available
> there, so we don't have to implement this ourselves. Its just making it
> available
>
> WDYT?
>
> Regards
> Carsten
>
> --
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org
>