Java Reference
In-Depth Information
<require extend='false' filter='(&amp;(package=org.foo.shape)
(version&gt;=4.0.0)(version&lt;5.0.0))' multiple='false' name='package'
optional='false'>
Import package org.foo.shape ;version=[4.0.0,5.0.0)
</require>
</resource>
The capability elements B and C represent what the bundle provides. In this case, B
represents the bundle itself, because the bundle can be required (for example,
Require-Bundle ), whereas C represents the package exported by the bundle. Bundle
dependencies are represented as requirement elements, such as the one for an
imported package D . Both capabilities and requirements have a name, which is actu-
ally a namespace; it's how capabilities are matched to requirements. For example,
capabilities representing exported packages and requirements representing imported
packages both have the package namespace.
In general, a capability is a set of properties specified using a <p> element with the
following attributes:
n —The name of the property
v —The value of the property
t —The type of the property, which is one of the following:
string —A string value, which is the default
version —An OSG i version
uri —A URI
long —A long value
double —A double value
set —A comma-separated list of values
Looking more closely at the bundle capability B , you see it's a fairly straightforward
mapping from the bundle identification metadata:
D
Requirement
element
Bundle-ManifestVersion: 2
Bundle-Name: Simple Paint API
Bundle-SymbolicName: org.foo.shape
Bundle-Version: 4.0
Likewise, the package capability C is also a simple mapping from the bundle's
Export-Package header:
Export-Package: org.foo.shape;version="4.0"
A requirement is an LDAP query over the properties of a capability. So, to match a
requirement to a capability, first the namespace must match. If that matches, the
requirements LDAP query must match the properties supplied by the capabilities.
Even with the LDAP query, the package requirement D is a fairly easy mapping from
the Import-Package header:
Import-Package: org.foo.shape;version="[4.0,5.0)"
Search WWH ::




Custom Search