1 package org.apache.maven.model.building;
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.model.Model;
25 import org.apache.maven.model.Profile;
26
27 /**
28 * Collects the output of the model builder.
29 *
30 * @author Benjamin Bentmann
31 */
32 public interface ModelBuildingResult
33 {
34
35 /**
36 * Gets the sequence of model identifiers that denote the lineage of models from which the effective model was
37 * constructed. Model identifiers have the form {@code <groupId>:<artifactId>:<version>}. The first identifier from
38 * the list denotes the model on which the model builder was originally invoked. The last identifier will always be
39 * an empty string that by definition denotes the super POM.
40 *
41 * @return The model identifiers from the lineage of models, never {@code null}.
42 */
43 List<String> getModelIds();
44
45 /**
46 *
47 * @return the file model
48 * @since 4.0.0
49 */
50 Model getFileModel();
51
52 /**
53 * Gets the assembled model.
54 *
55 * @return The assembled model, never {@code null}.
56 */
57 Model getEffectiveModel();
58
59 /**
60 * Gets the raw model as it was read from the input model source. Apart from basic validation, the raw model has not
61 * undergone any updates by the model builder, e.g. reflects neither inheritance nor interpolation.
62 *
63 * @return The raw model, never {@code null}.
64 */
65 Model getRawModel();
66
67 /**
68 * Gets the specified raw model as it was read from a model source. Apart from basic validation, a raw model has not
69 * undergone any updates by the model builder, e.g. reflects neither inheritance nor interpolation. The model
70 * identifier should be from the collection obtained by {@link #getModelIds()}. As a special case, an empty string
71 * can be used as the identifier for the super POM.
72 *
73 * @param modelId The identifier of the desired raw model, must not be {@code null}.
74 * @return The raw model or {@code null} if the specified model id does not refer to a known model.
75 */
76 Model getRawModel( String modelId );
77
78 /**
79 * Gets the profiles from the specified model that were active during model building. The model identifier should be
80 * from the collection obtained by {@link #getModelIds()}. As a special case, an empty string can be used as the
81 * identifier for the super POM.
82 *
83 * @param modelId The identifier of the model whose active profiles should be retrieved, must not be {@code null}.
84 * @return The active profiles of the model or an empty list if none or {@code null} if the specified model id does
85 * not refer to a known model.
86 */
87 List<Profile> getActivePomProfiles( String modelId );
88
89 /**
90 * Gets the external profiles that were active during model building. External profiles are those that were
91 * contributed by {@link ModelBuildingRequest#getProfiles()}.
92 *
93 * @return The active external profiles or an empty list if none, never {@code null}.
94 */
95 List<Profile> getActiveExternalProfiles();
96
97 /**
98 * Gets the problems that were encountered during the model building. Note that only problems of severity
99 * {@link ModelProblem.Severity#WARNING} and below are reported here. Problems with a higher severity level cause
100 * the model builder to fail with a {@link ModelBuildingException}.
101 *
102 * @return The problems that were encountered during the model building, can be empty but never {@code null}.
103 */
104 List<ModelProblem> getProblems();
105
106 }