Class ResolverImpl
- java.lang.Object
-
- org.apache.felix.bundlerepository.impl.ResolverImpl
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<Requirement>
m_addedRequirementSet
private java.util.Set<Resource>
m_addedSet
private org.osgi.framework.BundleContext
m_context
private java.util.Set<Resource>
m_failedSet
private java.util.Set<Capability>
m_globalCapabilities
private org.apache.felix.utils.log.Logger
m_logger
private java.util.Set<Resource>
m_optionalSet
private java.util.Map<Resource,java.util.List<Reason>>
m_reasonMap
private Repository[]
m_repositories
private java.util.Set<Resource>
m_requiredSet
private int
m_resolutionFlags
private boolean
m_resolved
private java.util.Set<Resource>
m_resolveSet
private long
m_resolveTimeStamp
private java.util.Set<Reason>
m_unsatisfiedSet
-
Fields inherited from interface org.apache.felix.bundlerepository.Resolver
DO_NOT_PREFER_LOCAL, NO_LOCAL_RESOURCES, NO_OPTIONAL_RESOURCES, NO_SYSTEM_BUNDLE, START
-
-
Constructor Summary
Constructors Constructor Description ResolverImpl(org.osgi.framework.BundleContext context, Repository[] repositories, org.apache.felix.utils.log.Logger logger)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Requirement requirement)
Add the following requirement to the resolution The current resolution will be lost after adding a requirement.void
add(Resource resource)
Add the following resource to the resolution.void
addGlobalCapability(Capability capability)
Add a global capability.private void
checkInterrupt()
void
deploy(int flags)
private LocalResource[]
findLocalResources(java.lang.String symName)
Returns all local resources with the given symbolic name.private LocalResource
findUpdatableLocalResource(Resource resource)
Requirement[]
getAddedRequirements()
Returns the list of requirements that have been added to the resolutionResource[]
getAddedResources()
Returns the list of resources that have been added to the resolutionprivate ResourceCapability
getBestCandidate(java.util.List<ResourceCapability> caps)
Determines which resource is preferred to deliver the required capability.static java.lang.String
getBundleName(org.osgi.framework.Bundle bundle)
Capability[]
getGlobalCapabilities()
Returns the list of global capabilitiesprotected LocalResource[]
getLocalResources()
Resource[]
getOptionalResources()
List of optional resources that may be installedReason[]
getReason(Resource resource)
List of reasons why a resource has been included either as a mandatory or optional resource during the resolution.private Resource[]
getRemoteResources()
Resource[]
getRequiredResources()
List of mandatory resources that need to be installedprivate Requirement[]
getResolvableRequirements(Resource resource, Resource[] resources)
private Resource[]
getResources()
Reason[]
getUnsatisfiedRequirements()
List of requirements that could not be satisfied during the resolutionprivate boolean
isFragmentBundle(org.osgi.framework.Bundle bundle)
Determines if the given bundle is a fragement bundle.private boolean
isResourceUpdatable(Resource oldVersion, Resource newVersion, Resource[] resources)
boolean
resolve()
Start the resolution process and return whether the constraints have been successfully met or not.boolean
resolve(int flags)
Start the resolution process with the following flags.private boolean
resolve(Resource resource, Resource[] locals, Resource[] remotes, boolean optional)
private Resource
searchResources(Requirement req, java.util.Set<Resource> resourceSet)
private java.util.List<ResourceCapability>
searchResources(Requirement req, Resource[] resources)
Searches for resources that do meet the given requirement
-
-
-
Field Detail
-
m_context
private final org.osgi.framework.BundleContext m_context
-
m_logger
private final org.apache.felix.utils.log.Logger m_logger
-
m_repositories
private final Repository[] m_repositories
-
m_addedSet
private final java.util.Set<Resource> m_addedSet
-
m_addedRequirementSet
private final java.util.Set<Requirement> m_addedRequirementSet
-
m_globalCapabilities
private final java.util.Set<Capability> m_globalCapabilities
-
m_failedSet
private final java.util.Set<Resource> m_failedSet
-
m_resolveSet
private final java.util.Set<Resource> m_resolveSet
-
m_requiredSet
private final java.util.Set<Resource> m_requiredSet
-
m_optionalSet
private final java.util.Set<Resource> m_optionalSet
-
m_unsatisfiedSet
private final java.util.Set<Reason> m_unsatisfiedSet
-
m_resolved
private boolean m_resolved
-
m_resolveTimeStamp
private long m_resolveTimeStamp
-
m_resolutionFlags
private int m_resolutionFlags
-
-
Constructor Detail
-
ResolverImpl
public ResolverImpl(org.osgi.framework.BundleContext context, Repository[] repositories, org.apache.felix.utils.log.Logger logger)
-
-
Method Detail
-
add
public void add(Resource resource)
Description copied from interface:Resolver
Add the following resource to the resolution. The resource will be part of the output and all its requirements will be satisfied. It has the same effect has adding a requirement that will match this resource by symbolicname and version. The current resolution will be lost after adding a resource.
-
getAddedResources
public Resource[] getAddedResources()
Description copied from interface:Resolver
Returns the list of resources that have been added to the resolution- Specified by:
getAddedResources
in interfaceResolver
- Returns:
-
add
public void add(Requirement requirement)
Description copied from interface:Resolver
Add the following requirement to the resolution The current resolution will be lost after adding a requirement.
-
getAddedRequirements
public Requirement[] getAddedRequirements()
Description copied from interface:Resolver
Returns the list of requirements that have been added to the resolution- Specified by:
getAddedRequirements
in interfaceResolver
- Returns:
-
addGlobalCapability
public void addGlobalCapability(Capability capability)
Description copied from interface:Resolver
Add a global capability. A global capability is one capability provided by the environment but not reflected in local resources.- Specified by:
addGlobalCapability
in interfaceResolver
- Parameters:
capability
- the new global capability
-
getGlobalCapabilities
public Capability[] getGlobalCapabilities()
Description copied from interface:Resolver
Returns the list of global capabilities- Specified by:
getGlobalCapabilities
in interfaceResolver
- Returns:
-
getRequiredResources
public Resource[] getRequiredResources()
Description copied from interface:Resolver
List of mandatory resources that need to be installed- Specified by:
getRequiredResources
in interfaceResolver
- Returns:
-
getOptionalResources
public Resource[] getOptionalResources()
Description copied from interface:Resolver
List of optional resources that may be installed- Specified by:
getOptionalResources
in interfaceResolver
- Returns:
-
getReason
public Reason[] getReason(Resource resource)
Description copied from interface:Resolver
List of reasons why a resource has been included either as a mandatory or optional resource during the resolution.
-
getUnsatisfiedRequirements
public Reason[] getUnsatisfiedRequirements()
Description copied from interface:Resolver
List of requirements that could not be satisfied during the resolution- Specified by:
getUnsatisfiedRequirements
in interfaceResolver
- Returns:
-
getLocalResources
protected LocalResource[] getLocalResources()
-
getRemoteResources
private Resource[] getRemoteResources()
-
getResources
private Resource[] getResources()
-
resolve
public boolean resolve()
Description copied from interface:Resolver
Start the resolution process and return whether the constraints have been successfully met or not. The resolution can be interrupted by a call to Thread.interrupt() at any time. The result will be to stop the resolver and throw an InterruptedException.
-
resolve
public boolean resolve(int flags)
Description copied from interface:Resolver
Start the resolution process with the following flags.
-
resolve
private boolean resolve(Resource resource, Resource[] locals, Resource[] remotes, boolean optional)
-
searchResources
private Resource searchResources(Requirement req, java.util.Set<Resource> resourceSet)
-
searchResources
private java.util.List<ResourceCapability> searchResources(Requirement req, Resource[] resources)
Searches for resources that do meet the given requirement- Parameters:
req
- the the requirement that must be satisfied by resourcesresources
- list of resources to look at- Returns:
- all resources meeting the given requirement
-
getBestCandidate
private ResourceCapability getBestCandidate(java.util.List<ResourceCapability> caps)
Determines which resource is preferred to deliver the required capability. This method selects the resource providing the highest version of the capability. If two resources provide the same version of the capability, the resource with the largest number of cabailities be preferred- Parameters:
caps
-- Returns:
-
checkInterrupt
private void checkInterrupt()
-
isFragmentBundle
private boolean isFragmentBundle(org.osgi.framework.Bundle bundle)
Determines if the given bundle is a fragement bundle.- Parameters:
bundle
- bundle to check- Returns:
- flag indicating if the given bundle is a fragement
-
findUpdatableLocalResource
private LocalResource findUpdatableLocalResource(Resource resource)
-
findLocalResources
private LocalResource[] findLocalResources(java.lang.String symName)
Returns all local resources with the given symbolic name.- Parameters:
symName
- The symbolic name of the wanted local resources.- Returns:
- The local resources with the specified symbolic name.
-
isResourceUpdatable
private boolean isResourceUpdatable(Resource oldVersion, Resource newVersion, Resource[] resources)
-
getResolvableRequirements
private Requirement[] getResolvableRequirements(Resource resource, Resource[] resources)
-
getBundleName
public static java.lang.String getBundleName(org.osgi.framework.Bundle bundle)
-
-