Examples of XMLMsg


Examples of ru.vassaev.core.xml.XMLMsg

        } catch (NumberFormatException ex) {
          throw new SysException(ex);
        }
      }
      //Socket s = new Socket("localhost", 8897);
      XMLMsg m = null;
      InputStream is = null;
      OutputStream os = s.getOutputStream();
      try {
        m = getMsg();
        String key = cntx.getPrmString("key");
        if ((key == null) || (key.length() == 0))
          key = getStan();
        m.setKey(key);
        cntx.ta.setParamObject(cntx.id_task, "key", key);

        String keyNames = cntx.getPrmString("keyNames");
        m.setKeyNames(keyNames);

        Map<String, Object> prms_in = cntx.getGroupParams("in");
        PrmInterface prm = m.getPrmInterface();
        for (String n : prms_in.keySet()) {
          Object v = prms_in.get(n);
          n = n.substring("in/".length());
          if (v != null)
            prm.setField(n, v.toString());
          else
            prm.setField(n, null);
        }
        boolean isCalcKey = m.isCalcKey();
        key = (isCalcKey ? m.getCalcKey() : m.getKey());
        cntx.ta.setParamObject(cntx.id_task, "calcKey", key);
        is = m.getInputStream();
        int b = -1;
        while ((b = is.read()) != -1)
          os.write(b);
        os.flush();
        is = s.getInputStream();
        InfoBase<XMLMsg, XMLMsg> ib = new InfoBase<XMLMsg, XMLMsg>();
        ib.makeQuery(m, key);
        m.reset();
        Reader th = new Reader(is, ib, m, key, cntx.ta, cntx.id_task);
        try {
          th.start();
//====================================
          cntx.log(false, "Start waiting (", timeout, ")");
          XMLMsg r = ib.takeResponseWithWait(key, timeout); //, id_task, ta, id_processor);
          cntx.log(false, "End waiting");

          if (r == null) {
            throw new TaskException(State.DONE_TOUT, "An expected response was not received on time");
          }
          PrmInterface r_prm = r.getPrmInterface();
          StringList flds = r_prm.getFieldNames();
          for (int j = 0; j < flds.size(); j++) {
            String k = flds.get(j).toString();
            cntx.ta.setParamObject(cntx.id_task, "out." + k, r_prm.getField(k));
          }
View Full Code Here

Examples of ru.vassaev.core.xml.XMLMsg

      this.ib = ib;
      this.m = m;
    }

    public void run() {
      XMLMsg r = null;
      try {
        CloseableOutputStream oss = m.getOutputStream();
        int b;
        while ((b = is.read()) != -1) {
          oss.write(b);
View Full Code Here

Examples of ru.vassaev.core.xml.XMLMsg

  public void initFactory(Map<String, Object> prms) {
  }

  public XMLMsg create() {
    return new XMLMsg();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.