View Javadoc

1   /*
2    * Copyright 2008-2010 smartics, Kronseder & Reiner GmbH
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package de.smartics.maven.issues;
18  
19  import org.codehaus.plexus.util.StringUtils;
20  
21  /**
22   * Provides configuration information for issue management facades.
23   *
24   * @author <a href="mailto:robert.reiner@smartics.de">Robert Reiner</a>
25   * @version $Revision:591 $
26   */
27  public class IssueManagementConfig
28  {
29    // ********************************* Fields *********************************
30  
31    // --- constants ------------------------------------------------------------
32  
33    // --- members --------------------------------------------------------------
34  
35    /**
36     * The identifier of the issue management system this configuration applies
37     * to. The identifier is specified in the Maven POM and is evaluated by a
38     * {@link RepositoryFacadeFactory} to create a {@link RepositoryFacade}
39     * capable to access the remote issue management repository.
40     */
41    private final String issueManagementId;
42  
43    /**
44     * The URL to connect to the issue management system.
45     */
46    private final String connectionUrl;
47  
48    /**
49     * The name of the user for authentication to access a private installation of
50     * a issue management system.
51     */
52    private String issueManagementUser;
53  
54    /**
55     * The password for authentication to access a private installation of a issue
56     * management system.
57     */
58    private String issueManagementPassword;
59  
60    /**
61     * The name of the user for HTTP basic authentication to the issue management
62     * webserver.
63     */
64    private String webUser;
65  
66    /**
67     * The password for HTTP basic authentication to the issue management
68     * webserver.
69     */
70    private String webPassword;
71  
72    /**
73     * Sets the version of the task repository.
74     */
75    private String repositoryVersion;
76  
77    /**
78     * Maximum number of entries to be displayed by the Bugzilla Report. Use
79     * <code>-1</code> for unlimited entries.
80     */
81    private int maxEntries;
82  
83    /**
84     * Maximum number retries to connect to the issue management system.
85     */
86    private int maxRetries;
87  
88    /**
89     * The timeout in milliseconds between retries of connection attempts.
90     */
91    private long timeout;
92  
93    /**
94     * The flag indicates whether (<code>true</code>) or not (<code>false</code>)
95     * logout problems from the task repository should be ignored.
96     * <p>
97     * This is a kind of hack that grabs for the string 'Logout' in the exception
98     * message reported from the task repository. It may be useful if the task
99     * repository's response is quite slow.
100    */
101   private boolean ignoreLogoutProblem;
102 
103   /**
104    * The directory to store task data information for the task cache. This is an
105    * optimization to not fetch tasks already fetched.
106    */
107   private String buildDirectory;
108 
109   /**
110    * Informs that the column names retrieved by the query should be logged at
111    * the end of the query. This allows to grab the keywords returned by the
112    * issue management system.
113    */
114   private boolean logColumns;
115 
116   // ****************************** Initializer *******************************
117 
118   // ****************************** Constructors ******************************
119 
120   /**
121    * Default constructor.
122    *
123    * @param issueManagementId the identifier of the issue management system this
124    *          configuration applies to.
125    * @param connectionUrl the URL to connect to the issue management system.
126    * @throws IllegalArgumentException if any of the given strings is blank.
127    */
128   public IssueManagementConfig(final String issueManagementId,
129       final String connectionUrl) throws IllegalArgumentException
130   {
131     if (StringUtils.isBlank(issueManagementId))
132     {
133       throw new IllegalArgumentException(
134           "The issue management ID must not be blank.");
135     }
136     if (StringUtils.isBlank(connectionUrl))
137     {
138       throw new IllegalArgumentException(
139           "The issue management connection URL must not be blank.");
140     }
141 
142     this.issueManagementId = issueManagementId;
143     this.connectionUrl = connectionUrl;
144   }
145 
146   // ****************************** Inner Classes *****************************
147 
148   // ********************************* Methods ********************************
149 
150   // --- init -----------------------------------------------------------------
151 
152   // --- get&set --------------------------------------------------------------
153 
154   /**
155    * Returns the identifier of the issue management system this configuration
156    * applies to. The identifier is specified in the Maven POM and is evaluated
157    * by a {@link RepositoryFacadeFactory} to create a {@link RepositoryFacade}
158    * capable to access the remote issue management repository.
159    *
160    * @return the identifier of the issue management system this configuration
161    *         applies to.
162    */
163   public String getIssueManagementId()
164   {
165     return issueManagementId;
166   }
167 
168   /**
169    * Returns the URL to connect to the issue management system.
170    *
171    * @return the URL to connect to the issue management system.
172    */
173   public String getConnectionUrl()
174   {
175     return connectionUrl;
176   }
177 
178   /**
179    * Returns the name of the user for authentication to access a private
180    * installation of a issue management system.
181    *
182    * @return the name of the user for authentication to access a private
183    *         installation of a issue management system.
184    */
185   public String getIssueManagementUser()
186   {
187     return issueManagementUser;
188   }
189 
190   /**
191    * Sets the name of the user for authentication to access a private
192    * installation of a issue management system.
193    *
194    * @param issueManagementUser the name of the user for authentication to
195    *          access a private installation of a issue management system.
196    */
197   public void setIssueManagementUser(final String issueManagementUser)
198   {
199     this.issueManagementUser = issueManagementUser;
200   }
201 
202   /**
203    * Returns the password for authentication to access a private installation of
204    * a issue management system.
205    *
206    * @return the password for authentication to access a private installation of
207    *         a issue management system.
208    */
209   public String getIssueManagementPassword()
210   {
211     return issueManagementPassword;
212   }
213 
214   /**
215    * Sets the password for authentication to access a private installation of a
216    * issue management system.
217    *
218    * @param issueManagementPassword the password for authentication to access a
219    *          private installation of a issue management system.
220    */
221   public void setIssueManagementPassword(final String issueManagementPassword)
222   {
223     this.issueManagementPassword = issueManagementPassword;
224   }
225 
226   /**
227    * Returns the name of the user for HTTP basic authentication to the issue
228    * management webserver.
229    *
230    * @return the name of the user for HTTP basic authentication to the issue
231    *         management webserver.
232    */
233   public String getWebUser()
234   {
235     return webUser;
236   }
237 
238   /**
239    * Sets the name of the user for HTTP basic authentication to the issue
240    * management webserver.
241    *
242    * @param webUser the name of the user for HTTP basic authentication to the
243    *          issue management webserver.
244    */
245   public void setWebUser(final String webUser)
246   {
247     this.webUser = webUser;
248   }
249 
250   /**
251    * Returns the password for HTTP basic authentication to the issue management
252    * webserver.
253    *
254    * @return the password for HTTP basic authentication to the issue management
255    *         webserver.
256    */
257   public String getWebPassword()
258   {
259     return webPassword;
260   }
261 
262   /**
263    * Sets the password for HTTP basic authentication to the issue management
264    * webserver.
265    *
266    * @param webPassword the password for HTTP basic authentication to the issue
267    *          management webserver.
268    */
269   public void setWebPassword(final String webPassword)
270   {
271     this.webPassword = webPassword;
272   }
273 
274   /**
275    * Returns the value for repositoryVersion.
276    * <p>
277    * Sets the version of the task repository.
278    *
279    * @return the value for repositoryVersion.
280    */
281   public String getRepositoryVersion()
282   {
283     return repositoryVersion;
284   }
285 
286   /**
287    * Sets the value for repositoryVersion.
288    * <p>
289    * Sets the version of the task repository.
290    *
291    * @param repositoryVersion the value for repositoryVersion.
292    */
293   public void setRepositoryVersion(final String repositoryVersion)
294   {
295     this.repositoryVersion = repositoryVersion;
296   }
297 
298   /**
299    * Returns the value for maxEntries.
300    * <p>
301    * Maximum number of entries to be displayed by the Bugzilla Report. Use
302    * <code>-1</code> for unlimited entries.
303    *
304    * @return the value for maxEntries.
305    */
306   public int getMaxEntries()
307   {
308     return maxEntries;
309   }
310 
311   /**
312    * Sets the value for maxEntries.
313    * <p>
314    * Maximum number of entries to be displayed by the Bugzilla Report. Use
315    * <code>-1</code> for unlimited entries.
316    *
317    * @param maxEntries the value for maxEntries.
318    */
319   public void setMaxEntries(final int maxEntries)
320   {
321     this.maxEntries = maxEntries;
322   }
323 
324   /**
325    * Returns the value for maxRetries.
326    * <p>
327    * Maximum number retries to connect to the issue management system.
328    *
329    * @return the value for maxRetries.
330    */
331   public int getMaxRetries()
332   {
333     return maxRetries;
334   }
335 
336   /**
337    * Sets the value for maxRetries.
338    * <p>
339    * Maximum number retries to connect to the issue management system.
340    *
341    * @param maxRetries the value for maxRetries.
342    */
343   public void setMaxRetries(final int maxRetries)
344   {
345     this.maxRetries = maxRetries;
346   }
347 
348   /**
349    * Returns the timeout in milliseconds between retries of connection attempts.
350    *
351    * @return the timeout in milliseconds between retries of connection attempts.
352    */
353   public long getTimeout()
354   {
355     return timeout;
356   }
357 
358   /**
359    * Sets the timeout between retries of connection attempts.
360    *
361    * @param timeout the timeout between retries of connection attempts.
362    */
363   public void setTimeout(final long timeout)
364   {
365     this.timeout = timeout;
366   }
367 
368   /**
369    * Returns the flag indicates whether (<code>true</code>) or not (
370    * <code>false</code>) logout problems from the task repository should be
371    * ignored.
372    * <p>
373    * This is a kind of hack that grabs for the string 'Logout' in the exception
374    * message reported from the task repository. It may be useful if the task
375    * repository's response is quite slow.
376    *
377    * @return the flag indicates whether (<code>true</code>) or not (
378    *         <code>false</code>) logout problems from the task repository should
379    *         be ignored.
380    */
381   public boolean isIgnoreLogoutProblem()
382   {
383     return ignoreLogoutProblem;
384   }
385 
386   /**
387    * Sets the flag indicates whether (<code>true</code>) or not (
388    * <code>false</code>) logout problems from the task repository should be
389    * ignored.
390    * <p>
391    * This is a kind of hack that grabs for the string 'Logout' in the exception
392    * message reported from the task repository. It may be useful if the task
393    * repository's response is quite slow.
394    *
395    * @param ignoreLogoutProblem the flag indicates whether (<code>true</code>)
396    *          or not (<code>false</code>) logout problems from the task
397    *          repository should be ignored.
398    */
399   public void setIgnoreLogoutProblem(final boolean ignoreLogoutProblem)
400   {
401     this.ignoreLogoutProblem = ignoreLogoutProblem;
402   }
403 
404   /**
405    * Returns the directory to store task data information for the task cache.
406    * This is an optimization to not fetch tasks already fetched.
407    *
408    * @return the directory to store task data information for the task cache.
409    */
410   public String getBuildDirectory()
411   {
412     return buildDirectory;
413   }
414 
415   /**
416    * Sets the directory to store task data information for the task cache. This
417    * is an optimization to not fetch tasks already fetched.
418    *
419    * @param buildDirectory the directory to store task data information for the
420    *          task cache.
421    */
422   public void setBuildDirectory(final String buildDirectory)
423   {
424     this.buildDirectory = buildDirectory;
425   }
426 
427   /**
428    * Returns the value for logColumns.
429    * <p>
430    * Informs that the column names retrieved by the query should be logged at
431    * the end of the query. This allows to grab the keywords returned by the
432    * issue management system.
433    * </p>
434    *
435    * @return the value for logColumns.
436    */
437   public boolean isLogColumns()
438   {
439     return logColumns;
440   }
441 
442   /**
443    * Sets the value for logColumns.
444    * <p>
445    * Informs that the column names retrieved by the query should be logged at
446    * the end of the query. This allows to grab the keywords returned by the
447    * issue management system.
448    * </p>
449    *
450    * @param logColumns the value for logColumns.
451    */
452   public void setLogColumns(final boolean logColumns)
453   {
454     this.logColumns = logColumns;
455   }
456 
457   // --- business -------------------------------------------------------------
458 
459   // --- object basics --------------------------------------------------------
460 
461 }