001    package org.apache.maven.execution;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one
005     * or more contributor license agreements.  See the NOTICE file
006     * distributed with this work for additional information
007     * regarding copyright ownership.  The ASF licenses this file
008     * to you under the Apache License, Version 2.0 (the
009     * "License"); you may not use this file except in compliance
010     * with the License.  You may obtain a copy of the License at
011     *
012     *   http://www.apache.org/licenses/LICENSE-2.0
013     *
014     * Unless required by applicable law or agreed to in writing,
015     * software distributed under the License is distributed on an
016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017     * KIND, either express or implied.  See the License for the
018     * specific language governing permissions and limitations
019     * under the License.
020     */
021    
022    import java.util.List;
023    
024    import org.apache.maven.project.MavenProject;
025    
026    /**
027     * Describes the inter-dependencies between projects in the reactor.
028     * 
029     * @author Benjamin Bentmann
030     */
031    public interface ProjectDependencyGraph
032    {
033    
034        /**
035         * Gets all projects in their intended build order, i.e. after topologically sorting the projects according to their
036         * inter-dependencies.
037         * 
038         * @return The projects in the build order, never {@code null}.
039         */
040        List<MavenProject> getSortedProjects();
041    
042        /**
043         * Gets the downstream projects of the specified project. A downstream project is a project that directly or
044         * indirectly depends on the given project.
045         * 
046         * @param project The project whose downstream projects should be retrieved, must not be {@code null}.
047         * @param transitive A flag whether to retrieve all direct and indirect downstream projects or just the immediate
048         *            downstream projects.
049         * @return The downstream projects in the build order, never {@code null}.
050         */
051        List<MavenProject> getDownstreamProjects( MavenProject project, boolean transitive );
052    
053        /**
054         * Gets the upstream projects of the specified project. An upstream project is a project that directly or indirectly
055         * is a prerequisite of the given project.
056         * 
057         * @param project The project whose upstream projects should be retrieved, must not be {@code null}.
058         * @param transitive A flag whether to retrieve all direct and indirect upstream projects or just the immediate
059         *            upstream projects.
060         * @return The upstream projects in the build order, never {@code null}.
061         */
062        List<MavenProject> getUpstreamProjects( MavenProject project, boolean transitive );
063    
064    }