View Javadoc

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