org.eclipse.aether.spi.connector

## Class ArtifactDownload

- java.lang.Object
- - org.eclipse.aether.spi.connector.Transfer
  - - org.eclipse.aether.spi.connector.ArtifactTransfer
    - - org.eclipse.aether.spi.connector.ArtifactDownload

-     public final class ArtifactDownload
      extends ArtifactTransfer

  A download of an artifact from a remote repository. A repository connector processing this download has to use `setException(ArtifactTransferException)` and `setSupportedContexts(Collection)` (if applicable) to report the results of the transfer.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.aether.spi.connector.Transfer

      `Transfer.State`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ArtifactDownload()` Creates a new uninitialized download.
    `ArtifactDownload(Artifact artifact, String context, File file, String checksumPolicy)` Creates a new download with the specified properties.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getChecksumPolicy()` Gets the checksum policy for this transfer.
    `File` | `getFile()` Gets the local file the artifact is downloaded to or uploaded from.
    `List<RemoteRepository>` | `getRepositories()` Gets the remote repositories that are being aggregated by the physically contacted remote repository (i.e. a repository manager).
    `String` | `getRequestContext()` Gets the context of this transfer.
    `Collection<String>` | `getSupportedContexts()` Gets the set of request contexts in which the artifact is generally available.
    `boolean` | `isExistenceCheck()` Indicates whether this transfer shall only verify the existence of the artifact in the remote repository rather than actually downloading the file.
    `ArtifactDownload` | `setArtifact(Artifact artifact)` Sets the artifact to transfer.
    `ArtifactDownload` | `setChecksumPolicy(String checksumPolicy)` Sets the checksum policy for this transfer.
    `ArtifactDownload` | `setException(ArtifactTransferException exception)` Sets the exception that occurred during the transfer.
    `ArtifactDownload` | `setExistenceCheck(boolean existenceCheck)` Controls whether this transfer shall only verify the existence of the artifact in the remote repository rather than actually downloading the file.
    `ArtifactDownload` | `setFile(File file)` Sets the local file the artifact is downloaded to or uploaded from.
    `ArtifactDownload` | `setListener(TransferListener listener)` Sets the listener that is to be notified during the transfer.
    `ArtifactDownload` | `setRepositories(List<RemoteRepository> repositories)` Sets the remote repositories that are being aggregated by the physically contacted remote repository (i.e. a repository manager).
    `ArtifactDownload` | `setRequestContext(String context)` Sets the context of this transfer.
    `ArtifactDownload` | `setSupportedContexts(Collection<String> contexts)` Sets the set of request contexts in which the artifact is generally available.
    `ArtifactDownload` | `setTrace(RequestTrace trace)` Sets the trace information that describes the higher level request/operation in which this transfer is issued.
    `String` | `toString()`

    - ### Methods inherited from class org.eclipse.aether.spi.connector.ArtifactTransfer

      `getArtifact, getException`

    - ### Methods inherited from class org.eclipse.aether.spi.connector.Transfer

      `getListener, getState, getTrace, setState`

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

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

- - ### Constructor Detail

    - #### ArtifactDownload

          public ArtifactDownload()

      Creates a new uninitialized download.

    - #### ArtifactDownload

          public ArtifactDownload(Artifact artifact,
                          String context,
                          File file,
                          String checksumPolicy)

      Creates a new download with the specified properties.
      Parameters:
        `artifact` - The artifact to download, may be `null`.
        `context` - The context in which this download is performed, may be `null`.
        `file` - The local file to download the artifact to, may be `null`.
        `checksumPolicy` - The checksum policy, may be `null`.

  - ### Method Detail

    - #### setArtifact

          public ArtifactDownload setArtifact(Artifact artifact)

      Description copied from class: `ArtifactTransfer`
      Sets the artifact to transfer.
      Overrides:
        `setArtifact` in class `ArtifactTransfer`
      Parameters:
        `artifact` - The artifact, may be `null`.
      Returns:
        This transfer for chaining, never `null`.

    - #### getFile

          public File getFile()

      Gets the local file the artifact is downloaded to or uploaded from. In case of a download, a connector should first transfer the bytes to a temporary file and only overwrite the target file once the entire download is completed such that an interrupted/failed download does not corrupt the current file contents. Note: In case of `isExistenceCheck()`, this method may return `null`.
      Overrides:
        `getFile` in class `ArtifactTransfer`
      Returns:
        The local file or `null` if not set.

    - #### setFile

          public ArtifactDownload setFile(File file)

      Description copied from class: `ArtifactTransfer`
      Sets the local file the artifact is downloaded to or uploaded from.
      Overrides:
        `setFile` in class `ArtifactTransfer`
      Parameters:
        `file` - The local file, may be `null`.
      Returns:
        This transfer for chaining, never `null`.

    - #### isExistenceCheck

          public boolean isExistenceCheck()

      Indicates whether this transfer shall only verify the existence of the artifact in the remote repository rather than actually downloading the file. Just like with an actual transfer, a connector is expected to signal the non-existence of the artifact by associating an `ArtifactNotFoundException` with this download. Note: If an existence check is requested, `getFile()` may be `null`, i.e. the connector must not try to access the local file.
      Returns:
        `true` if only the artifact existence shall be verified, `false` to actually download the artifact.

    - #### setExistenceCheck

          public ArtifactDownload setExistenceCheck(boolean existenceCheck)

      Controls whether this transfer shall only verify the existence of the artifact in the remote repository rather than actually downloading the file.
      Parameters:
        `existenceCheck` - `true` if only the artifact existence shall be verified, `false` to actually download the artifact.
      Returns:
        This transfer for chaining, never `null`.

    - #### getChecksumPolicy

          public String getChecksumPolicy()

      Gets the checksum policy for this transfer.
      Returns:
        The checksum policy, never `null`.

    - #### setChecksumPolicy

          public ArtifactDownload setChecksumPolicy(String checksumPolicy)

      Sets the checksum policy for this transfer.
      Parameters:
        `checksumPolicy` - The checksum policy, may be `null`.
      Returns:
        This transfer for chaining, never `null`.

    - #### getRequestContext

          public String getRequestContext()

      Gets the context of this transfer.
      Returns:
        The context id, never `null`.

    - #### setRequestContext

          public ArtifactDownload setRequestContext(String context)

      Sets the context of this transfer.
      Parameters:
        `context` - The context id, may be `null`.
      Returns:
        This transfer for chaining, never `null`.

    - #### getSupportedContexts

          public Collection<String> getSupportedContexts()

      Gets the set of request contexts in which the artifact is generally available. Repository managers can indicate that an artifact is available in more than the requested context to avoid future remote trips for the same artifact in a different context.
      Returns:
        The set of requests context in which the artifact is available, never `null`.

    - #### setSupportedContexts

          public ArtifactDownload setSupportedContexts(Collection<String> contexts)

      Sets the set of request contexts in which the artifact is generally available. Repository managers can indicate that an artifact is available in more than the requested context to avoid future remote trips for the same artifact in a different context. The set of supported contexts defaults to the original request context if not overridden by the repository connector.
      Parameters:
        `contexts` - The set of requests context in which the artifact is available, may be `null`.
      Returns:
        This transfer for chaining, never `null`.

    - #### getRepositories

          public List<RemoteRepository> getRepositories()

      Gets the remote repositories that are being aggregated by the physically contacted remote repository (i.e. a repository manager).
      Returns:
        The remote repositories being aggregated, never `null`.

    - #### setRepositories

          public ArtifactDownload setRepositories(List<RemoteRepository> repositories)

      Sets the remote repositories that are being aggregated by the physically contacted remote repository (i.e. a repository manager).
      Parameters:
        `repositories` - The remote repositories being aggregated, may be `null`.
      Returns:
        This transfer for chaining, never `null`.

    - #### setException

          public ArtifactDownload setException(ArtifactTransferException exception)

      Description copied from class: `ArtifactTransfer`
      Sets the exception that occurred during the transfer.
      Overrides:
        `setException` in class `ArtifactTransfer`
      Parameters:
        `exception` - The exception, may be `null` to denote a successful transfer.
      Returns:
        This transfer for chaining, never `null`.

    - #### setListener

          public ArtifactDownload setListener(TransferListener listener)

      Description copied from class: `Transfer`
      Sets the listener that is to be notified during the transfer.
      Parameters:
        `listener` - The transfer listener to notify, may be `null` if none.
      Returns:
        This transfer for chaining, never `null`.

    - #### setTrace

          public ArtifactDownload setTrace(RequestTrace trace)

      Description copied from class: `Transfer`
      Sets the trace information that describes the higher level request/operation in which this transfer is issued.
      Parameters:
        `trace` - The trace information about the higher level operation, may be `null`.
      Returns:
        This transfer for chaining, never `null`.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2010-2013 The Eclipse Foundation. All Rights Reserved.