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