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.Collection;
022import java.util.Map;
023
024import org.eclipse.aether.collection.DependencyManager;
025import org.eclipse.aether.graph.Exclusion;
026
027/**
028 * A dependency manager managing dependencies on all levels supporting transitive dependency management.
029 * <p>
030 * <b>Note:</b>Unlike the {@code ClassicDependencyManager} and the {@code TransitiveDependencyManager} this
031 * implementation applies management also on the first level. This is considered the resolver's default behaviour.
032 * It ignores all management overrides supported by the {@code MavenModelBuilder}.
033 * <p>
034 * This manager has {@code deriveUntil=Integer.MAX_VALUE} and {@code applyFrom=0}.
035 *
036 * @author Christian Schulte
037 * @since 1.4.0
038 */
039public final class DefaultDependencyManager extends AbstractDependencyManager {
040    /**
041     * Creates a new dependency manager without any management information.
042     */
043    public DefaultDependencyManager() {
044        super(Integer.MAX_VALUE, 0);
045    }
046
047    @SuppressWarnings("checkstyle:ParameterNumber")
048    private DefaultDependencyManager(
049            int depth,
050            int deriveUntil,
051            int applyFrom,
052            Map<Object, String> managedVersions,
053            Map<Object, String> managedScopes,
054            Map<Object, Boolean> managedOptionals,
055            Map<Object, String> managedLocalPaths,
056            Map<Object, Collection<Exclusion>> managedExclusions) {
057        super(
058                depth,
059                deriveUntil,
060                applyFrom,
061                managedVersions,
062                managedScopes,
063                managedOptionals,
064                managedLocalPaths,
065                managedExclusions);
066    }
067
068    @Override
069    protected DependencyManager newInstance(
070            Map<Object, String> managedVersions,
071            Map<Object, String> managedScopes,
072            Map<Object, Boolean> managedOptionals,
073            Map<Object, String> managedLocalPaths,
074            Map<Object, Collection<Exclusion>> managedExclusions) {
075        return new DefaultDependencyManager(
076                depth + 1,
077                deriveUntil,
078                applyFrom,
079                managedVersions,
080                managedScopes,
081                managedOptionals,
082                managedLocalPaths,
083                managedExclusions);
084    }
085}