Class ClusterElement

java.lang.Object
tigase.cluster.api.ClusterElement

public class ClusterElement extends Object
Class ClusterElement is a utility class for handling tigase cluster specific packets. The cluster packet has the following form:
<cluster xmlns="tigase:cluster" from="source" to="dest" type="set"> <data> <message xmlns="jabber:client" from="source-u" to="dest-x" type="chat"> <body>Hello world!</body> </message> </data> <control> <first-node>node1 JID address</first-node> <visited-nodes> <node-id>node1 JID address</node-id> <node-id>node2 JID address</node-id> </visited-nodes> <method-call name="method name"> <par name="param1 name">value</par> <par name="param2 name">value</par> <results> <val name="val1 name">value</var> <val name="val2 name">value</var> </results> </method-call> </control> </cluster>
If none of nodes could process the packet it goes back to the first node as this node is the most likely to process the packet correctly.
Created: Fri May 2 09:40:40 2008
Author:
Artur Hefczyc
  • Field Details

  • Constructor Details

    • ClusterElement

      public ClusterElement(tigase.xml.Element elem)
      Creates a new ClusterElement instance.
    • ClusterElement

      public ClusterElement(tigase.xmpp.jid.JID from, tigase.xmpp.jid.JID to, StanzaType type, Packet packet)
  • Method Details

    • clusterElement

      public static tigase.xml.Element clusterElement(tigase.xmpp.jid.JID from, tigase.xmpp.jid.JID to, StanzaType type)
    • createClusterElement

      public static tigase.xml.Element createClusterElement(tigase.xmpp.jid.JID from, tigase.xmpp.jid.JID to, StanzaType type, String packet_from)
    • createClusterMethodCall

      public static ClusterElement createClusterMethodCall(tigase.xmpp.jid.JID from, tigase.xmpp.jid.JID to, StanzaType type, String method_name, Map<String,String> params)
    • createForNextNode

      public static ClusterElement createForNextNode(ClusterElement clel, List<tigase.xmpp.jid.JID> cluster_nodes, tigase.xmpp.jid.JID comp_id)
    • addDataPacket

      public void addDataPacket(Packet packet)
    • addDataPacket

      public void addDataPacket(tigase.xml.Element packet)
    • addDataPackets

      public void addDataPackets(Queue<tigase.xml.Element> packets)
    • addMethodResult

      public void addMethodResult(String key, String val)
    • addVisitedNode

      public void addVisitedNode(tigase.xmpp.jid.JID node_id)
    • addVisitedNodes

      public void addVisitedNodes(Set<tigase.xmpp.jid.JID> nodes)
    • createMethodResponse

      public ClusterElement createMethodResponse(tigase.xmpp.jid.JID from, StanzaType type, Map<String,String> results)
    • createMethodResponse

      public ClusterElement createMethodResponse(tigase.xmpp.jid.JID from, tigase.xmpp.jid.JID to, StanzaType type, Map<String,String> results)
    • getAllMethodParams

      public Map<String,String> getAllMethodParams()
    • getAllMethodResults

      public Map<String,String> getAllMethodResults()
    • getClusterElement

      public tigase.xml.Element getClusterElement(String id)
    • getDataPackets

      public Queue<tigase.xml.Element> getDataPackets()
    • getFirstNode

      public tigase.xmpp.jid.JID getFirstNode()
    • getMethodName

      public String getMethodName()
    • getMethodParam

      public String getMethodParam(String par_name)
    • getMethodParam

      public long getMethodParam(String par_name, long def)
    • getMethodResultVal

      public String getMethodResultVal(String val_name)
    • getMethodResultVal

      public long getMethodResultVal(String val_name, long def)
    • getPriority

      public Priority getPriority()
    • setPriority

      public void setPriority(Priority priority)
    • getVisitedNodes

      public Set<tigase.xmpp.jid.JID> getVisitedNodes()
    • isVisitedNode

      public boolean isVisitedNode(tigase.xmpp.jid.JID node_id)
    • nextClusterNode

      public ClusterElement nextClusterNode(tigase.xmpp.jid.JID node_id)
    • parseMethodCall

      protected void parseMethodCall(tigase.xml.Element method_call)