org.sonatype.aether.spi.connector
Class ArtifactTransfer

java.lang.Object
  extended by org.sonatype.aether.spi.connector.Transfer
      extended by org.sonatype.aether.spi.connector.ArtifactTransfer
Direct Known Subclasses:
ArtifactDownload, ArtifactUpload

public abstract class ArtifactTransfer
extends Transfer

A download/upload of an artifact.

Author:
Benjamin Bentmann

Nested Class Summary
 
Nested classes/interfaces inherited from class org.sonatype.aether.spi.connector.Transfer
Transfer.State
 
Constructor Summary
ArtifactTransfer()
           
 
Method Summary
 Artifact getArtifact()
          Gets the artifact being transferred.
 ArtifactTransferException getException()
          Gets the exception that occurred during the transfer (if any).
 java.io.File getFile()
          Gets the local file the artifact is downloaded to or uploaded from.
 ArtifactTransfer setArtifact(Artifact artifact)
          Sets the artifact to transfer.
 ArtifactTransfer setException(ArtifactTransferException exception)
          Sets the exception that occurred during the transfer.
 ArtifactTransfer setFile(java.io.File file)
          Sets the local file the artifact is downloaded to or uploaded from.
 
Methods inherited from class org.sonatype.aether.spi.connector.Transfer
getState, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArtifactTransfer

public ArtifactTransfer()
Method Detail

getArtifact

public Artifact getArtifact()
Gets the artifact being transferred.

Returns:
The artifact being transferred or null if not set.

setArtifact

public ArtifactTransfer setArtifact(Artifact artifact)
Sets the artifact to transfer.

Parameters:
artifact - The artifact, may be null.
Returns:
This transfer for chaining, never null.

getFile

public java.io.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.

Returns:
The local file or null if not set.

setFile

public ArtifactTransfer setFile(java.io.File file)
Sets the local file the artifact is downloaded to or uploaded from.

Parameters:
file - The local file, may be null.
Returns:
This transfer for chaining, never null.

getException

public ArtifactTransferException getException()
Gets the exception that occurred during the transfer (if any).

Returns:
The exception or null if the transfer was successful.

setException

public ArtifactTransfer setException(ArtifactTransferException exception)
Sets the exception that occurred during the transfer.

Parameters:
exception - The exception, may be null to denote a successful transfer.
Returns:
This transfer for chaining, never null.


Copyright © 2010 Sonatype, Inc.. All Rights Reserved.