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.util.graph.manager;
20
21 import java.util.Collection;
22 import java.util.Map;
23
24 import org.eclipse.aether.collection.DependencyManager;
25 import org.eclipse.aether.graph.Exclusion;
26 import org.eclipse.aether.scope.ScopeManager;
27 import org.eclipse.aether.scope.SystemDependencyScope;
28
29 /**
30 * A dependency manager managing dependencies on all levels supporting transitive dependency management.
31 * <p>
32 * <b>Note:</b>Unlike the {@code ClassicDependencyManager} and the {@code TransitiveDependencyManager} this
33 * implementation applies management also on the first level. This is considered the resolver's default behaviour.
34 * It ignores all management overrides supported by the {@code MavenModelBuilder}.
35 * <p>
36 * This manager has {@code deriveUntil=Integer.MAX_VALUE} and {@code applyFrom=0}.
37 *
38 * @author Christian Schulte
39 * @since 1.4.0
40 */
41 public final class DefaultDependencyManager extends AbstractDependencyManager {
42 /**
43 * Creates a new dependency manager without any management information.
44 *
45 * @deprecated Use constructor that provides consumer application specific predicate.
46 */
47 @Deprecated
48 public DefaultDependencyManager() {
49 this(null);
50 }
51
52 public DefaultDependencyManager(ScopeManager scopeManager) {
53 super(Integer.MAX_VALUE, 0, scopeManager);
54 }
55
56 @SuppressWarnings("checkstyle:ParameterNumber")
57 private DefaultDependencyManager(
58 int depth,
59 int deriveUntil,
60 int applyFrom,
61 Map<Object, Holder<String>> managedVersions,
62 Map<Object, Holder<String>> managedScopes,
63 Map<Object, Holder<Boolean>> managedOptionals,
64 Map<Object, Holder<String>> managedLocalPaths,
65 Map<Object, Collection<Holder<Collection<Exclusion>>>> managedExclusions,
66 SystemDependencyScope systemDependencyScope) {
67 super(
68 depth,
69 deriveUntil,
70 applyFrom,
71 managedVersions,
72 managedScopes,
73 managedOptionals,
74 managedLocalPaths,
75 managedExclusions,
76 systemDependencyScope);
77 }
78
79 @Override
80 protected DependencyManager newInstance(
81 Map<Object, Holder<String>> managedVersions,
82 Map<Object, Holder<String>> managedScopes,
83 Map<Object, Holder<Boolean>> managedOptionals,
84 Map<Object, Holder<String>> managedLocalPaths,
85 Map<Object, Collection<Holder<Collection<Exclusion>>>> managedExclusions) {
86 return new DefaultDependencyManager(
87 depth + 1,
88 deriveUntil,
89 applyFrom,
90 managedVersions,
91 managedScopes,
92 managedOptionals,
93 managedLocalPaths,
94 managedExclusions,
95 systemDependencyScope);
96 }
97 }