tigase.cluster.api

## 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:

             Hello world!

           node1 JID address

             node1 JID address
             node2 JID address

             value
             value

               value
               value

  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
  Version:
    $Rev$
  Author:
    Artur Hefczyc

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CLUSTER_CONTROL_EL_NAME` Field description
    `static String[]` | `CLUSTER_CONTROL_PATH` Field description
    `static String` | `CLUSTER_DATA_EL_NAME` Field description
    `static String[]` | `CLUSTER_DATA_PATH` Field description
    `static String` | `CLUSTER_EL_NAME` Field description
    `static String` | `CLUSTER_METHOD_EL_NAME` Field description
    `static String` | `CLUSTER_METHOD_PAR_EL_NAME` Field description
    `static String[]` | `CLUSTER_METHOD_PATH` Field description
    `static String` | `CLUSTER_METHOD_RESULTS_EL_NAME` Field description
    `static String[]` | `CLUSTER_METHOD_RESULTS_PATH` Field description
    `static String` | `CLUSTER_METHOD_RESULTS_VAL_EL_NAME` Field description
    `static String` | `CLUSTER_NAME_ATTR` Field description
    `static String` | `FIRST_NODE_EL_NAME` Field description
    `static String[]` | `FIRST_NODE_PATH` Field description
    `static String` | `NODE_ID_EL_NAME` Field description
    `static String` | `VISITED_NODES_EL_NAME` Field description
    `static String[]` | `VISITED_NODES_PATH` Field description
    `static String` | `XMLNS` Field description

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClusterElement(tigase.xml.Element elem)` Creates a new `ClusterElement` instance.
    `ClusterElement(tigase.xmpp.JID from, tigase.xmpp.JID to, StanzaType type, Packet packet)` Constructs ...

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDataPacket(tigase.xml.Element packet)` Method description
    `void` | `addDataPacket(Packet packet)` Method description
    `void` | `addDataPackets(Queue<tigase.xml.Element> packets)` Method description
    `void` | `addMethodResult(String key, String val)` Method description
    `void` | `addVisitedNode(tigase.xmpp.JID node_id)` Method description
    `void` | `addVisitedNodes(Set<tigase.xmpp.JID> nodes)` Method description
    `static tigase.xml.Element` | `clusterElement(tigase.xmpp.JID from, tigase.xmpp.JID to, StanzaType type)` Method description
    `static tigase.xml.Element` | `createClusterElement(tigase.xmpp.JID from, tigase.xmpp.JID to, StanzaType type, String packet_from)` Method description
    `static ClusterElement` | `createClusterMethodCall(tigase.xmpp.JID from, tigase.xmpp.JID to, StanzaType type, String method_name, Map<String,String> params)` Method description
    `static ClusterElement` | `createForNextNode(ClusterElement clel, List<tigase.xmpp.JID> cluster_nodes, tigase.xmpp.JID comp_id)` Method description
    `ClusterElement` | `createMethodResponse(tigase.xmpp.JID from, tigase.xmpp.JID to, StanzaType type, Map<String,String> results)` Method description
    `ClusterElement` | `createMethodResponse(tigase.xmpp.JID from, StanzaType type, Map<String,String> results)` Method description
    `Map<String,String>` | `getAllMethodParams()` Method description
    `Map<String,String>` | `getAllMethodResults()` Method description
    `tigase.xml.Element` | `getClusterElement(String id)` Method description
    `Queue<tigase.xml.Element>` | `getDataPackets()` Method description
    `tigase.xmpp.JID` | `getFirstNode()` Method description
    `String` | `getMethodName()` Method description
    `String` | `getMethodParam(String par_name)` Method description
    `long` | `getMethodParam(String par_name, long def)` Method description
    `String` | `getMethodResultVal(String val_name)` Method description
    `long` | `getMethodResultVal(String val_name, long def)` Method description
    `Set<tigase.xmpp.JID>` | `getVisitedNodes()` Method description
    `boolean` | `isVisitedNode(tigase.xmpp.JID node_id)` Method description
    `ClusterElement` | `nextClusterNode(tigase.xmpp.JID node_id)` Method description
    `protected void` | `parseMethodCall(tigase.xml.Element method_call)` Method description

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### CLUSTER_CONTROL_EL_NAME

          public static final String CLUSTER_CONTROL_EL_NAME

      Field description
      See Also:
        Constant Field Values

    - #### CLUSTER_DATA_EL_NAME

          public static final String CLUSTER_DATA_EL_NAME

      Field description
      See Also:
        Constant Field Values

    - #### CLUSTER_EL_NAME

          public static final String CLUSTER_EL_NAME

      Field description
      See Also:
        Constant Field Values

    - #### CLUSTER_METHOD_EL_NAME

          public static final String CLUSTER_METHOD_EL_NAME

      Field description
      See Also:
        Constant Field Values

    - #### CLUSTER_METHOD_PAR_EL_NAME

          public static final String CLUSTER_METHOD_PAR_EL_NAME

      Field description
      See Also:
        Constant Field Values

    - #### CLUSTER_METHOD_RESULTS_EL_NAME

          public static final String CLUSTER_METHOD_RESULTS_EL_NAME

      Field description
      See Also:
        Constant Field Values

    - #### CLUSTER_METHOD_RESULTS_VAL_EL_NAME

          public static final String CLUSTER_METHOD_RESULTS_VAL_EL_NAME

      Field description
      See Also:
        Constant Field Values

    - #### CLUSTER_NAME_ATTR

          public static final String CLUSTER_NAME_ATTR

      Field description
      See Also:
        Constant Field Values

    - #### FIRST_NODE_EL_NAME

          public static final String FIRST_NODE_EL_NAME

      Field description
      See Also:
        Constant Field Values

    - #### NODE_ID_EL_NAME

          public static final String NODE_ID_EL_NAME

      Field description
      See Also:
        Constant Field Values

    - #### VISITED_NODES_EL_NAME

          public static final String VISITED_NODES_EL_NAME

      Field description
      See Also:
        Constant Field Values

    - #### XMLNS

          public static final String XMLNS

      Field description
      See Also:
        Constant Field Values

    - #### VISITED_NODES_PATH

          public static final String[] VISITED_NODES_PATH

      Field description

    - #### FIRST_NODE_PATH

          public static final String[] FIRST_NODE_PATH

      Field description

    - #### CLUSTER_METHOD_RESULTS_PATH

          public static final String[] CLUSTER_METHOD_RESULTS_PATH

      Field description

    - #### CLUSTER_METHOD_PATH

          public static final String[] CLUSTER_METHOD_PATH

      Field description

    - #### CLUSTER_DATA_PATH

          public static final String[] CLUSTER_DATA_PATH

      Field description

    - #### CLUSTER_CONTROL_PATH

          public static final String[] CLUSTER_CONTROL_PATH

      Field description

  - ### Constructor Detail

    - #### ClusterElement

          public ClusterElement(tigase.xml.Element elem)

      Creates a new `ClusterElement` instance.
      Parameters:
        `elem` -

    - #### ClusterElement

          public ClusterElement(tigase.xmpp.JID from,
                        tigase.xmpp.JID to,
                        StanzaType type,
                        Packet packet)

      Constructs ...
      Parameters:
        `from` -
        `to` -
        `type` -
        `packet` -

  - ### Method Detail

    - #### clusterElement

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

      Method description
      Parameters:
        `from` -
        `to` -
        `type` -
      Returns:

    - #### createClusterElement

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

      Method description
      Parameters:
        `from` -
        `to` -
        `type` -
        `packet_from` -
      Returns:

    - #### createClusterMethodCall

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

      Method description
      Parameters:
        `from` -
        `to` -
        `type` -
        `method_name` -
        `params` -
      Returns:

    - #### createForNextNode

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

      Method description
      Parameters:
        `clel` -
        `cluster_nodes` -
        `comp_id` -
      Returns:

    - #### addDataPacket

          public void addDataPacket(Packet packet)

      Method description
      Parameters:
        `packet` -

    - #### addDataPacket

          public void addDataPacket(tigase.xml.Element packet)

      Method description
      Parameters:
        `packet` -

    - #### addDataPackets

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

      Method description
      Parameters:
        `packets` -

    - #### addMethodResult

          public void addMethodResult(String key,
                             String val)

      Method description
      Parameters:
        `key` -
        `val` -

    - #### addVisitedNode

          public void addVisitedNode(tigase.xmpp.JID node_id)

      Method description
      Parameters:
        `node_id` -

    - #### addVisitedNodes

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

      Method description
      Parameters:
        `nodes` -

    - #### createMethodResponse

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

      Method description
      Parameters:
        `from` -
        `type` -
        `results` -
      Returns:

    - #### createMethodResponse

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

      Method description
      Parameters:
        `from` -
        `to` -
        `type` -
        `results` -
      Returns:

    - #### getAllMethodParams

          public Map<String,String> getAllMethodParams()

      Method description
      Returns:

    - #### getAllMethodResults

          public Map<String,String> getAllMethodResults()

      Method description
      Returns:

    - #### getClusterElement

          public tigase.xml.Element getClusterElement(String id)

      Method description
      Parameters:
        `id` -
      Returns:

    - #### getDataPackets

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

      Method description
      Returns:

    - #### getFirstNode

          public tigase.xmpp.JID getFirstNode()

      Method description
      Returns:

    - #### getMethodName

          public String getMethodName()

      Method description
      Returns:

    - #### getMethodParam

          public String getMethodParam(String par_name)

      Method description
      Parameters:
        `par_name` -
      Returns:

    - #### getMethodParam

          public long getMethodParam(String par_name,
                            long def)

      Method description
      Parameters:
        `par_name` -
        `def` -
      Returns:

    - #### getMethodResultVal

          public String getMethodResultVal(String val_name)

      Method description
      Parameters:
        `val_name` -
      Returns:

    - #### getMethodResultVal

          public long getMethodResultVal(String val_name,
                                long def)

      Method description
      Parameters:
        `val_name` -
        `def` -
      Returns:

    - #### getVisitedNodes

          public Set<tigase.xmpp.JID> getVisitedNodes()

      Method description
      Returns:

    - #### isVisitedNode

          public boolean isVisitedNode(tigase.xmpp.JID node_id)

      Method description
      Parameters:
        `node_id` -
      Returns:

    - #### nextClusterNode

          public ClusterElement nextClusterNode(tigase.xmpp.JID node_id)

      Method description
      Parameters:
        `node_id` -
      Returns:

    - #### parseMethodCall

          protected void parseMethodCall(tigase.xml.Element method_call)

      Method description
      Parameters:
        `method_call` -

Copyright © 2013 Tigase. All rights reserved.