tigase.cluster.strategy

## Class DefaultClusteringStrategyAbstract<E extends ConnectionRecordIfc>

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

- Type Parameters:
    `E` -
  All Implemented Interfaces:
    ClusteringStrategyIfc<E>, OnlineJidsReporter
  Direct Known Subclasses:
    DefaultClusteringStrategy

      public class DefaultClusteringStrategyAbstract<E extends ConnectionRecordIfc>
      extends Object
      implements ClusteringStrategyIfc<E>

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

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected CopyOnWriteArrayList<tigase.xmpp.JID>` | `cl_nodes_list` Field description
    `protected ClusterControllerIfc` | `cluster` Field description
    `protected SessionManagerClusteredIfc` | `sm` Field description

  - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCommandListener(CommandListener cmd)` Method description
    `boolean` | `containsJid(tigase.xmpp.BareJID jid)` Method description
    `List<tigase.xmpp.JID>` | `getAllNodes()` Method description
    `tigase.xmpp.JID[]` | `getConnectionIdsForJid(tigase.xmpp.BareJID jid)` Method description
    `E` | `getConnectionRecord(tigase.xmpp.JID jid)` Method description
    `E` | `getConnectionRecordInstance()` Method description
    `Set<E>` | `getConnectionRecords(tigase.xmpp.BareJID bareJID)` Method description
    `Map<String,Object>` | `getDefaults(Map<String,Object> params)` Method description
    `String` | `getInfo()` Method description
    `Object` | `getInternalCacheData()` Deprecated.
    `List<tigase.xmpp.JID>` | `getNodesForPacketForward(tigase.xmpp.JID fromNode, Set<tigase.xmpp.JID> visitedNodes, Packet packet)` Method description
    `void` | `getStatistics(StatisticsList list)` Method description
    `void` | `handleLocalPacket(Packet packet, XMPPResourceConnection conn)` Method description
    `void` | `handleLocalUserLogin(tigase.xmpp.BareJID userId, XMPPResourceConnection conn)` Method description
    `void` | `handleLocalUserLogout(tigase.xmpp.BareJID userId, XMPPResourceConnection conn)` Method description
    `boolean` | `hasCompleteJidsInfo()` Method description
    `protected boolean` | `isSuitableForForward(Packet packet)` Method description
    `void` | `nodeConnected(tigase.xmpp.JID jid)` Method description
    `void` | `nodeDisconnected(tigase.xmpp.JID jid)` Method description
    `boolean` | `processPacket(Packet packet, XMPPResourceConnection conn)` Method description
    `boolean` | `sendToNextNode(tigase.xmpp.JID fromNode, Set<tigase.xmpp.JID> visitedNodes, Map<String,String> data, Packet packet)` Method attempts to send the packet to the next cluster node.
    `void` | `setClusterController(ClusterControllerIfc clComp)` Method description
    `void` | `setProperties(Map<String,Object> props)` Method description
    `void` | `setSessionManagerHandler(SessionManagerClusteredIfc sm)` Method description
    `String` | `toString()` Method description

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

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

- - ### Field Detail

    - #### cluster

          protected ClusterControllerIfc cluster

      Field description

    - #### sm

          protected SessionManagerClusteredIfc sm

      Field description

    - #### cl_nodes_list

          protected CopyOnWriteArrayList<tigase.xmpp.JID> cl_nodes_list

      Field description

  - ### Constructor Detail

    - #### DefaultClusteringStrategyAbstract

          public DefaultClusteringStrategyAbstract()

      Constructs ...

  - ### Method Detail

    - #### addCommandListener

          public final void addCommandListener(CommandListener cmd)

      Method description
      Parameters:
        `cmd` -

    - #### containsJid

          public boolean containsJid(tigase.xmpp.BareJID jid)

      Method description
      Specified by:
        `containsJid` in interface `OnlineJidsReporter`
      Parameters:
        `jid` -
      Returns:
        a value of `boolean`

    - #### handleLocalPacket

          public void handleLocalPacket(Packet packet,
                               XMPPResourceConnection conn)

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

    - #### handleLocalUserLogin

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

      Method description
      Specified by:
        `handleLocalUserLogin` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Parameters:
        `userId` -
        `conn` -

    - #### handleLocalUserLogout

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

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

    - #### nodeConnected

          public void nodeConnected(tigase.xmpp.JID jid)

      Method description
      Specified by:
        `nodeConnected` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Parameters:
        `jid` -

    - #### nodeDisconnected

          public void nodeDisconnected(tigase.xmpp.JID jid)

      Method description
      Specified by:
        `nodeDisconnected` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Parameters:
        `jid` -

    - #### processPacket

          public boolean processPacket(Packet packet,
                              XMPPResourceConnection conn)

      Method description
      Specified by:
        `processPacket` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Parameters:
        `packet` -
        `conn` -
      Returns:
        a value of `boolean`

    - #### sendToNextNode

          public boolean sendToNextNode(tigase.xmpp.JID fromNode,
                               Set<tigase.xmpp.JID> visitedNodes,
                               Map<String,String> data,
                               Packet packet)

      Method attempts to send the packet to the next cluster node. Returns true on successful attempt and false on failure. The true result does not mean that the packet has been delivered though. Only that it was sent. The send attempt may fail if there is no more cluster nodes to send the packet or if the clustering strategy logic decided that the packet does not have to be sent.
      Parameters:
        `fromNode` -
        `data` -
        `packet` - to be sent to a next cluster node
        `visitedNodes` - a list of nodes already visited by the packet.
      Returns:
        true if the packet was sent to next cluster node and false otherwise.

    - #### toString

          public String toString()

      Method description
      Overrides:
        `toString` in class `Object`
      Returns:
        a value of `String`

    - #### getAllNodes

          public List<tigase.xmpp.JID> getAllNodes()

      Method description
      Specified by:
        `getAllNodes` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Returns:
        a value of `List`

    - #### getConnectionIdsForJid

          public tigase.xmpp.JID[] getConnectionIdsForJid(tigase.xmpp.BareJID jid)

      Method description
      Specified by:
        `getConnectionIdsForJid` in interface `OnlineJidsReporter`
      Parameters:
        `jid` -
      Returns:
        a value of `JID[]`

    - #### getConnectionRecord

          public E getConnectionRecord(tigase.xmpp.JID jid)

      Method description
      Specified by:
        `getConnectionRecord` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Parameters:
        `jid` -
      Returns:
        a value of `E`

    - #### getConnectionRecordInstance

          public E getConnectionRecordInstance()

      Method description
      Specified by:
        `getConnectionRecordInstance` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Returns:
        a value of `E`

    - #### getConnectionRecords

          public Set<E> getConnectionRecords(tigase.xmpp.BareJID bareJID)

      Method description
      Specified by:
        `getConnectionRecords` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Parameters:
        `bareJID` -
      Returns:
        a value of `Set`

    - #### getDefaults

          public Map<String,Object> getDefaults(Map<String,Object> params)

      Method description
      Specified by:
        `getDefaults` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Parameters:
        `params` -
      Returns:
        a value of `Map`

    - #### getInfo

          public String getInfo()

      Method description
      Specified by:
        `getInfo` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Returns:
        a value of `String`

    - #### getInternalCacheData

          @Deprecated
          public Object getInternalCacheData()

      Deprecated.
      Method description
      Specified by:
        `getInternalCacheData` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Returns:
        a value of `Object`

    - #### getNodesForPacketForward

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

      Method description
      Parameters:
        `fromNode` -
        `visitedNodes` -
        `packet` -
      Returns:
        a value of `List`

    - #### getStatistics

          public void getStatistics(StatisticsList list)

      Method description
      Specified by:
        `getStatistics` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Parameters:
        `list` -

    - #### hasCompleteJidsInfo

          public boolean hasCompleteJidsInfo()

      Method description
      Specified by:
        `hasCompleteJidsInfo` in interface `OnlineJidsReporter`
      Returns:
        a value of `boolean`

    - #### setClusterController

          public void setClusterController(ClusterControllerIfc clComp)

      Method description
      Specified by:
        `setClusterController` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Parameters:
        `clComp` -

    - #### setProperties

          public void setProperties(Map<String,Object> props)

      Method description
      Specified by:
        `setProperties` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Parameters:
        `props` -

    - #### setSessionManagerHandler

          public void setSessionManagerHandler(SessionManagerClusteredIfc sm)

      Method description
      Specified by:
        `setSessionManagerHandler` in interface `ClusteringStrategyIfc<E extends ConnectionRecordIfc>`
      Parameters:
        `sm` -

    - #### isSuitableForForward

          protected boolean isSuitableForForward(Packet packet)

      Method description
      Parameters:
        `packet` -
      Returns:
        a value of `boolean`

Copyright © 2013 Tigase. All rights reserved.