Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.osgi.internal.resolver
Class ReadOnlyState  view ReadOnlyState download ReadOnlyState.java

java.lang.Object
  extended byorg.eclipse.osgi.internal.resolver.ReadOnlyState
All Implemented Interfaces:
org.eclipse.osgi.service.resolver.State

public class ReadOnlyState
extends java.lang.Object
implements org.eclipse.osgi.service.resolver.State


Field Summary
private  org.eclipse.osgi.service.resolver.State target
           
 
Constructor Summary
ReadOnlyState(org.eclipse.osgi.service.resolver.State target)
           
 
Method Summary
 boolean addBundle(org.eclipse.osgi.service.resolver.BundleDescription description)
          Adds the given bundle to this state.
 void addStateChangeListener(org.eclipse.osgi.service.resolver.StateChangeListener listener, int flags)
          Adds the given listener for change events to this state.
 org.eclipse.osgi.service.resolver.StateDelta compare(org.eclipse.osgi.service.resolver.State state)
          Returns a delta describing the differences between this state and the given state.
 org.eclipse.osgi.service.resolver.BundleDescription getBundle(long id)
          Returns descriptor for all bundles known to this state.
 org.eclipse.osgi.service.resolver.BundleDescription getBundle(java.lang.String symbolicName, org.eclipse.osgi.service.resolver.Version version)
          Returns the bundle descriptor for the bundle with the given name and version.
 org.eclipse.osgi.service.resolver.BundleDescription getBundleByLocation(java.lang.String location)
          Returns the bundle descriptor for the bundle with the given location identifier.
 org.eclipse.osgi.service.resolver.BundleDescription[] getBundles()
          Returns descriptions for all bundles known to this state.
 org.eclipse.osgi.service.resolver.BundleDescription[] getBundles(java.lang.String symbolicName)
          Returns all bundle descriptions with the given bundle symbolic name.
 org.eclipse.osgi.service.resolver.StateDelta getChanges()
          Returns the delta representing the changes from the time this state was first captured until now.
 org.eclipse.osgi.service.resolver.PackageSpecification[] getExportedPackages()
          Returns all exported packages in this state, according to the OSGi rules for resolution.
 org.eclipse.osgi.service.resolver.StateObjectFactory getFactory()
          Returns the factory that created this state.
 org.eclipse.osgi.service.resolver.BundleDescription[] getResolvedBundles()
          Returns descriptions for all bundles currently resolved in this state.
 org.eclipse.osgi.service.resolver.Resolver getResolver()
          Returns the resolver associated with this state.
 long getTimeStamp()
          Returns the id of the state on which this state is based.
 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.
 boolean removeBundle(org.eclipse.osgi.service.resolver.BundleDescription bundle)
          Removes the given bundle description.
 org.eclipse.osgi.service.resolver.BundleDescription removeBundle(long bundleId)
          Removes a bundle description with the given bundle id.
 void removeStateChangeListener(org.eclipse.osgi.service.resolver.StateChangeListener listener)
          Removes the given listener from the list of listeners.
 org.eclipse.osgi.service.resolver.StateDelta resolve()
          Same as State.resolve(true);
 org.eclipse.osgi.service.resolver.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.
 org.eclipse.osgi.service.resolver.StateDelta resolve(org.eclipse.osgi.service.resolver.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(org.eclipse.osgi.service.resolver.BundleDescription bundle, int status)
          Sets whether or not the given bundle is selected in this state..
 void resolveConstraint(org.eclipse.osgi.service.resolver.VersionConstraint constraint, org.eclipse.osgi.service.resolver.Version actualVersion, org.eclipse.osgi.service.resolver.BundleDescription supplier)
          Resolves the given version constraint with the given values.
 void setOverrides(java.lang.Object value)
          Sets the version overrides which are to be applied during the resolutoin of this state.
 void setResolver(org.eclipse.osgi.service.resolver.Resolver value)
          Sets the resolver associated with this state.
 boolean updateBundle(org.eclipse.osgi.service.resolver.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
 

Field Detail

target

private org.eclipse.osgi.service.resolver.State target
Constructor Detail

ReadOnlyState

public ReadOnlyState(org.eclipse.osgi.service.resolver.State target)
Method Detail

addBundle

public boolean addBundle(org.eclipse.osgi.service.resolver.BundleDescription description)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Adds the given bundle to this state.

Specified by:
addBundle in interface org.eclipse.osgi.service.resolver.State

addStateChangeListener

public void addStateChangeListener(org.eclipse.osgi.service.resolver.StateChangeListener listener,
                                   int flags)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Adds the given listener for change events to this state. Has no effect if an identical listener is already registered.

The resolver associated with the state, if implements StateChangeListener, receives all notifications for added/removed bundlers for free.

Specified by:
addStateChangeListener in interface org.eclipse.osgi.service.resolver.State

compare

public org.eclipse.osgi.service.resolver.StateDelta compare(org.eclipse.osgi.service.resolver.State state)
                                                     throws org.osgi.framework.BundleException
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns a delta describing the differences between this state and the given state. The given state is taken as the base so the absence of a bundle in this state is reported as a deletion, etc.

Note that the generated StateDelta will contain BundleDeltas with one of the following types: BundleDelta.ADDED, BundleDelta.REMOVED and BundleDelta.UPDATED

Specified by:
compare in interface org.eclipse.osgi.service.resolver.State

getBundle

public org.eclipse.osgi.service.resolver.BundleDescription getBundle(long id)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns descriptor for all bundles known to this state.

Specified by:
getBundle in interface org.eclipse.osgi.service.resolver.State

getBundle

public org.eclipse.osgi.service.resolver.BundleDescription getBundle(java.lang.String symbolicName,
                                                                     org.eclipse.osgi.service.resolver.Version version)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns the bundle descriptor for the bundle with the given name and version. null is returned if no such bundle is found in this state. If the version argument is null then the bundle with the given name which is resolve and/or has the highest version number is returned.

Specified by:
getBundle in interface org.eclipse.osgi.service.resolver.State

getBundleByLocation

public org.eclipse.osgi.service.resolver.BundleDescription getBundleByLocation(java.lang.String location)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns the bundle descriptor for the bundle with the given location identifier. null is returned if no such bundle is found in this state.

Specified by:
getBundleByLocation in interface org.eclipse.osgi.service.resolver.State

getBundles

public org.eclipse.osgi.service.resolver.BundleDescription[] getBundles()
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns descriptions for all bundles known to this state.

Specified by:
getBundles in interface org.eclipse.osgi.service.resolver.State

getBundles

public org.eclipse.osgi.service.resolver.BundleDescription[] getBundles(java.lang.String symbolicName)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns all bundle descriptions with the given bundle symbolic name.

Specified by:
getBundles in interface org.eclipse.osgi.service.resolver.State

getChanges

public org.eclipse.osgi.service.resolver.StateDelta getChanges()
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns the delta representing the changes from the time this state was first captured until now.

Specified by:
getChanges in interface org.eclipse.osgi.service.resolver.State

getExportedPackages

public org.eclipse.osgi.service.resolver.PackageSpecification[] getExportedPackages()
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns all exported packages in this state, according to the OSGi rules for resolution.

Specified by:
getExportedPackages in interface org.eclipse.osgi.service.resolver.State

getFactory

public org.eclipse.osgi.service.resolver.StateObjectFactory getFactory()
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns the factory that created this state.

Specified by:
getFactory in interface org.eclipse.osgi.service.resolver.State

getResolvedBundles

public org.eclipse.osgi.service.resolver.BundleDescription[] getResolvedBundles()
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns descriptions for all bundles currently resolved in this state.

Specified by:
getResolvedBundles in interface org.eclipse.osgi.service.resolver.State

getResolver

public org.eclipse.osgi.service.resolver.Resolver getResolver()
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns the resolver associated with this state. A state can work with at most one resolver at any given time. Similarly, a resolver can work with at most one state at a time.

Specified by:
getResolver in interface org.eclipse.osgi.service.resolver.State

getTimeStamp

public long getTimeStamp()
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns the id of the state on which this state is based. This correlates this state to the system state. For example, if Resolver.getState() returns state 4 but then some bundles are installed, the system state id is updated. By comparing 4 to the current system state id it is possible to detect if the the states are out of sync.

Specified by:
getTimeStamp in interface org.eclipse.osgi.service.resolver.State

isEmpty

public boolean isEmpty()
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns whether this state is empty.

Specified by:
isEmpty in interface org.eclipse.osgi.service.resolver.State

isResolved

public boolean isResolved()
Description copied from interface: org.eclipse.osgi.service.resolver.State
Returns true if there have been no modifications to this state since the last time resolve() was called.

Specified by:
isResolved in interface org.eclipse.osgi.service.resolver.State

removeBundle

public boolean removeBundle(org.eclipse.osgi.service.resolver.BundleDescription bundle)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Removes the given bundle description.

Specified by:
removeBundle in interface org.eclipse.osgi.service.resolver.State

removeBundle

public org.eclipse.osgi.service.resolver.BundleDescription removeBundle(long bundleId)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Removes a bundle description with the given bundle id.

Specified by:
removeBundle in interface org.eclipse.osgi.service.resolver.State

removeStateChangeListener

public void removeStateChangeListener(org.eclipse.osgi.service.resolver.StateChangeListener listener)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Removes the given listener from the list of listeners. Has no effect if an identical listener is not registered.

Specified by:
removeStateChangeListener in interface org.eclipse.osgi.service.resolver.State

resolve

public org.eclipse.osgi.service.resolver.StateDelta resolve()
Description copied from interface: org.eclipse.osgi.service.resolver.State
Same as State.resolve(true);

Specified by:
resolve in interface org.eclipse.osgi.service.resolver.State

resolve

public org.eclipse.osgi.service.resolver.StateDelta resolve(boolean incremental)
Description copied from interface: org.eclipse.osgi.service.resolver.State
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.

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.

Specified by:
resolve in interface org.eclipse.osgi.service.resolver.State

resolve

public org.eclipse.osgi.service.resolver.StateDelta resolve(org.eclipse.osgi.service.resolver.BundleDescription[] discard)
Description copied from interface: org.eclipse.osgi.service.resolver.State
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.

Specified by:
resolve in interface org.eclipse.osgi.service.resolver.State

resolveBundle

public void resolveBundle(org.eclipse.osgi.service.resolver.BundleDescription bundle,
                          int status)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Sets whether or not the given bundle is selected in this state..

This method is intended to be used by resolvers in the process of determining which constraints are satisfied by which components.

Specified by:
resolveBundle in interface org.eclipse.osgi.service.resolver.State

resolveConstraint

public void resolveConstraint(org.eclipse.osgi.service.resolver.VersionConstraint constraint,
                              org.eclipse.osgi.service.resolver.Version actualVersion,
                              org.eclipse.osgi.service.resolver.BundleDescription supplier)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Resolves the given version constraint with the given values. The given constraint object is destructively modified to reflect its new resolved state. Note that a constraint can be unresolved by passing null for both the actual version and the supplier.

This method is intended to be used by resolvers in the process of determining which constraints are satisfied by which components.

Specified by:
resolveConstraint in interface org.eclipse.osgi.service.resolver.State

setOverrides

public void setOverrides(java.lang.Object value)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Sets the version overrides which are to be applied during the resolutoin of this state. Version overrides allow external forces to refine/override the version constraints setup by the components in the state.

Specified by:
setOverrides in interface org.eclipse.osgi.service.resolver.State

setResolver

public void setResolver(org.eclipse.osgi.service.resolver.Resolver value)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Sets the resolver associated with this state. A state can work with at most one resolver at any given time. Similarly, a resolver can work with at most one state at a time.

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);
 

Specified by:
setResolver in interface org.eclipse.osgi.service.resolver.State

updateBundle

public boolean updateBundle(org.eclipse.osgi.service.resolver.BundleDescription newDescription)
Description copied from interface: org.eclipse.osgi.service.resolver.State
Updates an existing bundle description with the given description.

Specified by:
updateBundle in interface org.eclipse.osgi.service.resolver.State