View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.api.services.model;
20  
21  import java.util.List;
22  import java.util.Map;
23  
24  import org.apache.maven.api.annotations.Nonnull;
25  import org.apache.maven.api.model.Model;
26  
27  /**
28   * Describes the environmental context used to determine the activation status of profiles.
29   *
30   * The {@link Model} is available from the activation context, but only static parts of it
31   * are allowed to be used, i.e. those that do not change between file model and effective model.
32   *
33   */
34  public interface ProfileActivationContext {
35  
36      /**
37       * Gets the identifiers of those profiles that should be activated by explicit demand.
38       *
39       * @return The identifiers of those profiles to activate, never {@code null}.
40       */
41      @Nonnull
42      List<String> getActiveProfileIds();
43  
44      /**
45       * Gets the identifiers of those profiles that should be deactivated by explicit demand.
46       *
47       * @return The identifiers of those profiles to deactivate, never {@code null}.
48       */
49      @Nonnull
50      List<String> getInactiveProfileIds();
51  
52      /**
53       * Gets the system properties to use for interpolation and profile activation. The system properties are collected
54       * from the runtime environment like {@link System#getProperties()} and environment variables.
55       *
56       * @return The execution properties, never {@code null}.
57       */
58      @Nonnull
59      Map<String, String> getSystemProperties();
60  
61      /**
62       * Gets the user properties to use for interpolation and profile activation. The user properties have been
63       * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command
64       * line.
65       *
66       * @return The user properties, never {@code null}.
67       */
68      @Nonnull
69      Map<String, String> getUserProperties();
70  
71      /**
72       * Gets the model which is being activated.
73       *
74       * @return The project model, never {@code null}.
75       */
76      @Nonnull
77      Model getModel();
78  }