Package center.task

Examples of center.task.Context


  }

  protected Object calculate(TimeList tl, Context cntx) throws CalculateException {
    try {
      tl.addPointTime(Type.START);
      Context res = new Context(cntx, cntx.id_subject, 0, cntx.ta, tsk);
      AProcessor po = tsk.newProcessorInstance(res);
      try {
        res.info.calculate(TimeState.getInstance(TimeState.Time.before, State.PROCESSING), res);
      } catch (Throwable e) {
        e.printStackTrace();
      }
      State st;
      try {
        st = po.process(res);
        res.setPrmByFullName("tsk", "STATUS_ID", st, false);
        res.info.calculate(TimeState.getInstance(TimeState.Time.after, State.PROCESSING), res);
      } catch (Throwable e) {
        st = State.DONE_ERR;
        res.setPrmByFullName("tsk", "STATUS_ID", st, false);
        throw new CalculateException(owner, e);
      }
      return res;
    } catch (SysException e) {
      throw new CalculateException(owner, e);
View Full Code Here


  }

  protected Object calculate(TimeList tl, Context cntx) throws CalculateException {
    try {
      tl.addPointTime(Type.START);
      Context res = tsk.createAndReadyTask(cntx.ta, cntx, cntx.id_task, null, null);
      if (res == null || res.id_task < 0)
        return res;
      tl.addPointTime(TimeList.Type.WAIT);
      if (!nowait) {
        res.ta.waitFinished(cntx.id_task, res.id_task, wait);
View Full Code Here

        boolean subdirectories = Strings.parseBooleanNvl(cntx.getPrmString("subdirectories"), true);
        File dir = new File(path);
        File d = occupyFile(dir, prc, cntx, dir, subdirectories);
        if (d != null) {
          NewTaskInfo nti = getChild();
          Context cntx_child = nti.createAndReadyTask(cntx.ta, cntx, cntx.id_subject, null, null);
          if ((cntx_child == null) || (cntx_child.id_task <= 0)) {
            {
              String rn = cntx.getPrmString("path_skip");
              if (rn == null || rn.length() == 0) {
                cntx.log(false, d.getAbsolutePath(), " wasn't renamed");
View Full Code Here

      prc.regResourceName(dt, "DT");
      prc.regResourceName(value, "VALUE");
      prc.regResourceName(nm, "NAME");
      prc.regResourceName(a.id, "ID");
     
      Context cntx = getContext();
      Connection con = Manager.getConnection(stmt.getAliasDB());
      PreparedStatement st = null;
      try {
        System.out.println("\t"+a.id + " : " + dt + " : " + nm + " = " + value);
        st = stmt.getCallStatement(con);
        ArrayList<String> names = stmt.getBindParamNames();
        for (String name : names) {
          Object val = cntx.getPrmByFullName(name);
          stmt.setParam(st, name, val, java.sql.Types.VARCHAR);
        }
        st.execute();
        con.commit();
      } catch(SQLException ex) {
View Full Code Here

        // HttpsServer srv = (HttpsServer)
        // httpExchange.getHttpContext().getServer();
        // SSLContext ssl = srv.getHttpsConfigurator().getSSLContext();
        // }
        NewTaskInfo nti = getChild();
        Context cntx_child = null;
        try {
          String grp_in = cntx.getPrmString("grp_in");
          if (grp_in == null)
            grp_in = "in";
          String grp_out = cntx.getPrmString("grp_out");
          if (grp_out == null)
            grp_out = "out";

          if (!Strings.parseBooleanNvl(
              cntx.getPrmString("save-in-body"), true)) {
            prms.remove("body");
          }
          cntx_child = nti.createAndReadyTask(cntx.ta, cntx,
              cntx.id_subject, grp_in, prms);
          Object res = null;
          if ((cntx_child == null) || (cntx_child.id_task <= 0)) {
            res = cntx_child
                .getPrmByFullName(((grp_out == null) || (grp_out
                    .length() == 0)) ? "body" : grp_out
                    + "/body");
            if (res == null) {
              Headers hd = httpExchange.getResponseHeaders();
              hd.put("Content-Type",
                  Arrays.asList("text/plain; charset=" + enc));
              httpExchange.sendResponseHeaders(503, 0);
              OutputStream w = httpExchange.getResponseBody();
              w.write("Обработчик не выбран".getBytes(enc));
              w.close();
              return;
            }
          } else {
            Process.currentProcess().regResourceName(
                cntx_child.id_task, "child.id");
            long wait = Strings.parseIntegerNvl(
                cntx.getPrmByFullName("wait"), 30000);// !!!
            cntx.log(false, "Start waiting (", wait, ")");
            cntx_child.ta.waitFinished(cntx_child.id_subject,
                cntx_child.id_task, wait);
            cntx.log(false, "End waiting");
            res = cntx_child
                .getPrmByFullName(((grp_out == null) || (grp_out
                    .length() == 0)) ? "body" : grp_out
                    + "/body");
          }

          if (res != null) {
            Map<String, Object> result = cntx_child
                .getGroupParams(grp_out);
            long l = 0;
            if (res instanceof FileInputStream) {
              is = (FileInputStream) res;
              l = ((FileInputStream) is).getChannel().size();
View Full Code Here

TOP

Related Classes of center.task.Context

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.