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