1 package org.eclipse.aether.spi.connector; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import org.eclipse.aether.RequestTrace; 23 import org.eclipse.aether.transfer.TransferListener; 24 25 /** 26 * An artifact/metadata transfer. 27 * 28 * @noextend This class is not intended to be extended by clients. 29 */ 30 public abstract class Transfer 31 { 32 33 private TransferListener listener; 34 35 private RequestTrace trace; 36 37 Transfer() 38 { 39 // hide from public 40 } 41 42 /** 43 * Gets the exception that occurred during the transfer (if any). 44 * 45 * @return The exception or {@code null} if the transfer was successful. 46 */ 47 public abstract Exception getException(); 48 49 /** 50 * Gets the listener that is to be notified during the transfer. 51 * 52 * @return The transfer listener or {@code null} if none. 53 */ 54 public TransferListener getListener() 55 { 56 return listener; 57 } 58 59 /** 60 * Sets the listener that is to be notified during the transfer. 61 * 62 * @param listener The transfer listener to notify, may be {@code null} if none. 63 * @return This transfer for chaining, never {@code null}. 64 */ 65 Transfer setListener( TransferListener listener ) 66 { 67 this.listener = listener; 68 return this; 69 } 70 71 /** 72 * Gets the trace information that describes the higher level request/operation in which this transfer is issued. 73 * 74 * @return The trace information about the higher level operation or {@code null} if none. 75 */ 76 public RequestTrace getTrace() 77 { 78 return trace; 79 } 80 81 /** 82 * Sets the trace information that describes the higher level request/operation in which this transfer is issued. 83 * 84 * @param trace The trace information about the higher level operation, may be {@code null}. 85 * @return This transfer for chaining, never {@code null}. 86 */ 87 Transfer setTrace( RequestTrace trace ) 88 { 89 this.trace = trace; 90 return this; 91 } 92 93 }