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;
022
023import org.eclipse.aether.collection.DependencyManager;
024import org.eclipse.aether.graph.Exclusion;
025import org.eclipse.aether.scope.ScopeManager;
026import org.eclipse.aether.scope.SystemDependencyScope;
027
028/**
029 * A dependency manager managing transitive dependencies supporting transitive dependency management.
030 * <p>
031 * This manager is similar to "classic", it has {@code deriveUntil=Integer.MAX_VALUE} (unlike 2 as in "classic") and
032 * {@code applyFrom=2}.
033 *
034 * @author Christian Schulte
035 * @since 1.4.0
036 */
037public final class TransitiveDependencyManager extends AbstractDependencyManager {
038    /**
039     * Creates a new dependency manager without any management information.
040     *
041     * @deprecated Use constructor that provides consumer application specific predicate.
042     */
043    @Deprecated
044    public TransitiveDependencyManager() {
045        this(null);
046    }
047
048    public TransitiveDependencyManager(ScopeManager scopeManager) {
049        super(Integer.MAX_VALUE, 2, scopeManager);
050    }
051
052    @SuppressWarnings("checkstyle:ParameterNumber")
053    private TransitiveDependencyManager(
054            int depth,
055            int deriveUntil,
056            int applyFrom,
057            MMap<Key, Holder<String>> managedVersions,
058            MMap<Key, Holder<String>> managedScopes,
059            MMap<Key, Holder<Boolean>> managedOptionals,
060            MMap<Key, Holder<String>> managedLocalPaths,
061            MMap<Key, Collection<Holder<Collection<Exclusion>>>> managedExclusions,
062            SystemDependencyScope systemDependencyScope) {
063        super(
064                depth,
065                deriveUntil,
066                applyFrom,
067                managedVersions,
068                managedScopes,
069                managedOptionals,
070                managedLocalPaths,
071                managedExclusions,
072                systemDependencyScope);
073    }
074
075    @Override
076    protected DependencyManager newInstance(
077            MMap<Key, Holder<String>> managedVersions,
078            MMap<Key, Holder<String>> managedScopes,
079            MMap<Key, Holder<Boolean>> managedOptionals,
080            MMap<Key, Holder<String>> managedLocalPaths,
081            MMap<Key, Collection<Holder<Collection<Exclusion>>>> managedExclusions) {
082        return new TransitiveDependencyManager(
083                depth + 1,
084                deriveUntil,
085                applyFrom,
086                managedVersions,
087                managedScopes,
088                managedOptionals,
089                managedLocalPaths,
090                managedExclusions,
091                systemDependencyScope);
092    }
093}