|
OSGi™ Service Platform Core Specification Release 4 Version 4.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ResolverHook
OSGi Framework Resolver Hook instances are obtained from the OSGi
Framework Resolver Hook Factory
service.
A Resolver Hook instance is called by the framework during a resolve process.
A resolver hook may influence the outcome of a resolve process by removing
entries from shrinkable collections that are passed to the hook during a
resolve process. A shrinkable collection is a Collection
that
supports all remove operations. Any other attempts to modify a shrinkable
collection will result in an UnsupportedOperationException
being
thrown.
The following steps outline the way a framework uses the resolver hooks during a resolve process.
ResolverHookFactory.begin(Collection)
method to inform the hooks
about a resolve process beginning and to obtain a Resolver Hook instance that
will be used for the duration of the resolve process.R
. For each
resolver hook call the filterResolvable(Collection)
method with the
shrinkable collection R
.R
now contains all the unresolved
bundle revisions that may end up as resolved at the end of the current
resolve process. Any other bundle revisions that got removed from the
shrinkable collection R
must not end up as resolved at the end of the
current resolve process.B
left in the shrinkable collection
R
that represents a singleton bundle do the following:osgi.wiring.bundle
, are singletons,
and have the same symbolic name as the singleton bundle revision B
and place each of the matching capabilities into a shrinkable collection
S
.
Remove the osgi.wiring.bundle
capability provided by bundle revision B
from shrinkable collection
S
. A singleton bundle cannot collide with itself.
For each resolver hook call the
filterSingletonCollisions(BundleCapability, Collection)
with the
osgi.wiring.bundle
capability
provided by bundle revision B
and the shrinkable collection S
The shrinkable collection S
now contains all singleton
osgi.wiring.bundle
capabilities that
can influence the ability of bundle revision B
to resolve.R
. For each bundle
revision B
left in the shrinkable collection R
which the
framework attempts to resolve the following steps must be followed:
For each requirement T
specified by bundle revision B
determine the collection of capabilities that satisfy (or match) the
requirement and place each matching capability into a shrinkable collection
C
. A capability is considered to match a particular requirement if
its attributes satisfy a specified requirement and the requirer bundle has
permission to access the capability.
For each resolver hook call the
filterMatches(BundleRequirement, Collection)
with the requirement
T
and the shrinkable collection C
.
The shrinkable collection C
now contains all the capabilities that
may be used to satisfy the requirement T
. Any other capabilities that
got removed from the shrinkable collection C
must not be used to
satisfy requirement T
.end()
method to inform the hooks
about a resolve process ending.
Resolver hooks are low level. Implementations of the resolver hook must be
careful not to create an unresolvable state which is very hard for a
developer or a provisioner to diagnose. Resolver hooks also must not be
allowed to start another synchronous resolve process (e.g. by calling
Bundle.start()
or FrameworkWiring.resolveBundles(Collection)
). The framework must detect this and throw an IllegalStateException
.
ResolverHookFactory
Method Summary | |
---|---|
void |
end()
This method is called once at the end of the resolve process. |
void |
filterMatches(BundleRequirement requirement,
java.util.Collection<BundleCapability> candidates)
Filter matches hook method. |
void |
filterResolvable(java.util.Collection<BundleRevision> candidates)
Filter resolvable candidates hook method. |
void |
filterSingletonCollisions(BundleCapability singleton,
java.util.Collection<BundleCapability> collisionCandidates)
Filter singleton collisions hook method. |
Method Detail |
---|
void filterResolvable(java.util.Collection<BundleRevision> candidates)
candidates
- the collection of resolvable candidates available during
a resolve process.void filterSingletonCollisions(BundleCapability singleton, java.util.Collection<BundleCapability> collisionCandidates)
Currently only capabilities with the name space of
osgi.wiring.bundle
can be
singletons. In that case all the collision candidates have the name space
of osgi.wiring.bundle
, are
singletons, and have the same symbolic name as the specified singleton
capability.
In the future, capabilities in other name spaces may support the
singleton concept. Hook implementations should be prepared to receive
calls to this method for capabilities in name spaces other than
osgi.wiring.bundle
.
This method can filter the list of collision candidates by removing potential collisions. Removing a collision candidate will allow the specified singleton to resolve regardless of the resolution state of the removed collision candidate.
singleton
- the singleton involved in a resolve processcollisionCandidates
- a collection of singleton collision candidatesvoid filterMatches(BundleRequirement requirement, java.util.Collection<BundleCapability> candidates)
All of the candidates will have the same name space and will match the specified requirement.
If the Java Runtime Environment supports permissions then the collection of candidates will only contain candidates for which the requirer has permission to access.
requirement
- the requirement to filter candidates forcandidates
- a collection of candidates that match the requirementvoid end()
|
OSGi™ Service Platform Core Specification Release 4 Version 4.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |