Java Reference
In-Depth Information
Table 7.1
Interaction between the
resolution
and
cardinality
directives
resolution
directive
cardinality
directive
Number of wired capabilities
mandatory
single
Exactly one
One or more
mandatory
multiple
optional
single
Zero or one
Zero or more
optional
multiple
THE USES DIRECTIVE
The
uses
directive is a comma-separated list of packages used by a capability. The rea-
son this information is interesting is because it helps the resolver ensure that the class
space is consistent. Although you could generate
uses
directives by hand, it's better to
have a tool do it. We'll come back to
uses
constraints in section 7.2.1.
THE EFFECTIVE DIRECTIVE
The
effective
directive is almost certainly the one that you'll have the least contact
with. The
effective
directive applies to both requirements and capabilities, and is
used to determine at what time that requirement is needed, or when the capability
becomes available. There's only one defined value, which is the default. This value is
resolve
. If a requirement is effective at
resolve
time, it must be taken into account dur-
ing the resolution process. If a requirement is effective at any other time, it isn't pro-
cessed by the resolver because it has no resolution impact. Similarly, a resolve-time
capability can be used by the resolver to satisfy requirements, but a capability with any
other effective time can't, and is ignored.
Given that an
effective
directive of anything other than
resolve
is more or less
ignored by the
OSG
i resolver, you might think that it isn't useful. This isn't true, although
its use is fairly specific. A good example of a nonresolve time requirement is configura-
tion. The
OSG
i Compendium Specification defines the Configuration Admin service,
which can inject configuration into managed services. To be injected with configura-
tion, your managed service must specify a persistent identifier (
PID
), which identifies
the configuration dictionary to be injected. This clearly has no impact on the resolution
of your bundle; however, without the configuration dictionary your service will be rel-
atively useless. Some proposed provisioning systems allow you to express an active time
requirement on a configuration dictionary with a particular
PID
. This requirement
allows the provisioning system to identify a configuration resource (with the right
PID
)
and make the configuration available for you at runtime. The
OSG
i Resolver Service
Specification suggests using a value of
active
for this case, but implementations are free
to choose a value that makes sense within their requirement's namespace.
THE FILTER DIRECTIVE
As far as the resolution process is concerned, the
filter
directive is probably the most
important of all the directives. The
filter
directive exists on a requirement and con-
tains an
LDAP
filter that's used to determine whether a particular capability satisfies




