public interface State
This interface is not intended to be implemented by clients. The
StateObjectFactory
should be used to construct instances.
Modifier and Type | Method and Description |
---|---|
boolean |
addBundle(BundleDescription description)
Adds the given bundle to this state.
|
void |
addDisabledInfo(DisabledInfo disabledInfo)
Adds the disabled info to this state.
|
void |
addDynamicImportPackages(BundleDescription importingBundle,
ImportPackageSpecification[] dynamicImports)
Adds the specified dynamic imports to the specified importingBundle.
|
void |
addResolverError(BundleDescription bundle,
int type,
String data,
VersionConstraint unsatisfied)
Adds a new
ResolverError for the specified bundle. |
StateDelta |
compare(State baseState)
Returns a delta describing the differences between this state and the
given state.
|
BundleDescription |
getBundle(long id)
Returns the bundle descriptor for the bundle with the given id.
|
BundleDescription |
getBundle(String symbolicName,
Version version)
Returns the bundle descriptor for the bundle with the given name and
version.
|
BundleDescription |
getBundleByLocation(String location)
Returns the bundle descriptor for the bundle with the given location
identifier.
|
BundleDescription[] |
getBundles()
Returns descriptions for all bundles known to this state.
|
BundleDescription[] |
getBundles(String symbolicName)
Returns all bundle descriptions with the given bundle symbolic name.
|
StateDelta |
getChanges()
Returns the delta representing the changes from the time this state was
first captured until now.
|
Collection<BundleDescription> |
getDependencyClosure(Collection<BundleDescription> bundles)
Returns the dependency closure for the specified bundles.
|
BundleDescription[] |
getDisabledBundles()
Returns an array of BundleDescriptions for the bundles that are disabled
in the system.
|
DisabledInfo |
getDisabledInfo(BundleDescription bundle,
String policyName)
Returns the disabled info for the specified bundle with the specified policy name.
|
DisabledInfo[] |
getDisabledInfos(BundleDescription bundle)
Returns an array of disabled info for the specified bundle.
|
ExportPackageDescription[] |
getExportedPackages()
Returns all exported packages in this state, according to the OSGi rules for resolution.
|
StateObjectFactory |
getFactory()
Returns the factory that created this state.
|
long |
getHighestBundleId()
Returns the highest bundle ID.
|
Dictionary[] |
getPlatformProperties()
Returns the list of platform properties currently set for this state.
|
BundleDescription[] |
getRemovalPending()
Returns descriptions for all bundles in a removal pending state.
|
BundleDescription[] |
getResolvedBundles()
Returns descriptions for all bundles currently resolved in this state.
|
Resolver |
getResolver()
Returns the resolver associated with this state.
|
ResolverError[] |
getResolverErrors(BundleDescription bundle)
Returns all
ResolverError s for the given bundle |
StateHelper |
getStateHelper()
Returns a state helper object.
|
ExportPackageDescription[] |
getSystemPackages()
Returns the list of system packages which are exported by the system bundle.
|
long |
getTimeStamp()
Returns the timestamp for this state.
|
boolean |
isEmpty()
Returns whether this state is empty.
|
boolean |
isResolved()
Returns true if there have been no modifications to this state since the
last time resolve() was called.
|
ExportPackageDescription |
linkDynamicImport(BundleDescription importingBundle,
String requestedPackage)
Attempts to find an ExportPackageDescription that will satisfy a dynamic import
for the specified requestedPackage for the specified importingBundle.
|
boolean |
removeBundle(BundleDescription bundle)
Removes the given bundle description.
|
BundleDescription |
removeBundle(long bundleId)
Removes a bundle description with the given bundle id.
|
void |
removeBundleComplete(BundleDescription bundle)
Sets the given removal pending bundle to removal complete for this state.
|
void |
removeDisabledInfo(DisabledInfo disabledInfo)
Removes the disabled info from the state.
|
void |
removeResolverErrors(BundleDescription bundle)
Removes all
ResolverError s for the specified bundle. |
StateDelta |
resolve()
Same as State.resolve(true);
|
StateDelta |
resolve(boolean incremental)
Resolves the constraints contained in this state using the resolver
currently associated with the state and returns a delta describing the
changes in resolved states and dependencies in the state.
|
StateDelta |
resolve(BundleDescription[] discard)
Resolves the constraints contained in this state using the resolver
currently associated with the state in an incremental, "least-perturbing"
mode, and returns a delta describing the changes in resolved states and
dependencies in the state.
|
StateDelta |
resolve(BundleDescription[] resolve,
boolean discard)
Resolves the constraints contained in this state using the resolver
currently associated with the state in an incremental, "least-perturbing"
mode, and returns a delta describing the changes in resolved states and
dependencies in the state.
|
void |
resolveBundle(BundleDescription bundle,
boolean status,
BundleDescription[] hosts,
ExportPackageDescription[] selectedExports,
BundleDescription[] resolvedRequires,
ExportPackageDescription[] resolvedImports)
|
void |
resolveBundle(BundleDescription bundle,
boolean status,
BundleDescription[] hosts,
ExportPackageDescription[] selectedExports,
ExportPackageDescription[] substitutedExports,
BundleDescription[] resolvedRequires,
ExportPackageDescription[] resolvedImports)
|
void |
resolveBundle(BundleDescription bundle,
boolean status,
BundleDescription[] hosts,
ExportPackageDescription[] selectedExports,
ExportPackageDescription[] substitutedExports,
GenericDescription[] selectedCapabilities,
BundleDescription[] resolvedRequires,
ExportPackageDescription[] resolvedImports,
GenericDescription[] resolvedCapabilities,
Map<String,List<StateWire>> resolvedWires)
Sets whether or not the given bundle is selected in this state.
|
void |
resolveConstraint(VersionConstraint constraint,
BaseDescription supplier)
Resolves the given version constraint with the given supplier.
|
void |
setNativePathsInvalid(NativeCodeDescription nativeCodeDescription,
boolean hasInvalidNativePaths)
Sets the native code paths of a native code description as invalid.
|
void |
setOverrides(Object value)
Deprecated.
The exact form of this has never been defined. There is
no alternative method available.
|
boolean |
setPlatformProperties(Dictionary<?,?> platformProperties)
Sets the platform properties of the state.
|
boolean |
setPlatformProperties(Dictionary<?,?>[] platformProperties)
Sets the platform properties of the state to a list of platform properties.
|
void |
setResolver(Resolver value)
Sets the resolver associated with this state.
|
void |
setResolverHookFactory(ResolverHookFactory hookFactory)
Sets the resolver hook factory for this state.
|
void |
setTimeStamp(long newTimeStamp)
Sets the timestamp for this state
|
boolean |
updateBundle(BundleDescription newDescription)
Updates an existing bundle description with the given description.
|
boolean addBundle(BundleDescription description)
If the bundle already exists in another state then an IllegalStateException
will be thrown. Note that even if you remove a BundleDescription
from
one State
object using removeBundle(BundleDescription)
it
may still be considered as removing pending if other bundles in that state depend on the
bundle you removed. To complete a pending removal a call must be done to
resolve(BundleDescription[])
with the removed bundle.
description
- the description to addIllegalStateException
- if the bundle already exists in another stateStateDelta compare(State baseState) throws BundleException
Note that the generated StateDelta will contain BundleDeltas with one of the following types: BundleDelta.ADDED, BundleDelta.REMOVED and BundleDelta.UPDATED
baseState
- the base stateBundleException
BundleDescription removeBundle(long bundleId)
bundleId
- the id of the bundle description to be removednull
, if a bundle
with the given id does not exist in this stateboolean removeBundle(BundleDescription bundle)
bundle
- the bundle description to be removedtrue
, if if the bundle description was removed,
false
otherwiseboolean updateBundle(BundleDescription newDescription)
newDescription
- the bundle description to replace an existing onetrue
, if if the bundle description was updated,
false
otherwiseStateDelta getChanges()
BundleDescription[] getBundles()
BundleDescription getBundle(long id)
null
is returned if no such bundle is found in
this state.BundleDescription.getBundleId()
BundleDescription getBundle(String symbolicName, Version version)
version is
null.
symbolicName
- symbolic name of the bundle to queryversion
- version of the bundle to query. null matches any bundleBundleDescription getBundleByLocation(String location)
location
- location identifier of the bundle to querylong getTimeStamp()
void setTimeStamp(long newTimeStamp)
newTimeStamp
- the new timestamp for this stateboolean isResolved()
void resolveConstraint(VersionConstraint constraint, BaseDescription supplier)
This method is intended to be used by resolvers in the process of determining which constraints are satisfied by which components.
constraint
- the version constraint to updatesupplier
- the supplier which satisfies the constraint. May be null if
the constraint is to be unresolved.IllegalStateException
- if this is not done during a call to
resolve
void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports)
This method is intended to be used by resolvers in the process of determining which constraints are satisfied by which components.
bundle
- the bundle to updatestatus
- whether or not the given bundle is resolved, if false the other parameters are ignoredhosts
- the host for the resolve fragment, can be null
selectedExports
- the selected exported packages for this resolved bundle, can be null
resolvedRequires
- the BundleDescription
s that resolve the required bundles for this bundle, can be null
resolvedImports
- the exported packages that resolve the imports for this bundle, can be null
IllegalStateException
- if this is not done during a call to resolve
void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, ExportPackageDescription[] substitutedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports)
This method is intended to be used by resolvers in the process of determining which constraints are satisfied by which components.
bundle
- the bundle to updatestatus
- whether or not the given bundle is resolved, if false the other parameters are ignoredhosts
- the host for the resolve fragment, can be null
selectedExports
- the selected exported packages for this resolved bundle, can be null
substitutedExports
- the exported packages that resolve imports for this bundle and substitute exports, can be null
resolvedRequires
- the BundleDescription
s that resolve the required bundles for this bundle, can be null
resolvedImports
- the exported packages that resolve the imports for this bundle, can be null
IllegalStateException
- if this is not done during a call to resolve
void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, ExportPackageDescription[] substitutedExports, GenericDescription[] selectedCapabilities, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports, GenericDescription[] resolvedCapabilities, Map<String,List<StateWire>> resolvedWires)
This method is intended to be used by resolvers in the process of determining which constraints are satisfied by which components.
bundle
- the bundle to updatestatus
- whether or not the given bundle is resolved, if false the other parameters are ignoredhosts
- the host for the resolve fragment, can be null
selectedExports
- the selected exported packages for this resolved bundle, can be null
substitutedExports
- the exported packages that resolve imports for this bundle and substitute exports, can be null
selectedCapabilities
- the selected capabilities for this resolved bundle, can be null
resolvedRequires
- the BundleDescription
s that resolve the required bundles for this bundle, can be null
resolvedImports
- the exported packages that resolve the imports for this bundle, can be null
resolvedCapabilities
- the capabilities that resolve the required capabilities for this bundle, can be null
resolvedWires
- the map of state wires for the resolved requirements of the given bundle. The key is the name space of the requirement.IllegalStateException
- if this is not done during a call to resolve
void removeBundleComplete(BundleDescription bundle)
This method is intended to be used by resolvers in the process of resolving bundles.
bundle
- the bundle to set a removal complete.IllegalStateException
- if this is not done during a call to
resolve
void addResolverError(BundleDescription bundle, int type, String data, VersionConstraint unsatisfied)
ResolverError
for the specified bundle.
This method is intended to be used by resolvers in the process of resolving.
bundle
- the bundle to add a new ResolverError
fortype
- the type of ResolverError
to adddata
- the data for the ResolverError
unsatisfied
- the unsatisfied constraint or null if the resolver error was not caused
by an unsatisfied constraint.IllegalStateException
- if this is not done during a call to resolve
void removeResolverErrors(BundleDescription bundle)
ResolverError
s for the specified bundle.
This method is intended to be used by resolvers in the process of resolving.
bundle
- the bundle to remove all ResolverError
s forIllegalStateException
- if this is not done during a call to resolve
ResolverError[] getResolverErrors(BundleDescription bundle)
ResolverError
s for the given bundlebundle
- the bundle to get all ResolverError
s forResolverError
s for the given bundleResolver getResolver()
void setResolver(Resolver value)
To ensure that this state and the given resovler are properly linked, the following expression must be included in this method if the given resolver (value) is not identical to the result of this.getResolver().
if (this.getResolver() != value) value.setState(this);
StateDelta resolve(boolean incremental)
Note that this method is typically implemented using
this.getResolver().resolve();and is the preferred path for invoking resolution. In particular, states should refuse to perform updates (@see #select() and #resolveConstraint()) if they are not currently involved in a resolution cycle.
Note the given state is destructively modified to reflect the results of resolution.
incremental
- a flag controlling whether resolution should be incrementalStateDelta resolve()
StateDelta resolve(BundleDescription[] discard)
discard
- an array containing descriptions for bundles whose
current resolution state should be forgotten. If null
then all the current removal pending BundleDescriptions are refreshed.StateDelta resolve(BundleDescription[] resolve, boolean discard)
resolve
- an array containing descriptions for bundles to resolve.discard
- a value of true indicates the resolve descriptions
should have their current resolution state discarded and re-resolved.void setOverrides(Object value)
value
- BundleDescription[] getResolvedBundles()
BundleDescription[] getRemovalPending()
Collection<BundleDescription> getDependencyClosure(Collection<BundleDescription> bundles)
A graph of bundles is computed starting with the specified bundles. The graph is expanded by adding any bundle that is either wired to a package that is currently exported by a bundle in the graph or requires a bundle in the graph. The graph is fully constructed when there is no bundle outside the graph that is wired to a bundle in the graph. The graph may contain removal pending bundles.
bundles
- The initial bundles for which to generate the dependency
closure.boolean isEmpty()
true
if this state is empty, false
otherwiseExportPackageDescription[] getExportedPackages()
BundleDescription[] getBundles(String symbolicName)
symbolicName
- symbolic name of the bundles to queryStateObjectFactory getFactory()
ExportPackageDescription linkDynamicImport(BundleDescription importingBundle, String requestedPackage)
null
is returned.importingBundle
- the BundleDescription that is requesting a dynamic packagerequestedPackage
- the name of the package that is being requestednull
is returned if none is available.void addDynamicImportPackages(BundleDescription importingBundle, ImportPackageSpecification[] dynamicImports)
importingBundle
- the bundle to add the imports to.dynamicImports
- the dynamic imports to add.BundleDescription.getAddedDynamicImportPackages()
boolean setPlatformProperties(Dictionary<?,?> platformProperties)
The values used for the supported properties can be String type to specify a single value for the property or they can by String[] to specify a list of values for the property.
platformProperties
- the platform properties of the stateboolean setPlatformProperties(Dictionary<?,?>[] platformProperties)
platformProperties
- a set of platform properties for the statesetPlatformProperties(Dictionary)
Dictionary[] getPlatformProperties()
ExportPackageDescription[] getSystemPackages()
setPlatformProperties(Dictionary)
StateHelper getStateHelper()
A possible implementation for this method would provide the same single StateHelper instance to all clients.
StateHelper
long getHighestBundleId()
Note that this method returns the highest bundle ID the ever existed in this this state object. This bundle may have been removed from the state.
void setNativePathsInvalid(NativeCodeDescription nativeCodeDescription, boolean hasInvalidNativePaths)
The framework, or some other entity which has access to bundle content, will call this method to validate or invalidate native code paths.
nativeCodeDescription
- the native code description.hasInvalidNativePaths
- true if the native code paths are invalid; false otherwise.BundleDescription[] getDisabledBundles()
getDisabledInfos(BundleDescription)
to interrogate the reason that
each bundle is disabled.DisabledInfo
void addDisabledInfo(DisabledInfo disabledInfo)
disabledInfo
- the disabled info to add.IllegalArgumentException
- if the BundleDescription
for
the specified disabled info does not exist in this state.void removeDisabledInfo(DisabledInfo disabledInfo)
disabledInfo
- the disabled info to removeDisabledInfo[] getDisabledInfos(BundleDescription bundle)
bundle
- the bundle to get the disabled info for.DisabledInfo getDisabledInfo(BundleDescription bundle, String policyName)
null
is returned.bundle
- the bundle to get the disabled info forvoid setResolverHookFactory(ResolverHookFactory hookFactory)
hookFactory
- the resolver hook factoryIllegalStateException
- if the resolver hook factory is already setCopyright © 2007–2018 The Apache Software Foundation. All rights reserved.