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.scope; 020 021import java.util.Collection; 022import java.util.Optional; 023 024import org.eclipse.aether.RepositorySystemSession; 025import org.eclipse.aether.collection.DependencySelector; 026import org.eclipse.aether.graph.DependencyFilter; 027 028/** 029 * Scope manager. 030 * 031 * @since 2.0.0 032 * 033 * @noimplement This interface is not intended to be implemented by clients. 034 * @noextend This interface is not intended to be extended by clients. 035 */ 036public interface ScopeManager { 037 /** 038 * The label. 039 */ 040 String getId(); 041 042 /** 043 * Returns the "system" scope, if exists. 044 * <p> 045 * This is a special scope. In this scope case, Resolver should handle it specially, as it has no POM (so is 046 * always a leaf on graph), is not in any repository, but is actually hosted on host OS file system. On resolution 047 * resolver merely checks is file present or not. 048 */ 049 Optional<SystemDependencyScope> getSystemDependencyScope(); 050 051 /** 052 * Returns a specific dependency scope by label. 053 * <p> 054 * Note: despite returns optional, this method may throw as well, if manager set in "strict" mode. 055 */ 056 Optional<DependencyScope> getDependencyScope(String id); 057 058 /** 059 * Returns the "universe" (all) of dependency scopes as immutable collection. 060 */ 061 Collection<DependencyScope> getDependencyScopeUniverse(); 062 063 /** 064 * Returns a specific resolution scope by label. 065 * <p> 066 * Note: despite returns optional, this method may throw as well, if manager set in "strict" mode. 067 */ 068 Optional<ResolutionScope> getResolutionScope(String id); 069 070 /** 071 * Returns the "universe" (all) of resolution scopes as immutable collection. 072 */ 073 Collection<ResolutionScope> getResolutionScopeUniverse(); 074 075 /** 076 * Resolver scope configuration specific: dependency selector to be used to support this scope (with its dependency 077 * and resolution scopes). 078 * <p> 079 * Important: Resolver 2.x when used with {@link ScopeManager}, the scope semantics is defined by client code. 080 * Hence, the scopes cannot be interpreted with fixed logic as it was the case in Maven 3.9 and before, instead 081 * the {@link ScopeManager} has to be asked to create selector based on scope configuration. 082 */ 083 DependencySelector getDependencySelector(RepositorySystemSession session, ResolutionScope resolutionScope); 084 085 /** 086 * Resolver scope configuration specific: dependency filter to be used to support this scope (with its dependency 087 * and resolution scopes). 088 * <p> 089 * Important: Resolver 2.x when used with {@link ScopeManager}, the scope semantics is defined by client code. 090 * Hence, the scopes cannot be interpreted with fixed logic as it was the case in Maven 3.9 and before, instead 091 * the {@link ScopeManager} has to be asked to create filter based on scope configuration. 092 */ 093 DependencyFilter getDependencyFilter(RepositorySystemSession session, ResolutionScope resolutionScope); 094}