1 package org.apache.maven.shared.runtime;
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.net.URL;
23 import java.util.List;
24
25 import org.apache.maven.project.MavenProject;
26
27 /**
28 * Provides methods to introspect the current Maven runtime environment.
29 *
30 * @author <a href="mailto:markh@apache.org">Mark Hobson</a>
31 * @version $Id: MavenRuntime.java 831910 2009-11-02 15:05:33Z markh $
32 */
33 public interface MavenRuntime
34 {
35 // fields -----------------------------------------------------------------
36
37 /**
38 * The Plexus role for this component.
39 */
40 String ROLE = MavenRuntime.class.getName();
41
42 // public methods ---------------------------------------------------------
43
44 /**
45 * Gets the properties for the specified URL's Maven project.
46 *
47 * @param url
48 * the URL to introspect
49 * @return the project properties for the specified URL's Maven project
50 * @throws MavenRuntimeException
51 * if an error occurred introspecting the Maven runtime environment
52 */
53 MavenProjectProperties getProjectProperties( URL url ) throws MavenRuntimeException;
54
55 /**
56 * Gets the properties for the specified class's Maven project.
57 *
58 * @param klass
59 * the class to introspect
60 * @return the project properties for the specified class's Maven project
61 * @throws MavenRuntimeException
62 * if an error occurred introspecting the Maven runtime environment
63 */
64 MavenProjectProperties getProjectProperties( Class<?> klass ) throws MavenRuntimeException;
65
66 /**
67 * Obtains a list of basic properties for each Maven project accessible from the specified class loader.
68 *
69 * @param classLoader
70 * the class loader to introspect
71 * @return a list of project properties for each Maven project found within the class path
72 * @throws MavenRuntimeException
73 * if an error occurred introspecting the Maven runtime environment
74 */
75 List<MavenProjectProperties> getProjectsProperties( ClassLoader classLoader ) throws MavenRuntimeException;
76
77 /**
78 * Gets the specified URL's Maven project.
79 *
80 * @param url
81 * the URL to introspect
82 * @return the specified URL's Maven project
83 * @throws MavenRuntimeException
84 * if an error occurred introspecting the Maven runtime environment
85 */
86 MavenProject getProject( URL url ) throws MavenRuntimeException;
87
88 /**
89 * Gets the specified class's Maven project.
90 *
91 * @param klass
92 * the class to introspect
93 * @return the specified class's Maven project
94 * @throws MavenRuntimeException
95 * if an error occurred introspecting the Maven runtime environment
96 */
97 MavenProject getProject( Class<?> klass ) throws MavenRuntimeException;
98
99 /**
100 * Obtains a list of Maven projects accessible from the specified class loader.
101 *
102 * @param classLoader
103 * the class loader to introspect
104 * @return a list of projects for each Maven project found within the class path
105 * @throws MavenRuntimeException
106 * if an error occurred introspecting the Maven runtime environment
107 */
108 List<MavenProject> getProjects( ClassLoader classLoader ) throws MavenRuntimeException;
109
110 /**
111 * Obtains a list of Maven projects accessible from the specified class loader ordered by their dependencies.
112 *
113 * @param classLoader
114 * the class loader to introspect
115 * @return a list of projects for each Maven project found within the class path ordered by their dependencies
116 * @throws MavenRuntimeException
117 * if an error occurred introspecting the Maven runtime environment
118 */
119 List<MavenProject> getSortedProjects( ClassLoader classLoader ) throws MavenRuntimeException;
120 }