Package tigase.xml

Examples of tigase.xml.Element


*/
public class ElementUtils {

  public static Element createIqQuery(final String from, final String to,
    final StanzaType type, final String id, final String xmlns) {
    Element iq = new Element("iq",
      new String[] {"from", "to", "type", "id"},
      new String[] {from, to, type.toString(), id});
    Element query = new Element("query");
    query.setXMLNS(xmlns);
    iq.addChild(query);
    return iq;
  }
View Full Code Here


    return iq;
  }

  public static Element createIqQuery(final String from, final String to,
    final StanzaType type, final String id, final Element query) {
    Element iq = new Element("iq",
      new String[] {"from", "to", "type", "id"},
      new String[] {from, to, type.toString(), id});
    iq.addChild(query);
    return iq;
  }
View Full Code Here

    if (packet.isXMLNS("/iq/query", INFO_XMLNS)
      || packet.isXMLNS("/iq/query", ITEMS_XMLNS)) {

      String jid = packet.getElemTo();
      String node = packet.getAttribute("/iq/query", "node");
      Element query = packet.getElement().getChild("query").clone();

      if (packet.isXMLNS("/iq/query", INFO_XMLNS)) {
        for (XMPPService comp: components.values()) {
          Element resp = comp.getDiscoInfo(node, jid);
          if (resp != null) {
            query = resp;
            break;
          }
        } // end of for ()
View Full Code Here

  public String getName() {
    return name;
  }

  public Element getElement() {
    return new Element("identity",
      new String[] {"category", "type", "name"},
      new String[] {category, type, name});
  }
View Full Code Here

        Map<String, String> params = new LinkedHashMap<String, String>();
        params.put(CID, cid);
        params.put(KEY, key);
        params.put(FORKEY_SESSION_ID, forkey_sessionId);
        params.put(ASKING_SESSION_ID, asking_sessionId);
        Element check_db_key =
          ClusterElement.createClusterMethodCall(getComponentId(), cluster_node,
            StanzaType.set, ClusterMethods.CHECK_DB_KEY.toString(),
            params).getClusterElement();
        addOutPacket(new Packet(check_db_key));
      }
View Full Code Here

   *
   * @param node a <code>String</code> value
   * @return an <code>Element</code> value
   */
  public Element getDiscoInfo(String node) {
    Element query = null;
    if (node == null) {
      query = new Element("query",
        new String[] {"xmlns"},
        new String[] {"http://jabber.org/protocol/disco#info"});
      if (identities != null) {
        for (ServiceIdentity ident: identities) {
          query.addChild(ident.getElement());
        }
      }
      if (features != null) {
        for (String feature: features) {
          query.addChild(new Element("feature",
              new String[] {"var"},
              new String[] {feature}));
        }
      }
    } else {
      ServiceEntity entity = findNode(node);
      if (entity != null) {
        query = entity.getDiscoInfo(null);
        query.setAttribute("node", node);
      }
    }
    return query;
  }
View Full Code Here

   * @param node a <code>String</code> value
   * @param jid a <code>String</code> value
   * @return an <code>Element</code> value
   */
  public Element getDiscoItem(String node, String jid) {
    Element item = new Element("item");
    if (jid != null) {
      item.setAttribute("jid", jid);
    } else {
      if (this.jid != null) {
        item.setAttribute("jid", this.jid);
      }
    }
    if (node != null) {
      item.setAttribute("node", node + (this.node != null ? "/" + this.node : ""));
    } else {
      if (this.node != null) {
        item.setAttribute("node", this.node);
      }
    }
    if (name != null) {
      item.setAttribute("name", name);
    }
    return item;
  }
View Full Code Here

            + major + "." + minor + "." + bugfix + build + ".exe";
          } else {
            link = "http://www.tigase.org/files/downloads/tigase-server/tigase-server-"
            + major + "." + minor + "." + bugfix + build + ".tar.gz";
          }
          Element message = new Element("message",
            new String[] {"to", "from"},
            new String[] {receiver.getDefHostName(),
                          "updates.checker@" + receiver.getDefHostName()});
          Element subject = new Element("subject",
            "Updates checker - new version of the Tigase server");
          message.addChild(subject);
          Element body = new Element("body",
            "You are currently using: '"
            + major_ver + "." + minor_ver + "." + bugfix_ver + "' version of Tigase"
            + " server. A new version of the server has been released: '"
            + major + "." + minor + "." + bugfix + "' and it is available for"
            + " download at address: " + link + "\n\n" + intro_msg);
View Full Code Here

      try {
        String loc_digest = Algorithms.hexDigest(id, secret, "SHA");
        log.finest("Calculating digest: id="+id+", secret="+secret
          +", digest="+loc_digest);
        if (digest != null && digest.equals(loc_digest)) {
          Packet resp = new Packet(new Element("handshake"));
          writePacketToSocket(serv, resp);
          serviceConnected(serv);
        } else {
          log.warning("Handshaking password doesn't match, disconnecting...");
          serv.stop();
View Full Code Here

            }
            Queue<Element> elems = domHandler.getParsedElements();
            if (elems.size() > 0) {
              readCompleted();
            }
            Element elem = null;
            while ((elem = elems.poll()) != null) {
              //  assert debug(elem.toString() + "\n");
              //log.finer("Read element: " + elem.getName());
              if (log.isLoggable(Level.FINEST)) {
                log.finest("Read packet: " + elem.toString());
              }
              //              System.out.print(elem.toString());
              addReceivedPacket(new Packet(elem));
            } // end of while ((elem = elems.poll()) != null)
          catch (Exception ex) {
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.