|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface State
The state of a system as reported by a resolver. This includes all bundles presented to the resolver relative to this state (i.e., both resolved and unresolved).
Clients may implement this interface.
Method Summary | |
---|---|
boolean |
addBundle(BundleDescription description)
Adds the given bundle to this state. |
void |
addResolverError(BundleDescription bundle,
int type,
java.lang.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(java.lang.String symbolicName,
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. null is returned if no such bundle is found in this state. |
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. |
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[] |
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,
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 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 |
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 a 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)
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 |
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 value)
Sets the resolver associated with 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. |
Method Detail |
---|
boolean addBundle(BundleDescription description)
description
- the description to add
StateDelta 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 state
BundleException
BundleDescription removeBundle(long bundleId)
bundleId
- the id of the bundle description to be removed
null
, if a bundle
with the given id does not exist in this stateboolean removeBundle(BundleDescription bundle)
bundle
- the bundle description to be removed
true
, if if the bundle description was removed,
false
otherwiseboolean updateBundle(BundleDescription newDescription)
newDescription
- the bundle description to replace an existing one
true
, 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(java.lang.String symbolicName, Version version)
version is
null.
- Parameters:
symbolicName
- symbolic name of the bundle to queryversion
- version of the bundle to query. null matches any bundle
- Returns:
- the descriptor for the identified bundle
BundleDescription getBundleByLocation(java.lang.String location)
location
- location identifier of the bundle to query
long 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.
java.lang.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 BundleDescriptions 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
java.lang.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.
java.lang.IllegalStateException
- if this is not done during a call to
resolve
void addResolverError(BundleDescription bundle, int type, java.lang.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.
java.lang.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 for
java.lang.IllegalStateException
- if this is not done during a call to resolve
ResolverError[] getResolverErrors(BundleDescription bundle)
ResolverError
s for the given bundle
bundle
- the bundle to get all ResolverError
s for
ResolverError
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 incremental
StateDelta 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.
void setOverrides(java.lang.Object value)
value
- BundleDescription[] getResolvedBundles()
boolean isEmpty()
true
if this state is empty, false
otherwiseExportPackageDescription[] getExportedPackages()
PackageAdmin.getExportedPackages(Bundle)
BundleDescription[] getBundles(java.lang.String symbolicName)
symbolicName
- symbolic name of the bundles to query
StateObjectFactory getFactory()
ExportPackageDescription linkDynamicImport(BundleDescription importingBundle, java.lang.String requestedPackage)
null
is returned.
importingBundle
- the BundleDescription that is requesting a dynamic packagerequestedPackage
- the name of the package that is being requested
null
is returned if none is available.boolean setPlatformProperties(java.util.Dictionary platformProperties)
osgi.nl - the platform language setting
osgi.os - the platform operating system
osgi.arch - the platform architecture
osgi.ws - the platform windowing system
org.osgi.framework.system.packages - the packages exported by the system bundle
osgi.resolverMode - the resolver mode. A value of "strict" will set the resolver mode to strict.
org.osgi.framework.executionenvironment - the comma separated list of supported execution environments
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 state
boolean setPlatformProperties(java.util.Dictionary[] platformProperties)
platformProperties
- a set of platform properties for the state
for a list of supported properties.
java.util.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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |