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 transitive dependencies supporting transitive dependency management.
029 * <p>
030 * This manager is similar to "classic", it has {@code deriveUntil=Integer.MAX_VALUE} (unlike 2 as in "classic") and
031 * {@code applyFrom=2}.
032 *
033 * @author Christian Schulte
034 * @since 1.4.0
035 */
036public final class TransitiveDependencyManager extends AbstractDependencyManager {
037    /**
038     * Creates a new dependency manager without any management information.
039     */
040    public TransitiveDependencyManager() {
041        super(Integer.MAX_VALUE, 2);
042    }
043
044    @SuppressWarnings("checkstyle:ParameterNumber")
045    private TransitiveDependencyManager(
046            int depth,
047            int deriveUntil,
048            int applyFrom,
049            Map<Object, String> managedVersions,
050            Map<Object, String> managedScopes,
051            Map<Object, Boolean> managedOptionals,
052            Map<Object, String> managedLocalPaths,
053            Map<Object, Collection<Exclusion>> managedExclusions) {
054        super(
055                depth,
056                deriveUntil,
057                applyFrom,
058                managedVersions,
059                managedScopes,
060                managedOptionals,
061                managedLocalPaths,
062                managedExclusions);
063    }
064
065    @Override
066    protected DependencyManager newInstance(
067            Map<Object, String> managedVersions,
068            Map<Object, String> managedScopes,
069            Map<Object, Boolean> managedOptionals,
070            Map<Object, String> managedLocalPaths,
071            Map<Object, Collection<Exclusion>> managedExclusions) {
072        return new TransitiveDependencyManager(
073                depth + 1,
074                deriveUntil,
075                applyFrom,
076                managedVersions,
077                managedScopes,
078                managedOptionals,
079                managedLocalPaths,
080                managedExclusions);
081    }
082}