Package tigase.cluster.api
Class ClusterElement
java.lang.Object
tigase.cluster.api.ClusterElement
Class ClusterElement is a utility class for handling tigase cluster specific packets. The cluster packet has the
following form:
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
<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 Summary
Modifier and TypeFieldDescriptionstatic final String
static final String[]
static final String
static final String[]
static final String
static final String
static final String
static final String[]
static final String
static final String[]
static final String
static final String
static final String
static final String[]
static final String
static final String
static final String[]
static final String
-
Constructor Summary
ConstructorDescriptionClusterElement
(Element elem) Creates a newClusterElement
instance.ClusterElement
(JID from, JID to, StanzaType type, Packet packet) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataPacket
(Packet packet) void
addDataPacket
(Element packet) void
addDataPackets
(Queue<Element> packets) void
addMethodResult
(String key, String val) void
addVisitedNode
(JID node_id) void
addVisitedNodes
(Set<JID> nodes) static Element
clusterElement
(JID from, JID to, StanzaType type) static Element
createClusterElement
(JID from, JID to, StanzaType type, String packet_from) static ClusterElement
createClusterMethodCall
(JID from, JID to, StanzaType type, String method_name, Map<String, String> params) static ClusterElement
createForNextNode
(ClusterElement clel, List<JID> cluster_nodes, JID comp_id) createMethodResponse
(JID from, JID to, StanzaType type, Map<String, String> results) createMethodResponse
(JID from, StanzaType type, Map<String, String> results) getMethodParam
(String par_name) long
getMethodParam
(String par_name, long def) getMethodResultVal
(String val_name) long
getMethodResultVal
(String val_name, long def) boolean
isVisitedNode
(JID node_id) nextClusterNode
(JID node_id) protected void
parseMethodCall
(Element method_call) void
setPriority
(Priority priority)
-
Field Details
-
CLUSTER_CONTROL_EL_NAME
- See Also:
-
CLUSTER_DATA_EL_NAME
- See Also:
-
CLUSTER_EL_NAME
- See Also:
-
CLUSTER_METHOD_EL_NAME
- See Also:
-
CLUSTER_METHOD_PAR_EL_NAME
- See Also:
-
CLUSTER_METHOD_RESULTS_EL_NAME
- See Also:
-
CLUSTER_METHOD_RESULTS_VAL_EL_NAME
- See Also:
-
CLUSTER_NAME_ATTR
- See Also:
-
FIRST_NODE_EL_NAME
- See Also:
-
NODE_ID_EL_NAME
- See Also:
-
VISITED_NODES_EL_NAME
- See Also:
-
XMLNS
- See Also:
-
VISITED_NODES_PATH
-
FIRST_NODE_PATH
-
CLUSTER_METHOD_RESULTS_PATH
-
CLUSTER_METHOD_PATH
-
CLUSTER_DATA_PATH
-
CLUSTER_CONTROL_PATH
-
-
Constructor Details
-
ClusterElement
Creates a newClusterElement
instance. -
ClusterElement
-
-
Method Details
-
clusterElement
-
createClusterElement
-
createClusterMethodCall
public static ClusterElement createClusterMethodCall(JID from, JID to, StanzaType type, String method_name, Map<String, String> params) -
createForNextNode
public static ClusterElement createForNextNode(ClusterElement clel, List<JID> cluster_nodes, JID comp_id) -
addDataPacket
-
addDataPacket
-
addDataPackets
-
addMethodResult
-
addVisitedNode
-
addVisitedNodes
-
createMethodResponse
-
createMethodResponse
public ClusterElement createMethodResponse(JID from, JID to, StanzaType type, Map<String, String> results) -
getAllMethodParams
-
getAllMethodResults
-
getClusterElement
-
getDataPackets
-
getFirstNode
-
getMethodName
-
getMethodParam
-
getMethodParam
-
getMethodResultVal
-
getMethodResultVal
-
getPriority
-
setPriority
-
getVisitedNodes
-
isVisitedNode
-
nextClusterNode
-
parseMethodCall
-