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.SystemScopeHandler;
25  import org.eclipse.aether.collection.DependencyManager;
26  import org.eclipse.aether.graph.Exclusion;
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(SYSTEM_SCOPE_HANDLER);
46      }
47  
48      public TransitiveDependencyManager(SystemScopeHandler systemScopeHandler) {
49          super(Integer.MAX_VALUE, 2, systemScopeHandler);
50      }
51  
52      @SuppressWarnings("checkstyle:ParameterNumber")
53      private TransitiveDependencyManager(
54              int depth,
55              int deriveUntil,
56              int applyFrom,
57              Map<Object, String> managedVersions,
58              Map<Object, String> managedScopes,
59              Map<Object, Boolean> managedOptionals,
60              Map<Object, String> managedLocalPaths,
61              Map<Object, Collection<Exclusion>> managedExclusions,
62              SystemScopeHandler systemScopeHandler) {
63          super(
64                  depth,
65                  deriveUntil,
66                  applyFrom,
67                  managedVersions,
68                  managedScopes,
69                  managedOptionals,
70                  managedLocalPaths,
71                  managedExclusions,
72                  systemScopeHandler);
73      }
74  
75      @Override
76      protected DependencyManager newInstance(
77              Map<Object, String> managedVersions,
78              Map<Object, String> managedScopes,
79              Map<Object, Boolean> managedOptionals,
80              Map<Object, String> managedLocalPaths,
81              Map<Object, 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                  systemScopeHandler);
92      }
93  }