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.collection;
020
021import java.util.List;
022
023import org.eclipse.aether.RepositorySystemSession;
024import org.eclipse.aether.artifact.Artifact;
025import org.eclipse.aether.graph.Dependency;
026
027/**
028 * A context used during dependency collection to update the dependency manager, selector and traverser.
029 *
030 * @see DependencyManager#deriveChildManager(DependencyCollectionContext)
031 * @see DependencyTraverser#deriveChildTraverser(DependencyCollectionContext)
032 * @see DependencySelector#deriveChildSelector(DependencyCollectionContext)
033 * @see VersionFilter#deriveChildFilter(DependencyCollectionContext)
034 * @noimplement This interface is not intended to be implemented by clients.
035 * @noextend This interface is not intended to be extended by clients.
036 */
037public interface DependencyCollectionContext {
038
039    /**
040     * Gets the repository system session during which the dependency collection happens.
041     *
042     * @return The repository system session, never {@code null}.
043     */
044    RepositorySystemSession getSession();
045
046    /**
047     * Gets the artifact whose children are to be processed next during dependency collection. For all nodes but the
048     * root, this is simply shorthand for {@code getDependency().getArtifact()}. In case of the root node however,
049     * {@link #getDependency()} might be {@code null} while the node still has an artifact which serves as its label and
050     * is not to be resolved.
051     *
052     * @return The artifact whose children are going to be processed or {@code null} in case of the root node without
053     *         dependency and label.
054     */
055    Artifact getArtifact();
056
057    /**
058     * Gets the dependency whose children are to be processed next during dependency collection.
059     *
060     * @return The dependency whose children are going to be processed or {@code null} in case of the root node without
061     *         dependency.
062     */
063    Dependency getDependency();
064
065    /**
066     * Gets the dependency management information that was contributed by the artifact descriptor of the current
067     * dependency.
068     *
069     * @return The dependency management information, never {@code null}.
070     */
071    List<Dependency> getManagedDependencies();
072}