Java Reference
In-Depth Information
Resource repository
Suet pudding resource
Lemon pudding resource
Suet bundle resource
osgi.identity
type=steamed.pudding
symbolicName=lemon
version=1.0
osgi.identity
type=steamed.pudding
symbolicName=suet
version=1.0
osgi.identity
type=osgi.bundle
symbolicName=suet
version=1.0
Figure 7.2
Resource repositories may contain resources of any type including, but not restricted to,
bundles. Two resources may share a symbolic name and version as long as they're different types.
7.1.2
Requirements and capabilities
As with a
Resource
, both a
Requirement
and a
Capability
are generic objects that
can be used to express
any
dependency or exposed feature. As such, they're more
than capable of expressing the potential range of bundle dependencies and features.
Requirements and capabilities define a namespace, which is like the
type
of the
osgi.identity
capability, indicating what sorts of things they require and provide.
Requirements and capabilities are related in that a capability can
satisfy
a requirement
if it meets three rules (see figure 7.3):
The requirement and capability share a namespace.
1
The requirement's filter matches the attributes of the capability.
2
Any relevant
directives
are satisfied. We'll cover these in more detail in section 7.1.3.
3
Requirements and capabilities share a similar structure. They both expose the following:
A link back to the resource
that
owns
this requirement or
capability.
■
Resource
Capabilities
Resource
Capabilities
A namespace. A particular
resource may define require-
ments and capabilities from
many namespaces. Critically, a
capability and requirement
can only match if they're in the
same namespace.
■
Requirements
Requirements
A set of attributes that
describe the required or pro-
vided feature. The attributes
for a requirement are used to
■
Figure 7.3
A requirement is satisfied by a capability if
that capability is of a matching namespace, provides the
attributes needed by the requirement, and has no con-
flicting constraints.
































