1 package org.sonatype.aether.transfer; 2 3 /******************************************************************************* 4 * Copyright (c) 2010-2011 Sonatype, Inc. 5 * All rights reserved. This program and the accompanying materials 6 * are made available under the terms of the Eclipse Public License v1.0 7 * which accompanies this distribution, and is available at 8 * http://www.eclipse.org/legal/epl-v10.html 9 *******************************************************************************/ 10 11 import java.io.File; 12 13 import org.sonatype.aether.RequestTrace; 14 15 /** 16 * Describes a resource being uploaded or downloaded by the repository system. 17 * 18 * @author Benjamin Bentmann 19 */ 20 public interface TransferResource 21 { 22 23 /** 24 * The base URL of the repository, e.g. "http://repo1.maven.org/maven2/". Unless the URL is unknown, it will be 25 * terminated by a trailing slash. 26 * 27 * @return The base URL of the repository or an empty string if unknown, never {@code null}. 28 */ 29 String getRepositoryUrl(); 30 31 /** 32 * The path of the resource relative to the repository's base URL, e.g. "org/apache/maven/maven/3.0/maven-3.0.pom". 33 * 34 * @return The path of the resource, never {@code null}. 35 */ 36 String getResourceName(); 37 38 /** 39 * Gets the local file being uploaded or downloaded. When the repository system merely checks for the existence of a 40 * remote resource, no local file will be involved in the transfer. 41 * 42 * @return The source/target file involved in the transfer or {@code null} if none. 43 */ 44 File getFile(); 45 46 /** 47 * The size of the resource in bytes. Note that the size of a resource during downloads might be unknown to the 48 * client which is usually the case when transfers employ compression like gzip. In general, the content length is 49 * not known until the transfer has {@link TransferListener#transferStarted(TransferEvent) started}. 50 * 51 * @return The size of the resource in bytes or a negative value if unknown. 52 */ 53 long getContentLength(); 54 55 /** 56 * Gets the timestamp when the transfer of this resource was started. 57 * 58 * @return The timestamp when the transfer of this resource was started. 59 */ 60 long getTransferStartTime(); 61 62 /** 63 * Gets the trace information that describes the higher level request/operation during which this resource is 64 * transferred. 65 * 66 * @return The trace information about the higher level operation or {@code null} if none. 67 */ 68 RequestTrace getTrace(); 69 70 }