public final class StateHelperImpl extends Object implements StateHelper
ACCESS_DISCOURAGED, ACCESS_ENCOURAGED, VISIBLE_INCLUDE_ALL_HOST_WIRES, VISIBLE_INCLUDE_EE_PACKAGES
Constructor and Description |
---|
StateHelperImpl() |
Modifier and Type | Method and Description |
---|---|
int |
getAccessCode(BundleDescription bundle,
ExportPackageDescription export)
Returns the access code that the specified
BundleDescription has to the
specified ExportPackageDescription . |
BundleDescription[] |
getDependentBundles(BundleDescription[] bundles)
Returns all bundles in the state depending on the given bundles.
|
static StateHelper |
getInstance() |
BundleDescription[] |
getPrerequisites(BundleDescription[] bundles)
Returns all the prerequisite bundles in the state for the given bundles.
|
VersionConstraint[] |
getUnsatisfiedConstraints(BundleDescription bundle)
Returns all unsatisfied constraints in the given bundle.
|
VersionConstraint[] |
getUnsatisfiedLeaves(BundleDescription[] bundles)
Returns all unsatisfied constraints in the given bundles that have no possible supplier.
|
ExportPackageDescription[] |
getVisiblePackages(BundleDescription bundle)
Returns a list of all packages that the specified bundle has access to which are
exported by other bundles.
|
ExportPackageDescription[] |
getVisiblePackages(BundleDescription bundle,
int options)
Returns a list of all packages that the specified bundle has access to which are
exported by other bundles.
|
boolean |
isResolvable(BundleSpecification specification)
Returns whether the given bundle specification constraint is resolvable.
|
boolean |
isResolvable(HostSpecification specification)
Returns whether the given host specification constraint is resolvable.
|
boolean |
isResolvable(ImportPackageSpecification constraint)
Returns whether the given package specification constraint is resolvable.
|
Object[][] |
sortBundles(BundleDescription[] toSort)
Sorts the given array of resolved bundles in pre-requisite order.
|
public BundleDescription[] getDependentBundles(BundleDescription[] bundles)
StateHelper
getDependentBundles
in interface StateHelper
bundles
- the initial set of bundlesStateHelper
public BundleDescription[] getPrerequisites(BundleDescription[] bundles)
StateHelper
getPrerequisites
in interface StateHelper
bundles
- the inital set of bundlespublic VersionConstraint[] getUnsatisfiedLeaves(BundleDescription[] bundles)
StateHelper
The returned constraints include only the unsatisfied constraints in the given state that have no possible supplier (leaf constraints). There may be additional unsatisfied constraints in the given bundles but these will have at least one possible supplier. In this case the possible supplier of the constraint is not resolved for some reason. For example, a given state only has Bundles X and Y installed and Bundles X and Y have the following constraints:
Bundle X requires Bundle Y Bundle Y requires Bundle Z
In this case Bundle Y has an unsatisfied constraint leaf on Bundle Z. This will cause Bundle X's constraint on Bundle Y to be unsatisfied as well because the bundles are involved in a dependency chain. Bundle X's constraint on Bundle Y is not considered a leaf because there is a possible supplier Y in the given state.
Note that a bundle may have no unsatisfied constraints and still not be resolved.
getUnsatisfiedLeaves
in interface StateHelper
bundles
- the bundles to examinepublic VersionConstraint[] getUnsatisfiedConstraints(BundleDescription bundle)
StateHelper
Note that a bundle may have no unsatisfied constraints and still not be resolved.
getUnsatisfiedConstraints
in interface StateHelper
bundle
- the bundle to examineStateHelper
public boolean isResolvable(ImportPackageSpecification constraint)
StateHelper
isResolvable
in interface StateHelper
constraint
- the package specification constraint to be examinedtrue
if the constraint can be resolved,
false
otherwiseStateHelper
public boolean isResolvable(BundleSpecification specification)
StateHelper
isResolvable
in interface StateHelper
specification
- the bundle specification constraint to be examinedtrue
if the constraint can be resolved,
false
otherwiseStateHelper
public boolean isResolvable(HostSpecification specification)
StateHelper
isResolvable
in interface StateHelper
specification
- the host specification constraint to be examinedtrue
if the constraint can be resolved,
false
otherwiseStateHelper
public Object[][] sortBundles(BundleDescription[] toSort)
StateHelper
Unresolved bundles are ignored.
sortBundles
in interface StateHelper
toSort
- an array of bundles to be sortedpublic ExportPackageDescription[] getVisiblePackages(BundleDescription bundle)
StateHelper
Same as calling getVisiblePackages(bundle, 0)
getVisiblePackages
in interface StateHelper
bundle
- a bundle to get the list of packages for.public ExportPackageDescription[] getVisiblePackages(BundleDescription bundle, int options)
StateHelper
getVisiblePackages
in interface StateHelper
bundle
- a bundle to get the list of packages for.options
- the options for selecting the visible packagesStateHelper.VISIBLE_INCLUDE_EE_PACKAGES
,
StateHelper.VISIBLE_INCLUDE_ALL_HOST_WIRES
public int getAccessCode(BundleDescription bundle, ExportPackageDescription export)
StateHelper
BundleDescription
has to the
specified ExportPackageDescription
.getAccessCode
in interface StateHelper
bundle
- the bundle to find the access code forexport
- the export to find the access code forStateHelper.ACCESS_ENCOURAGED
,
StateHelper.ACCESS_DISCOURAGED
public static StateHelper getInstance()
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.