001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.eclipse.aether.util.graph.manager; 020 021import java.util.ArrayList; 022import java.util.Collection; 023 024import org.eclipse.aether.collection.DependencyManager; 025import org.eclipse.aether.graph.Exclusion; 026import org.eclipse.aether.scope.ScopeManager; 027import org.eclipse.aether.scope.SystemDependencyScope; 028 029/** 030 * A dependency manager managing dependencies on all levels supporting transitive dependency management. 031 * <p> 032 * <b>Note:</b>Unlike the {@code ClassicDependencyManager} and the {@code TransitiveDependencyManager} this 033 * implementation applies management also on the first level. This is considered the resolver's default behaviour. 034 * It ignores all management overrides supported by the {@code MavenModelBuilder}. 035 * <p> 036 * This manager has {@code deriveUntil=Integer.MAX_VALUE} and {@code applyFrom=0}. 037 * 038 * @author Christian Schulte 039 * @since 1.4.0 040 */ 041public final class DefaultDependencyManager extends AbstractDependencyManager { 042 /** 043 * Creates a new dependency manager without any management information. 044 * 045 * @deprecated Use constructor that provides consumer application specific predicate. 046 */ 047 @Deprecated 048 public DefaultDependencyManager() { 049 this(null); 050 } 051 052 public DefaultDependencyManager(ScopeManager scopeManager) { 053 super(Integer.MAX_VALUE, 0, scopeManager); 054 } 055 056 @SuppressWarnings("checkstyle:ParameterNumber") 057 private DefaultDependencyManager( 058 ArrayList<AbstractDependencyManager> path, 059 int depth, 060 int deriveUntil, 061 int applyFrom, 062 MMap<Key, String> managedVersions, 063 MMap<Key, String> managedScopes, 064 MMap<Key, Boolean> managedOptionals, 065 MMap<Key, String> managedLocalPaths, 066 MMap<Key, Holder<Collection<Exclusion>>> managedExclusions, 067 SystemDependencyScope systemDependencyScope) { 068 super( 069 path, 070 depth, 071 deriveUntil, 072 applyFrom, 073 managedVersions, 074 managedScopes, 075 managedOptionals, 076 managedLocalPaths, 077 managedExclusions, 078 systemDependencyScope); 079 } 080 081 @Override 082 protected DependencyManager newInstance( 083 MMap<Key, String> managedVersions, 084 MMap<Key, String> managedScopes, 085 MMap<Key, Boolean> managedOptionals, 086 MMap<Key, String> managedLocalPaths, 087 MMap<Key, Holder<Collection<Exclusion>>> managedExclusions) { 088 ArrayList<AbstractDependencyManager> path = new ArrayList<>(this.path); 089 path.add(this); 090 return new DefaultDependencyManager( 091 path, 092 depth + 1, 093 deriveUntil, 094 applyFrom, 095 managedVersions, 096 managedScopes, 097 managedOptionals, 098 managedLocalPaths, 099 managedExclusions, 100 systemDependencyScope); 101 } 102}