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