1 package org.sonatype.aether.spi.connector; 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.util.Collection; 12 13 /** 14 * A connector for a remote repository. The connector is responsible for downloading/uploading of artifacts and metadata 15 * from/to a remote repository. Besides performing the actual transfer and recording any exception encountered in the 16 * provided upload/download objects, a connector must also use 17 * {@link Transfer#setState(org.sonatype.aether.spi.connector.Transfer.State)} to update the state of a transfer during 18 * its processing. Furthermore, the connector must notify any {@link org.sonatype.aether.transfer.TransferListener 19 * TransferListener} configured on its associated {@link org.sonatype.aether.RepositorySystemSession 20 * RepositorySystemSession}. If applicable, a connector should obey connect/request timeouts and other relevant settings 21 * from the configuration properties of the repository system session. While a connector itself can use multiple threads 22 * internally to performs the transfers, clients must not call a connector concurrently, i.e. connectors are generally 23 * not thread-safe. 24 * 25 * @author Benjamin Bentmann 26 * @see org.sonatype.aether.RepositorySystemSession#getConfigProperties() 27 */ 28 public interface RepositoryConnector 29 { 30 31 /** 32 * Performs the specified downloads. Any error encountered during a transfer can later be queried via 33 * {@link ArtifactDownload#getException()} and {@link MetadataDownload#getException()}, respectively. The connector 34 * may perform the transfers concurrently and in any order. 35 * 36 * @param artifactDownloads The artifact downloads to perform, may be {@code null} or empty. 37 * @param metadataDownloads The metadata downloads to perform, may be {@code null} or empty. 38 */ 39 void get( Collection<? extends ArtifactDownload> artifactDownloads, 40 Collection<? extends MetadataDownload> metadataDownloads ); 41 42 /** 43 * Performs the specified uploads. Any error encountered during a transfer can later be queried via 44 * {@link ArtifactDownload#getException()} and {@link MetadataDownload#getException()}, respectively. The connector 45 * may perform the transfers concurrently and in any order. 46 * 47 * @param artifactUploads The artifact uploads to perform, may be {@code null} or empty. 48 * @param metadataUploads The metadata uploads to perform, may be {@code null} or empty. 49 */ 50 void put( Collection<? extends ArtifactUpload> artifactUploads, Collection<? extends MetadataUpload> metadataUploads ); 51 52 /** 53 * Closes this connector and frees any network resources associated with it. Once closed, a connector must not be 54 * used for further transfers, any attempt to do so would yield a {@link IllegalStateException} or similar. Closing 55 * an already closed connector is harmless and has no effect. 56 */ 57 void close(); 58 59 }