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 * Aggregates repository definitions by merging duplicate repositories and optionally applies mirror, proxy and 059 * authentication settings from the supplied session, additionally distinguishing the provenance of the recessive 060 * repository definitions. Repository definitions that originate from a remote artifact descriptor (i.e. a POM 061 * downloaded during dependency collection) are remotely supplied input: implementations may withhold session 062 * authentication from them unless an operator-defined mirror has been selected for them, so that session 063 * authentication is applied only to repositories the operator configured. Repository definitions supplied 064 * by the build itself (e.g. via 065 * {@code RepositorySystem#newResolutionRepositories}) must keep receiving mirror, proxy and authentication 066 * settings as documented for 067 * {@link #aggregateRepositories(RepositorySystemSession, List, List, boolean)}. 068 * <p> 069 * The default implementation ignores the provenance hint and delegates to 070 * {@link #aggregateRepositories(RepositorySystemSession, List, List, boolean)}. 071 * 072 * @param session The repository session during which the repositories will be accessed, must not be {@code null}. 073 * @param dominantRepositories The current list of remote repositories to merge the new definitions into, must not 074 * be {@code null}. 075 * @param recessiveRepositories The remote repositories to merge into the existing list, must not be {@code null}. 076 * @param recessiveIsRaw {@code true} if the recessive repository definitions have not yet been subjected to mirror, 077 * proxy and authentication settings, {@code false} otherwise. 078 * @param recessiveIsFromDescriptor {@code true} if the recessive repository definitions were declared by a remote 079 * artifact descriptor (POM) rather than by the build itself, {@code false} otherwise. 080 * @return The aggregated list of remote repositories, never {@code null}. 081 * @since 2.0.23 082 * @see RepositorySystemSession#getMirrorSelector() 083 * @see RepositorySystemSession#getProxySelector() 084 * @see RepositorySystemSession#getAuthenticationSelector() 085 */ 086 default List<RemoteRepository> aggregateRepositories( 087 RepositorySystemSession session, 088 List<RemoteRepository> dominantRepositories, 089 List<RemoteRepository> recessiveRepositories, 090 boolean recessiveIsRaw, 091 boolean recessiveIsFromDescriptor) { 092 return aggregateRepositories(session, dominantRepositories, recessiveRepositories, recessiveIsRaw); 093 } 094 095 /** 096 * Gets the effective repository policy for the specified remote repository by merging the applicable 097 * snapshot/release policy of the repository with global settings from the supplied session. 098 * 099 * @param session The repository session during which the repository will be accessed, must not be {@code null}. 100 * @param repository The remote repository to determine the effective policy for, must not be {@code null}. 101 * @param releases {@code true} if the policy for release artifacts needs to be considered, {@code false} if not. 102 * @param snapshots {@code true} if the policy for snapshot artifacts needs to be considered, {@code false} if not. 103 * @return The effective repository policy, never {@code null}. 104 * @see RepositorySystemSession#getChecksumPolicy() 105 * @see RepositorySystemSession#getUpdatePolicy() 106 */ 107 RepositoryPolicy getPolicy( 108 RepositorySystemSession session, RemoteRepository repository, boolean releases, boolean snapshots); 109}