tigase.cluster.strategy

## Class DefaultClusteringStrategy<E extends ConnectionRecordIfc>

- java.lang.Object
- - tigase.cluster.strategy.DefaultClusteringStrategyAbstract<E>
  - - tigase.cluster.strategy.DefaultClusteringStrategy<E>

- Type Parameters:
    `E` -
  All Implemented Interfaces:
    ClusteringStrategyIfc<E>, OnlineJidsReporter

      public class DefaultClusteringStrategy<E extends ConnectionRecordIfc>
      extends DefaultClusteringStrategyAbstract<E>

  Created: May 13, 2009 9:53:44 AM
  Version:
    $Rev$
  Author:
    Artur Hefczyc

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CONNECTION_ID` Field description
    `static String` | `RESOURCE` Field description
    `static String` | `SM_ID` Field description
    `static String` | `USER_ID` Field description
    `static String` | `XMPP_SESSION_ID` Field description

    - ### Fields inherited from class tigase.cluster.strategy.DefaultClusteringStrategyAbstract

      `cl_nodes_list, cluster, sm`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultClusteringStrategy()` Constructs ...

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected ConnectionRecordIfc` | `getConnectionRecord(tigase.xmpp.JID node, Map<String,String> data)` Method takes the data received from other cluster node and creates a ConnectionRecord with all essential connection information.
    `List<tigase.xmpp.JID>` | `getNodesForPacketForward(tigase.xmpp.JID fromNode, Set<tigase.xmpp.JID> visitedNodes, Packet packet)` Method description
    `void` | `handleLocalPacket(Packet packet, XMPPResourceConnection conn)` Method description
    `void` | `handleLocalResourceBind(XMPPResourceConnection conn)` Method description
    `void` | `handleLocalUserLogout(tigase.xmpp.BareJID userId, XMPPResourceConnection conn)` Method description
    `protected Map<String,String>` | `prepareConnectionParams(XMPPResourceConnection conn)` A utility method used to prepare a Map of data with user session data before it can be sent over to another cluster node.

    - ### Methods inherited from class tigase.cluster.strategy.DefaultClusteringStrategyAbstract

      `addCommandListener, containsJid, getAllNodes, getConnectionIdsForJid, getConnectionRecord, getConnectionRecordInstance, getConnectionRecords, getDefaults, getInfo, getInternalCacheData, getStatistics, handleLocalPresenceSet, handleLocalUserLogin, hasCompleteJidsInfo, isSuitableForForward, nodeConnected, nodeDisconnected, processPacket, sendToNextNode, setClusterController, setProperties, setSessionManagerHandler, toString`

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

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

- - ### Field Detail

    - #### CONNECTION_ID

          public static final String CONNECTION_ID

      Field description
      See Also:
        Constant Field Values

    - #### RESOURCE

          public static final String RESOURCE

      Field description
      See Also:
        Constant Field Values

    - #### SM_ID

          public static final String SM_ID

      Field description
      See Also:
        Constant Field Values

    - #### USER_ID

          public static final String USER_ID

      Field description
      See Also:
        Constant Field Values

    - #### XMPP_SESSION_ID

          public static final String XMPP_SESSION_ID

      Field description
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DefaultClusteringStrategy

          public DefaultClusteringStrategy()

      Constructs ...

  - ### Method Detail

    - #### handleLocalPacket

          public void handleLocalPacket(Packet packet,
                               XMPPResourceConnection conn)

      Method description
      Specified by:
        `handleLocalPacket` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Overrides:
        `handleLocalPacket` in class `DefaultClusteringStrategyAbstract<E extends ConnectionRecordIfc>`
      Parameters:
        `packet` -
        `conn` -

    - #### handleLocalResourceBind

          public void handleLocalResourceBind(XMPPResourceConnection conn)

      Method description
      Specified by:
        `handleLocalResourceBind` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Overrides:
        `handleLocalResourceBind` in class `DefaultClusteringStrategyAbstract<E extends ConnectionRecordIfc>`
      Parameters:
        `conn` -

    - #### handleLocalUserLogout

          public void handleLocalUserLogout(tigase.xmpp.BareJID userId,
                                   XMPPResourceConnection conn)

      Method description
      Specified by:
        `handleLocalUserLogout` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Overrides:
        `handleLocalUserLogout` in class `DefaultClusteringStrategyAbstract<E extends ConnectionRecordIfc>`
      Parameters:
        `userId` -
        `conn` -

    - #### getNodesForPacketForward

          public List<tigase.xmpp.JID> getNodesForPacketForward(tigase.xmpp.JID fromNode,
                                                       Set<tigase.xmpp.JID> visitedNodes,
                                                       Packet packet)

      Method description
      Overrides:
        `getNodesForPacketForward` in class `DefaultClusteringStrategyAbstract<E extends ConnectionRecordIfc>`
      Parameters:
        `fromNode` - is a `JID`
        `visitedNodes` - is a `Set`
        `packet` - is a `Packet`
      Returns:
        a value of `List`

    - #### prepareConnectionParams

          protected Map<String,String> prepareConnectionParams(XMPPResourceConnection conn)
                                                        throws NotAuthorizedException,
                                                               NoConnectionIdException

      A utility method used to prepare a Map of data with user session data before it can be sent over to another cluster node. This is supposed to contain all the user's session essential information which directly identify user's resource and network connection. This information allows to detect two different user's connection made for the same resource. This may happen if both connections are established to different nodes.
      Parameters:
        `conn` - is user's XMPPResourceConnection for which Map structure is prepare.
      Returns:
        a Map structure with all user's connection essential data.
      Throws:
        `NoConnectionIdException`
        `NotAuthorizedException`

    - #### getConnectionRecord

          protected ConnectionRecordIfc getConnectionRecord(tigase.xmpp.JID node,
                                                Map<String,String> data)

      Method takes the data received from other cluster node and creates a ConnectionRecord with all essential connection information. This might be used later to identify user's XMPPResourceConnection or use the clustering strategy API.
      Parameters:
        `node` -
        `data` -
      Returns:

Copyright © 2014 "Tigase, Inc.". All rights reserved.