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 org.eclipse.aether.RequestTrace;
023import org.eclipse.aether.transfer.TransferListener;
024
025/**
026 * An artifact/metadata transfer.
027 * 
028 * @noextend This class is not intended to be extended by clients.
029 */
030public abstract class Transfer
031{
032
033    private TransferListener listener;
034
035    private RequestTrace trace;
036
037    Transfer()
038    {
039        // hide from public
040    }
041
042    /**
043     * Gets the exception that occurred during the transfer (if any).
044     * 
045     * @return The exception or {@code null} if the transfer was successful.
046     */
047    public abstract Exception getException();
048
049    /**
050     * Gets the listener that is to be notified during the transfer.
051     * 
052     * @return The transfer listener or {@code null} if none.
053     */
054    public TransferListener getListener()
055    {
056        return listener;
057    }
058
059    /**
060     * Sets the listener that is to be notified during the transfer.
061     * 
062     * @param listener The transfer listener to notify, may be {@code null} if none.
063     * @return This transfer for chaining, never {@code null}.
064     */
065    Transfer setListener( TransferListener listener )
066    {
067        this.listener = listener;
068        return this;
069    }
070
071    /**
072     * Gets the trace information that describes the higher level request/operation in which this transfer is issued.
073     * 
074     * @return The trace information about the higher level operation or {@code null} if none.
075     */
076    public RequestTrace getTrace()
077    {
078        return trace;
079    }
080
081    /**
082     * Sets the trace information that describes the higher level request/operation in which this transfer is issued.
083     * 
084     * @param trace The trace information about the higher level operation, may be {@code null}.
085     * @return This transfer for chaining, never {@code null}.
086     */
087    Transfer setTrace( RequestTrace trace )
088    {
089        this.trace = trace;
090        return this;
091    }
092
093}