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  /**
28   * <p>DefaultReleaseEnvironment class.</p>
29   *
30   */
31  public class DefaultReleaseEnvironment
32      implements ReleaseEnvironment
33  {
34  
35      private File mavenHome;
36  
37      private File javaHome;
38  
39      private File localRepositoryDirectory;
40  
41      private Settings settings;
42  
43      private String mavenExecutorId = DEFAULT_MAVEN_EXECUTOR_ID;
44  
45      private Locale locale = Locale.ENGLISH;
46  
47      @Override
48      public File getMavenHome()
49      {
50          return mavenHome;
51      }
52  
53      @Override
54      public Settings getSettings()
55      {
56          return settings;
57      }
58  
59      /**
60       * <p>Setter for the field <code>mavenHome</code>.</p>
61       *
62       * @param mavenHome a {@link java.io.File} object
63       * @return a {@link org.apache.maven.shared.release.env.DefaultReleaseEnvironment} object
64       */
65      public DefaultReleaseEnvironment setMavenHome( File mavenHome )
66      {
67          this.mavenHome = mavenHome;
68          return this;
69      }
70  
71      /**
72       * <p>Setter for the field <code>settings</code>.</p>
73       *
74       * @param settings a {@link org.apache.maven.settings.Settings} object
75       * @return a {@link org.apache.maven.shared.release.env.DefaultReleaseEnvironment} object
76       */
77      public DefaultReleaseEnvironment setSettings( Settings settings )
78      {
79          this.settings = settings;
80          return this;
81      }
82  
83      @Override
84      public String getMavenExecutorId()
85      {
86          return mavenExecutorId;
87      }
88  
89      /**
90       * <p>Setter for the field <code>mavenExecutorId</code>.</p>
91       *
92       * @param mavenExecutorId a {@link java.lang.String} object
93       * @return a {@link org.apache.maven.shared.release.env.DefaultReleaseEnvironment} object
94       */
95      public DefaultReleaseEnvironment setMavenExecutorId( String mavenExecutorId )
96      {
97          this.mavenExecutorId = mavenExecutorId;
98          return this;
99      }
100 
101     @Override
102     public File getJavaHome()
103     {
104         return javaHome;
105     }
106 
107     /**
108      * <p>Setter for the field <code>javaHome</code>.</p>
109      *
110      * @param javaHome a {@link java.io.File} object
111      * @return a {@link org.apache.maven.shared.release.env.DefaultReleaseEnvironment} object
112      */
113     public DefaultReleaseEnvironment setJavaHome( File javaHome )
114     {
115         this.javaHome = javaHome;
116         return this;
117     }
118 
119     @Override
120     public File getLocalRepositoryDirectory()
121     {
122         File localRepo = localRepositoryDirectory;
123 
124         if ( localRepo == null && settings != null && settings.getLocalRepository() != null )
125         {
126             localRepo = new File( settings.getLocalRepository() ).getAbsoluteFile();
127         }
128 
129         return localRepo;
130     }
131 
132     /**
133      * <p>Setter for the field <code>localRepositoryDirectory</code>.</p>
134      *
135      * @param localRepositoryDirectory a {@link java.io.File} object
136      * @return a {@link org.apache.maven.shared.release.env.DefaultReleaseEnvironment} object
137      */
138     public DefaultReleaseEnvironment setLocalRepositoryDirectory( File localRepositoryDirectory )
139     {
140         this.localRepositoryDirectory = localRepositoryDirectory;
141         return this;
142     }
143 
144     @Override
145     public Locale getLocale()
146     {
147         return locale;
148     }
149 
150     /**
151      * <p>Setter for the field <code>locale</code>.</p>
152      *
153      * @param locale a {@link java.util.Locale} object
154      * @return a {@link org.apache.maven.shared.release.env.DefaultReleaseEnvironment} object
155      */
156     public DefaultReleaseEnvironment setLocale( Locale locale )
157     {
158         this.locale = locale;
159         return this;
160     }
161 }