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.scope;
20
21 import java.util.Collection;
22 import java.util.Optional;
23
24 import org.eclipse.aether.RepositorySystemSession;
25 import org.eclipse.aether.collection.DependencySelector;
26 import org.eclipse.aether.graph.DependencyFilter;
27
28 /**
29 * Scope manager.
30 *
31 * @since 2.0.0
32 *
33 * @noimplement This interface is not intended to be implemented by clients.
34 * @noextend This interface is not intended to be extended by clients.
35 */
36 public interface ScopeManager {
37 /**
38 * The label.
39 */
40 String getId();
41
42 /**
43 * Returns the "system" scope, if exists.
44 * <p>
45 * This is a special scope. In this scope case, Resolver should handle it specially, as it has no POM (so is
46 * always a leaf on graph), is not in any repository, but is actually hosted on host OS file system. On resolution
47 * resolver merely checks is file present or not.
48 */
49 Optional<SystemDependencyScope> getSystemDependencyScope();
50
51 /**
52 * Returns a specific dependency scope by label.
53 * <p>
54 * Note: despite returns optional, this method may throw as well, if manager set in "strict" mode.
55 */
56 Optional<DependencyScope> getDependencyScope(String id);
57
58 /**
59 * Returns the "universe" (all) of dependency scopes as immutable collection.
60 */
61 Collection<DependencyScope> getDependencyScopeUniverse();
62
63 /**
64 * Returns a specific resolution scope by label.
65 * <p>
66 * Note: despite returns optional, this method may throw as well, if manager set in "strict" mode.
67 */
68 Optional<ResolutionScope> getResolutionScope(String id);
69
70 /**
71 * Returns the "universe" (all) of resolution scopes as immutable collection.
72 */
73 Collection<ResolutionScope> getResolutionScopeUniverse();
74
75 /**
76 * Resolver scope configuration specific: dependency selector to be used to support this scope (with its dependency
77 * and resolution scopes).
78 * <p>
79 * Important: Resolver 2.x when used with {@link ScopeManager}, the scope semantics is defined by client code.
80 * Hence, the scopes cannot be interpreted with fixed logic as it was the case in Maven 3.9 and before, instead
81 * the {@link ScopeManager} has to be asked to create selector based on scope configuration.
82 */
83 DependencySelector getDependencySelector(RepositorySystemSession session, ResolutionScope resolutionScope);
84
85 /**
86 * Resolver scope configuration specific: dependency filter to be used to support this scope (with its dependency
87 * and resolution scopes).
88 * <p>
89 * Important: Resolver 2.x when used with {@link ScopeManager}, the scope semantics is defined by client code.
90 * Hence, the scopes cannot be interpreted with fixed logic as it was the case in Maven 3.9 and before, instead
91 * the {@link ScopeManager} has to be asked to create filter based on scope configuration.
92 */
93 DependencyFilter getDependencyFilter(RepositorySystemSession session, ResolutionScope resolutionScope);
94 }