Package sos.util

Examples of sos.util.SOSArguments


         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

    if(args.length==0 || args[0].equals("-?") || args[0].equals("/?") || args[0].equals("-h")){
      showUsage();
      System.exit(0);
    }
    try {
      SOSArguments arguments = new SOSArguments(args);
     
      String xmlFile="";
      String logFile="";
      int logLevel=0;
      String settingsFile="";
      String modelID="";
      String packageName="";
      try {
        xmlFile = arguments.as_string("-file=","job_export.xml");
        logLevel = arguments.as_int("-v=",SOSStandardLogger.INFO);
        logFile = arguments.as_string("-log=","");
        modelID = arguments.as_string("-jobchain=","");
        packageName = arguments.as_string("-package=","");
        settingsFile = arguments.as_string("-settings=","../config/factory.ini");
      } catch (Exception e1) {
        System.out.println(e1.getMessage());
        showUsage();
        System.exit(0);
      }
      if(packageName.length()>0 && modelID.length()>0){
        System.out.println("jobchain und package d�rfen nicht zusammen angegeben werden.");
        showUsage();
        System.exit(0);
      }
      if(packageName.length()==0 && modelID.length()==0){
        System.out.println("Entweder jobchain oder package muss angegeben werden.");
        showUsage();
        System.exit(0);
      }
      if (logFile.length()>0sosLogger = new SOSStandardLogger(logFile, logLevel);
      else sosLogger = new SOSStandardLogger(logLevel);
     
      ManagedJobExport.setSosLogger(sosLogger);
      conn = ManagedJobExport.getDBConnection(settingsFile);     
           
      conn.connect();
     
      arguments.check_all_used();
      export(xmlFile,modelID, packageName);
     
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
View Full Code Here

  private void readProgramArguments(String[] arguments) throws Exception {
    try {
      if (arguments != null) {
        originParameterFromArguments = new SOSConfigurationItem[arguments.length];
        SOSArguments arguments_ = new SOSArguments(arguments, true);

        java.util.Iterator keys = arguments_.get_arguments().keySet().iterator();
        int i = 0;
        while (keys.hasNext()) {
          String key = sosString.parseToString(keys.next());
          String newKey = (key.trim().startsWith("-") && key.trim().endsWith("=") & key.length() > 0 ? key.substring(1, key.length() - 1) : key);
          originParameterFromArguments[i] = new SOSConfigurationItem();
          originParameterFromArguments[i].setName(newKey);
          originParameterFromArguments[i].setValue(arguments_.as_string(key.toString()));
          i++;
        }

      }
      else {
View Full Code Here

                if (this.getLogger() != null) sosLogger.debug6("connecting to database.. .");

                String dbProperty = this.getJobProperties().getProperty("db").replaceAll("jdbc:", "-url=jdbc:");
                dbProperty = dbProperty.substring(dbProperty.indexOf('-'));
               
                SOSArguments arguments = new SOSArguments(dbProperty);

              this.setConnection( SOSConnection.createInstance
                                    this.getJobProperties().getProperty("db_class"),
                                    arguments.as_string("-class=", ""),
                                    arguments.as_string("-url=", ""),
                                    arguments.as_string("-user=", ""),
                                    arguments.as_string("-password=", ""),
                                    (SOSLogger)new SOSSchedulerLogger(this.spooler_log) )
                            );
              this.getConnection().connect();
               
              if (this.getLogger() != null) this.getLogger().debug6("..successfully connected to " + arguments.as_string("-url=", ""));
            }
            catch (Exception e) {
                throw (new Exception("connect to database failed: " + e.getMessage()));
            }
View Full Code Here

    if(args.length==0 || args[0].equals("-?") || args[0].equals("-h")){
      showUsage();
      System.exit(0);
    }
    try {
      SOSArguments arguments = new SOSArguments(args);
     
      String xmlFile="";
      String logFile="";
      int logLevel=0;
      String settingsFile="";
      int jobID=0;
      try {
        xmlFile = arguments.as_string("-file=","job_export.xml");
        logLevel = arguments.as_int("-v=",SOSStandardLogger.INFO);
        logFile = arguments.as_string("-log=","");
        jobID = arguments.as_int("-job=");
        settingsFile = arguments.as_string("-settings=","../config/factory.ini");
      } catch (Exception e1) {
        System.out.println(e1.getMessage());
        showUsage();
        System.exit(0);
      }
      if (logFile.length()>0sosLogger = new SOSStandardLogger(logFile, logLevel);
      else sosLogger = new SOSStandardLogger(logLevel);
     
      getDBConnection(settingsFile);
           
      conn.connect();
     
      arguments.check_all_used();
      export(xmlFile,jobID);
     
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
View Full Code Here

    if (sosLogger != null) sosLogger.debug6("connecting to database.. .");

    String dbProperty = props.getProperty("db").replaceAll("jdbc:", "-url=jdbc:");
    dbProperty = dbProperty.substring(dbProperty.indexOf('-'));
   
    SOSArguments dbArguments = new SOSArguments(dbProperty);

    conn =  SOSConnection.createInstance
                   props.getProperty("db_class"),
                   dbArguments.as_string("-class=", ""),
                   dbArguments.as_string("-url=", ""),
                   dbArguments.as_string("-user=", ""),
                   dbArguments.as_string("-password=", ""),
                   sosLogger);
   
    return conn;
  }
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

TOP

Related Classes of sos.util.SOSArguments

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.