Package 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 usesetException(ArtifactTransferException)andsetSupportedContexts(Collection)(if applicable) to report the results of the transfer.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringchecksumPolicyprivate java.lang.Stringcontextprivate java.util.Collection<java.lang.String>contextsprivate booleanexistenceCheckprivate java.util.List<RemoteRepository>repositories
-
Constructor Summary
Constructors Constructor Description ArtifactDownload()Creates a new uninitialized download.ArtifactDownload(Artifact artifact, java.lang.String context, java.io.File file, java.lang.String checksumPolicy)Creates a new download with the specified properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetChecksumPolicy()Gets the checksum policy for this transfer.java.util.List<RemoteRepository>getRepositories()Gets the remote repositories that are being aggregated by the physically contacted remote repository (i.e.java.lang.StringgetRequestContext()Gets the context of this transfer.java.util.Collection<java.lang.String>getSupportedContexts()Gets the set of request contexts in which the artifact is generally available.booleanisExistenceCheck()Indicates whether this transfer shall only verify the existence of the artifact in the remote repository rather than actually downloading the file.ArtifactDownloadsetArtifact(Artifact artifact)Sets the artifact to transfer.ArtifactDownloadsetChecksumPolicy(java.lang.String checksumPolicy)Sets the checksum policy for this transfer.ArtifactDownloadsetException(ArtifactTransferException exception)Sets the exception that occurred during the transfer.ArtifactDownloadsetExistenceCheck(boolean existenceCheck)Controls whether this transfer shall only verify the existence of the artifact in the remote repository rather than actually downloading the file.ArtifactDownloadsetFile(java.io.File file)Sets the local file the artifact is downloaded to or uploaded from.ArtifactDownloadsetListener(TransferListener listener)Sets the listener that is to be notified during the transfer.ArtifactDownloadsetRepositories(java.util.List<RemoteRepository> repositories)Sets the remote repositories that are being aggregated by the physically contacted remote repository (i.e.ArtifactDownloadsetRequestContext(java.lang.String context)Sets the context of this transfer.ArtifactDownloadsetSupportedContexts(java.util.Collection<java.lang.String> contexts)Sets the set of request contexts in which the artifact is generally available.ArtifactDownloadsetTrace(RequestTrace trace)Sets the trace information that describes the higher level request/operation in which this transfer is issued.java.lang.StringtoString()-
Methods inherited from class org.eclipse.aether.spi.connector.ArtifactTransfer
getArtifact, getException, getFile
-
Methods inherited from class org.eclipse.aether.spi.connector.Transfer
getListener, getTrace
-
-
-
-
Field Detail
-
existenceCheck
private boolean existenceCheck
-
checksumPolicy
private java.lang.String checksumPolicy
-
context
private java.lang.String context
-
contexts
private java.util.Collection<java.lang.String> contexts
-
repositories
private java.util.List<RemoteRepository> repositories
-
-
Constructor Detail
-
ArtifactDownload
public ArtifactDownload()
Creates a new uninitialized download.
-
ArtifactDownload
public ArtifactDownload(Artifact artifact, java.lang.String context, java.io.File file, java.lang.String checksumPolicy)
Creates a new download with the specified properties.- Parameters:
artifact- The artifact to download, may benull.context- The context in which this download is performed, may benull.file- The local file to download the artifact to, may benull.checksumPolicy- The checksum policy, may benull.
-
-
Method Detail
-
setArtifact
public ArtifactDownload setArtifact(Artifact artifact)
Description copied from class:ArtifactTransferSets the artifact to transfer.- Overrides:
setArtifactin classArtifactTransfer- Parameters:
artifact- The artifact, may benull.- Returns:
- This transfer for chaining, never
null.
-
setFile
public ArtifactDownload setFile(java.io.File file)
Description copied from class:ArtifactTransferSets the local file the artifact is downloaded to or uploaded from.- Overrides:
setFilein classArtifactTransfer- Parameters:
file- The local file, may benull.- 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 anArtifactNotFoundExceptionwith this download. Note: If an existence check is requested,ArtifactTransfer.getFile()may benull, i.e. the connector must not try to access the local file.- Returns:
trueif only the artifact existence shall be verified,falseto 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-trueif only the artifact existence shall be verified,falseto actually download the artifact.- Returns:
- This transfer for chaining, never
null.
-
getChecksumPolicy
public java.lang.String getChecksumPolicy()
Gets the checksum policy for this transfer.- Returns:
- The checksum policy, never
null.
-
setChecksumPolicy
public ArtifactDownload setChecksumPolicy(java.lang.String checksumPolicy)
Sets the checksum policy for this transfer.- Parameters:
checksumPolicy- The checksum policy, may benull.- Returns:
- This transfer for chaining, never
null.
-
getRequestContext
public java.lang.String getRequestContext()
Gets the context of this transfer.- Returns:
- The context id, never
null.
-
setRequestContext
public ArtifactDownload setRequestContext(java.lang.String context)
Sets the context of this transfer.- Parameters:
context- The context id, may benull.- Returns:
- This transfer for chaining, never
null.
-
getSupportedContexts
public java.util.Collection<java.lang.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(java.util.Collection<java.lang.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 benull.- Returns:
- This transfer for chaining, never
null.
-
getRepositories
public java.util.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(java.util.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 benull.- Returns:
- This transfer for chaining, never
null.
-
setException
public ArtifactDownload setException(ArtifactTransferException exception)
Description copied from class:ArtifactTransferSets the exception that occurred during the transfer.- Overrides:
setExceptionin classArtifactTransfer- Parameters:
exception- The exception, may benullto denote a successful transfer.- Returns:
- This transfer for chaining, never
null.
-
setListener
public ArtifactDownload setListener(TransferListener listener)
Description copied from class:TransferSets the listener that is to be notified during the transfer.- Overrides:
setListenerin classTransfer- Parameters:
listener- The transfer listener to notify, may benullif none.- Returns:
- This transfer for chaining, never
null.
-
setTrace
public ArtifactDownload setTrace(RequestTrace trace)
Description copied from class:TransferSets the trace information that describes the higher level request/operation in which this transfer is issued.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-