public abstract class AbstractResolveContext extends ResolveContext
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
CONTRACT_OSGI_FRAMEWORK
Deprecated.
|
protected static java.lang.String |
IDENTITY_INITIAL_RESOURCE |
protected static java.lang.String |
IDENTITY_SYSTEM_RESOURCE |
protected LogService |
log |
| Constructor and Description |
|---|
AbstractResolveContext(LogService log) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCallbacks(java.util.Collection<ResolutionCallback> callbacks) |
void |
addEffectiveDirective(java.lang.String effectiveDirective) |
void |
addEffectiveDirective(java.lang.String effectiveDirective,
java.util.Set<java.lang.String> excludedNamespaces) |
void |
addEffectiveSet(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> effectiveSet) |
void |
addRepository(Repository repo) |
void |
addResolverHook(ResolverHook resolverHook) |
protected void |
addSystemResource(ResourceBuilder system,
Resource resource) |
static Requirement |
createBundleRequirement(java.lang.String bsn,
java.lang.String versionStr) |
static Requirement |
createIdentityRequirement(java.lang.String identity,
java.lang.String versionRange) |
static Capability |
createPackageCapability(java.lang.String packageName,
java.lang.String versionString) |
static Repository |
createRepository(java.util.List<Resource> resources) |
protected static Capability |
findFrameworkContractCapability(Resource resource)
Deprecated.
|
protected java.util.Collection<Capability> |
findProviders(Repository repo,
Requirement requirement)
Return any capabilities from the given repo.
|
java.util.List<Capability> |
findProviders(Requirement requirement)
Find Capabilities that match the given Requirement.
|
protected java.util.ArrayList<Capability> |
findProvidersFromRepositories(Requirement requirement,
java.util.LinkedHashSet<Capability> existingWiredCapabilities) |
java.util.Set<Resource> |
getBlackList() |
java.util.List<ResolutionCallback> |
getCallbacks() |
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getEffectiveSet() |
java.util.List<Requirement> |
getFailed() |
Resource |
getFramework() |
Resource |
getHighestResource(java.lang.String bsn,
java.lang.String range) |
static Capability |
getIdentityCapability(Resource resource) |
Resource |
getInputResource() |
int |
getLevel() |
java.util.Collection<Resource> |
getMandatoryResources()
Return the resources that must be resolved for this resolve context.
|
java.util.List<Repository> |
getRepositories() |
static java.lang.String |
getResourceIdentity(Resource resource) |
java.util.List<Resource> |
getResources(java.util.List<Repository> repos,
Requirement req) |
java.util.List<Resource> |
getResources(java.util.List<Repository> repos,
java.lang.String bsn,
java.lang.String range)
Get the framework repository from the
|
static Version |
getResourceVersion(Resource resource) |
Resource |
getSystemResource() |
java.util.Map<Resource,Wiring> |
getWirings()
Returns the wirings for existing resolved resources.
|
protected void |
init() |
int |
insertHostedCapability(java.util.List<Capability> caps,
HostedCapability hc)
Add a
HostedCapability to the list of capabilities returned from
ResolveContext.findProviders(Requirement). |
boolean |
isEffective(Requirement requirement)
Test if a given requirement should be wired in the resolve operation.
|
boolean |
isInputResource(Resource resource) |
boolean |
isSystemResource(Resource resource) |
void |
loadPath(ResourceBuilder system,
java.lang.String path,
java.lang.String what)
Load a bnd path from the OSGi repositories.
|
protected void |
postProcessProviders(Requirement requirement,
java.util.Set<Capability> wired,
java.util.List<Capability> candidates) |
protected void |
processMandatoryResource(Requirement requirement,
java.util.LinkedHashSet<Capability> firstStageResult,
Resource resource) |
static boolean |
resourceIdentityEquals(Resource r1,
Resource r2) |
protected void |
setBlackList(java.util.Collection<Requirement> reject)
If the blacklist is set, we have a list of requirements of resources that
should not be included (blacklist).
|
protected void |
setFramework(ResourceBuilder system,
Resource framework)
Add a framework resource to the system resource builder
|
void |
setInputRequirements(Requirement... reqs) |
void |
setInputResource(Resource inputResource) |
void |
setLevel(int n) |
void |
setOptionalRoots(java.util.Collection<Resource> roots) |
void |
setSystemResource(Resource system) |
protected static Version |
toVersion(java.lang.Object object) |
findRelatedResources, getOptionalResources, getSubstitutionWires, onCancel@Deprecated protected static final java.lang.String CONTRACT_OSGI_FRAMEWORK
protected static final java.lang.String IDENTITY_INITIAL_RESOURCE
protected static final java.lang.String IDENTITY_SYSTEM_RESOURCE
protected final LogService log
public AbstractResolveContext(LogService log)
protected void init()
public java.util.List<Capability> findProviders(Requirement requirement)
ResolveContext
The returned list contains Capability objects where the Resource
must be the declared Resource of the Capability. The Resolver can then
add additional HostedCapability objects with the
ResolveContext.insertHostedCapability(List, HostedCapability) method when it,
for example, attaches fragments. Those HostedCapability objects
will then use the host's Resource which likely differs from the declared
Resource of the corresponding Capability.
The returned list is in priority order such that the Capabilities with a
lower index have a preference over those with a higher index. The
resolver must use the
ResolveContext.insertHostedCapability(List, HostedCapability) method to add
additional Capabilities to maintain priority order. In general, this is
necessary when the Resolver uses Capabilities declared in a Resource but
that must originate from an attached host.
Each returned Capability must match the given Requirement. This means
that the filter in the Requirement must match as well as any namespace
specific directives. For example, the mandatory attributes for the
osgi.wiring.package namespace.
findProviders in class ResolveContextrequirement - The requirement that a resolver is attempting to
satisfy. Must not be null.Capability objects that match the specified
requirement.public java.util.Collection<Resource> getMandatoryResources()
ResolveContextThe default implementation returns an empty collection.
getMandatoryResources in class ResolveContextpublic int insertHostedCapability(java.util.List<Capability> caps,
HostedCapability hc)
ResolveContextHostedCapability to the list of capabilities returned from
ResolveContext.findProviders(Requirement).
This method is used by the Resolver to add Capabilities that are
hosted by another Resource to the list of Capabilities returned from
ResolveContext.findProviders(Requirement). This function is necessary to allow
fragments to attach to hosts, thereby changing the origin of a
Capability. This method must insert the specified HostedCapability in a
place that makes the list maintain the preference order. It must return
the index in the list of the inserted HostedCapability.
insertHostedCapability in class ResolveContextcaps - The list returned from
ResolveContext.findProviders(Requirement). Must not be null.hc - The HostedCapability to insert in the specified
list. Must not be null.public boolean isEffective(Requirement requirement)
ResolveContextfalse, then the resolver should ignore this
requirement during the resolve operation.
The primary use case for this is to test the effective directive
on the requirement, though implementations are free to use any effective
test.
isEffective in class ResolveContextrequirement - The Requirement to test. Must not be null.true if the requirement should be considered as part of
the resolve operation.public java.util.Map<Resource,Wiring> getWirings()
ResolveContextFor example, if this resolve context is for an OSGi framework, then the result would contain all the currently resolved bundles with each bundle's current wiring.
Multiple calls to this method for this resolve context must return the same result.
getWirings in class ResolveContextprotected void processMandatoryResource(Requirement requirement,
java.util.LinkedHashSet<Capability> firstStageResult,
Resource resource)
protected java.util.ArrayList<Capability> findProvidersFromRepositories(Requirement requirement,
java.util.LinkedHashSet<Capability> existingWiredCapabilities)
protected java.util.Collection<Capability> findProviders(Repository repo,
Requirement requirement)
repo - The repo to fetch requirements fromrequirement - the requirementpublic static Requirement createBundleRequirement(java.lang.String bsn,
java.lang.String versionStr)
public void setOptionalRoots(java.util.Collection<Resource> roots)
public void addRepository(Repository repo)
public java.util.List<Repository> getRepositories()
public java.util.List<Requirement> getFailed()
@Deprecated protected static Capability findFrameworkContractCapability(Resource resource)
public Resource getInputResource()
public void setInputResource(Resource inputResource)
public Resource getSystemResource()
public void setSystemResource(Resource system)
public void addEffectiveDirective(java.lang.String effectiveDirective)
public void addEffectiveDirective(java.lang.String effectiveDirective,
java.util.Set<java.lang.String> excludedNamespaces)
public void addEffectiveSet(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> effectiveSet)
protected void postProcessProviders(Requirement requirement,
java.util.Set<Capability> wired,
java.util.List<Capability> candidates)
public void addResolverHook(ResolverHook resolverHook)
public void addCallbacks(java.util.Collection<ResolutionCallback> callbacks)
public static Requirement createIdentityRequirement(java.lang.String identity,
java.lang.String versionRange)
public boolean isInputResource(Resource resource)
public boolean isSystemResource(Resource resource)
public Resource getHighestResource(java.lang.String bsn,
java.lang.String range)
public java.util.List<Resource> getResources(java.util.List<Repository> repos,
java.lang.String bsn,
java.lang.String range)
repos - bsn - public java.util.List<Resource> getResources(java.util.List<Repository> repos,
Requirement req)
protected void setFramework(ResourceBuilder system,
Resource framework)
throws java.lang.Exception
system - the system resource being build upframework - the framework resourcejava.lang.Exceptionprotected void addSystemResource(ResourceBuilder system,
Resource resource)
throws java.lang.Exception
java.lang.Exceptionprotected static Version toVersion(java.lang.Object object)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic static Repository createRepository(java.util.List<Resource> resources)
public static Capability createPackageCapability(java.lang.String packageName,
java.lang.String versionString)
throws java.lang.Exception
java.lang.Exceptionpublic static boolean resourceIdentityEquals(Resource r1,
Resource r2)
public static Capability getIdentityCapability(Resource resource)
public static java.lang.String getResourceIdentity(Resource resource)
public static Version getResourceVersion(Resource resource)
protected void setBlackList(java.util.Collection<Requirement> reject)
public java.util.List<ResolutionCallback> getCallbacks()
public java.util.Set<Resource> getBlackList()
public void setLevel(int n)
public int getLevel()
public Resource getFramework()
public void loadPath(ResourceBuilder system,
java.lang.String path,
java.lang.String what)
throws java.io.IOException,
java.lang.Exception
system - path - what - java.io.IOExceptionjava.lang.Exceptionpublic void setInputRequirements(Requirement... reqs)
throws java.lang.Exception
java.lang.Exceptionpublic java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getEffectiveSet()
Copyright (c) aQute SARL (2000, 2019) and others. All Rights Reserved.