001package org.eclipse.aether.spi.connector; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.io.File; 023 024import org.eclipse.aether.RequestTrace; 025import org.eclipse.aether.artifact.Artifact; 026import org.eclipse.aether.transfer.ArtifactTransferException; 027import org.eclipse.aether.transfer.TransferListener; 028 029/** 030 * An upload of an artifact to a remote repository. A repository connector processing this upload has to use 031 * {@link #setException(ArtifactTransferException)} to report the results of the transfer. 032 */ 033public final class ArtifactUpload 034 extends ArtifactTransfer 035{ 036 037 /** 038 * Creates a new uninitialized upload. 039 */ 040 public ArtifactUpload() 041 { 042 // enables default constructor 043 } 044 045 /** 046 * Creates a new upload with the specified properties. 047 * 048 * @param artifact The artifact to upload, may be {@code null}. 049 * @param file The local file to upload the artifact from, may be {@code null}. 050 */ 051 public ArtifactUpload( Artifact artifact, File file ) 052 { 053 setArtifact( artifact ); 054 setFile( file ); 055 } 056 057 @Override 058 public ArtifactUpload setArtifact( Artifact artifact ) 059 { 060 super.setArtifact( artifact ); 061 return this; 062 } 063 064 @Override 065 public ArtifactUpload setFile( File file ) 066 { 067 super.setFile( file ); 068 return this; 069 } 070 071 @Override 072 public ArtifactUpload setException( ArtifactTransferException exception ) 073 { 074 super.setException( exception ); 075 return this; 076 } 077 078 @Override 079 public ArtifactUpload setListener( TransferListener listener ) 080 { 081 super.setListener( listener ); 082 return this; 083 } 084 085 @Override 086 public ArtifactUpload setTrace( RequestTrace trace ) 087 { 088 super.setTrace( trace ); 089 return this; 090 } 091 092 @Override 093 public String toString() 094 { 095 return getArtifact() + " - " + getFile(); 096 } 097 098}