View Javadoc
1   package org.apache.maven.shared.release.env;
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.Locale;
24  
25  import org.apache.maven.settings.Settings;
26  
27  public class DefaultReleaseEnvironment
28      implements ReleaseEnvironment
29  {
30  
31      private File mavenHome;
32  
33      private File javaHome;
34  
35      private File localRepositoryDirectory;
36  
37      private Settings settings;
38  
39      private String mavenExecutorId = DEFAULT_MAVEN_EXECUTOR_ID;
40      
41      private Locale locale = Locale.ENGLISH;
42  
43      public File getMavenHome()
44      {
45          return mavenHome;
46      }
47  
48      public Settings getSettings()
49      {
50          return settings;
51      }
52  
53      public ReleaseEnvironment setMavenHome( File mavenHome )
54      {
55          this.mavenHome = mavenHome;
56          return this;
57      }
58  
59      public ReleaseEnvironment setSettings( Settings settings )
60      {
61          this.settings = settings;
62          return this;
63      }
64  
65      public String getMavenExecutorId()
66      {
67          return mavenExecutorId;
68      }
69  
70      public ReleaseEnvironment setMavenExecutorId( String mavenExecutorId )
71      {
72          this.mavenExecutorId = mavenExecutorId;
73          return this;
74      }
75  
76      public File getJavaHome()
77      {
78          return javaHome;
79      }
80  
81      public ReleaseEnvironment setJavaHome( File javaHome )
82      {
83          this.javaHome = javaHome;
84          return this;
85      }
86  
87      public File getLocalRepositoryDirectory()
88      {
89          File localRepo = localRepositoryDirectory;
90  
91          if ( localRepo == null && settings != null && settings.getLocalRepository() != null )
92          {
93              localRepo = new File( settings.getLocalRepository() ).getAbsoluteFile();
94          }
95  
96          return localRepo;
97      }
98  
99      public ReleaseEnvironment setLocalRepositoryDirectory( File localRepositoryDirectory )
100     {
101         this.localRepositoryDirectory = localRepositoryDirectory;
102         return this;
103     }
104 
105     public Locale getLocale()
106     {
107         return locale;
108     }
109     
110     public ReleaseEnvironment setLocale( Locale locale )
111     {
112         this.locale = locale;
113         return this;
114     }
115 }