org.eclipse.osgi.service.resolver
Interface StateObjectFactory


public interface StateObjectFactory

A factory for states and their component objects.

Clients may implement this interface.

Since:
3.1

Field Summary
static StateObjectFactory defaultFactory
          The default object factory that can be used to create, populate and resolve states.
 
Method Summary
 BundleDescription createBundleDescription(BundleDescription original)
          Creates a bundle description that is a copy of the given description.
 BundleDescription createBundleDescription(java.util.Dictionary manifest, java.lang.String location, long id)
          Deprecated. use createBundleDescription(State, Dictionary, String, long)
 BundleDescription createBundleDescription(long id, java.lang.String symbolicName, Version version, java.lang.String location, BundleSpecification[] required, HostSpecification host, ImportPackageSpecification[] imports, ExportPackageDescription[] exports, boolean singleton, boolean attachFragments, boolean dynamicFragments, java.lang.String platformFilter, java.lang.String[] executionEnvironments, GenericSpecification[] genericRequires, GenericDescription[] genericCapabilities)
          Creates a bundle description from the given parameters.
 BundleDescription createBundleDescription(long id, java.lang.String symbolicName, Version version, java.lang.String location, BundleSpecification[] required, HostSpecification host, ImportPackageSpecification[] imports, ExportPackageDescription[] exports, java.lang.String[] providedPackages, boolean singleton)
          Deprecated. use createBundleDescription(long, String, Version, String, BundleSpecification[], HostSpecification, ImportPackageSpecification[], ExportPackageDescription[], boolean, boolean, boolean, String, String[], GenericSpecification[], GenericDescription[])
 BundleDescription createBundleDescription(long id, java.lang.String symbolicName, Version version, java.lang.String location, BundleSpecification[] required, HostSpecification host, ImportPackageSpecification[] imports, ExportPackageDescription[] exports, java.lang.String[] providedPackages, boolean singleton, boolean attachFragments, boolean dynamicFragments, java.lang.String platformFilter, java.lang.String executionEnvironment, GenericSpecification[] genericRequires, GenericDescription[] genericCapabilities)
          Deprecated. use createBundleDescription(long, String, Version, String, BundleSpecification[], HostSpecification, ImportPackageSpecification[], ExportPackageDescription[], boolean, boolean, boolean, String, String[], GenericSpecification[], GenericDescription[])
 BundleDescription createBundleDescription(State state, java.util.Dictionary manifest, java.lang.String location, long id)
          Returns a bundle description based on the information in the supplied manifest dictionary.
 BundleSpecification createBundleSpecification(BundleSpecification original)
          Creates a bundle specification that is a copy of the given constraint.
 BundleSpecification createBundleSpecification(java.lang.String requiredSymbolicName, VersionRange requiredVersionRange, boolean export, boolean optional)
          Creates a bundle specification from the given parameters.
 ExportPackageDescription createExportPackageDescription(ExportPackageDescription original)
          Creates an import package specification that is a copy of the given constraint
 ExportPackageDescription createExportPackageDescription(java.lang.String packageName, Version version, java.util.Map directives, java.util.Map attributes, boolean root, BundleDescription exporter)
          Used by the Resolver to dynamically create ExportPackageDescription objects during the resolution process.
 GenericDescription createGenericDescription(java.lang.String name, java.lang.String type, Version version, java.util.Map attributes)
          Creates a generic description from the given parameters
 GenericSpecification createGenericSpecification(java.lang.String name, java.lang.String type, java.lang.String matchingFilter, boolean optional, boolean multiple)
          Creates a generic specification from the given parameters
 HostSpecification createHostSpecification(HostSpecification original)
          Creates a host specification that is a copy of the given constraint.
 HostSpecification createHostSpecification(java.lang.String hostSymbolicName, VersionRange hostVersionRange)
          Creates a host specification from the given parameters.
 ImportPackageSpecification createImportPackageSpecification(ImportPackageSpecification original)
          Creates an import package specification that is a copy of the given import package
 ImportPackageSpecification createImportPackageSpecification(java.lang.String packageName, VersionRange versionRange, java.lang.String bundleSymbolicName, VersionRange bundleVersionRange, java.util.Map directives, java.util.Map attributes, BundleDescription importer)
          Creates an import package specification from the given parameters.
 State createState()
          Deprecated. use createState(boolean)
 State createState(boolean resolver)
          Creates an empty state with or without a resolver.
 State createState(State state)
          Creates a new state that is a copy of the given state.
 State readState(java.io.DataInputStream stream)
          Deprecated. use readState(File) instead
 State readState(java.io.File stateDirectory)
          Reads a persisted state from the given directory.
 State readState(java.io.InputStream stream)
          Deprecated. use readState(File) instead
 void writeState(State state, java.io.DataOutputStream stream)
          Deprecated. use writeState(State, File) instead
 void writeState(State state, java.io.File stateDirectory)
          Persists the given state in the given directory.
 void writeState(State state, java.io.OutputStream stream)
          Deprecated. use writeState(State, File) instead
 

Field Detail

defaultFactory

static final StateObjectFactory defaultFactory
The default object factory that can be used to create, populate and resolve states. This is particularly useful when using the resolver outside the context of a running Equinox framework.

Method Detail

createState

State createState()
Deprecated. use createState(boolean)

Creates an empty state. The returned state does not have an attached resolver.

Returns:
the created state

createState

State createState(boolean resolver)
Creates an empty state with or without a resolver.

Parameters:
createResolver - true if the created state should be initialized with a resolver.
Returns:
the created state
Since:
3.2

createState

State createState(State state)
Creates a new state that is a copy of the given state. The returned state will contain copies of all bundle descriptions in the given state. No data pertaining to resolution is copied.

Parameters:
state - a state to be copied
Returns:
the created state

createBundleDescription

BundleDescription createBundleDescription(long id,
                                          java.lang.String symbolicName,
                                          Version version,
                                          java.lang.String location,
                                          BundleSpecification[] required,
                                          HostSpecification host,
                                          ImportPackageSpecification[] imports,
                                          ExportPackageDescription[] exports,
                                          java.lang.String[] providedPackages,
                                          boolean singleton)
Deprecated. use createBundleDescription(long, String, Version, String, BundleSpecification[], HostSpecification, ImportPackageSpecification[], ExportPackageDescription[], boolean, boolean, boolean, String, String[], GenericSpecification[], GenericDescription[])

Creates a bundle description from the given parameters.

Parameters:
id - id for the bundle
symbolicName - symbolic name for the bundle (may be null)
version - version for the bundle (may be null)
location - location for the bundle (may be null)
required - version constraints for all required bundles (may be null)
host - version constraint specifying the host for the bundle to be created. Should be null if the bundle is not a fragment
imports - version constraints for all packages imported (may be null)
exports - package descriptions of all the exported packages (may be null)
providedPackages - the list of provided packages (may be null)
singleton - whether the bundle created should be a singleton
Returns:
the created bundle description

createBundleDescription

BundleDescription createBundleDescription(long id,
                                          java.lang.String symbolicName,
                                          Version version,
                                          java.lang.String location,
                                          BundleSpecification[] required,
                                          HostSpecification host,
                                          ImportPackageSpecification[] imports,
                                          ExportPackageDescription[] exports,
                                          java.lang.String[] providedPackages,
                                          boolean singleton,
                                          boolean attachFragments,
                                          boolean dynamicFragments,
                                          java.lang.String platformFilter,
                                          java.lang.String executionEnvironment,
                                          GenericSpecification[] genericRequires,
                                          GenericDescription[] genericCapabilities)
Deprecated. use createBundleDescription(long, String, Version, String, BundleSpecification[], HostSpecification, ImportPackageSpecification[], ExportPackageDescription[], boolean, boolean, boolean, String, String[], GenericSpecification[], GenericDescription[])

Creates a bundle description from the given parameters.

Parameters:
id - id for the bundle
symbolicName - symbolic name for the bundle (may be null)
version - version for the bundle (may be null)
location - location for the bundle (may be null)
required - version constraints for all required bundles (may be null)
host - version constraint specifying the host for the bundle to be created. Should be null if the bundle is not a fragment
imports - version constraints for all packages imported (may be null)
exports - package descriptions of all the exported packages (may be null)
providedPackages - the list of provided packages (may be null)
singleton - whether the bundle created should be a singleton
attachFragments - whether the bundle allows fragments to attach
dynamicFragments - whether the bundle allows fragments to dynamically attach
platformFilter - the platform filter (may be null)
executionEnvironment - the execution environment (may be null)
genericRequires - the version constraints for all required capabilities (may be null)
genericCapabilities - the specifications of all the capabilities of the bundle (may be null)
Returns:
the created bundle description

createBundleDescription

BundleDescription createBundleDescription(long id,
                                          java.lang.String symbolicName,
                                          Version version,
                                          java.lang.String location,
                                          BundleSpecification[] required,
                                          HostSpecification host,
                                          ImportPackageSpecification[] imports,
                                          ExportPackageDescription[] exports,
                                          boolean singleton,
                                          boolean attachFragments,
                                          boolean dynamicFragments,
                                          java.lang.String platformFilter,
                                          java.lang.String[] executionEnvironments,
                                          GenericSpecification[] genericRequires,
                                          GenericDescription[] genericCapabilities)
Creates a bundle description from the given parameters.

Parameters:
id - id for the bundle
symbolicName - symbolic name for the bundle (may be null)
version - version for the bundle (may be null)
location - location for the bundle (may be null)
required - version constraints for all required bundles (may be null)
host - version constraint specifying the host for the bundle to be created. Should be null if the bundle is not a fragment
imports - version constraints for all packages imported (may be null)
exports - package descriptions of all the exported packages (may be null)
singleton - whether the bundle created should be a singleton
attachFragments - whether the bundle allows fragments to attach
dynamicFragments - whether the bundle allows fragments to dynamically attach
platformFilter - the platform filter (may be null)
executionEnvironments - the execution environment (may be null)
genericRequires - the version constraints for all required capabilities (may be null)
genericCapabilities - the specifications of all the capabilities of the bundle (may be null)
Returns:
the created bundle description

createBundleDescription

BundleDescription createBundleDescription(State state,
                                          java.util.Dictionary manifest,
                                          java.lang.String location,
                                          long id)
                                          throws BundleException
Returns a bundle description based on the information in the supplied manifest dictionary. The manifest should contain String keys and String values which correspond to proper OSGi manifest headers and values.

Parameters:
state - the state for which the description is being created
manifest - a collection of OSGi manifest headers and values
location - the URL location of the bundle (may be null)
id - the id of the bundle
Returns:
a bundle description derived from the given information
Throws:
BundleException - if an error occurs while reading the manifest

createBundleDescription

BundleDescription createBundleDescription(java.util.Dictionary manifest,
                                          java.lang.String location,
                                          long id)
                                          throws BundleException
Deprecated. use createBundleDescription(State, Dictionary, String, long)

Returns a bundle description based on the information in the supplied manifest dictionary. The manifest should contain String keys and String values which correspond to proper OSGi manifest headers and values.

Parameters:
manifest - a collection of OSGi manifest headers and values
location - the URL location of the bundle (may be null)
id - the id of the bundle
Returns:
a bundle description derived from the given information
Throws:
BundleException - if an error occurs while reading the manifest

createBundleDescription

BundleDescription createBundleDescription(BundleDescription original)
Creates a bundle description that is a copy of the given description.

Parameters:
original - the bundle description to be copied
Returns:
the created bundle description

createBundleSpecification

BundleSpecification createBundleSpecification(java.lang.String requiredSymbolicName,
                                              VersionRange requiredVersionRange,
                                              boolean export,
                                              boolean optional)
Creates a bundle specification from the given parameters.

Parameters:
requiredSymbolicName - the symbolic name for the required bundle
requiredVersionRange - the required version range (may be null)
export - whether the required bundle should be re-exported
optional - whether the constraint should be optional
Returns:
the created bundle specification
See Also:
for information on the available match rules

createBundleSpecification

BundleSpecification createBundleSpecification(BundleSpecification original)
Creates a bundle specification that is a copy of the given constraint.

Parameters:
original - the constraint to be copied
Returns:
the created bundle specification

createHostSpecification

HostSpecification createHostSpecification(java.lang.String hostSymbolicName,
                                          VersionRange hostVersionRange)
Creates a host specification from the given parameters.

Parameters:
hostSymbolicName - the symbolic name for the host bundle
hostVersionRange - the version range for the host bundle (may be null)
Returns:
the created host specification
See Also:
for information on the available match rules

createHostSpecification

HostSpecification createHostSpecification(HostSpecification original)
Creates a host specification that is a copy of the given constraint.

Parameters:
original - the constraint to be copied
Returns:
the created host specification

createImportPackageSpecification

ImportPackageSpecification createImportPackageSpecification(java.lang.String packageName,
                                                            VersionRange versionRange,
                                                            java.lang.String bundleSymbolicName,
                                                            VersionRange bundleVersionRange,
                                                            java.util.Map directives,
                                                            java.util.Map attributes,
                                                            BundleDescription importer)
Creates an import package specification from the given parameters.

Parameters:
packageName - the package name
versionRange - the package versionRange (may be null).
bundleSymbolicName - the Bundle-SymbolicName of the bundle that must export the package (may be null)
bundleVersionRange - the bundle versionRange (may be null).
directives - the directives for this package (may be null)
attributes - the arbitrary attributes for the package import (may be null)
importer - the importing bundle (may be null)
Returns:
the created package specification

createImportPackageSpecification

ImportPackageSpecification createImportPackageSpecification(ImportPackageSpecification original)
Creates an import package specification that is a copy of the given import package

Parameters:
original - the import package to be copied
Returns:
the created package specification

createExportPackageDescription

ExportPackageDescription createExportPackageDescription(java.lang.String packageName,
                                                        Version version,
                                                        java.util.Map directives,
                                                        java.util.Map attributes,
                                                        boolean root,
                                                        BundleDescription exporter)
Used by the Resolver to dynamically create ExportPackageDescription objects during the resolution process. The Resolver needs to create ExportPackageDescriptions dynamally for a host when a fragment. exports a package

Parameters:
packageName - the package name
version - the version of the package (may be null)
directives - the directives for the package (may be null)
attributes - the attributes for the package (may be null)
root - whether the package is a root package
exporter - the exporter of the package (may be null)
Returns:
the created package

createGenericDescription

GenericDescription createGenericDescription(java.lang.String name,
                                            java.lang.String type,
                                            Version version,
                                            java.util.Map attributes)
Creates a generic description from the given parameters

Parameters:
name - the name of the generic description
type - the type of the generic description (may be null)
version - the version of the generic description (may be null)
attributes - the attributes for the generic description (may be null)
Returns:
the created generic description

createGenericSpecification

GenericSpecification createGenericSpecification(java.lang.String name,
                                                java.lang.String type,
                                                java.lang.String matchingFilter,
                                                boolean optional,
                                                boolean multiple)
                                                throws InvalidSyntaxException
Creates a generic specification from the given parameters

Parameters:
name - the name of the generic specification
type - the type of the generic specification (may be null)
matchingFilter - the matching filter (may be null)
optional - whether the specification is optional
multiple - whether the specification allows for multiple suppliers
Returns:
the created generic specification
Throws:
InvalidSyntaxException - if the matching filter is invalid

createExportPackageDescription

ExportPackageDescription createExportPackageDescription(ExportPackageDescription original)
Creates an import package specification that is a copy of the given constraint

Parameters:
original - the export package to be copied
Returns:
the created package

writeState

void writeState(State state,
                java.io.OutputStream stream)
                throws java.io.IOException
Deprecated. use writeState(State, File) instead

Persists the given state in the given output stream. Closes the stream.

Parameters:
state - the state to be written
stream - the stream where to write the state to
Throws:
java.io.IOException - if an IOException happens while writing the state to the stream
java.lang.IllegalArgumentException - if the state provided was not created by this factory
Since:
3.1

writeState

void writeState(State state,
                java.io.DataOutputStream stream)
                throws java.io.IOException
Deprecated. use writeState(State, File) instead

Persists the given state in the given output stream. Closes the stream.

Parameters:
state - the state to be written
stream - the stream where to write the state to
Throws:
java.io.IOException - if an IOException happens while writing the state to the stream
java.lang.IllegalArgumentException - if the state provided was not created by this factory
See Also:
writeState(State, OutputStream)

writeState

void writeState(State state,
                java.io.File stateDirectory)
                throws java.io.IOException
Persists the given state in the given directory.

Parameters:
state - the state to be written
stateDirectory - the directory where to write the state to
Throws:
java.io.IOException - if an IOException happens while writing the state to the stream
java.lang.IllegalArgumentException - if the state provided was not created by this factory

readState

State readState(java.io.InputStream stream)
                throws java.io.IOException
Deprecated. use readState(File) instead

Reads a persisted state from the given stream. Closes the stream.

Parameters:
stream - the stream where to read the state from
Returns:
the state read
Throws:
java.io.IOException - if an IOException happens while reading the state from the stream
Since:
3.1

readState

State readState(java.io.DataInputStream stream)
                throws java.io.IOException
Deprecated. use readState(File) instead

Reads a persisted state from the given stream. Closes the stream.

Parameters:
stream - the stream where to read the state from
Returns:
the state read
Throws:
java.io.IOException - if an IOException happens while reading the state from the stream
See Also:
readState(InputStream)

readState

State readState(java.io.File stateDirectory)
                throws java.io.IOException
Reads a persisted state from the given directory.

Parameters:
stateDirectory - the directory where to read the state from
Returns:
the state read
Throws:
java.io.IOException - if an IOException happens while reading the state from the stream