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 building of effective settings.
27   * 
28   * @author Benjamin Bentmann
29   */
30  public class DefaultSettingsBuildingRequest
31      implements SettingsBuildingRequest
32  {
33  
34      private File globalSettingsFile;
35  
36      private File userSettingsFile;
37  
38      private Properties systemProperties;
39  
40      private Properties userProperties;
41  
42      public File getGlobalSettingsFile()
43      {
44          return globalSettingsFile;
45      }
46  
47      public DefaultSettingsBuildingRequest setGlobalSettingsFile( File globalSettingsFile )
48      {
49          this.globalSettingsFile = globalSettingsFile;
50  
51          return this;
52      }
53  
54      public File getUserSettingsFile()
55      {
56          return userSettingsFile;
57      }
58  
59      public DefaultSettingsBuildingRequest setUserSettingsFile( File userSettingsFile )
60      {
61          this.userSettingsFile = userSettingsFile;
62  
63          return this;
64      }
65  
66      public Properties getSystemProperties()
67      {
68          if ( systemProperties == null )
69          {
70              systemProperties = new Properties();
71          }
72  
73          return systemProperties;
74      }
75  
76      public DefaultSettingsBuildingRequest setSystemProperties( Properties systemProperties )
77      {
78          if ( systemProperties != null )
79          {
80              this.systemProperties = new Properties();
81              this.systemProperties.putAll( systemProperties );
82          }
83          else
84          {
85              this.systemProperties = null;
86          }
87  
88          return this;
89      }
90  
91      public Properties getUserProperties()
92      {
93          if ( userProperties == null )
94          {
95              userProperties = new Properties();
96          }
97  
98          return userProperties;
99      }
100 
101     public DefaultSettingsBuildingRequest setUserProperties( Properties userProperties )
102     {
103         if ( userProperties != null )
104         {
105             this.userProperties = new Properties();
106             this.userProperties.putAll( userProperties );
107         }
108         else
109         {
110             this.userProperties = null;
111         }
112 
113         return this;
114     }
115 
116 }