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