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  
27  /**
28   * A dependency manager managing transitive dependencies supporting transitive dependency management.
29   * <p>
30   * This manager is similar to "classic", it has {@code deriveUntil=Integer.MAX_VALUE} (unlike 2 as in "classic") and
31   * {@code applyFrom=2}.
32   *
33   * @author Christian Schulte
34   * @since 1.4.0
35   */
36  public final class TransitiveDependencyManager extends AbstractDependencyManager {
37      /**
38       * Creates a new dependency manager without any management information.
39       */
40      public TransitiveDependencyManager() {
41          super(Integer.MAX_VALUE, 2);
42      }
43  
44      @SuppressWarnings("checkstyle:ParameterNumber")
45      private TransitiveDependencyManager(
46              int depth,
47              int deriveUntil,
48              int applyFrom,
49              Map<Object, String> managedVersions,
50              Map<Object, String> managedScopes,
51              Map<Object, Boolean> managedOptionals,
52              Map<Object, String> managedLocalPaths,
53              Map<Object, Collection<Exclusion>> managedExclusions) {
54          super(
55                  depth,
56                  deriveUntil,
57                  applyFrom,
58                  managedVersions,
59                  managedScopes,
60                  managedOptionals,
61                  managedLocalPaths,
62                  managedExclusions);
63      }
64  
65      @Override
66      protected DependencyManager newInstance(
67              Map<Object, String> managedVersions,
68              Map<Object, String> managedScopes,
69              Map<Object, Boolean> managedOptionals,
70              Map<Object, String> managedLocalPaths,
71              Map<Object, Collection<Exclusion>> managedExclusions) {
72          return new TransitiveDependencyManager(
73                  depth + 1,
74                  deriveUntil,
75                  applyFrom,
76                  managedVersions,
77                  managedScopes,
78                  managedOptionals,
79                  managedLocalPaths,
80                  managedExclusions);
81      }
82  }