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.metadata.Metadata;
026import org.eclipse.aether.transfer.MetadataTransferException;
027import org.eclipse.aether.transfer.TransferListener;
028
029/**
030 * An upload of metadata to a remote repository. A repository connector processing this upload has to use
031 * {@link #setException(MetadataTransferException)} to report the results of the transfer.
032 */
033public final class MetadataUpload
034    extends MetadataTransfer
035{
036
037    /**
038     * Creates a new uninitialized upload.
039     */
040    public MetadataUpload()
041    {
042        // enables default constructor
043    }
044
045    /**
046     * Creates a new upload with the specified properties.
047     * 
048     * @param metadata The metadata to upload, may be {@code null}.
049     * @param file The local file to upload the metadata from, may be {@code null}.
050     */
051    public MetadataUpload( Metadata metadata, File file )
052    {
053        setMetadata( metadata );
054        setFile( file );
055    }
056
057    @Override
058    public MetadataUpload setMetadata( Metadata metadata )
059    {
060        super.setMetadata( metadata );
061        return this;
062    }
063
064    @Override
065    public MetadataUpload setFile( File file )
066    {
067        super.setFile( file );
068        return this;
069    }
070
071    @Override
072    public MetadataUpload setException( MetadataTransferException exception )
073    {
074        super.setException( exception );
075        return this;
076    }
077
078    @Override
079    public MetadataUpload setListener( TransferListener listener )
080    {
081        super.setListener( listener );
082        return this;
083    }
084
085    @Override
086    public MetadataUpload setTrace( RequestTrace trace )
087    {
088        super.setTrace( trace );
089        return this;
090    }
091
092    @Override
093    public String toString()
094    {
095        return getMetadata() + " - " + getFile();
096    }
097
098}