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 dependencies on all levels supporting transitive dependency management.
29   * <p>
30   * <b>Note:</b>Unlike the {@code ClassicDependencyManager} and the {@code TransitiveDependencyManager} this
31   * implementation applies management also on the first level. This is considered the resolver's default behaviour.
32   * It ignores all management overrides supported by the {@code MavenModelBuilder}.
33   * <p>
34   * This manager has {@code deriveUntil=Integer.MAX_VALUE} and {@code applyFrom=0}.
35   *
36   * @author Christian Schulte
37   * @since 1.4.0
38   */
39  public final class DefaultDependencyManager extends AbstractDependencyManager {
40      /**
41       * Creates a new dependency manager without any management information.
42       */
43      public DefaultDependencyManager() {
44          super(Integer.MAX_VALUE, 0);
45      }
46  
47      @SuppressWarnings("checkstyle:ParameterNumber")
48      private DefaultDependencyManager(
49              int depth,
50              int deriveUntil,
51              int applyFrom,
52              Map<Object, String> managedVersions,
53              Map<Object, String> managedScopes,
54              Map<Object, Boolean> managedOptionals,
55              Map<Object, String> managedLocalPaths,
56              Map<Object, Collection<Exclusion>> managedExclusions) {
57          super(
58                  depth,
59                  deriveUntil,
60                  applyFrom,
61                  managedVersions,
62                  managedScopes,
63                  managedOptionals,
64                  managedLocalPaths,
65                  managedExclusions);
66      }
67  
68      @Override
69      protected DependencyManager newInstance(
70              Map<Object, String> managedVersions,
71              Map<Object, String> managedScopes,
72              Map<Object, Boolean> managedOptionals,
73              Map<Object, String> managedLocalPaths,
74              Map<Object, Collection<Exclusion>> managedExclusions) {
75          return new DefaultDependencyManager(
76                  depth + 1,
77                  deriveUntil,
78                  applyFrom,
79                  managedVersions,
80                  managedScopes,
81                  managedOptionals,
82                  managedLocalPaths,
83                  managedExclusions);
84      }
85  }