1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.eclipse.aether.impl;
20
21 import java.util.Collection;
22 import java.util.List;
23
24 import org.eclipse.aether.RepositorySystem;
25 import org.eclipse.aether.RepositorySystemSession;
26 import org.eclipse.aether.artifact.Artifact;
27 import org.eclipse.aether.resolution.ArtifactRequest;
28 import org.eclipse.aether.resolution.ArtifactResolutionException;
29 import org.eclipse.aether.resolution.ArtifactResult;
30
31 /**
32 * Resolves artifacts, that is gets a local filesystem path to their binary contents.
33 *
34 * @noimplement This interface is not intended to be implemented by clients.
35 * @noextend This interface is not intended to be extended by clients.
36 * @provisional This type is provisional and can be changed, moved or removed without prior notice.
37 */
38 public interface ArtifactResolver {
39
40 /**
41 * Resolves the path for an artifact. The artifact will be downloaded to the local repository if necessary. An
42 * artifact that is already resolved will be skipped and is not re-resolved. Note that this method assumes that any
43 * relocations have already been processed and the artifact coordinates are used as-is.
44 *
45 * @param session The repository session, must not be {@code null}.
46 * @param request The resolution request, must not be {@code null}.
47 * @return The resolution result, never {@code null}.
48 * @throws ArtifactResolutionException If the artifact could not be resolved.
49 * @see Artifact#getFile()
50 * @see RepositorySystem#resolveArtifact(RepositorySystemSession, ArtifactRequest)
51 */
52 ArtifactResult resolveArtifact(RepositorySystemSession session, ArtifactRequest request)
53 throws ArtifactResolutionException;
54
55 /**
56 * Resolves the paths for a collection of artifacts. Artifacts will be downloaded to the local repository if
57 * necessary. Artifacts that are already resolved will be skipped and are not re-resolved. Note that this method
58 * assumes that any relocations have already been processed and the artifact coordinates are used as-is.
59 *
60 * @param session The repository session, must not be {@code null}.
61 * @param requests The resolution requests, must not be {@code null}.
62 * @return The resolution results (in request order), never {@code null}.
63 * @throws ArtifactResolutionException If any artifact could not be resolved.
64 * @see Artifact#getFile()
65 * @see RepositorySystem#resolveArtifacts(RepositorySystemSession, Collection)
66 */
67 List<ArtifactResult> resolveArtifacts(
68 RepositorySystemSession session, Collection<? extends ArtifactRequest> requests)
69 throws ArtifactResolutionException;
70 }