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
23 import org.eclipse.aether.collection.DependencyManager;
24 import org.eclipse.aether.graph.Exclusion;
25 import org.eclipse.aether.scope.ScopeManager;
26 import org.eclipse.aether.scope.SystemDependencyScope;
27
28 /**
29 * A dependency manager managing transitive dependencies supporting transitive dependency management.
30 * <p>
31 * This manager is similar to "classic", it has {@code deriveUntil=Integer.MAX_VALUE} (unlike 2 as in "classic") and
32 * {@code applyFrom=2}.
33 *
34 * @author Christian Schulte
35 * @since 1.4.0
36 */
37 public final class TransitiveDependencyManager extends AbstractDependencyManager {
38 /**
39 * Creates a new dependency manager without any management information.
40 *
41 * @deprecated Use constructor that provides consumer application specific predicate.
42 */
43 @Deprecated
44 public TransitiveDependencyManager() {
45 this(null);
46 }
47
48 public TransitiveDependencyManager(ScopeManager scopeManager) {
49 super(Integer.MAX_VALUE, 2, scopeManager);
50 }
51
52 @SuppressWarnings("checkstyle:ParameterNumber")
53 private TransitiveDependencyManager(
54 int depth,
55 int deriveUntil,
56 int applyFrom,
57 MMap<Key, Holder<String>> managedVersions,
58 MMap<Key, Holder<String>> managedScopes,
59 MMap<Key, Holder<Boolean>> managedOptionals,
60 MMap<Key, Holder<String>> managedLocalPaths,
61 MMap<Key, Collection<Holder<Collection<Exclusion>>>> managedExclusions,
62 SystemDependencyScope systemDependencyScope) {
63 super(
64 depth,
65 deriveUntil,
66 applyFrom,
67 managedVersions,
68 managedScopes,
69 managedOptionals,
70 managedLocalPaths,
71 managedExclusions,
72 systemDependencyScope);
73 }
74
75 @Override
76 protected DependencyManager newInstance(
77 MMap<Key, Holder<String>> managedVersions,
78 MMap<Key, Holder<String>> managedScopes,
79 MMap<Key, Holder<Boolean>> managedOptionals,
80 MMap<Key, Holder<String>> managedLocalPaths,
81 MMap<Key, Collection<Holder<Collection<Exclusion>>>> managedExclusions) {
82 return new TransitiveDependencyManager(
83 depth + 1,
84 deriveUntil,
85 applyFrom,
86 managedVersions,
87 managedScopes,
88 managedOptionals,
89 managedLocalPaths,
90 managedExclusions,
91 systemDependencyScope);
92 }
93 }