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