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.List;
022
023import org.eclipse.aether.RepositorySystemSession;
024import org.eclipse.aether.repository.RemoteRepository;
025import org.eclipse.aether.repository.RepositoryPolicy;
026
027/**
028 * Helps dealing with remote repository definitions.
029 *
030 * @noimplement This interface is not intended to be implemented by clients.
031 * @noextend This interface is not intended to be extended by clients.
032 * @provisional This type is provisional and can be changed, moved or removed without prior notice.
033 */
034public interface RemoteRepositoryManager {
035
036    /**
037     * Aggregates repository definitions by merging duplicate repositories and optionally applies mirror, proxy and
038     * authentication settings from the supplied session.
039     *
040     * @param session The repository session during which the repositories will be accessed, must not be {@code null}.
041     * @param dominantRepositories The current list of remote repositories to merge the new definitions into, must not
042     *            be {@code null}.
043     * @param recessiveRepositories The remote repositories to merge into the existing list, must not be {@code null}.
044     * @param recessiveIsRaw {@code true} if the recessive repository definitions have not yet been subjected to mirror,
045     *            proxy and authentication settings, {@code false} otherwise.
046     * @return The aggregated list of remote repositories, never {@code null}.
047     * @see RepositorySystemSession#getMirrorSelector()
048     * @see RepositorySystemSession#getProxySelector()
049     * @see RepositorySystemSession#getAuthenticationSelector()
050     */
051    List<RemoteRepository> aggregateRepositories(
052            RepositorySystemSession session,
053            List<RemoteRepository> dominantRepositories,
054            List<RemoteRepository> recessiveRepositories,
055            boolean recessiveIsRaw);
056
057    /**
058     * Gets the effective repository policy for the specified remote repository by merging the applicable
059     * snapshot/release policy of the repository with global settings from the supplied session.
060     *
061     * @param session The repository session during which the repository will be accessed, must not be {@code null}.
062     * @param repository The remote repository to determine the effective policy for, must not be {@code null}.
063     * @param releases {@code true} if the policy for release artifacts needs to be considered, {@code false} if not.
064     * @param snapshots {@code true} if the policy for snapshot artifacts needs to be considered, {@code false} if not.
065     * @return The effective repository policy, never {@code null}.
066     * @see RepositorySystemSession#getChecksumPolicy()
067     * @see RepositorySystemSession#getUpdatePolicy()
068     */
069    RepositoryPolicy getPolicy(
070            RepositorySystemSession session, RemoteRepository repository, boolean releases, boolean snapshots);
071}