Package tigase.xml

Examples of tigase.xml.Element


        tmp_name = tmp_name.substring(pref.length()+1, tmp_name.length());
        prefix = pref;
        log.finest("new_xmlns = " + new_xmlns);
      } // end of if (tmp_name.startsWith(xmlns))
    } // end of for (String xmlns: namespaces.keys())
    Element elem = newElement(tmp_name, null, attr_names, attr_values);
    String ns = elem.getXMLNS();
    if (ns == null) {
      if (el_stack.isEmpty() || el_stack.peek().getXMLNS() == null) {
        //elem.setDefXMLNS(top_xmlns);
      } else {
        elem.setDefXMLNS(el_stack.peek().getXMLNS());
        log.finest("DefXMLNS assigned: " + elem.toString());
      }
    }
    if (new_xmlns != null) {
      elem.setXMLNS(new_xmlns);
      elem.removeAttribute("xmlns:" + prefix);
      log.finest("new_xmlns assigned: " + elem.toString());
    }
    el_stack.push(elem);
  }
View Full Code Here


    if (el_stack.isEmpty()) {
      el_stack.push(newElement(tmp_name, null, null, null));
    } // end of if (tmp_name.equals())

    Element elem = el_stack.pop();
    if (el_stack.isEmpty()) {
      all_roots.offer(elem);
      if (log.isLoggable(Level.FINEST)) {
        log.finest("Adding new request: "+elem.toString());
      }
    } else {
      el_stack.peek().addChild(elem);
    } // end of if (el_stack.isEmpty()) else
  }
View Full Code Here

          //params.put(RESOURCE, resource);
          params.put(CONNECTION_ID, connectionId);
          params.put(PRIORITY, "" + priority);
          params.put(TOKEN, token);
          params.put(AUTH_TIME, ""+authTime);
          Element check_session_el = ClusterElement.createClusterMethodCall(
            getComponentId(), cluster_node, StanzaType.set,
            ClusterMethods.SESSION_TRANSFER.toString(), params).getClusterElement();
          fastAddOutPacket(new Packet(check_session_el));
        } catch (Exception e) {
          log.log(Level.WARNING, "Problem with session transfer process, ", e);
View Full Code Here

    if (nodes != null) {
      for (Element node: nodes) {
        visited_nodes.add(node.getCData());
      }
    }
    Element method_call = elem.findChild(CLUSTER_METHOD_PATH);
    if (method_call != null) {
      parseMethodCall(method_call);
    }
  }
View Full Code Here

      addDataPacket(packet);
    }
  }

  public static Element clusterElement(String from, String to, StanzaType type) {
    Element cluster_el = new Element(CLUSTER_EL_NAME,
      new String[] {"from", "to", "type"},
      new String[] {from, to, type.toString()});
    cluster_el.setXMLNS(XMLNS);
    cluster_el.addChild(new Element(CLUSTER_CONTROL_EL_NAME,
        new Element[] {new Element(VISITED_NODES_EL_NAME)}, null, null));
    return cluster_el;
  }
View Full Code Here

    return cluster_el;
  }

  public static Element createClusterElement(String from, String to,
    StanzaType type, String packet_from) {
    Element cluster_el = clusterElement(from, to, type);
    cluster_el.addChild(new Element(CLUSTER_DATA_EL_NAME));
//         new String[] {PACKET_FROM_ATTR_NAME}, new String[] {packet_from}));
    return cluster_el;
  }
View Full Code Here

    return cluster_el;
  }

  public static ClusterElement createClusterMethodCall(String from, String to,
    StanzaType type, String method_name, Map<String, String> params) {
    Element cluster_el = clusterElement(from, to, type);
    Element method_call = new Element(CLUSTER_METHOD_EL_NAME,
      new String [] {CLUSTER_NAME_ATTR}, new String[] {method_name});
    if (params != null) {
      for (Map.Entry<String, String> entry: params.entrySet()) {
        method_call.addChild(new Element(CLUSTER_METHOD_PAR_EL_NAME,
            entry.getValue(),
            new String[] {CLUSTER_NAME_ATTR}, new String[] {entry.getKey()}));
      }
    }
    cluster_el.findChild(CLUSTER_CONTROL_PATH).addChild(method_call);
View Full Code Here

    return createMethodResponse(from, null, type, results);
  }

  public ClusterElement createMethodResponse(String from, String to,
    String type, Map<String, String> results) {
    Element result_el = elem.clone();
    result_el.setAttribute("from", from);
    result_el.setAttribute("to", (to != null ? to : first_node));
    result_el.setAttribute("type", type);
    Element res = new Element(CLUSTER_METHOD_RESULTS_EL_NAME);
    result_el.findChild(CLUSTER_METHOD_PATH).addChild(res);
    ClusterElement result_cl = new ClusterElement(result_el);
    if (results != null) {
      for (Map.Entry<String, String> entry: results.entrySet()) {
        result_cl.addMethodResult(entry.getKey(), entry.getValue());
View Full Code Here

    }
    return result_cl;
  }

  public void addMethodResult(String key, String val) {
    Element res = elem.findChild(CLUSTER_METHOD_RESULTS_PATH);
    if (res == null) {
      res = new Element(CLUSTER_METHOD_RESULTS_EL_NAME);
      elem.findChild(CLUSTER_METHOD_PATH).addChild(res);
    }
    res.addChild(new Element(CLUSTER_METHOD_RESULTS_VAL_EL_NAME, val,
        new String[] {CLUSTER_NAME_ATTR}, new String[] {key}));
    if (method_results == null) {
      method_results = new LinkedHashMap<String, String>();
    }
    method_results.put(key, val);
View Full Code Here

  public String getFirstNode() {
    return first_node;
  }

  public ClusterElement nextClusterNode(String node_id) {
    Element next_el = elem.clone();
    String from = elem.getAttribute("to");
    next_el.setAttribute("from", from);
    next_el.setAttribute("to", node_id);
    //next_el.setAttribute("type", StanzaType.set.toString());
    ClusterElement next_cl = new ClusterElement(next_el);
    return next_cl;
  }
View Full Code Here

TOP

Related Classes of tigase.xml.Element

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.