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.settings.building;
20  
21  import java.io.File;
22  import java.util.Properties;
23  
24  /**
25   * Collects settings that control building of effective settings.
26   *
27   * @deprecated since 4.0.0, use {@link org.apache.maven.api.services.SettingsBuilder} instead
28   */
29  @Deprecated(since = "4.0.0")
30  public class DefaultSettingsBuildingRequest implements SettingsBuildingRequest {
31  
32      private File globalSettingsFile;
33  
34      private File projectSettingsFile;
35  
36      private File userSettingsFile;
37  
38      private SettingsSource globalSettingsSource;
39  
40      private SettingsSource projectSettingsSource;
41  
42      private SettingsSource userSettingsSource;
43  
44      private Properties systemProperties;
45  
46      private Properties userProperties;
47  
48      @Override
49      public File getGlobalSettingsFile() {
50          return globalSettingsFile;
51      }
52  
53      @Override
54      public DefaultSettingsBuildingRequest setGlobalSettingsFile(File globalSettingsFile) {
55          this.globalSettingsFile = globalSettingsFile;
56  
57          return this;
58      }
59  
60      @Override
61      public SettingsSource getGlobalSettingsSource() {
62          return globalSettingsSource;
63      }
64  
65      @Override
66      public DefaultSettingsBuildingRequest setGlobalSettingsSource(SettingsSource globalSettingsSource) {
67          this.globalSettingsSource = globalSettingsSource;
68  
69          return this;
70      }
71  
72      @Override
73      public File getProjectSettingsFile() {
74          return projectSettingsFile;
75      }
76  
77      @Override
78      public DefaultSettingsBuildingRequest setProjectSettingsFile(File projectSettingsFile) {
79          this.projectSettingsFile = projectSettingsFile;
80  
81          return this;
82      }
83  
84      @Override
85      public SettingsSource getProjectSettingsSource() {
86          return projectSettingsSource;
87      }
88  
89      @Override
90      public DefaultSettingsBuildingRequest setProjectSettingsSource(SettingsSource projectSettingsSource) {
91          this.projectSettingsSource = projectSettingsSource;
92  
93          return this;
94      }
95  
96      @Override
97      public File getUserSettingsFile() {
98          return userSettingsFile;
99      }
100 
101     @Override
102     public DefaultSettingsBuildingRequest setUserSettingsFile(File userSettingsFile) {
103         this.userSettingsFile = userSettingsFile;
104 
105         return this;
106     }
107 
108     @Override
109     public SettingsSource getUserSettingsSource() {
110         return userSettingsSource;
111     }
112 
113     @Override
114     public DefaultSettingsBuildingRequest setUserSettingsSource(SettingsSource userSettingsSource) {
115         this.userSettingsSource = userSettingsSource;
116 
117         return this;
118     }
119 
120     @Override
121     public Properties getSystemProperties() {
122         if (systemProperties == null) {
123             systemProperties = new Properties();
124         }
125 
126         return systemProperties;
127     }
128 
129     @Override
130     public DefaultSettingsBuildingRequest setSystemProperties(Properties systemProperties) {
131         if (systemProperties != null) {
132             this.systemProperties = new Properties();
133             synchronized (systemProperties) { // avoid concurrent modification if someone else sets/removes an unrelated
134                 // system property
135                 this.systemProperties.putAll(systemProperties);
136             }
137         } else {
138             this.systemProperties = null;
139         }
140 
141         return this;
142     }
143 
144     @Override
145     public Properties getUserProperties() {
146         if (userProperties == null) {
147             userProperties = new Properties();
148         }
149 
150         return userProperties;
151     }
152 
153     @Override
154     public DefaultSettingsBuildingRequest setUserProperties(Properties userProperties) {
155         if (userProperties != null) {
156             this.userProperties = new Properties();
157             this.userProperties.putAll(userProperties);
158         } else {
159             this.userProperties = null;
160         }
161 
162         return this;
163     }
164 }