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.metadata.Metadata;
25 import org.eclipse.aether.transfer.MetadataTransferException;
26 import org.eclipse.aether.transfer.TransferListener;
27
28 /**
29 * An upload of metadata to a remote repository. A repository connector processing this upload has to use
30 * {@link #setException(MetadataTransferException)} to report the results of the transfer.
31 */
32 public final class MetadataUpload extends MetadataTransfer {
33
34 /**
35 * Creates a new uninitialized upload.
36 */
37 public MetadataUpload() {
38 // enables default constructor
39 }
40
41 /**
42 * Creates a new upload with the specified properties.
43 *
44 * @param metadata The metadata to upload, may be {@code null}.
45 * @param file The local file to upload the metadata from, may be {@code null}.
46 */
47 public MetadataUpload(Metadata metadata, File file) {
48 setMetadata(metadata);
49 setFile(file);
50 }
51
52 @Override
53 public MetadataUpload setMetadata(Metadata metadata) {
54 super.setMetadata(metadata);
55 return this;
56 }
57
58 @Override
59 public MetadataUpload setFile(File file) {
60 super.setFile(file);
61 return this;
62 }
63
64 @Override
65 public MetadataUpload setException(MetadataTransferException exception) {
66 super.setException(exception);
67 return this;
68 }
69
70 @Override
71 public MetadataUpload setListener(TransferListener listener) {
72 super.setListener(listener);
73 return this;
74 }
75
76 @Override
77 public MetadataUpload setTrace(RequestTrace trace) {
78 super.setTrace(trace);
79 return this;
80 }
81
82 @Override
83 public String toString() {
84 return getMetadata() + " - " + getFile();
85 }
86 }