org.eclipse.osgi.internal.resolver
Class BundleDescriptionImpl

java.lang.Object
  extended by org.eclipse.osgi.internal.resolver.BaseDescriptionImpl
      extended by org.eclipse.osgi.internal.resolver.BundleDescriptionImpl
All Implemented Interfaces:
KeyedElement, BaseDescription, BundleDescription, BundleReference, BundleRevision

public final class BundleDescriptionImpl
extends BaseDescriptionImpl
implements BundleDescription, KeyedElement


Field Summary
 
Fields inherited from class org.eclipse.osgi.internal.resolver.BaseDescriptionImpl
monitor
 
Fields inherited from interface org.osgi.framework.wiring.BundleRevision
BUNDLE_NAMESPACE, HOST_NAMESPACE, PACKAGE_NAMESPACE, TYPE_FRAGMENT
 
Constructor Summary
BundleDescriptionImpl()
           
 
Method Summary
protected  void addDependencies(BaseDescription[] newDependencies, boolean checkDups)
           
protected  void addDependency(BaseDescriptionImpl dependency, boolean checkDups)
           
protected  void addDependent(BundleDescription dependent)
           
 boolean attachFragments()
          Returns true if this bundle allows fragments to attach
 boolean compare(KeyedElement other)
          Compares this element with a specified element
 boolean dynamicFragments()
          Returns true if this bundle allows fragments to attach dynamically after it has been resolved.
 ImportPackageSpecification[] getAddedDynamicImportPackages()
          Returns an array of dynamic import package specifications that have been added dynamically to this bundle description.
 Map<String,Object> getAttributes()
          Returns the arbitrary attributes for this bundle description.
 Bundle getBundle()
          Returns the Bundle object associated with this BundleReference.
 long getBundleId()
          Returns the numeric id of this bundle.
 List<Capability> getCapabilities(String namespace)
           
 State getContainingState()
          Returns the state object which hosts this bundle.
 Map<String,Object> getDeclaredAttributes()
          Returns the attributes declared with the description.
 List<BundleCapability> getDeclaredCapabilities(String namespace)
          Returns the capabilities declared by this bundle revision.
 Map<String,String> getDeclaredDirectives()
          Returns the directives declared with the description.
 List<BundleRequirement> getDeclaredRequirements(String namespace)
          Returns the requirements declared by this bundle revision.
 BundleDescription[] getDependents()
          Returns all bundles which depend on this bundle.
 int getEquinoxEE()
           
 String[] getExecutionEnvironments()
          Returns the list of execution environments that are required by this bundle.
 ExportPackageDescription[] getExportPackages()
          Returns an array of export package descriptions defined by the Export-Package clauses.
 BundleDescription[] getFragments()
          Returns all fragments known to this bundle (regardless resolution status).
 GenericDescription[] getGenericCapabilities()
          Returns an array of generic descriptions for the capabilities of this bundle.
 GenericSpecification[] getGenericRequires()
          Returns an array of generic specifications constraints required by this bundle.
 HostSpecification getHost()
          Returns the host for this bundle.
 ImportPackageSpecification[] getImportPackages()
          Returns an array of import package specifications defined by the Import-Package clause.
 Object getKey()
          Returns the key for this element
 int getKeyHashCode()
          Returns the hash code of the key
 String getLocation()
          The location string for this bundle.
 NativeCodeSpecification getNativeCodeSpecification()
          Returns the native code specification for this bundle.
 String getPlatformFilter()
          Returns the platform filter in the form of an LDAP filter
 BundleSpecification[] getRequiredBundles()
          Returns an array of bundle specifications defined by the Require-Bundle clause in this bundle.
 List<Requirement> getRequirements(String namespace)
           
 GenericDescription[] getResolvedGenericRequires()
          Returns all the capabilities that satisfy all the capability requirements for this bundle.
 ExportPackageDescription[] getResolvedImports()
          Returns all the export packages that satisfy all the imported packages for this bundle.
 BundleDescription[] getResolvedRequires()
          Returns all the bundle descriptions that satisfy all the require bundles for this bundle.
 ExportPackageDescription[] getSelectedExports()
          Returns all the exported packages from this bundle that have been selected by the resolver.
 GenericDescription[] getSelectedGenericCapabilities()
          Returns all the capabilities provided by ths bundle that have been selected by the resolver.
protected  int getStateBits()
           
 ExportPackageDescription[] getSubstitutedExports()
          Returns the export packages that satisfy imported packages for this bundle description and substitute one of the exports for this bundle description.
 BundleDescription getSupplier()
          Returns the bundle which supplies this base description
 String getSymbolicName()
          Gets the Bundle-SymbolicName of this BundleDescription.
 int getTypes()
          Returns the special types of this bundle revision.
 Map<String,List<StateWire>> getWires()
           
 BundleWiring getWiring()
          Returns the bundle wiring which is using this bundle revision.
 boolean hasDynamicImports()
          Returns true if this bundle has one or more dynamically imported packages.
 boolean isRemovalPending()
          Returns whether this bundle is pending a removal.
 boolean isResolved()
          Returns true if this bundle is resolved in its host state.
 boolean isSingleton()
          Returns whether this bundle is a singleton.
protected  void removeDependencies()
           
protected  void removeDependent(BundleDescription dependent)
           
protected  void setBundleId(long bundleId)
           
protected  void setContainingState(State value)
           
 void setEquinoxEE(int equinox_ee)
           
protected  void setExecutionEnvironments(String[] executionEnvironments)
           
protected  void setExportPackages(ExportPackageDescription[] exportPackages)
           
protected  void setGenericCapabilities(GenericDescription[] genericCapabilities)
           
protected  void setGenericRequires(GenericSpecification[] genericRequires)
           
protected  void setHost(HostSpecification host)
           
protected  void setImportPackages(ImportPackageSpecification[] importPackages)
           
protected  void setLazyLoaded(boolean lazyLoad)
           
protected  void setLocation(String location)
           
protected  void setNativeCodeSpecification(NativeCodeSpecification nativeCode)
           
protected  void setPlatformFilter(String platformFilter)
           
protected  void setRequiredBundles(BundleSpecification[] requiredBundles)
           
protected  void setResolvedCapabilities(GenericDescription[] resolvedCapabilities)
           
protected  void setResolvedImports(ExportPackageDescription[] resolvedImports)
           
protected  void setResolvedRequires(BundleDescription[] resolvedRequires)
           
protected  void setSelectedCapabilities(GenericDescription[] selectedCapabilities)
           
protected  void setSelectedExports(ExportPackageDescription[] selectedExports)
           
protected  void setStateBit(int stateBit, boolean on)
           
protected  void setStateWires(Map<String,List<StateWire>> stateWires)
           
protected  void setSubstitutedExports(ExportPackageDescription[] substitutedExports)
           
protected  void setSymbolicName(String symbolicName)
           
 String toString()
          Returns the string representation of this bundle.
 
Methods inherited from class org.eclipse.osgi.internal.resolver.BaseDescriptionImpl
getCapability, getFragmentDeclaration, getName, getUserObject, getVersion, setName, setUserObject, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.osgi.service.resolver.BaseDescription
getCapability, getName, getUserObject, getVersion, setUserObject
 
Methods inherited from interface org.osgi.framework.wiring.BundleRevision
getVersion
 

Constructor Detail

BundleDescriptionImpl

public BundleDescriptionImpl()
Method Detail

getBundleId

public long getBundleId()
Description copied from interface: BundleDescription
Returns the numeric id of this bundle. Typically a bundle description will only have a numeric id if it represents a bundle that is installed in a framework as the framework assigns the ids. -1 is returned if the id is not known.

Specified by:
getBundleId in interface BundleDescription
Returns:
the numeric id of this bundle description

getSymbolicName

public String getSymbolicName()
Description copied from interface: BundleDescription
Gets the Bundle-SymbolicName of this BundleDescription. Same as calling BaseDescription.getName().

Specified by:
getSymbolicName in interface BundleDescription
Specified by:
getSymbolicName in interface BundleRevision
Returns:
The bundle symbolic name or null if the bundle does not have a symbolic name.
See Also:
Bundle.getSymbolicName()

getSupplier

public BundleDescription getSupplier()
Description copied from interface: BaseDescription
Returns the bundle which supplies this base description

Specified by:
getSupplier in interface BaseDescription
Returns:
the bundle which supplies this base description

getLocation

public String getLocation()
Description copied from interface: BundleDescription
The location string for this bundle.

Specified by:
getLocation in interface BundleDescription
Returns:
The bundle location or null if the bundle description does not have a location

getPlatformFilter

public String getPlatformFilter()
Description copied from interface: BundleDescription
Returns the platform filter in the form of an LDAP filter

Specified by:
getPlatformFilter in interface BundleDescription
Returns:
the platfomr filter in the form of an LDAP filter

getExecutionEnvironments

public String[] getExecutionEnvironments()
Description copied from interface: BundleDescription
Returns the list of execution environments that are required by this bundle. Any one of the listed execution environments will allow this bundle to be resolved.

Specified by:
getExecutionEnvironments in interface BundleDescription
Returns:
the list of execution environments that are required.

getImportPackages

public ImportPackageSpecification[] getImportPackages()
Description copied from interface: BundleDescription
Returns an array of import package specifications defined by the Import-Package clause.

Specified by:
getImportPackages in interface BundleDescription
Returns:
an array of import package specifications

getAddedDynamicImportPackages

public ImportPackageSpecification[] getAddedDynamicImportPackages()
Description copied from interface: BundleDescription
Returns an array of dynamic import package specifications that have been added dynamically to this bundle description.

Specified by:
getAddedDynamicImportPackages in interface BundleDescription
Returns:
an array of dynamic import package specifications
See Also:
State.addDynamicImportPackages(BundleDescription, ImportPackageSpecification[])

getRequiredBundles

public BundleSpecification[] getRequiredBundles()
Description copied from interface: BundleDescription
Returns an array of bundle specifications defined by the Require-Bundle clause in this bundle.

Specified by:
getRequiredBundles in interface BundleDescription
Returns:
an array of bundle specifications

getGenericRequires

public GenericSpecification[] getGenericRequires()
Description copied from interface: BundleDescription
Returns an array of generic specifications constraints required by this bundle.

Specified by:
getGenericRequires in interface BundleDescription
Returns:
an array of generic specifications

getGenericCapabilities

public GenericDescription[] getGenericCapabilities()
Description copied from interface: BundleDescription
Returns an array of generic descriptions for the capabilities of this bundle.

Specified by:
getGenericCapabilities in interface BundleDescription
Returns:
an array of generic descriptions

getNativeCodeSpecification

public NativeCodeSpecification getNativeCodeSpecification()
Description copied from interface: BundleDescription
Returns the native code specification for this bundle. A value of null is returned if there is no native code specification.

Specified by:
getNativeCodeSpecification in interface BundleDescription
Returns:
the native code specification.

getExportPackages

public ExportPackageDescription[] getExportPackages()
Description copied from interface: BundleDescription
Returns an array of export package descriptions defined by the Export-Package clauses. All export package descriptions are returned even if they have not been selected by the resolver as an exporter of the package.

Specified by:
getExportPackages in interface BundleDescription
Returns:
an array of export package descriptions

isResolved

public boolean isResolved()
Description copied from interface: BundleDescription
Returns true if this bundle is resolved in its host state.

Specified by:
isResolved in interface BundleDescription
Returns:
true if this bundle is resolved in its host state.

getContainingState

public State getContainingState()
Description copied from interface: BundleDescription
Returns the state object which hosts this bundle. null is returned if this bundle is not currently in a state.

Specified by:
getContainingState in interface BundleDescription
Returns:
the state object which hosts this bundle.

getFragments

public BundleDescription[] getFragments()
Description copied from interface: BundleDescription
Returns all fragments known to this bundle (regardless resolution status).

Specified by:
getFragments in interface BundleDescription
Returns:
an array of BundleDescriptions containing all known fragments

getHost

public HostSpecification getHost()
Description copied from interface: BundleDescription
Returns the host for this bundle. null is returned if this bundle is not a fragment.

Specified by:
getHost in interface BundleDescription
Returns:
the host for this bundle.

isSingleton

public boolean isSingleton()
Description copied from interface: BundleDescription
Returns whether this bundle is a singleton. Singleton bundles require that at most one single version of the bundle can be resolved at a time.

The existence of a single bundle marked as singleton causes all bundles with the same symbolic name to be treated as singletons as well.

Specified by:
isSingleton in interface BundleDescription
Returns:
true, if this bundle is a singleton, false otherwise

isRemovalPending

public boolean isRemovalPending()
Description copied from interface: BundleDescription
Returns whether this bundle is pending a removal. A bundle is pending removal if it has been removed from the state but other bundles in the state currently depend on it.

Specified by:
isRemovalPending in interface BundleDescription
Returns:
true, if this bundle is pending a removal, false otherwise

hasDynamicImports

public boolean hasDynamicImports()
Description copied from interface: BundleDescription
Returns true if this bundle has one or more dynamically imported packages.

Specified by:
hasDynamicImports in interface BundleDescription
Returns:
true if this bundle has one or more dynamically imported packages.

attachFragments

public boolean attachFragments()
Description copied from interface: BundleDescription
Returns true if this bundle allows fragments to attach

Specified by:
attachFragments in interface BundleDescription
Returns:
true if this bundle allows fragments to attach

dynamicFragments

public boolean dynamicFragments()
Description copied from interface: BundleDescription
Returns true if this bundle allows fragments to attach dynamically after it has been resolved.

Specified by:
dynamicFragments in interface BundleDescription
Returns:
true if this bundle allows fragments to attach dynamically

getSelectedExports

public ExportPackageDescription[] getSelectedExports()
Description copied from interface: BundleDescription
Returns all the exported packages from this bundle that have been selected by the resolver. The returned list will include the ExportPackageDescriptions returned by BundleDescription.getExportPackages() that have been selected by the resolver and packages which are propagated by this bundle.

Specified by:
getSelectedExports in interface BundleDescription
Returns:
the selected list of packages that this bundle exports. If the bundle is unresolved or has no shared packages then an empty array is returned.

getSelectedGenericCapabilities

public GenericDescription[] getSelectedGenericCapabilities()
Description copied from interface: BundleDescription
Returns all the capabilities provided by ths bundle that have been selected by the resolver. The returned list will include the capabilities returned by BundleDescription.getGenericCapabilities() that have been selected by the resolver and any capabilities provided by fragments attached to this bundle.

Specified by:
getSelectedGenericCapabilities in interface BundleDescription
Returns:
the selected capabilities that this bundle provides. If the bundle is unresolved or has no capabilities then an empty array is returned.

getSubstitutedExports

public ExportPackageDescription[] getSubstitutedExports()
Description copied from interface: BundleDescription
Returns the export packages that satisfy imported packages for this bundle description and substitute one of the exports for this bundle description. If the bundle is not resolved or the bundle does not have substituted exports then an empty array is returned.

Specified by:
getSubstitutedExports in interface BundleDescription
Returns:
all substituted exports for this bundle description

getResolvedRequires

public BundleDescription[] getResolvedRequires()
Description copied from interface: BundleDescription
Returns all the bundle descriptions that satisfy all the require bundles for this bundle. If the bundle is not resolved or the bundle does not require any bundles then an empty array is returned.

Specified by:
getResolvedRequires in interface BundleDescription
Returns:
the bundles descriptions that satisfy all the require bundles for this bundle.

getResolvedImports

public ExportPackageDescription[] getResolvedImports()
Description copied from interface: BundleDescription
Returns all the export packages that satisfy all the imported packages for this bundle. If the bundle is not resolved or the bundle does not import any packages then an empty array is returned.

Specified by:
getResolvedImports in interface BundleDescription
Returns:
the exported packages that satisfy all the imported packages for this bundle.

getResolvedGenericRequires

public GenericDescription[] getResolvedGenericRequires()
Description copied from interface: BundleDescription
Returns all the capabilities that satisfy all the capability requirements for this bundle. This includes any capabilities required by fragments attached to this bundle.

Specified by:
getResolvedGenericRequires in interface BundleDescription
Returns:
the capabilities that satisfy all the capability requirements for this bundle. If the bundle is unresolved or has no capability requirements then an empty array is returned.

getWires

public Map<String,List<StateWire>> getWires()

setBundleId

protected void setBundleId(long bundleId)

setSymbolicName

protected void setSymbolicName(String symbolicName)

setLocation

protected void setLocation(String location)

setPlatformFilter

protected void setPlatformFilter(String platformFilter)

setExecutionEnvironments

protected void setExecutionEnvironments(String[] executionEnvironments)

setExportPackages

protected void setExportPackages(ExportPackageDescription[] exportPackages)

setImportPackages

protected void setImportPackages(ImportPackageSpecification[] importPackages)

setRequiredBundles

protected void setRequiredBundles(BundleSpecification[] requiredBundles)

setGenericCapabilities

protected void setGenericCapabilities(GenericDescription[] genericCapabilities)

setGenericRequires

protected void setGenericRequires(GenericSpecification[] genericRequires)

setNativeCodeSpecification

protected void setNativeCodeSpecification(NativeCodeSpecification nativeCode)

getStateBits

protected int getStateBits()

setStateBit

protected void setStateBit(int stateBit,
                           boolean on)

setContainingState

protected void setContainingState(State value)

setHost

protected void setHost(HostSpecification host)

setLazyLoaded

protected void setLazyLoaded(boolean lazyLoad)

setSelectedExports

protected void setSelectedExports(ExportPackageDescription[] selectedExports)

setSelectedCapabilities

protected void setSelectedCapabilities(GenericDescription[] selectedCapabilities)

setSubstitutedExports

protected void setSubstitutedExports(ExportPackageDescription[] substitutedExports)

setResolvedImports

protected void setResolvedImports(ExportPackageDescription[] resolvedImports)

setResolvedRequires

protected void setResolvedRequires(BundleDescription[] resolvedRequires)

setResolvedCapabilities

protected void setResolvedCapabilities(GenericDescription[] resolvedCapabilities)

setStateWires

protected void setStateWires(Map<String,List<StateWire>> stateWires)

toString

public String toString()
Description copied from interface: BundleDescription
Returns the string representation of this bundle.

Specified by:
toString in interface BundleDescription
Overrides:
toString in class Object
Returns:
String representation of this bundle.

getKey

public Object getKey()
Description copied from interface: KeyedElement
Returns the key for this element

Specified by:
getKey in interface KeyedElement
Returns:
the key for this element

compare

public boolean compare(KeyedElement other)
Description copied from interface: KeyedElement
Compares this element with a specified element

Specified by:
compare in interface KeyedElement
Parameters:
other - the element to compare with
Returns:
returns true if the specified element equals this element

getKeyHashCode

public int getKeyHashCode()
Description copied from interface: KeyedElement
Returns the hash code of the key

Specified by:
getKeyHashCode in interface KeyedElement
Returns:
the hash code of the key

removeDependencies

protected void removeDependencies()

addDependencies

protected void addDependencies(BaseDescription[] newDependencies,
                               boolean checkDups)

addDependency

protected void addDependency(BaseDescriptionImpl dependency,
                             boolean checkDups)

addDependent

protected void addDependent(BundleDescription dependent)

removeDependent

protected void removeDependent(BundleDescription dependent)

getDependents

public BundleDescription[] getDependents()
Description copied from interface: BundleDescription
Returns all bundles which depend on this bundle. A bundle depends on another bundle if it requires the bundle, imports a package which is exported by the bundle, is a fragment to the bundle or is the host of the bundle.

Specified by:
getDependents in interface BundleDescription
Returns:
all bundles which depend on this bundle.

setEquinoxEE

public void setEquinoxEE(int equinox_ee)

getEquinoxEE

public int getEquinoxEE()

getAttributes

public Map<String,Object> getAttributes()
Description copied from interface: BundleDescription
Returns the arbitrary attributes for this bundle description.

Specified by:
getAttributes in interface BundleDescription
Returns:
the arbitrary attributes for this bundle description

getDeclaredDirectives

public Map<String,String> getDeclaredDirectives()
Description copied from interface: BaseDescription
Returns the directives declared with the description. This will return all known directives for the type of description. The set of directives differs for each description type.

Specified by:
getDeclaredDirectives in interface BaseDescription
Returns:
the known directives declared with the description

getDeclaredAttributes

public Map<String,Object> getDeclaredAttributes()
Description copied from interface: BaseDescription
Returns the attributes declared with the description. This will return all known attributes for the type of description. The set of attributes differs for each description type.

Specified by:
getDeclaredAttributes in interface BaseDescription
Returns:
the attributes declared with the description

getDeclaredRequirements

public List<BundleRequirement> getDeclaredRequirements(String namespace)
Description copied from interface: BundleRevision
Returns the requirements declared by this bundle revision.

Specified by:
getDeclaredRequirements in interface BundleRevision
Parameters:
namespace - The name space of the declared requirements to return or null to return the declared requirements from all name spaces.
Returns:
A list containing a snapshot of the declared BundleRequirements, or an empty list if this bundle revision declares no requirements in the specified name space. The list contains the declared requirements in the order they are specified in the manifest.

getDeclaredCapabilities

public List<BundleCapability> getDeclaredCapabilities(String namespace)
Description copied from interface: BundleRevision
Returns the capabilities declared by this bundle revision.

Specified by:
getDeclaredCapabilities in interface BundleRevision
Parameters:
namespace - The name space of the declared capabilities to return or null to return the declared capabilities from all name spaces.
Returns:
A list containing a snapshot of the declared BundleCapabilitys, or an empty list if this bundle revision declares no capabilities in the specified name space. The list contains the declared capabilities in the order they are specified in the manifest.

getTypes

public int getTypes()
Description copied from interface: BundleRevision
Returns the special types of this bundle revision. The bundle revision type values are: A bundle revision may be more than one type at a time. A type code is used to identify the bundle revision type for future extendability.

If this bundle revision is not one or more of the defined types then 0 is returned.

Specified by:
getTypes in interface BundleRevision
Returns:
The special types of this bundle revision. The type values are ORed together.

getBundle

public Bundle getBundle()
Description copied from interface: BundleReference
Returns the Bundle object associated with this BundleReference.

Specified by:
getBundle in interface BundleReference
Returns:
The Bundle object associated with this BundleReference.

getWiring

public BundleWiring getWiring()
Description copied from interface: BundleRevision
Returns the bundle wiring which is using this bundle revision.

Specified by:
getWiring in interface BundleRevision
Returns:
The bundle wiring which is using this bundle revision or null if no bundle wiring is using this bundle revision.
See Also:
BundleWiring.getRevision()

getCapabilities

public List<Capability> getCapabilities(String namespace)

getRequirements

public List<Requirement> getRequirements(String namespace)


Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.