Package sos.util

Examples of sos.util.SOSArguments$Argument


                    }

                    // TODO: why do we iterate over all anonymous arguments?
                    // canProcess will always return true?
                    for (final Iterator i = anonymous.iterator(); i.hasNext();) {
                        final Argument argument = (Argument) i.next();

                        if (argument.canProcess(commandLine, arguments)) {
                            argument.process(commandLine, arguments);
                        }
                    }
                } // [END argument is NOT anonymous
            } // [END option NOT found
        } // [END process each command line token
View Full Code Here


     *
     * @return A new Argument instance using the options specified in this
     * ArgumentBuilder.
     */
    public final Argument create() {
        final Argument argument =
            new ArgumentImpl(
                name,
                description,
                minimum,
                maximum,
View Full Code Here

    private void createOption(
        final char type,
        final boolean required,
        final char opt) {
        final Argument argument;
        if (type != ' ') {
            abuilder.reset();
            abuilder.withValidator(validator(type));
            if (required) {
                abuilder.withMinimum(1);
View Full Code Here

    }
  }
 
  private Option createOption(String name, String desc,
                              String argName, int max, boolean required){
    Argument argument = argBuilder.
      withName(argName).
      withMinimum(1).
      withMaximum(max).
      create();
    return builder.
View Full Code Here

  }
 
  private Option createOption(String name, String desc,
                              String argName, int max, boolean required, Validator validator){
   
    Argument argument = argBuilder.
      withName(argName).
      withMinimum(1).
      withMaximum(max).
      withValidator(validator).
      create();
View Full Code Here

        GroupBuilder gBuilder = new GroupBuilder();

        /**
         *  OUTPUT Option
         */
        Argument outputPath = aBuilder.withName("output path").withMinimum(1).withMaximum(1).create();
        Option outputOption = oBuilder.withLongName("output")
                                      .withDescription("Path to generated output file")
                                      .withArgument(outputPath).create();

        /**
         *  GCP Option
         */
        Argument GCPPath = aBuilder.withName("path").withMinimum(1).withMaximum(1).create();
        Option inputOption = oBuilder.withLongName("input").withDescription("File with GCPs")
                                     .withArgument(GCPPath).create();

        /**
         * Set skew option
         */
        Argument skewArg = aBuilder.withName("skew").withMinimum(1).withMaximum(1).create();
        Option setSkew = oBuilder.withLongName("skew")
                                 .withDescription("Sets exlipcitly the value of skew parameter ")
                                 .withArgument(skewArg).create();

        /**
         * Set rotation option
         */
        Argument phiArg = aBuilder.withName("rotation").withMinimum(1).withMaximum(1).create();
        Option setPhi = oBuilder.withLongName("phi")
                                .withDescription("Sets exlipcitly the value of rotation parameter (in radians)")
                                .withArgument(phiArg).create();

        Option statistics = oBuilder.withLongName("s")
View Full Code Here

         if (spooler_task.params().var("db_class") != null && spooler_task.params().var("db_class").length() > 0) {
            this.setDbClass(spooler_task.params().var("db_class"));
            spooler_log.debug1(".. job parameter [db_class]: " + this.getDbClass());
        }

        SOSArguments arguments = new SOSArguments(this.getDbProperty());

        SOSConnection conn;
       
        if (sosLogger!=null){
            conn = getSchedulerConnection(this.getJobSettings(),sosLogger);
        }else{
            conn = getSchedulerConnection(this.getJobSettings());
        }
       
        if (spooler_task.params().var("db") != null && spooler_task.params().var("db").length() > 0) {
           if (sosLogger!=null){
              conn = SOSConnection.createInstance
                dbClass,
                  arguments.as_string("-class=", ""),
                  arguments.as_string("-url=", ""),
                  arguments.as_string("-user=", ""),
                  arguments.as_string("-password=", ""),
                  sosLogger );
           } else{
              conn = SOSConnection.createInstance
          dbClass,
          arguments.as_string("-class=", ""),
          arguments.as_string("-url=", ""),
          arguments.as_string("-user=", ""),
          arguments.as_string("-password=", ""));
        }
        }
        if (spooler_job!=null && getJobSettings()!=null) setJobProperties(getJobSettings().getSection("job " + spooler_job.name()));           
        if (spooler_task != null) this.setJobId(spooler_task.id());           
        if (spooler_job != null) this.setJobName(spooler_job.name());
View Full Code Here

                isExport = false;
            }
        }

        if (isExport) {
            SOSArguments arguments = new SOSArguments(args);

            SOSExportProcessor processor = new SOSExportProcessor(new File(
                    arguments.as_string("-config=", "sos_settings.ini")),
                    new File(arguments.as_string("-log=", "sos_export.log")),
                    arguments.as_int("-log-level=", 0),
                    new File(arguments.as_string("-output=", "sos_export.xml")),
                    new String(arguments.as_string("-tables=", "")),
                    new String(arguments.as_string("-execute=", "")),
                    new String(arguments.as_string("-keys=", "")));

            arguments.check_all_used();
            processor.doExport();
        }
    }
View Full Code Here

    public static SOSConnection getSchedulerConnection(SOSSettings schedulerSettings, SOSLogger log) throws Exception {
       
        String dbProperty = schedulerSettings.getSection("spooler").getProperty("db").replaceAll("jdbc:", "-url=jdbc:");
        dbProperty = dbProperty.substring(dbProperty.indexOf('-'));
        if (dbProperty.endsWith("-password=")) dbProperty=dbProperty.substring(0, dbProperty.length()-10);
        SOSArguments arguments = new SOSArguments(dbProperty);

        SOSConnection conn;
        if (log!=null){
            conn = SOSConnection.createInstance
                                            schedulerSettings.getSection("spooler").getProperty("db_class"),
                                            arguments.as_string("-class=", ""),
                                            arguments.as_string("-url=", ""),
                                            arguments.as_string("-user=", ""),
                                            arguments.as_string("-password=", ""),
                                            log );
        } else{
            conn = SOSConnection.createInstance
                    schedulerSettings.getSection("spooler").getProperty("db_class"),
                    arguments.as_string("-class=", ""),
                    arguments.as_string("-url=", ""),
                    arguments.as_string("-user=", ""),
                    arguments.as_string("-password=", ""));
        }
       
        return conn;                           
    }
View Full Code Here

      Properties env = getEnvVars(logger); // gleich am anfang, weil scheduler_params aus der Umgebungsvariable gelesen wird
      args = mergeSchedulerParamsAndArgumenst(args);
      Properties arg = extractArguments(args);
      arg.putAll(schedulerParams);

      SOSArguments arguments = null;
      try {
        arguments = new SOSArguments(args, true);
        operation = arguments.as_string("-operation=", "");
        settingsFile = arguments.as_string("-settings=", "");
        settingsSection = arguments.as_string("-profile=", "");
        logLevel = arguments.as_int("-verbose=", SOSLogger.INFO);
        logFile = arguments.as_string("-log_filename=", "");
      }
      catch (Exception e) {
        e.printStackTrace(System.err);
        System.err.println("[ERROR] could not init SOSArguments, cause: " + e.getMessage());
        throw e;
View Full Code Here

TOP

Related Classes of sos.util.SOSArguments$Argument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.