1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.eclipse.aether.spi.connector;
20
21 import java.io.File;
22
23 import org.eclipse.aether.RequestTrace;
24 import org.eclipse.aether.artifact.Artifact;
25 import org.eclipse.aether.transfer.ArtifactTransferException;
26 import org.eclipse.aether.transfer.TransferListener;
27
28 /**
29 * An upload of an artifact to a remote repository. A repository connector processing this upload has to use
30 * {@link #setException(ArtifactTransferException)} to report the results of the transfer.
31 */
32 public final class ArtifactUpload extends ArtifactTransfer {
33 /**
34 * Creates a new uninitialized upload.
35 */
36 public ArtifactUpload() {
37 // enables default constructor
38 }
39
40 /**
41 * Creates a new upload with the specified properties.
42 *
43 * @param artifact The artifact to upload, may be {@code null}.
44 * @param file The local file to upload the artifact from, may be {@code null}.
45 */
46 public ArtifactUpload(Artifact artifact, File file) {
47 setArtifact(artifact);
48 setFile(file);
49 }
50
51 @Override
52 public ArtifactUpload setArtifact(Artifact artifact) {
53 super.setArtifact(artifact);
54 return this;
55 }
56
57 @Override
58 public ArtifactUpload setFile(File file) {
59 super.setFile(file);
60 return this;
61 }
62
63 @Override
64 public ArtifactUpload setException(ArtifactTransferException exception) {
65 super.setException(exception);
66 return this;
67 }
68
69 @Override
70 public ArtifactUpload setListener(TransferListener listener) {
71 super.setListener(listener);
72 return this;
73 }
74
75 @Override
76 public ArtifactUpload setTrace(RequestTrace trace) {
77 super.setTrace(trace);
78 return this;
79 }
80
81 @Override
82 public String toString() {
83 return getArtifact() + " - " + getFile();
84 }
85 }