Package sos.configuration

Examples of sos.configuration.SOSConfiguration


    this.settings.CheckMandatory();
    this.profile.CheckMandatory();
    try {
      SOSStandardLogger objSOSLogger = new SOSStandardLogger(0);
      getEnvVars();// TODO replace SOSConfigurations by a "ini-File-only" approach, to avoid dependencies on job-scheduler
      SOSConfiguration objConf = new SOSConfiguration(settings.Value(), "globals", objSOSLogger);
      // SOSConfiguration objConf = new SOSConfiguration(settings.Value(), "globals", null);
      Properties objGlobals = objConf.getParameterAsProperties();
      objConf = new SOSConfiguration(settings.Value(), profile.Value(), objSOSLogger);
      // objConf = new SOSConfiguration(settings.Value(), profile.Value(), null);
      if (objConf.getParameterAsProperties().size() <= 0) {
        String strM = String.format(objMsg.getMsg(SOSVfs_E_0060), profile.Value(), settings.Value());
        // String strM = String.format("SOSVfs-E-0000: Profile '%1$s' not found or is empty in file '%2$s'", profile.Value(),
        // settings.Value());
        logger.error(strM, new JobSchedulerException(strM));
        throw new JobSchedulerException(strM);
      }
      Properties objP = new Properties();
      objP.putAll(objGlobals);
      objP.putAll(objConf.getParameterAsProperties());
      while (true) {
        Properties objIncludes = new Properties();
        boolean flgIncludeFound = false;
        for (Object k : objP.keySet()) {
          String strKey = (String) k;
          String strValue = (String) objP.get(k);
          logger.debug("ReadSettingsFile() - Property. Key = " + strKey + ", val = " + strValue); //$NON-NLS-1$ //$NON-NLS-2$
          if (isIncludeDirective(strKey)) {
            String[] strValues = strValue.split(",");
            for (String strV : strValues) {
              SOSConfiguration config_ = new SOSConfiguration(settings.Value(), strV, objSOSLogger);
              if (config_.getParameterAsProperties().size() <= 0) {

                // String strM = String.format("SOSVfs-E-0000: Include '%1$s' not found or is empty in file '%2$s'", strV,
                // settings.Value());
                String strM = String.format(objMsg.getMsg(SOSVfs_E_0000), strV, settings.Value());
                logger.error(strM);
                throw new JobSchedulerException(strM);
              }
              objIncludes.putAll(config_.getParameterAsProperties());
            }
            flgIncludeFound = true;
          }
          else {
            if (isIniComment(strKey) == false) {
View Full Code Here


          createIncludeConfigurationFile("sos/net/sosftp/Configuration.xml", "sos.net.sosftp.Configuration.xml");// Alle
          // Parametern
          // sind hier
          // auch g�ltig
          SOSConfiguration con = new SOSConfiguration(null, schedulerParams, sosString.parseToString(schedulerParams.get("settings")),
              sosString.parseToString(schedulerParams.get("profile")),
              // "sos/net/sosftp/Configuration.xml",
              "sos/scheduler/ftp/SOSFTPConfiguration.xml", new SOSSchedulerLogger(spooler_log));
          con.checkConfigurationItems();

          SOSFTPCommandReceive ftpCommand = new SOSFTPCommandReceive(con, new SOSSchedulerLogger(spooler_log));
          ftpCommand.setSchedulerJob(this);
          rc = ftpCommand.transfer();
          filelist = ftpCommand.getFilelist();

          Iterator<String> iterator = filelist.iterator();
          if (spooler_job.order_queue() == null) {

            // parallel Transfer for standalone Job
            while (iterator.hasNext()) {
              String fileName = sosString.parseToString(iterator.next());
              String fileSpec = schedulerParams.containsKey(conVarname_file_spec) ? sosString.parseToString(schedulerParams.get(conVarname_file_spec))
                  : ".*";

              Pattern pattern = Pattern.compile(fileSpec, 0);
              Matcher matcher = pattern.matcher(fileName);
              if (matcher.find()) {
                Variable_set newParams = params;
                newParams.set_var(conVarname_ftp_file_path, (remoteDir.endsWith("/") || remoteDir.endsWith("\\") ? remoteDir : remoteDir + "/")
                    + fileName);
                spooler_log.info("launching job for parallel transfer with parameter: ftp_file_path "
                    + (remoteDir.endsWith("/") || remoteDir.endsWith("\\") ? remoteDir : remoteDir + "/") + fileName);
                spooler.job(spooler_task.job().name()).start(params);
              }
            }
            return false;
          }
          else {
            // parallel Transfer for order job
            while (iterator.hasNext()) {
              String fileName = (String) iterator.next();
              String fileSpec = schedulerParams.containsKey("file_spec") ? sosString.parseToString(schedulerParams.get("file_spec")) : ".*";
              Pattern pattern = Pattern.compile(fileSpec, 0);
              Matcher matcher = pattern.matcher(fileName);
              if (matcher.find()) {
                Variable_set newParams = spooler.create_variable_set();
                if (spooler_task.params() != null)
                  newParams.merge(params);

                newParams.set_var(conVarname_ftp_file_path, (remoteDir.endsWith("/") || remoteDir.endsWith("\\") ? remoteDir : remoteDir + "/")
                    + fileName);
                newParams.set_var("ftp_parent_order_id", spooler_task.order().id());
                newParams.set_var("ftp_order_self_destruct", "1");

                Order newOrder = spooler.create_order();
                newOrder.set_state(spooler_task.order().state());
                newOrder.set_params(newParams);

                spooler_task.order().job_chain().add_order(newOrder);

                getLogger().info(
                    "launching order for parallel transfer with parameter: ftp_file_path "
                        + (remoteDir.endsWith("/") || remoteDir.endsWith("\\") ? remoteDir : remoteDir + "/") + fileName);

                spooler.variables().set_var("ftp_order", normalize(spooler_task.order().id()) + "." + normalize(newOrder.id()) + "." + "0");
                spooler.variables().set_var("ftp_check_receive_" + normalize(spooler_task.order().id()) + "." + normalize(newOrder.id()), "0");
              }
            }
            // am aktuellen Auftrag speichern, dass im Wiederholungsfall per setback() nicht erneut Auftr�ge erzeugt werden
            // sollen, sondern dass deren Erledigungszustand gepr�ft wird:
            spooler_task.order().params().set_var(conVarname_ftp_check_parallel, "yes");
            spooler_job.set_delay_order_after_setback(1, parallelTransferCheckSetback);
            spooler_job.set_max_order_setbacks(parallelTransferCheckRetry);
            spooler_task.order().setback();
            spooler.variables().set_var("cur_transfer_retry" + normalize(spooler_task.order().id()), String.valueOf(parallelTransferCheckRetry));
            return false;

          }
        }
        // kb 2011-04-27 no more longer needed due to too much trouble with this file / concept
        // createIncludeConfigurationFile("sos/net/sosftp/Configuration.xml", "sos.net.sosftp.Configuration.xml");// Alle Parametern
        // sind hier auch
        // g�ltig
        SOSConfiguration con = new SOSConfiguration(null, schedulerParams, sosString.parseToString(schedulerParams.get("settings")),
            sosString.parseToString(schedulerParams.get("profile")),
            // "sos/net/sosftp/Configuration.xml",
            "sos/scheduler/ftp/SOSFTPConfiguration.xml", new SOSSchedulerLogger(spooler_log));
        con.checkConfigurationItems();
        sos.net.sosftp.SOSFTPCommandReceive ftpCommand = new sos.net.sosftp.SOSFTPCommandReceive(con, new SOSSchedulerLogger(spooler_log));
        ftpCommand.setSchedulerJob(this);
        rc = ftpCommand.transfer();

        createOrderParameter(ftpCommand);
View Full Code Here

          Properties p = new Properties();
          p.putAll((Properties)schedulerParams.clone());
          p.put("skip_transfer", "yes");
          // kb 2011-04--27  no longer needed due to too much trouble with this file / concept
//          createIncludeConfigurationFile("sos/net/sosftp/Configuration.xml", "sos.net.sosftp.Configuration.xml");//Alle Parametern sind hier auch g�ltig
          SOSConfiguration con = new SOSConfiguration(null, p,
              sosString.parseToString(schedulerParams.get("settings")),
              sosString.parseToString(schedulerParams.get("profile")),
              //"sos/net/sosftp/Configuration.xml",
              "sos/scheduler/ftp/SOSFTPConfiguration.xml",
              new SOSSchedulerLogger(spooler_log));
          con.checkConfigurationItems();

          sos.net.sosftp.SOSFTPCommandSend ftpCommand = new sos.net.sosftp.SOSFTPCommandSend(con, new SOSSchedulerLogger(spooler_log));
          ftpCommand.setSchedulerJob(this);
          rc = ftpCommand.transfer();         
          Vector filelist = ftpCommand.getFilelist();
          Iterator iterator = filelist.iterator()

          if(spooler_job.order_queue() == null) {
            // parallel transfer for standalone job
            while (iterator.hasNext()) {           
              File fileName = (File)iterator.next();
              Variable_set newParams = params;
              newParams.set_var("ftp_file_path", fileName.getCanonicalPath());
              newParams.set_var("ftp_local_dir", "");
              getLogger().info("launching job for parallel transfer with parameter ftp_file_path: " + fileName.getCanonicalPath());
              spooler.job(spooler_task.job().name()).start(params);
            }
            return false;
          } else {
            // parallel transfer for order job
            while (iterator.hasNext()) {
              File fileName = (File)iterator.next();
              Variable_set newParams = spooler.create_variable_set();
              if (spooler_task.params() != null) newParams.merge(params);

              newParams.set_var("ftp_file_path", fileName.getCanonicalPath());
              newParams.set_var("ftp_parent_order_id", spooler_task.order().id());
              newParams.set_var("ftp_order_self_destruct", "1");

              Order newOrder = spooler.create_order();
              newOrder.set_state(spooler_task.order().state());
              newOrder.set_params(newParams);

              spooler.job_chain(spooler_task.order().job_chain().name()).add_order(newOrder);

              getLogger().info("launching order for parallel transfer with parameter ftp_file_path: " + fileName.getCanonicalPath());

              spooler.variables().set_var("ftp_order", normalize(spooler_task.order().id()) + "." + normalize(newOrder.id()) + "." + "0");
              spooler.variables().set_var("ftp_check_send_" + normalize(spooler_task.order().id()) + "." + normalize(newOrder.id()), "0");

            }
            // am aktuellen Auftrag speichern, dass im Wiederholungsfall per setback() nicht erneut Auftr�ge erzeugt werden sollen, sondern dass deren Erledigungszustand gepr�ft wird:
            spooler_task.order().params().set_var("ftp_check_parallel", "yes");
            spooler_job.set_delay_order_after_setback(1, parallelTransferCheckSetback);
            spooler_job.set_max_order_setbacks(parallelTransferCheckRetry);
            spooler_task.order().setback();
            spooler.variables().set_var("cur_transfer_retry" + normalize(spooler_task.order().id()), String.valueOf(parallelTransferCheckRetry));
            return false;
          }
        }
        // end Parallel Transfer
        createIncludeConfigurationFile("sos/net/sosftp/Configuration.xml", "sos.net.sosftp.Configuration.xml");//Alle Parametern sind hier auch g�ltig
        SOSConfiguration con =   new SOSConfiguration(null,
            schedulerParams,
            sosString.parseToString(schedulerParams.get("settings")),
            sosString.parseToString(schedulerParams.get("profile")),
            //"sos/net/sosftp/Configuration.xml",
            "sos/scheduler/ftp/SOSFTPConfiguration.xml",
            new SOSSchedulerLogger(spooler_log));
        con.checkConfigurationItems();

        sos.net.sosftp.SOSFTPCommandSend ftpCommand = new sos.net.sosftp.SOSFTPCommandSend(con, new SOSSchedulerLogger(spooler_log));
        ftpCommand.setSchedulerJob(this);
        rc = ftpCommand.transfer();
View Full Code Here

          if (sshKillPid.length()>0){           
            remoteKill(sshKillPid);
          }
        }else{

          SOSConfiguration con =
            new SOSConfiguration(null, schedulerParameter, null, null, "sos/net/sosftp/Configuration.xml", new SOSSchedulerLogger(spooler_log));

          con.checkConfigurationItems();

          ftpCommand = new sos.net.sosftp.SOSFTPCommandSSH(con, new SOSSchedulerLogger(spooler_log));
          ftpCommand.setSchedulerJob(this);
          boolean rc = ftpCommand.transfer();
         
View Full Code Here

TOP

Related Classes of sos.configuration.SOSConfiguration

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.