001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.eclipse.aether.impl;
020
021import java.util.Collection;
022import java.util.List;
023
024import org.eclipse.aether.RepositorySystem;
025import org.eclipse.aether.RepositorySystemSession;
026import org.eclipse.aether.artifact.Artifact;
027import org.eclipse.aether.resolution.ArtifactRequest;
028import org.eclipse.aether.resolution.ArtifactResolutionException;
029import org.eclipse.aether.resolution.ArtifactResult;
030
031/**
032 * Resolves artifacts, that is gets a local filesystem path to their binary contents.
033 *
034 * @noimplement This interface is not intended to be implemented by clients.
035 * @noextend This interface is not intended to be extended by clients.
036 * @provisional This type is provisional and can be changed, moved or removed without prior notice.
037 */
038public interface ArtifactResolver {
039
040    /**
041     * Resolves the path for an artifact. The artifact will be downloaded to the local repository if necessary. An
042     * artifact that is already resolved will be skipped and is not re-resolved. Note that this method assumes that any
043     * relocations have already been processed and the artifact coordinates are used as-is.
044     *
045     * @param session The repository session, must not be {@code null}.
046     * @param request The resolution request, must not be {@code null}.
047     * @return The resolution result, never {@code null}.
048     * @throws ArtifactResolutionException If the artifact could not be resolved.
049     * @see Artifact#getFile()
050     * @see RepositorySystem#resolveArtifact(RepositorySystemSession, ArtifactRequest)
051     */
052    ArtifactResult resolveArtifact(RepositorySystemSession session, ArtifactRequest request)
053            throws ArtifactResolutionException;
054
055    /**
056     * Resolves the paths for a collection of artifacts. Artifacts will be downloaded to the local repository if
057     * necessary. Artifacts that are already resolved will be skipped and are not re-resolved. Note that this method
058     * assumes that any relocations have already been processed and the artifact coordinates are used as-is.
059     *
060     * @param session The repository session, must not be {@code null}.
061     * @param requests The resolution requests, must not be {@code null}.
062     * @return The resolution results (in request order), never {@code null}.
063     * @throws ArtifactResolutionException If any artifact could not be resolved.
064     * @see Artifact#getFile()
065     * @see RepositorySystem#resolveArtifacts(RepositorySystemSession, Collection)
066     */
067    List<ArtifactResult> resolveArtifacts(
068            RepositorySystemSession session, Collection<? extends ArtifactRequest> requests)
069            throws ArtifactResolutionException;
070}