/**
   * The main CLI processor
   *
   * @param args command line argument
   */
  public static void main(String[] args) {

    checkJavaVersion();
    String logConfig = System.getProperty("log4j.configuration");
    if (logConfig != null && logConfig.length() > 0) {
      File lc = new File(logConfig);
      if (lc.exists()) {
        PropertyConfigurator.configure(logConfig);
        Properties defaults = loadDefaults();
        try {
          Options o = getOptions();
          CommandLineParser parser = new GnuParser();
          CommandLine cmdline = parser.parse(o, args);
          GdcNotification gdi = new GdcNotification(cmdline, defaults);
          if (!gdi.finishedSucessfuly) {
            System.exit(1);
          }
        } catch (org.apache.commons.cli.ParseException e) {
          l.error("Error parsing command line parameters: " + e.getMessage());
          l.debug("Error parsing command line parameters", e);
        }
      } else {
        l.error(
            "Can't find the logging config. Please configure the logging via the log4j.configuration.");
      }
    } else {
      l.error(
          "Can't find the logging config. Please configure the logging via the log4j.configuration.");
    }
  }
 /**
  * Loads default values of common parameters from a properties file searching the working
  * directory and user's home.
  *
  * @return default configuration
  */
 private static Properties loadDefaults() {
   final String[] dirs = new String[] {"user.dir", "user.home"};
   final Properties props = new Properties();
   for (final String d : dirs) {
     String path = System.getProperty(d) + File.separator + DEFAULT_PROPERTIES;
     File f = new File(path);
     if (f.exists() && f.canRead()) {
       try {
         FileInputStream is = new FileInputStream(f);
         props.load(is);
         l.debug("Successfully red the gdi configuration from '" + f.getAbsolutePath() + "'.");
         return props;
       } catch (IOException e) {
         l.warn(
             "Readable gdi configuration '"
                 + f.getAbsolutePath()
                 + "' found be error occurred reading it.");
         l.debug("Error reading gdi configuration '" + f.getAbsolutePath() + "': ", e);
       }
     }
   }
   return props;
 }