Coverage Report - net.sf.statcvs.output.ConfigurationOptions
 
Classes in this File Line Coverage Branch Coverage Complexity
ConfigurationOptions
8%
33/390
0%
0/180
2.577
 
 1  
 /*
 2  
     StatCvs - CVS statistics generation 
 3  
     Copyright (C) 2002  Lukasz Pekacki <lukasz@pekacki.de>
 4  
     http://statcvs.sf.net/
 5  
     
 6  
     This library is free software; you can redistribute it and/or
 7  
     modify it under the terms of the GNU Lesser General Public
 8  
     License as published by the Free Software Foundation; either
 9  
     version 2.1 of the License, or (at your option) any later version.
 10  
 
 11  
     This library is distributed in the hope that it will be useful,
 12  
     but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  
     Lesser General Public License for more details.
 15  
 
 16  
     You should have received a copy of the GNU Lesser General Public
 17  
     License along with this library; if not, write to the Free Software
 18  
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 19  
     
 20  
         $RCSfile: ConfigurationOptions.java,v $
 21  
         $Date: 2009/03/13 23:04:28 $ 
 22  
 */
 23  
 package net.sf.statcvs.output;
 24  
 
 25  
 import java.awt.Color;
 26  
 import java.io.BufferedReader;
 27  
 import java.io.File;
 28  
 import java.io.FileInputStream;
 29  
 import java.io.FileNotFoundException;
 30  
 import java.io.FileReader;
 31  
 import java.io.IOException;
 32  
 import java.io.InputStream;
 33  
 import java.net.MalformedURLException;
 34  
 import java.net.URL;
 35  
 import java.util.ArrayList;
 36  
 import java.util.Collection;
 37  
 import java.util.Properties;
 38  
 import java.util.regex.Pattern;
 39  
 import java.util.regex.PatternSyntaxException;
 40  
 
 41  
 import net.sf.statcvs.pages.MarkupSyntax;
 42  
 import net.sf.statcvs.util.FilePatternMatcher;
 43  
 import net.sf.statcvs.util.FileUtils;
 44  
 import net.sf.statcvs.weblinks.bugs.BugTracker;
 45  
 import net.sf.statcvs.weblinks.bugs.Bugzilla;
 46  
 import net.sf.statcvs.weblinks.bugs.Mantis;
 47  
 
 48  
 import org.jfree.chart.renderer.category.BarRenderer;
 49  
 import org.jfree.chart.renderer.category.StandardBarPainter;
 50  
 import org.jfree.chart.renderer.xy.StandardXYBarPainter;
 51  
 import org.jfree.chart.renderer.xy.XYBarRenderer;
 52  
 
 53  
 /**
 54  
  * Class for storing all command line parameters. The parameters
 55  
  * are set by the {@link net.sf.statcvs.Main#main} method. Interested classes
 56  
  * can read all parameter values from here.
 57  0
  * 
 58  
  * TODO: Should be moved to more appropriate package and made non-public
 59  
  * 
 60  
  * @author jentzsch
 61  
  * @version $Id: ConfigurationOptions.java,v 1.37 2009/03/13 23:04:28 benoitx Exp $
 62  
  */
 63  16
 public class ConfigurationOptions {
 64  16
 
 65  16
     private static final String LOGGING_CONFIG_DEFAULT = "logging.properties";
 66  16
     private static final String LOGGING_CONFIG_VERBOSE = "logging-verbose.properties";
 67  16
     private static final String LOGGING_CONFIG_DEBUG = "logging-debug.properties";
 68  16
 
 69  24
     private static String logFileName = null;
 70  8
     private static String checkedOutDirectory = null;
 71  24
     private static String projectName = null;
 72  24
     private static String outputDir = "";
 73  8
     private static String loggingProperties = LOGGING_CONFIG_DEFAULT;
 74  24
     private static String notesFile = null;
 75  8
     private static String notes = null;
 76  16
 
 77  24
     private static FilePatternMatcher includePattern = null;
 78  8
     private static FilePatternMatcher excludePattern = null;
 79  
 
 80  24
     private static Collection nonDeveloperLogins = new ArrayList();
 81  16
 
 82  24
     private static CssHandler cssHandler = new DefaultCssHandler("objectlab-statcvs.css");
 83  8
     private static String charSet = "ISO-8859-1";
 84  8
     private static WebRepositoryIntegration webRepository = null;
 85  
     private static Pattern symbolicNamesPattern;
 86  0
 
 87  8
     private static BugTracker webBugTracker = BugTracker.NO_BUG_TRACKER;
 88  8
     private static String outputFormat = "html";
 89  8
     private static Properties properties = new Properties();
 90  0
 
 91  0
     static {
 92  8
         XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter());
 93  8
         BarRenderer.setDefaultBarPainter(new StandardBarPainter());
 94  8
     }
 95  
 
 96  
     public static String getCharSet() {
 97  0
         return charSet;
 98  0
     }
 99  
 
 100  
     public static void setCharSet(final String cs) {
 101  0
         charSet = cs;
 102  0
     }
 103  
 
 104  
     /**
 105  0
      * returns the {@link CssHandler}
 106  0
      * @return the CssHandler
 107  
      */
 108  
     public static CssHandler getCssHandler() {
 109  0
         return cssHandler;
 110  
     }
 111  
 
 112  
     /**
 113  0
      * Method getProjectName.
 114  0
      * @return String name of the project
 115  
      */
 116  
     public static String getProjectName() {
 117  0
         return projectName;
 118  
     }
 119  
 
 120  
     /**
 121  0
      * Method getCheckedOutDirectory.
 122  0
      * @return String name of the checked out directory
 123  
      */
 124  
     public static String getCheckedOutDirectory() {
 125  0
         return checkedOutDirectory;
 126  
     }
 127  
 
 128  
     /**
 129  
      * Method getLogfilename.
 130  0
      * @return String name of the logfile to be parsed
 131  
      */
 132  
     public static String getLogFileName() {
 133  0
         return logFileName;
 134  
     }
 135  
 
 136  
     /**
 137  
      * Returns the outputDir.
 138  
      * @return String output Directory
 139  0
      */
 140  
     public static String getOutputDir() {
 141  0
         return outputDir;
 142  
     }
 143  
 
 144  
     /**
 145  
      * Returns the report notes (from "-notes filename" switch) or <tt>null</tt>
 146  
      * if not specified
 147  
      * @return the report notes
 148  0
      */
 149  0
     public static String getNotes() {
 150  0
         return notes;
 151  
     }
 152  0
 
 153  0
     /**
 154  
      * Returns a {@link WebRepositoryIntegration} object if the user
 155  
      * has specified a URL to one. <tt>null</tt> otherwise.
 156  
      * @return the web repository
 157  0
      */
 158  0
     public static WebRepositoryIntegration getWebRepository() {
 159  0
         return webRepository;
 160  
     }
 161  0
 
 162  0
     /**
 163  
      * Sets the checkedOutDirectory.
 164  
      * @param checkedOutDirectory The checkedOutDirectory to set
 165  
      * @throws ConfigurationException if directory does not exist
 166  
      */
 167  
     public static void setCheckedOutDirectory(final String checkedOutDirectory) throws ConfigurationException {
 168  0
         final File directory = new File(checkedOutDirectory);
 169  0
         if (!directory.exists() || !directory.isDirectory()) {
 170  0
             throw new ConfigurationException("directory does not exist: " + checkedOutDirectory);
 171  
         }
 172  0
         ConfigurationOptions.checkedOutDirectory = checkedOutDirectory;
 173  0
     }
 174  0
 
 175  0
     /**
 176  0
      * Sets the cssFile. Currently, the css file can be any local file or
 177  0
      * a HTTP URL. If it is a local file, a copy will be included in the
 178  0
      * output directory. If this method is never called, a default CSS file
 179  0
      * will be generated in the output directory.
 180  
      *
 181  0
      * @param cssFile The cssFile to set
 182  0
      * @throws ConfigurationException if the specified CSS file can not be
 183  0
      * accessed from local file system or from URL source, or if the specified
 184  0
      * CSS file is local and does not exist
 185  0
      */
 186  0
     public static void setCssFile(final String cssFile) throws ConfigurationException {
 187  0
         try {
 188  0
             final URL url = new URL(cssFile);
 189  0
             if (!url.getProtocol().equals("http")) {
 190  0
                 throw new ConfigurationException("Only HTTP URLs or local files allowed for -css");
 191  
             }
 192  0
             cssHandler = new UrlCssHandler(url);
 193  0
         } catch (final MalformedURLException isLocalFile) {
 194  0
             cssHandler = new LocalFileCssHandler(cssFile);
 195  0
         }
 196  0
         cssHandler.checkForMissingResources();
 197  0
     }
 198  0
 
 199  0
     /**
 200  
      * Sets the logFileName.
 201  0
      * @param logFileName The logFileName to set
 202  0
      * @throws ConfigurationException if the file does not exist
 203  0
      */
 204  
     public static void setLogFileName(final String logFileName) throws ConfigurationException {
 205  0
         final File inputFile = new File(logFileName);
 206  0
         if (!inputFile.exists()) {
 207  0
             throw new ConfigurationException("Specified logfile not found: " + logFileName);
 208  0
         }
 209  0
         ConfigurationOptions.logFileName = logFileName;
 210  0
     }
 211  0
 
 212  0
     /**
 213  
      * Sets the outputDir.
 214  0
      * @param outputDir The outputDir to set
 215  0
      * @throws ConfigurationException if the output directory cannot be created
 216  
      */
 217  0
     public static void setOutputDir(String outputDir) throws ConfigurationException {
 218  0
         if (!outputDir.endsWith(FileUtils.getDirSeparator())) {
 219  0
             outputDir += FileUtils.getDefaultDirSeparator();
 220  
         }
 221  0
         final File outDir = new File(outputDir);
 222  0
         if (!outDir.exists() && !outDir.mkdirs()) {
 223  0
             throw new ConfigurationException("Can't create output directory: " + outputDir);
 224  0
         }
 225  0
         ConfigurationOptions.outputDir = outputDir;
 226  0
     }
 227  0
 
 228  0
     /**
 229  0
      * Sets the name of the notes file. The notes file will be included
 230  0
      * on the index page of the output. It must contain a valid
 231  0
      * block-level HTML fragment (for example
 232  
      * <tt>"&lt;p&gt;Some notes&lt;/p&gt;"</tt>) 
 233  0
      * @param notesFile a local filename
 234  
      * @throws ConfigurationException if the file is not found or can't be read
 235  0
      */
 236  0
     public static void setNotesFile(final String notesFile) throws ConfigurationException {
 237  0
         final File f = new File(notesFile);
 238  0
         if (!f.exists()) {
 239  0
             throw new ConfigurationException("Notes file not found: " + notesFile);
 240  0
         }
 241  0
         if (!f.canRead()) {
 242  0
             throw new ConfigurationException("Can't read notes file: " + notesFile);
 243  
         }
 244  0
         ConfigurationOptions.notesFile = notesFile;
 245  
         try {
 246  0
             notes = readNotesFile();
 247  0
         } catch (final IOException e) {
 248  0
             throw new ConfigurationException(e.getMessage());
 249  0
         }
 250  0
     }
 251  0
 
 252  
     /**
 253  
      * Sets the URL to a <a href="http://viewcvs.sourceforge.net/">ViewCVS</a>
 254  
      * web-based CVS browser. This must be the URL at which the checked-out
 255  
      * module's root can be viewed in ViewCVS.
 256  
      * @param url URL to a ViewCVS repository
 257  
      */
 258  
     public static void setViewCvsURL(final String url) {
 259  0
         ConfigurationOptions.webRepository = new ViewCvsIntegration(url);
 260  0
     }
 261  0
 
 262  
     /**
 263  
      * Sets the URL to a 
 264  
      * <a href="http://www.freebsd.org/projects/cvsweb.html">cvsweb</a>
 265  
      * web-based CVS browser. This must be the URL at which the checked-out
 266  
      * module's root can be viewed in cvsweb.
 267  
      * @param url URL to a cvsweb repository
 268  
      */
 269  0
     public static void setCvswebURL(final String url) {
 270  0
         ConfigurationOptions.webRepository = new CvswebIntegration(url);
 271  0
     }
 272  
 
 273  
     /**
 274  
      * Sets the URL to a <a href="http://www.horde.org/chora/">Chora</a>
 275  
      * web-based CVS browser. This must be the URL at which the checked-out
 276  
      * module's root can be viewed in Chora.
 277  
      * @param url URL to a cvsweb repository
 278  
      */
 279  0
     public static void setChoraURL(final String url) {
 280  0
         ConfigurationOptions.webRepository = new ChoraIntegration(url);
 281  0
     }
 282  0
 
 283  0
     /**
 284  
      * Sets the URL to a <a href="http://www.jcvs.org/jcvsweb/">JCVSWeb</a>
 285  
      * web-based CVS browser. This must be the URL at which the checked-out
 286  
      * module's root can be viewed in JCVSWeb.
 287  
      * @param url URL to a JCVSWeb repository
 288  
      */
 289  
     public static void setJCVSWebURL(final String url) {
 290  0
         ConfigurationOptions.webRepository = new JCVSWebIntegration(url);
 291  0
     }
 292  0
 
 293  
     /**
 294  0
      * Sets the URL to a <a href="http://www.viewvc.org/">ViewVC</a> web-based CVS/SVN browser. 
 295  0
      * This must be the URL at which the checked-out module's
 296  
      * root can be viewed in ViewVC.
 297  
      * 
 298  0
      * @param url
 299  
      *            URL to a ViewVC repository
 300  
      */
 301  
     public static void setViewVcURL(final String url) {
 302  0
         ConfigurationOptions.webRepository = new ViewVcIntegration(url);
 303  0
     }
 304  0
 
 305  0
     /**
 306  0
      * Sets the URL to a <a href="http://trac.edgewall.org/wiki/TracBrowser">Trac</a> web-based SVN browser and issue tracking. 
 307  
      * This must be the URL at which the checked-out module's
 308  
      * root can be viewed in Trac 
 309  
      * 
 310  0
      * @param url
 311  0
      *            URL to a Trac website
 312  0
      */
 313  0
     public static void setViewTracURL(final String url) {
 314  0
         ConfigurationOptions.webRepository = new TracIntegration(url);
 315  0
     }
 316  0
 
 317  0
     /**
 318  0
      * Sets a project title to be used in the reports
 319  0
      * @param projectName The project title to be used in the reports
 320  0
      */
 321  0
     public static void setProjectName(final String projectName) {
 322  0
         ConfigurationOptions.projectName = projectName;
 323  0
     }
 324  0
 
 325  0
     /**
 326  0
      * Gets the name of the logging properties file
 327  0
      * @return the name of the logging properties file
 328  0
      */
 329  0
     public static String getLoggingProperties() {
 330  0
         return loggingProperties;
 331  0
     }
 332  0
 
 333  0
     /**
 334  0
      * Sets the logging level to verbose
 335  0
      */
 336  
     public static void setVerboseLogging() {
 337  0
         ConfigurationOptions.loggingProperties = LOGGING_CONFIG_VERBOSE;
 338  0
     }
 339  0
 
 340  0
     /**
 341  0
      * Sets the logging level to debug
 342  0
      */
 343  0
     public static void setDebugLogging() {
 344  0
         ConfigurationOptions.loggingProperties = LOGGING_CONFIG_DEBUG;
 345  0
     }
 346  0
 
 347  0
     private static String readNotesFile() throws IOException {
 348  0
         BufferedReader r = null;
 349  0
         final StringBuffer result = new StringBuffer();
 350  
         try {
 351  0
             r = new BufferedReader(new FileReader(notesFile));
 352  0
             String line = r.readLine();
 353  0
             while (line != null) {
 354  0
                 result.append(line);
 355  0
                 line = r.readLine();
 356  
             }
 357  
         } finally {
 358  0
             if (r != null) {
 359  0
                 r.close();
 360  
             }
 361  
         }
 362  0
         return result.toString();
 363  0
     }
 364  0
 
 365  0
     /**
 366  0
      * Sets a file include pattern list. Only files matching one of the
 367  0
      * patterns will be included in the analysis.
 368  0
      * @param patternList a list of Ant-style wildcard patterns, seperated
 369  
      *                    by : or ;
 370  
      * @see net.sf.statcvs.util.FilePatternMatcher
 371  0
      */
 372  0
     public static void setIncludePattern(final String patternList) {
 373  0
         includePattern = new FilePatternMatcher(patternList);
 374  0
     }
 375  0
 
 376  0
     /**
 377  
      * Sets a file exclude pattern list. Files matching any of the
 378  0
      * patterns will be excluded from the analysis.
 379  0
      * @param patternList a list of Ant-style wildcard patterns, seperated
 380  0
      *                    by : or ;
 381  
      * @see net.sf.statcvs.util.FilePatternMatcher
 382  0
      */
 383  0
     public static void setExcludePattern(final String patternList) {
 384  0
         excludePattern = new FilePatternMatcher(patternList);
 385  0
     }
 386  0
 
 387  0
     /**
 388  0
      * @return Returns the excludePattern.
 389  
      */
 390  0
     public static FilePatternMatcher getExcludePattern() {
 391  0
         return excludePattern;
 392  0
     }
 393  0
 
 394  0
     /**
 395  0
      * @return Returns the includePattern.
 396  0
      */
 397  0
     public static FilePatternMatcher getIncludePattern() {
 398  0
         return includePattern;
 399  0
     }
 400  0
 
 401  2
     public static void setSymbolicNamesPattern(final String symbolicNamesPattern) throws ConfigurationException {
 402  0
         try {
 403  0
             ConfigurationOptions.symbolicNamesPattern = Pattern.compile(symbolicNamesPattern);
 404  0
         } catch (final PatternSyntaxException e) {
 405  0
             throw new ConfigurationException("Invalid regular expression for tags: " + e.getLocalizedMessage());
 406  0
         }
 407  0
     }
 408  0
 
 409  0
     public static Pattern getSymbolicNamesPattern() {
 410  0
         return symbolicNamesPattern;
 411  0
     }
 412  
 
 413  6
     public static void setBugzillaUrl(final String bugzillaUrl) {
 414  0
         ConfigurationOptions.webBugTracker = new Bugzilla(bugzillaUrl);
 415  0
     }
 416  0
 
 417  0
     public static void setMantisUrl(final String mantisUrl) {
 418  0
         ConfigurationOptions.webBugTracker = new Mantis(mantisUrl);
 419  0
     }
 420  0
 
 421  
     public static BugTracker getWebBugtracker() {
 422  0
         return ConfigurationOptions.webBugTracker;
 423  0
     }
 424  
 
 425  0
     public static void setOutputFormat(final String outputFormat) throws ConfigurationException {
 426  0
         if (!"html".equals(outputFormat) && !"xdoc".equals(outputFormat) && !"xml".equals(outputFormat)) {
 427  0
             throw new ConfigurationException("Invalid output format, use only 'html', 'xdoc' or 'xml'");
 428  0
         }
 429  0
         ConfigurationOptions.outputFormat = outputFormat;
 430  0
     }
 431  0
 
 432  0
     public static String getOutputFormat() {
 433  4
         return outputFormat;
 434  0
     }
 435  0
 
 436  0
     public static MarkupSyntax getMarkupSyntax() {
 437  0
         if ("xdoc".equals(outputFormat)) {
 438  0
             return ReportConfig.XDOC;
 439  0
         } else if ("xml".equals(outputFormat)) {
 440  0
             return ReportConfig.XML;
 441  0
         }
 442  0
         return ReportConfig.HTML;
 443  0
     }
 444  0
 
 445  0
     public static void setWebRepositoryIntegration(final WebRepositoryIntegration webRepo) {
 446  0
         webRepository = webRepo;
 447  0
     }
 448  0
 
 449  0
     /**
 450  
     * Allow change between css that are shipped with the tool.
 451  0
     * @param cssName statcvs.css or objectlab-statcvs-xdoc.css
 452  0
     */
 453  0
     public static void setDefaultCssFile(final String cssName) {
 454  0
         cssHandler = new DefaultCssHandler(cssName);
 455  0
     }
 456  0
 
 457  
     /**
 458  0
      * Excludes a login name from charts and reports that compare
 459  
      * several developers. Useful to reduce the noise from admin
 460  0
      * accounts.
 461  0
      * @param loginName A login name
 462  0
      */
 463  0
     public static void addNonDeveloperLogin(final String loginName) {
 464  0
         nonDeveloperLogins.add(loginName);
 465  0
     }
 466  0
 
 467  0
     /**
 468  0
      * Gets login names that should be excluded from charts and
 469  0
      * reports that compare several developers.
 470  0
      */
 471  
     public static Collection getNonDeveloperLogins() {
 472  0
         return nonDeveloperLogins;
 473  0
     }
 474  25
 
 475  0
     /**
 476  0
      * Set the config file that may contain user details.
 477  0
      * @param propertiesFilename
 478  
      */
 479  0
     public static void setConfigFile(final String propertiesFilename) throws ConfigurationException {
 480  0
         if (propertiesFilename != null) {
 481  0
             InputStream is = null;
 482  0
             try {
 483  0
                 is = new FileInputStream(propertiesFilename);
 484  0
                 properties.load(is);
 485  0
             } catch (final FileNotFoundException e) {
 486  75
                 throw new ConfigurationException("Unable to find the configuration file " + propertiesFilename);
 487  0
             } catch (final IOException e) {
 488  0
                 throw new ConfigurationException("Problem reading the configuration file " + propertiesFilename);
 489  
             } finally {
 490  0
                 if (is != null) {
 491  
                     try {
 492  0
                         is.close();
 493  0
                     } catch (final IOException e) {
 494  0
                         throw new ConfigurationException("Problem closing stream to the configuration file " + propertiesFilename);
 495  0
                     }
 496  
                 }
 497  0
             }
 498  
         }
 499  0
     }
 500  
 
 501  
     /**
 502  
      * The config properties.
 503  
      * @return
 504  
      */
 505  
     public static Properties getConfigProperties() {
 506  50
         return properties;
 507  
     }
 508  
 
 509  
     /**
 510  
      * Return a String prop.
 511  
      * @param propName
 512  
      * @param defaultValue
 513  
      * @return
 514  
      */
 515  
     public static String getConfigStringProperty(final String propName, final String defaultValue) {
 516  0
         if (properties != null) {
 517  0
             return properties.getProperty(propName, defaultValue);
 518  
         }
 519  0
         return defaultValue;
 520  
     }
 521  
 
 522  
     public static String getConfigStringProperty(final String propName, final String fallBackPropName, final String defaultValue) {
 523  0
         if (properties != null) {
 524  0
             final String val = properties.getProperty(propName);
 525  0
             if (val != null) {
 526  0
                 return val;
 527  
             } else {
 528  0
                 return properties.getProperty(fallBackPropName, defaultValue);
 529  
             }
 530  
         }
 531  0
         return defaultValue;
 532  
     }
 533  
 
 534  
     /**
 535  
      * Return a Integer prop.
 536  
      * @param propName
 537  
      * @param defaultValue
 538  
      * @return
 539  
      */
 540  
     public static Integer getConfigIntegerProperty(final String propName, final Integer defaultValue) {
 541  0
         if (properties != null) {
 542  0
             final String val = properties.getProperty(propName);
 543  0
             if (val != null) {
 544  
                 try {
 545  0
                     return Integer.valueOf(val);
 546  0
                 } catch (final NumberFormatException e) {
 547  0
                     return defaultValue;
 548  
                 }
 549  
             }
 550  
         }
 551  0
         return defaultValue;
 552  
     }
 553  
 
 554  
     /**
 555  
      * Return a Float prop.
 556  
      * @param propName
 557  
      * @param defaultValue
 558  
      * @return
 559  
      */
 560  
     public static Float getConfigIntegerProperty(final String propName, final Float defaultValue) {
 561  0
         if (properties != null) {
 562  0
             final String val = properties.getProperty(propName);
 563  0
             if (val != null) {
 564  
                 try {
 565  0
                     return Float.valueOf(val);
 566  0
                 } catch (final NumberFormatException e) {
 567  0
                     return defaultValue;
 568  
                 }
 569  
             }
 570  
         }
 571  0
         return defaultValue;
 572  
     }
 573  
 
 574  
     /**
 575  
      * Return a String prop.
 576  
      * @param propName
 577  
      * @param defaultValue
 578  
      * @return
 579  
      */
 580  
     public static Color getConfigColorProperty(final String propName, final Color defaultValue) {
 581  0
         if (properties != null) {
 582  0
             String val = properties.getProperty(propName);
 583  0
             if (val != null) {
 584  0
                 if (val.startsWith("#")) {
 585  0
                     val = val.substring(1);
 586  
                 }
 587  0
                 val = val.toLowerCase();
 588  0
                 if (val.length() > 6) {
 589  0
                     return defaultValue;
 590  
                 }
 591  0
                 return new Color(Integer.parseInt(val, 16));
 592  
             }
 593  
         }
 594  0
         return defaultValue;
 595  
     }
 596  
 
 597  
     /**
 598  
      * Return a Integer prop.
 599  
      * @param propName
 600  
      * @param defaultValue
 601  
      * @return
 602  
      */
 603  
     public static Integer getConfigIntegerProperty(final String propName, final String fallBackPropName, final Integer defaultValue) {
 604  0
         if (properties != null) {
 605  0
             final String val = properties.getProperty(propName);
 606  0
             if (val != null) {
 607  
                 try {
 608  0
                     return Integer.valueOf(val);
 609  0
                 } catch (final NumberFormatException e) {
 610  0
                     return defaultValue;
 611  
                 }
 612  
             } else {
 613  0
                 return getConfigIntegerProperty(fallBackPropName, defaultValue);
 614  
             }
 615  
         }
 616  0
         return defaultValue;
 617  
     }
 618  
 
 619  
     /**
 620  
      * Return a Float prop.
 621  
      * @param propName
 622  
      * @param defaultValue
 623  
      * @return
 624  
      */
 625  
     public static Float getConfigFloatProperty(final String propName, final String fallBackPropName, final Float defaultValue) {
 626  0
         if (properties != null) {
 627  0
             final String val = properties.getProperty(propName);
 628  0
             if (val != null) {
 629  
                 try {
 630  0
                     return Float.valueOf(val);
 631  0
                 } catch (final NumberFormatException e) {
 632  0
                     return defaultValue;
 633  
                 }
 634  
             } else {
 635  0
                 return getConfigIntegerProperty(fallBackPropName, defaultValue);
 636  
             }
 637  
         }
 638  0
         return defaultValue;
 639  
     }
 640  
 
 641  
     /**
 642  
      * Return a Boolean prop.
 643  
      * @param propName
 644  
      * @param defaultValue
 645  
      * @return
 646  
      */
 647  
     public static Boolean getConfigBooleanProperty(final String propName, final String fallBackPropName, final Boolean defaultValue) {
 648  0
         if (properties != null) {
 649  0
             String val = properties.getProperty(propName);
 650  0
             if (val != null) {
 651  
                 try {
 652  0
                     return Boolean.valueOf(val);
 653  0
                 } catch (final NumberFormatException e) {
 654  0
                     return defaultValue;
 655  
                 }
 656  
             } else {
 657  0
                 val = properties.getProperty(fallBackPropName);
 658  0
                 if (val != null) {
 659  0
                     return Boolean.valueOf(val);
 660  
                 }
 661  
             }
 662  
         }
 663  0
         return defaultValue;
 664  
     }
 665  
 
 666  
     /**
 667  
      * Return a Color prop.
 668  
      * @param propName
 669  
      * @param defaultValue
 670  
      * @return
 671  
      */
 672  
     public static Color getConfigColorProperty(final String propName, final String fallBackPropName, final Color defaultValue) {
 673  0
         if (properties != null) {
 674  0
             String val = properties.getProperty(propName);
 675  0
             if (val != null) {
 676  0
                 if (val.startsWith("#")) {
 677  0
                     val = val.substring(1);
 678  
                 }
 679  0
                 val = val.toLowerCase();
 680  0
                 if (val.length() > 6) {
 681  0
                     return defaultValue;
 682  
                 }
 683  0
                 return new Color(Integer.parseInt(val, 16));
 684  
             } else {
 685  0
                 return getConfigColorProperty(fallBackPropName, defaultValue);
 686  
             }
 687  
         }
 688  0
         return defaultValue;
 689  
     }
 690  
 }