View Javadoc
1   package org.apache.maven.execution;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.List;
23  
24  import org.apache.maven.project.MavenProject;
25  
26  /**
27   * Describes the inter-dependencies between projects in the reactor.
28   * 
29   * @author Benjamin Bentmann
30   */
31  public interface ProjectDependencyGraph
32  {
33  
34      /**
35       * Gets all projects in their intended build order, i.e. after topologically sorting the projects according to their
36       * inter-dependencies.
37       * 
38       * @return The projects in the build order, never {@code null}.
39       */
40      List<MavenProject> getSortedProjects();
41  
42      /**
43       * Gets the downstream projects of the specified project. A downstream project is a project that directly or
44       * indirectly depends on the given project.
45       * 
46       * @param project The project whose downstream projects should be retrieved, must not be {@code null}.
47       * @param transitive A flag whether to retrieve all direct and indirect downstream projects or just the immediate
48       *            downstream projects.
49       * @return The downstream projects in the build order, never {@code null}.
50       */
51      List<MavenProject> getDownstreamProjects( MavenProject project, boolean transitive );
52  
53      /**
54       * Gets the upstream projects of the specified project. An upstream project is a project that directly or indirectly
55       * is a prerequisite of the given project.
56       * 
57       * @param project The project whose upstream projects should be retrieved, must not be {@code null}.
58       * @param transitive A flag whether to retrieve all direct and indirect upstream projects or just the immediate
59       *            upstream projects.
60       * @return The upstream projects in the build order, never {@code null}.
61       */
62      List<MavenProject> getUpstreamProjects( MavenProject project, boolean transitive );
63  
64  }