Package org.eclipse.equinox.p2.repository.artifact

# Interface IArtifactRepository

All Superinterfaces:
  `IAdaptable`, `IQueryable<IArtifactKey>`, `IRepository<IArtifactKey>`

All Known Subinterfaces:
  `IFileArtifactRepository`

All Known Implementing Classes:
  `AbstractArtifactRepository`

public interface IArtifactRepository extends IRepository<IArtifactKey>
A repository containing artifacts.

This interface is not intended to be implemented by clients. Artifact repository implementations must subclass `AbstractArtifactRepository` rather than implementing this interface directly.

Since:
  2.0
Restriction:
  This interface is not intended to be implemented by clients. Instead subclass `AbstractArtifactRepository`.
Restriction:
  This interface is not intended to be extended by clients.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`CODE_RETRY`
The return code to use when a client could/should retry a failed getArtifact() operation.
`static final String`
`PROP_RUNNABLE`
The key for a boolean indicating if the repository is in runnable format.

### Fields inherited from interface org.eclipse.equinox.p2.repository.IRepository

`ENABLED, NONE, PREFERENCE_NODE, PROP_COMPRESSED, PROP_DESCRIPTION, PROP_MIRRORS_BASE_URL, PROP_MIRRORS_URL, PROP_NAME, PROP_NICKNAME, PROP_PASSWORD, PROP_SYSTEM, PROP_TIMESTAMP, PROP_USERNAME, TYPE_ARTIFACT, TYPE_METADATA`

## Method Summary

Modifier and Type
Method
Description
`void`
`addDescriptor(IArtifactDescriptor descriptor)`
Deprecated.
See {`addDescriptor(IArtifactDescriptor, IProgressMonitor)`
`void`
`addDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor)`
Add the given descriptor to the set of descriptors in this repository.
`void`
`addDescriptors(IArtifactDescriptor[] descriptors)`
Deprecated.
See {`addDescriptors(IArtifactDescriptor[], IProgressMonitor)`
`void`
`addDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor)`
Add the given artifact descriptors to this repository
`boolean`
`contains(IArtifactKey key)`
Returns true if this repository contains the given artifact key.
`boolean`
`contains(IArtifactDescriptor descriptor)`
Returns true if this repository contains the given descriptor.
`IArtifactDescriptor`
`createArtifactDescriptor(IArtifactKey key)`
Create an instance of `IArtifactDescriptor` based on the given key
`IArtifactKey`
`createArtifactKey(String classifier, String id, Version version)`
Create an instance of `IArtifactKey`
`IQueryable<IArtifactDescriptor>`
`descriptorQueryable()`
Returns a queryable that can be queried for artifact descriptors contained in this repository
`IStatus`
`executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor)`
Executes a runnable against this repository.
`IStatus`
`getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor)`
Writes to the given output stream the bytes represented by the artifact descriptor.
`IArtifactDescriptor[]`
`getArtifactDescriptors(IArtifactKey key)`
Return the set of artifact descriptors describing the ways that this repository can supply the artifact associated with the given artifact key
`IStatus`
`getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor)`
Executes the given artifact requests on this byte server.
`OutputStream`
`getOutputStream(IArtifactDescriptor descriptor)`
Open an output stream to which a client can write the data for the given artifact descriptor.
`IStatus`
`getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor)`
Writes to the given output stream the bytes represented by the artifact descriptor.
`void`
`removeAll()`
Deprecated.
See `removeAll(IProgressMonitor)`
`void`
`removeAll(IProgressMonitor monitor)`
Remove the all keys, descriptors, and contents from this repository.
`void`
`removeDescriptor(IArtifactKey key)`
Deprecated.
See `removeDescriptor(IArtifactKey, IProgressMonitor)`
`void`
`removeDescriptor(IArtifactKey key, IProgressMonitor monitor)`
Remove the given key and all related content and descriptors from this repository.
`void`
`removeDescriptor(IArtifactDescriptor descriptor)`
Deprecated.
See `removeDescriptor(IArtifactDescriptor, IProgressMonitor)`
`void`
`removeDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor)`
Remove the given descriptor and its corresponding content in this repository.
`void`
`removeDescriptors(IArtifactKey[] keys)`
Deprecated.
See `removeDescriptors(IArtifactKey[], IProgressMonitor)`
`void`
`removeDescriptors(IArtifactKey[] keys, IProgressMonitor monitor)`
Remove the given list of keys and all related content and descriptors from this repository.
`void`
`removeDescriptors(IArtifactDescriptor[] descriptors)`
Deprecated.
See `removeDescriptors(IArtifactDescriptor[], IProgressMonitor)`
`void`
`removeDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor)`
Remove the given list of artifact descriptors and their corresponding content in this repository.

### Methods inherited from interface org.eclipse.core.runtime.IAdaptable

`getAdapter`

### Methods inherited from interface org.eclipse.equinox.p2.query.IQueryable

`query`

### Methods inherited from interface org.eclipse.equinox.p2.repository.IRepository

`getDescription, getLocation, getName, getProperties, getProperty, getProvider, getProvisioningAgent, getType, getVersion, isModifiable, setProperty, setProperty`

## Field Details

### PROP_RUNNABLE

static final String PROP_RUNNABLE
The key for a boolean indicating if the repository is in runnable format.

Since:
  2.3
See Also:
  - `IRepository.getProperties()`
  - Constant Field Values

### CODE_RETRY

static final int CODE_RETRY
The return code to use when a client could/should retry a failed getArtifact() operation. For example, the repository may have additional mirrors that could be consulted.

See Also:
  - Constant Field Values

## Method Details

### createArtifactDescriptor

IArtifactDescriptor createArtifactDescriptor(IArtifactKey key)
Create an instance of `IArtifactDescriptor` based on the given key

Parameters:
  `key` - `IArtifactKey`
Returns:
  a new instance of IArtifactDescriptor

### createArtifactKey

IArtifactKey createArtifactKey(String classifier, String id, Version version)
Create an instance of `IArtifactKey`

Parameters:
  `classifier` - The classifier for this artifact key.
  `id` - The id for this artifact key.
  `version` - The version for this artifact key.
Returns:
  a new IArtifactKey

### addDescriptor

@Deprecated void addDescriptor(IArtifactDescriptor descriptor)
Deprecated.
See {`addDescriptor(IArtifactDescriptor, IProgressMonitor)`
Add the given descriptor to the set of descriptors in this repository. This is a relatively low-level operation that should be used only when the actual related content is in this repository and the given descriptor accurately describes that content.

Parameters:
  `descriptor` - the descriptor to add.

### addDescriptor

void addDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor)
Add the given descriptor to the set of descriptors in this repository. This is a relatively low-level operation that should be used only when the actual related content is in this repository and the given descriptor accurately describes that content.

Parameters:
  `descriptor` - the descriptor to add.
  `monitor` - A progress monitor use to track progress and cancel the operation. This may be a long running operation if another process holds the lock on this location
Since:
  2.1

### addDescriptors

@Deprecated void addDescriptors(IArtifactDescriptor[] descriptors)
Deprecated.
See {`addDescriptors(IArtifactDescriptor[], IProgressMonitor)`
Add the given artifact descriptors to this repository

Parameters:
  `descriptors` - the artifact descriptors to add

### addDescriptors

void addDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor)
Add the given artifact descriptors to this repository

Parameters:
  `descriptors` - the artifact descriptors to add
  `monitor` - A progress monitor use to track progress and cancel the operation. This may be a long running operation if another process holds the lock on this location
Since:
  2.1

### contains

boolean contains(IArtifactDescriptor descriptor)
Returns true if this repository contains the given descriptor.

Parameters:
  `descriptor` - the descriptor to query
Returns:
  true if the given descriptor is already in this repository

### contains

boolean contains(IArtifactKey key)
Returns true if this repository contains the given artifact key.

Specified by:
  `contains` in interface `IQueryable<IArtifactKey>`
Specified by:
  `contains` in interface `IRepository<IArtifactKey>`
Parameters:
  `key` - the key to query
Returns:
  true if the given key is already in this repository

### getArtifact

IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor)
Writes to the given output stream the bytes represented by the artifact descriptor. Any processing steps defined by the descriptor will be applied to the artifact bytes before they are sent to the provided output stream.

Parameters:
  `descriptor` - the descriptor to transfer
  `destination` - the stream to write the final artifact output to
  `monitor` - a progress monitor, or `null` if progress reporting and cancellation are not desired
Returns:
  the result of the artifact transfer

### getRawArtifact

IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor)
Writes to the given output stream the bytes represented by the artifact descriptor. Any processing steps defined by the descriptor will not be applied to the artifact bytes.

Parameters:
  `descriptor` - the descriptor to transfer
  `destination` - the stream to write the final artifact output to
  `monitor` - a progress monitor, or `null` if progress reporting and cancellation are not desired
Returns:
  the result of the artifact transfer

### getArtifactDescriptors

IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key)
Return the set of artifact descriptors describing the ways that this repository can supply the artifact associated with the given artifact key

Parameters:
  `key` - the artifact key to lookup
Returns:
  the descriptors associated with the given key

### getArtifacts

IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor)
Executes the given artifact requests on this byte server.

Parameters:
  `requests` - The artifact requests
  `monitor` - A progress monitor use to track progress and cancel the operation.
Returns:
  a status object that is `OK` if requests were processed successfully. Otherwise, a status indicating information, warnings, or errors that occurred while executing the artifact requests

### getOutputStream

OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException
Open an output stream to which a client can write the data for the given artifact descriptor.

Parameters:
  `descriptor` - the descriptor describing the artifact data to be written to the resultant stream
Returns:
  the stream to which the artifact content can be written. The returned output stream may implement `IStateful`.
Throws:
  `ProvisionException` - if the output stream could not be created. Reasons include:
  - An I/O exception occurred (@link `ProvisionException.REPOSITORY_FAILED_WRITE`) .
  - An artifact already exists at that location (`ProvisionException.ARTIFACT_EXISTS`).

### descriptorQueryable

IQueryable<IArtifactDescriptor> descriptorQueryable()
Returns a queryable that can be queried for artifact descriptors contained in this repository

Returns:
  The queryable of artifact descriptors

### removeAll

@Deprecated void removeAll()
Deprecated.
See `removeAll(IProgressMonitor)`
Remove the all keys, descriptors, and contents from this repository.

### removeAll

void removeAll(IProgressMonitor monitor)
Remove the all keys, descriptors, and contents from this repository.

Parameters:
  `monitor` - A progress monitor use to track progress and cancel the operation. This may be a long running operation if another process holds the lock on this location
Since:
  2.1

### removeDescriptor

@Deprecated void removeDescriptor(IArtifactDescriptor descriptor)
Deprecated.
See `removeDescriptor(IArtifactDescriptor, IProgressMonitor)`
Remove the given descriptor and its corresponding content in this repository.

Parameters:
  `descriptor` - the descriptor to remove.

### removeDescriptor

void removeDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor)
Remove the given descriptor and its corresponding content in this repository.

Parameters:
  `descriptor` - the descriptor to remove.
  `monitor` - A progress monitor use to track progress and cancel the operation. This may be a long running operation if another process holds the lock on this location
Since:
  2.1

### removeDescriptor

@Deprecated void removeDescriptor(IArtifactKey key)
Deprecated.
See `removeDescriptor(IArtifactKey, IProgressMonitor)`
Remove the given key and all related content and descriptors from this repository.

Parameters:
  `key` - the key to remove.

### removeDescriptor

void removeDescriptor(IArtifactKey key, IProgressMonitor monitor)
Remove the given key and all related content and descriptors from this repository.

Parameters:
  `key` - the key to remove.
  `monitor` - A progress monitor use to track progress and cancel the operation. This may be a long running operation if another process holds the lock on this location
Since:
  2.1

### removeDescriptors

@Deprecated void removeDescriptors(IArtifactDescriptor[] descriptors)
Deprecated.
See `removeDescriptors(IArtifactDescriptor[], IProgressMonitor)`
Remove the given list of artifact descriptors and their corresponding content in this repository.

Parameters:
  `descriptors` - the list of descriptors to remove
Since:
  2.1

### removeDescriptors

void removeDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor)
Remove the given list of artifact descriptors and their corresponding content in this repository.

Parameters:
  `descriptors` - the list of descriptors to remove
  `monitor` - A progress monitor use to track progress and cancel the operation. This may be a long running operation if another process holds the lock on this location
Since:
  2.1

### removeDescriptors

@Deprecated void removeDescriptors(IArtifactKey[] keys)
Deprecated.
See `removeDescriptors(IArtifactKey[], IProgressMonitor)`
Remove the given list of keys and all related content and descriptors from this repository.

Parameters:
  `keys` - The keys to remove.
Since:
  2.1

### removeDescriptors

void removeDescriptors(IArtifactKey[] keys, IProgressMonitor monitor)
Remove the given list of keys and all related content and descriptors from this repository.

Parameters:
  `keys` - The keys to remove.
  `monitor` - A progress monitor use to track progress and cancel the operation. This may be a long running operation if another process holds the lock on this location
Since:
  2.1

### executeBatch

IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor)
Executes a runnable against this repository. It is up to the repository implementor to determine what "batch process" means, for example, it may mean that the repository index is not stored until after the runnable completes. The runnable should not execute anything in a separate thread.

Parameters:
  `runnable` - The runnable to execute
  `monitor` - A progress monitor that will be passed to the runnable
Returns:
  The result of running the runnable. Any exceptions thrown during the execution will be returned in the status.