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.settings.building;
20
21 import java.io.File;
22 import java.util.Properties;
23
24 /**
25 * Collects settings that control the building of effective settings.
26 *
27 * @author Benjamin Bentmann
28 */
29 public interface SettingsBuildingRequest {
30
31 /**
32 * Gets the global settings file.
33 *
34 * @return The global settings file or {@code null} if none.
35 */
36 File getGlobalSettingsFile();
37
38 /**
39 * Sets the global settings file. A non-existent settings file is equivalent to empty settings. If both user
40 * settings and global settings are given, the user settings take precedence.
41 *
42 * @param globalSettingsFile The global settings file, may be {@code null} to disable global settings.
43 * @return This request, never {@code null}.
44 */
45 SettingsBuildingRequest setGlobalSettingsFile(File globalSettingsFile);
46
47 /**
48 * Gets the global settings source.
49 *
50 * @return The global settings source or {@code null} if none.
51 */
52 SettingsSource getGlobalSettingsSource();
53
54 /**
55 * Sets the global settings source. If both user settings and a global settings are given, the user settings take
56 * precedence.
57 *
58 * @param globalSettingsSource The global settings source, may be {@code null} to disable global settings.
59 * @return This request, never {@code null}.
60 */
61 SettingsBuildingRequest setGlobalSettingsSource(SettingsSource globalSettingsSource);
62
63 /**
64 * Gets the project settings file.
65 *
66 * @return The project settings file or {@code null} if none.
67 * @since 4.0.0
68 */
69 File getProjectSettingsFile();
70
71 /**
72 * Sets the project settings file. A non-existent settings file is equivalent to empty settings.
73 *
74 * @param projectSettingsFile The project settings file, may be {@code null} to disable project settings.
75 * @return This request, never {@code null}.
76 * @since 4.0.0
77 */
78 DefaultSettingsBuildingRequest setProjectSettingsFile(File projectSettingsFile);
79
80 /**
81 * Gets the project settings source.
82 *
83 * @return The project settings source or {@code null} if none.
84 * @since 4.0.0
85 */
86 SettingsSource getProjectSettingsSource();
87
88 /**
89 * Sets the project settings source.
90 *
91 * @param projectSettingsSource The project settings source, may be {@code null} to disable global settings.
92 * @return This request, never {@code null}.
93 * @since 4.0.0
94 */
95 SettingsBuildingRequest setProjectSettingsSource(SettingsSource projectSettingsSource);
96
97 /**
98 * Gets the user settings file.
99 *
100 * @return The user settings file or {@code null} if none.
101 */
102 File getUserSettingsFile();
103
104 /**
105 * Sets the user settings file. A non-existent settings file is equivalent to empty settings. If both a user
106 * settings file and a global settings file are given, the user settings take precedence.
107 *
108 * @param userSettingsFile The user settings file, may be {@code null} to disable user settings.
109 * @return This request, never {@code null}.
110 */
111 SettingsBuildingRequest setUserSettingsFile(File userSettingsFile);
112
113 /**
114 * Gets the user settings source.
115 *
116 * @return The user settings source or {@code null} if none.
117 */
118 SettingsSource getUserSettingsSource();
119
120 /**
121 * Sets the user settings source. If both user settings and a global settings are given, the user settings take
122 * precedence.
123 *
124 * @param userSettingsSource The user settings source, may be {@code null} to disable user settings.
125 * @return This request, never {@code null}.
126 */
127 SettingsBuildingRequest setUserSettingsSource(SettingsSource userSettingsSource);
128
129 /**
130 * Gets the system properties to use for interpolation. The system properties are collected from the runtime
131 * environment like {@link System#getProperties()} and environment variables.
132 *
133 * @return The system properties, never {@code null}.
134 */
135 Properties getSystemProperties();
136
137 /**
138 * Sets the system properties to use for interpolation. The system properties are collected from the runtime
139 * environment like {@link System#getProperties()} and environment variables.
140 *
141 * @param systemProperties The system properties, may be {@code null}.
142 * @return This request, never {@code null}.
143 */
144 SettingsBuildingRequest setSystemProperties(Properties systemProperties);
145
146 /**
147 * Gets the user properties to use for interpolation. The user properties have been configured directly by the user
148 * on his discretion, e.g. via the {@code -Dkey=value} parameter on the command line.
149 *
150 * @return The user properties, never {@code null}.
151 */
152 Properties getUserProperties();
153
154 /**
155 * Sets the user properties to use for interpolation. The user properties have been configured directly by the user
156 * on his discretion, e.g. via the {@code -Dkey=value} parameter on the command line.
157 *
158 * @param userProperties The user properties, may be {@code null}.
159 * @return This request, never {@code null}.
160 */
161 SettingsBuildingRequest setUserProperties(Properties userProperties);
162 }