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 java.io.Closeable;
23 import java.util.Collection;
24
25 /**
26 * A connector for a remote repository. The connector is responsible for downloading/uploading of artifacts and metadata
27 * from/to a remote repository.
28 * <p>
29 * If applicable, a connector should obey connect/request timeouts and other relevant settings from the
30 * {@link org.eclipse.aether.RepositorySystemSession#getConfigProperties() configuration properties} of the repository
31 * session it has been obtained for. However, a connector must not emit any events to the transfer listener configured
32 * for the session. Instead, transfer events must be emitted only to the listener (if any) specified for a given
33 * download/upload request.
34 * <p>
35 * <strong>Note:</strong> While a connector itself can use multiple threads internally to performs the transfers,
36 * clients must not call a connector concurrently, i.e. connectors are generally not thread-safe.
37 *
38 * @see org.eclipse.aether.spi.connector.transport.TransporterProvider
39 * @see org.eclipse.aether.spi.connector.layout.RepositoryLayoutProvider
40 * @see org.eclipse.aether.spi.connector.checksum.ChecksumPolicyProvider
41 */
42 public interface RepositoryConnector
43 extends Closeable
44 {
45
46 /**
47 * Performs the specified downloads. If a download fails, the connector stores the underlying exception in the
48 * download object such that callers can inspect the result via {@link ArtifactDownload#getException()} and
49 * {@link MetadataDownload#getException()}, respectively. If reasonable, a connector should continue to process the
50 * remaining downloads after an error to retrieve as many items as possible. The connector may perform the transfers
51 * concurrently and in any order.
52 *
53 * @param artifactDownloads The artifact downloads to perform, may be {@code null} or empty.
54 * @param metadataDownloads The metadata downloads to perform, may be {@code null} or empty.
55 */
56 void get( Collection<? extends ArtifactDownload> artifactDownloads,
57 Collection<? extends MetadataDownload> metadataDownloads );
58
59 /**
60 * Performs the specified uploads. If an upload fails, the connector stores the underlying exception in the upload
61 * object such that callers can inspect the result via {@link ArtifactUpload#getException()} and
62 * {@link MetadataUpload#getException()}, respectively. The connector may perform the transfers concurrently and in
63 * any order.
64 *
65 * @param artifactUploads The artifact uploads to perform, may be {@code null} or empty.
66 * @param metadataUploads The metadata uploads to perform, may be {@code null} or empty.
67 */
68 void put( Collection<? extends ArtifactUpload> artifactUploads, Collection<? extends MetadataUpload> metadataUploads );
69
70 /**
71 * Closes this connector and frees any network resources associated with it. Once closed, a connector must not be
72 * used for further transfers, any attempt to do so would yield a {@link IllegalStateException} or similar. Closing
73 * an already closed connector is harmless and has no effect.
74 */
75 void close();
76
77 }