Package org.eclipse.equinox.p2.engine

# Class ProvisioningContext

java.lang.Object
org.eclipse.equinox.p2.engine.ProvisioningContext

public class ProvisioningContext extends Object
A provisioning context defines the scope in which a provisioning operation occurs. A context can be used to specify the set of repositories available to the planner and engine as they perform provisioning work.

Since:
  2.0

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CHECK_AUTHORITIES`
Instructs the `collect phase` to check the originating sources of all installable units and artifacts.
`static final String`
`FOLLOW_ARTIFACT_REPOSITORY_REFERENCES`
Instructs the provisioning context to follow artifact repository references when providing queryables for obtaining metadata and artifacts.
`static final String`
`FOLLOW_REPOSITORY_REFERENCES`
Instructs the provisioning context to follow metadata repository references when providing queryables for obtaining metadata and artifacts.

## Constructor Summary

Constructors
Constructor
Description
`ProvisioningContext(IProvisioningAgent agent)`
Creates a new provisioning context that includes all available metadata and artifact repositories available to the specified provisioning agent.

## Method Summary

Modifier and Type
Method
Description
`IQueryable<IArtifactDescriptor>`
`getArtifactDescriptors(IProgressMonitor monitor)`
Returns a queryable that can be used to obtain any artifact descriptors that are needed for the provisioning operation.
`IQueryable<IArtifactKey>`
`getArtifactKeys(IProgressMonitor monitor)`
Returns a queryable that can be used to obtain any artifact keys that are needed for the provisioning operation.
`IQueryable<IArtifactRepository>`
`getArtifactRepositories(IProgressMonitor monitor)`
Returns a queryable that can be used to obtain any artifact repositories that are needed for the provisioning operation.
`Map<URI,Set<IArtifactKey>>`
`getArtifactSources(Collection<? extends IArtifactKey> keys, IProgressMonitor monitor)`
Returns a map from simple artifact repository location to a subset of the given artifact keys available in that repository.
`List<IInstallableUnit>`
`getExtraInstallableUnits()`
Returns the list of additional installable units that should be considered as available for installation by the planner.
`Map<URI,Set<IInstallableUnit>>`
`getInstallableUnitSources(Collection<? extends IInstallableUnit> ius, IProgressMonitor monitor)`
Returns a map from simple metadata repository location to a subset of the given installable units available in that repository.
`IQueryable<IInstallableUnit>`
`getMetadata(IProgressMonitor monitor)`
Returns a queryable that can be used to obtain any metadata (installable units) that are needed for the provisioning operation.
`Map<String,String>`
`getProperties()`
Returns the properties that are defined in this context.
`String`
`getProperty(String key)`
Returns the value of the property with the given key, or `null` if no such property is defined
`void`
`setArtifactRepositories(URI... artifactRepositories)`
Sets the artifact repositories to consult when performing an operation.
`void`
`setExtraInstallableUnits(List<IInstallableUnit> extraIUs)`
Sets the list of additional installable units that should be considered as available for installation by the planner.
`void`
`setMetadataRepositories(URI... metadataRepositories)`
Sets the metadata repositories to consult when performing an operation.
`void`
`setProperty(String key, String value)`
Sets a property on this provisioning context.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### FOLLOW_REPOSITORY_REFERENCES

public static final String FOLLOW_REPOSITORY_REFERENCES
Instructs the provisioning context to follow metadata repository references when providing queryables for obtaining metadata and artifacts. When this property is set to "true", then metadata repository references that are encountered while loading the specified metadata repositories will be included in the provisioning context.

See Also:
  - `getMetadata(IProgressMonitor)`
  - `setMetadataRepositories(URI[])`
  - Constant Field Values

### CHECK_AUTHORITIES

public static final String CHECK_AUTHORITIES
Instructs the `collect phase` to check the originating sources of all installable units and artifacts.

Since:
  2.8
See Also:
  - `getInstallableUnitSources(Collection, IProgressMonitor)`
  - `getArtifactSources(Collection, IProgressMonitor)`
  - Constant Field Values

### FOLLOW_ARTIFACT_REPOSITORY_REFERENCES

public static final String FOLLOW_ARTIFACT_REPOSITORY_REFERENCES
Instructs the provisioning context to follow artifact repository references when providing queryables for obtaining metadata and artifacts. When this property is set to "true", then artifact repository references that are encountered while loading the specified artifact repositories will be included in the provisioning context.

Since:
  2.10
See Also:
  - `setArtifactRepositories(URI...)`
  - Constant Field Values

## Constructor Details

### ProvisioningContext

public ProvisioningContext(IProvisioningAgent agent)
Creates a new provisioning context that includes all available metadata and artifact repositories available to the specified provisioning agent.

Parameters:
  `agent` - the provisioning agent from which to obtain any necessary services.

## Method Details

### getArtifactKeys

public IQueryable<IArtifactKey> getArtifactKeys(IProgressMonitor monitor)
Returns a queryable that can be used to obtain any artifact keys that are needed for the provisioning operation.

Parameters:
  `monitor` - a progress monitor to be used when creating the queryable
Returns:
  a queryable that can be used to query available artifact keys.
See Also:
  - `setArtifactRepositories(URI[])`

### getArtifactDescriptors

public IQueryable<IArtifactDescriptor> getArtifactDescriptors(IProgressMonitor monitor)
Returns a queryable that can be used to obtain any artifact descriptors that are needed for the provisioning operation.

Parameters:
  `monitor` - a progress monitor to be used when creating the queryable
Returns:
  a queryable that can be used to query available artifact descriptors.
See Also:
  - `setArtifactRepositories(URI[])`

### getArtifactRepositories

public IQueryable<IArtifactRepository> getArtifactRepositories(IProgressMonitor monitor)
Returns a queryable that can be used to obtain any artifact repositories that are needed for the provisioning operation.

Parameters:
  `monitor` - a progress monitor to be used when creating the queryable
Returns:
  a queryable that can be used to query available artifact repositories.
See Also:
  - `setArtifactRepositories(URI[])`

### getMetadata

public IQueryable<IInstallableUnit> getMetadata(IProgressMonitor monitor)
Returns a queryable that can be used to obtain any metadata (installable units) that are needed for the provisioning operation. The provisioning context has a distinct lifecycle, whereby the metadata and artifact repositories to be used are determined when the client retrieves retrieves the metadata queryable. Clients should not reset the list of metadata repository locations or artifact repository locations once the metadata queryable has been retrieved.

Parameters:
  `monitor` - a progress monitor to be used when creating the queryable
Returns:
  a queryable that can be used to query available metadata.
See Also:
  - `setMetadataRepositories(URI[])`
  - `FOLLOW_REPOSITORY_REFERENCES`

### getInstallableUnitSources

public Map<URI,Set<IInstallableUnit>> getInstallableUnitSources(Collection<? extends IInstallableUnit> ius, IProgressMonitor monitor)
Returns a map from simple metadata repository location to a subset of the given installable units available in that repository. All available `metadata repositories` are considered, including all transitive `composite children` and all `IMetadataRepository.getReferences()` where applicable.

Parameters:
  `ius` - the installable units to consider.
  `monitor` - a progress monitor to be used when querying the repositories.
Returns:
  a map from simple metadata repository location to a subset of the given installable units available in that repository.
Since:
  2.8

### getArtifactSources

public Map<URI,Set<IArtifactKey>> getArtifactSources(Collection<? extends IArtifactKey> keys, IProgressMonitor monitor)
Returns a map from simple artifact repository location to a subset of the given artifact keys available in that repository. All available `artifacts repositories` are considered, including all transitive `composite children` and all `IMetadataRepository.getReferences()` where applicable.

Parameters:
  `keys` - the artifact keys to consider.
  `monitor` - a progress monitor to be used when querying the repositories.
Returns:
  a map from simple artifact repository location to a subset of the given artifact keys available in that repository.
Since:
  2.8

### getExtraInstallableUnits

public List<IInstallableUnit> getExtraInstallableUnits()
Returns the list of additional installable units that should be considered as available for installation by the planner. Returns an empty list if there are no extra installable units to consider. This method has no effect on the execution of the engine.

Returns:
  The extra installable units that are available

### getProperties

public Map<String,String> getProperties()
Returns the properties that are defined in this context. Context properties can be used to influence the behavior of either the planner or engine.

Returns:
  the defined provisioning context properties

### getProperty

public String getProperty(String key)
Returns the value of the property with the given key, or `null` if no such property is defined

Parameters:
  `key` - the property key
Returns:
  the property value, or `null`

### setArtifactRepositories

public void setArtifactRepositories(URI... artifactRepositories)
Sets the artifact repositories to consult when performing an operation.

The provisioning context has a distinct lifecycle, whereby the metadata and artifact repositories to be used are determined when the client retrieves the metadata queryable. Clients should not reset the list of artifact repository locations once the metadata queryable has been retrieved.

Parameters:
  `artifactRepositories` - the artifact repository locations

### setMetadataRepositories

public void setMetadataRepositories(URI... metadataRepositories)
Sets the metadata repositories to consult when performing an operation.

The provisioning context has a distinct lifecycle, whereby the metadata and artifact repositories to be used are determined when the client retrieves the metadata queryable. Clients should not reset the list of metadata repository locations once the metadata queryable has been retrieved.

Parameters:
  `metadataRepositories` - the metadata repository locations

### setExtraInstallableUnits

public void setExtraInstallableUnits(List<IInstallableUnit> extraIUs)
Sets the list of additional installable units that should be considered as available for installation by the planner. This method has no effect on the execution of the engine.

Parameters:
  `extraIUs` - the extra installable units

### setProperty

public void setProperty(String key, String value)
Sets a property on this provisioning context. Context properties can be used to influence the behavior of either the planner or engine.

Parameters:
  `key` - the property key
  `value` - the property value

### toString

public String toString()

Overrides:
  `toString` in class `Object`