Exemplo n.º 1
0
  public CabrinProcess(DuApiConnection conn, String templateUproc, String refFile)
      throws Exception { // upr is the name of the templateUproc
    array.add(ExecutionStatus.Running);
    array.add(ExecutionStatus.Aborted);
    array.add(ExecutionStatus.Pending);

    duapi = conn;

    if (duapi.doesUprocExist(templateUproc)) {
      templateCabrinUproc = duapi.getUproc(templateUproc);
      isTempUprocSet = true;
      count++;
    }
    readReferenceFile(refFile);
  }
Exemplo n.º 2
0
  public static void fireAwayCabrinProcesses(
      CabrinProcess cabproc, String submissionUser, String muName) throws Exception {

    if (!CabrinProcess.publicboard.containsKey(cabproc.getCabrinJob())) {
      Queue<CabrinProcess> myQ = new LinkedList<CabrinProcess>();
      myQ.add(cabproc);
      CabrinProcess.publicboard.put(cabproc.getCabrinJob(), myQ);

    } else if (CabrinProcess.publicboard.get(cabproc.getCabrinJob()).isEmpty()) {
      CabrinProcess.publicboard.get(cabproc.getCabrinJob()).add(cabproc);
    }

    if (duapi.getExecutionList(cabproc.getCabrinJob(), array).size() == 0) {

      cabproc = CabrinProcess.publicboard.get(cabproc.getCabrinJob()).poll();

      Uproc cabupr = duapi.getUproc(cabproc.getCabrinJob());
      cabupr.setVariables(cabproc.getCabrinUprocVariables());
      cabupr.update();

      System.out.println(" Update uproc :" + cabupr.getName());
      System.out.println(
          "Variable_1 : "
              + cabupr.getVariables().get(0).getName()
              + "-"
              + cabupr.getVariables().get(0).getValue());
      System.out.println(
          "Variable_2 : "
              + cabupr.getVariables().get(1).getName()
              + "-"
              + cabupr.getVariables().get(1).getValue());
      System.out.println(
          "Variable_3 : "
              + cabupr.getVariables().get(2).getName()
              + "-"
              + cabupr.getVariables().get(2).getValue());

      System.out.println("Updated uproc <" + cabproc.getCabrinJob() + ">");

      Date launchDateTime = new Date();

      List<String> mus = duapi.getMus();
      List<String> users = duapi.getUsers();
      if (mus.size() == 0) throw new Exception("No MU found");
      if (users.size() == 0) throw new Exception("No user found");
      String aMu = mus.get(0);
      String aUser = users.get(0);
      if (users.contains(submissionUser)) aUser = submissionUser;

      if (mus.contains(muName)) aMu = muName;

      Launch l =
          new Launch(
              duapi.getContext(),
              LaunchId.createWithName("", "", cabproc.getCabrinJob(), "000", aMu, null));
      {
        l.setImpl(new OwlsLaunchImpl());
        l.getIdentifier().setSyntaxRules(OwlsSyntaxRules.getInstance());
      }
      l.setBasedOnTask(false);
      l.setBeginDate(launchDateTime);
      Date endDate = new Date();
      endDate.setTime(launchDateTime.getTime() + 100000000);
      l.setEndDate(endDate);
      l.setProcessingDate((new SimpleDateFormat("yyyyMMdd")).format(launchDateTime));
      l.setUserName(aUser);
      l.setQueue("SYS_BATCH");
      l.setPriority("100");
      l.setPrinter("IMPR");

      l.create();

      System.out.println(
          "Launch created for <" + cabproc.getCabrinJob() + "> with nmLanc =" + l.getNumlanc());
    }
  }