|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.osgi.internal.resolver.StateImpl
public abstract class StateImpl
| Field Summary | |
|---|---|
static java.lang.String[] |
PROPS
|
| Constructor Summary | |
|---|---|
protected |
StateImpl()
|
| Method Summary | |
|---|---|
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,
java.lang.String data,
VersionConstraint unsatisfied)
Adds a new ResolverError for the specified bundle. |
boolean |
dynamicCacheChanged()
|
void |
fullyLoad()
|
BundleDescription |
getBundle(long id)
Returns the bundle descriptor for the bundle with the given id. |
BundleDescription |
getBundle(java.lang.String name,
Version version)
Returns the bundle descriptor for the bundle with the given name and version. |
BundleDescription |
getBundleByLocation(java.lang.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(java.lang.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. |
java.util.Collection<BundleDescription> |
getDependencyClosure(java.util.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,
java.lang.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. |
java.util.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 ResolverErrors for the given bundle |
ResolverHook |
getResolverHook()
|
StateHelper |
getStateHelper()
Returns a state helper object. |
java.lang.String |
getSystemBundle()
|
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,
java.lang.String requestedPackage)
Attempts to find an ExportPackageDescription that will satisfy a dynamic import for the specified requestedPackage for the specified importingBundle. |
boolean |
removeBundle(BundleDescription toRemove)
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 ResolverErrors 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[] reResolve)
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)
Deprecated. |
void |
resolveBundle(BundleDescription bundle,
boolean status,
BundleDescription[] hosts,
ExportPackageDescription[] selectedExports,
ExportPackageDescription[] substitutedExports,
BundleDescription[] resolvedRequires,
ExportPackageDescription[] resolvedImports)
Deprecated. |
void |
resolveBundle(BundleDescription bundle,
boolean status,
BundleDescription[] hosts,
ExportPackageDescription[] selectedExports,
ExportPackageDescription[] substitutedExports,
GenericDescription[] selectedCapabilities,
BundleDescription[] resolvedRequires,
ExportPackageDescription[] resolvedImports,
GenericDescription[] resolvedCapabilities,
java.util.Map<java.lang.String,java.util.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(java.lang.Object value)
Sets the version overrides which are to be applied during the resolutoin of this state. |
boolean |
setPlatformProperties(java.util.Dictionary<?,?> platformProperties)
Sets the platform properties of the state. |
boolean |
setPlatformProperties(java.util.Dictionary<?,?>[] platformProperties)
Sets the platform properties of the state to a list of platform properties. |
void |
setResolver(Resolver newResolver)
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 |
unloadLazyData(long checkStamp)
|
boolean |
updateBundle(BundleDescription newDescription)
Updates an existing bundle description with the given description. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.osgi.service.resolver.State |
|---|
compare |
| Field Detail |
|---|
public static final java.lang.String[] PROPS
| Constructor Detail |
|---|
protected StateImpl()
| Method Detail |
|---|
public boolean addBundle(BundleDescription description)
State
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 State.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
State.resolve(BundleDescription[]) with the removed bundle.
addBundle in interface Statedescription - the description to add
public boolean updateBundle(BundleDescription newDescription)
State
updateBundle in interface StatenewDescription - the bundle description to replace an existing one
true, if if the bundle description was updated,
false otherwisepublic BundleDescription removeBundle(long bundleId)
State
removeBundle in interface StatebundleId - the id of the bundle description to be removed
null, if a bundle
with the given id does not exist in this statepublic boolean removeBundle(BundleDescription toRemove)
State
removeBundle in interface StatetoRemove - the bundle description to be removed
true, if if the bundle description was removed,
false otherwisepublic StateDelta getChanges()
State
getChanges in interface Statepublic BundleDescription[] getBundles(java.lang.String symbolicName)
State
getBundles in interface StatesymbolicName - symbolic name of the bundles to query
public BundleDescription[] getBundles()
State
getBundles in interface Statepublic BundleDescription getBundle(long id)
Statenull is returned if no such bundle is found in
this state.
getBundle in interface StateBundleDescription.getBundleId()
public BundleDescription getBundle(java.lang.String name,
Version version)
Stateversion is
null.
- Specified by:
getBundle in interface State
- Parameters:
name - symbolic name of the bundle to queryversion - version of the bundle to query. null matches any bundle
- Returns:
- the descriptor for the identified bundle
public long getTimeStamp()
State
getTimeStamp in interface Statepublic boolean isResolved()
State
isResolved in interface State
public void resolveConstraint(VersionConstraint constraint,
BaseDescription supplier)
StateThis method is intended to be used by resolvers in the process of determining which constraints are satisfied by which components.
resolveConstraint in interface Stateconstraint - the version constraint to updatesupplier - the supplier which satisfies the constraint. May be null if
the constraint is to be unresolved.
public void resolveBundle(BundleDescription bundle,
boolean status,
BundleDescription[] hosts,
ExportPackageDescription[] selectedExports,
BundleDescription[] resolvedRequires,
ExportPackageDescription[] resolvedImports)
StateThis method is intended to be used by resolvers in the process of determining which constraints are satisfied by which components.
resolveBundle in interface Statebundle - 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 nullselectedExports - the selected exported packages for this resolved bundle, can be nullresolvedRequires - the BundleDescriptions that resolve the required bundles for this bundle, can be nullresolvedImports - the exported packages that resolve the imports for this bundle, can be null
public void resolveBundle(BundleDescription bundle,
boolean status,
BundleDescription[] hosts,
ExportPackageDescription[] selectedExports,
ExportPackageDescription[] substitutedExports,
BundleDescription[] resolvedRequires,
ExportPackageDescription[] resolvedImports)
StateThis method is intended to be used by resolvers in the process of determining which constraints are satisfied by which components.
resolveBundle in interface Statebundle - 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 nullselectedExports - the selected exported packages for this resolved bundle, can be nullsubstitutedExports - the exported packages that resolve imports for this bundle and substitute exports, can be nullresolvedRequires - the BundleDescriptions that resolve the required bundles for this bundle, can be nullresolvedImports - the exported packages that resolve the imports for this bundle, can be null
public void resolveBundle(BundleDescription bundle,
boolean status,
BundleDescription[] hosts,
ExportPackageDescription[] selectedExports,
ExportPackageDescription[] substitutedExports,
GenericDescription[] selectedCapabilities,
BundleDescription[] resolvedRequires,
ExportPackageDescription[] resolvedImports,
GenericDescription[] resolvedCapabilities,
java.util.Map<java.lang.String,java.util.List<StateWire>> resolvedWires)
StateThis method is intended to be used by resolvers in the process of determining which constraints are satisfied by which components.
resolveBundle in interface Statebundle - 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 nullselectedExports - the selected exported packages for this resolved bundle, can be nullsubstitutedExports - the exported packages that resolve imports for this bundle and substitute exports, can be nullselectedCapabilities - the selected capabilities for this resolved bundle, can be nullresolvedRequires - the BundleDescriptions that resolve the required bundles for this bundle, can be nullresolvedImports - the exported packages that resolve the imports for this bundle, can be nullresolvedCapabilities - the capabilities that resolve the required capabilities for this bundle, can be nullresolvedWires - the map of state wires for the resolved requirements of the given bundle. The key is the name space of the requirement.public void removeBundleComplete(BundleDescription bundle)
StateThis method is intended to be used by resolvers in the process of resolving bundles.
removeBundleComplete in interface Statebundle - the bundle to set a removal complete.public StateDelta resolve()
State
resolve in interface Statepublic StateDelta resolve(boolean incremental)
StateNote 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.
resolve in interface Stateincremental - a flag controlling whether resolution should be incremental
public StateDelta resolve(BundleDescription[] reResolve)
State
resolve in interface StatereResolve - an array containing descriptions for bundles whose
current resolution state should be forgotten. If null
then all the current removal pending BundleDescriptions are refreshed.
public StateDelta resolve(BundleDescription[] resolve,
boolean discard)
State
resolve in interface Stateresolve - 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.
public void setOverrides(java.lang.Object value)
State
setOverrides in interface Statepublic void setResolverHookFactory(ResolverHookFactory hookFactory)
State
setResolverHookFactory in interface StatehookFactory - the resolver hook factorypublic ResolverHook getResolverHook()
public BundleDescription[] getResolvedBundles()
State
getResolvedBundles in interface Statepublic boolean isEmpty()
State
isEmpty in interface Statetrue if this state is empty, false
otherwisepublic ExportPackageDescription[] getExportedPackages()
State
getExportedPackages in interface StatePackageAdmin.getExportedPackages(org.osgi.framework.Bundle)public void setTimeStamp(long newTimeStamp)
State
setTimeStamp in interface StatenewTimeStamp - the new timestamp for this statepublic StateObjectFactory getFactory()
State
getFactory in interface Statepublic BundleDescription getBundleByLocation(java.lang.String location)
State
getBundleByLocation in interface Statelocation - location identifier of the bundle to query
public Resolver getResolver()
State
getResolver in interface Statepublic void setResolver(Resolver newResolver)
StateTo 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);
setResolver in interface Statepublic boolean setPlatformProperties(java.util.Dictionary<?,?> platformProperties)
StateThe 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.
setPlatformProperties in interface StateplatformProperties - the platform properties of the state
public boolean setPlatformProperties(java.util.Dictionary<?,?>[] platformProperties)
State
setPlatformProperties in interface StateplatformProperties - a set of platform properties for the state
State.setPlatformProperties(Dictionary)public java.util.Dictionary[] getPlatformProperties()
State
getPlatformProperties in interface Statepublic java.lang.String getSystemBundle()
public BundleDescription[] getRemovalPending()
State
getRemovalPending in interface Statepublic java.util.Collection<BundleDescription> getDependencyClosure(java.util.Collection<BundleDescription> bundles)
StateA 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.
getDependencyClosure in interface Statebundles - The initial bundles for which to generate the dependency
closure.
public ExportPackageDescription linkDynamicImport(BundleDescription importingBundle,
java.lang.String requestedPackage)
Statenull is returned.
linkDynamicImport in interface StateimportingBundle - the BundleDescription that is requesting a dynamic packagerequestedPackage - the name of the package that is being requested
null is returned if none is available.
public void addDynamicImportPackages(BundleDescription importingBundle,
ImportPackageSpecification[] dynamicImports)
State
addDynamicImportPackages in interface StateimportingBundle - the bundle to add the imports to.dynamicImports - the dynamic imports to add.BundleDescription.getAddedDynamicImportPackages()public final void fullyLoad()
public final boolean unloadLazyData(long checkStamp)
public ExportPackageDescription[] getSystemPackages()
State
getSystemPackages in interface StateState.setPlatformProperties(Dictionary)public ResolverError[] getResolverErrors(BundleDescription bundle)
StateResolverErrors for the given bundle
getResolverErrors in interface Statebundle - the bundle to get all ResolverErrors for
ResolverErrors for the given bundle
public void addResolverError(BundleDescription bundle,
int type,
java.lang.String data,
VersionConstraint unsatisfied)
StateResolverError for the specified bundle.
This method is intended to be used by resolvers in the process of resolving.
addResolverError in interface Statebundle - the bundle to add a new ResolverError fortype - the type of ResolverError to adddata - the data for the ResolverErrorunsatisfied - the unsatisfied constraint or null if the resolver error was not caused
by an unsatisfied constraint.public void removeResolverErrors(BundleDescription bundle)
StateResolverErrors for the specified bundle.
This method is intended to be used by resolvers in the process of resolving.
removeResolverErrors in interface Statebundle - the bundle to remove all ResolverErrors forpublic boolean dynamicCacheChanged()
public StateHelper getStateHelper()
StateA possible implementation for this method would provide the same single StateHelper instance to all clients.
getStateHelper in interface StateStateHelperpublic long getHighestBundleId()
StateNote 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.
getHighestBundleId in interface State
public void setNativePathsInvalid(NativeCodeDescription nativeCodeDescription,
boolean hasInvalidNativePaths)
StateThe framework, or some other entity which has access to bundle content, will call this method to validate or invalidate native code paths.
setNativePathsInvalid in interface StatenativeCodeDescription - the native code description.hasInvalidNativePaths - true if the native code paths are invalid; false otherwise.public BundleDescription[] getDisabledBundles()
StateState.getDisabledInfos(BundleDescription) to interrogate the reason that
each bundle is disabled.
getDisabledBundles in interface StateDisabledInfopublic void addDisabledInfo(DisabledInfo disabledInfo)
State
addDisabledInfo in interface StatedisabledInfo - the disabled info to add.public void removeDisabledInfo(DisabledInfo disabledInfo)
State
removeDisabledInfo in interface StatedisabledInfo - the disabled info to remove
public DisabledInfo getDisabledInfo(BundleDescription bundle,
java.lang.String policyName)
Statenull is returned.
getDisabledInfo in interface Statebundle - the bundle to get the disabled info for
public DisabledInfo[] getDisabledInfos(BundleDescription bundle)
State
getDisabledInfos in interface Statebundle - the bundle to get the disabled info for.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||