tigase.cluster.strategy

## Interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>

- Type Parameters:
    `E` -
  All Superinterfaces:
    OnlineJidsReporter, StatisticHolder
  All Known Implementing Classes:
    DefaultClusteringStrategy, DefaultClusteringStrategyAbstract, SMNonCachingAllNodes

      public interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
      extends OnlineJidsReporter, StatisticHolder

  Created: May 2, 2009 4:36:03 PM
  Version:
    $Rev$
  Author:
    Artur Hefczyc

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `E` | `getConnectionRecord(JID jid)` Returns a ConnectionRecord object associated with this user's full JID if it exists in the cache or null if it does not.
    `E` | `getConnectionRecordInstance()` Method description
    `Set<E>` | `getConnectionRecords(BareJID bareJID)` Returns a set with all ConnectionRecords found in the cache for a given user ID, that is BareJID.
    `Map<String,Object>` | `getDefaults(Map<String,Object> params)` This method is used for configuration purpose.
    `String` | `getInfo()` Method description
    `Object` | `getInternalCacheData()` Deprecated.
    `List<JID>` | `getNodesConnected()` The method returns all cluster nodes currently connected to the cluster node.
    `void` | `getStatistics(StatisticsList list)` Add the strategy statistics to the List.
    `void` | `handleLocalPacket(Packet packet, XMPPResourceConnection conn)` Method description
    `void` | `handleLocalPresenceSet(XMPPResourceConnection conn)` Method description
    `void` | `handleLocalResourceBind(XMPPResourceConnection conn)` Method description
    `void` | `handleLocalUserChangedConnId(BareJID userId, XMPPResourceConnection conn, JID oldConnId, JID newConnId)`
    `void` | `handleLocalUserLogin(BareJID userId, XMPPResourceConnection conn)` Method description
    `void` | `handleLocalUserLogout(BareJID userId, XMPPResourceConnection conn)` Method description
    `void` | `nodeConnected(JID node)` This is a handler method which is called when a new node connects to the cluster.
    `void` | `nodeDisconnected(JID node)` This is a handler method which is called when a node disconnects from the cluster.
    `boolean` | `processPacket(Packet packet, XMPPResourceConnection conn)` Method description
    `void` | `setClusterController(ClusterControllerIfc clComp)` Method description
    `void` | `setProperties(Map<String,Object> props)` Method used to pass configuration parameters to the class.
    `void` | `setSessionManagerHandler(SessionManagerClusteredIfc sm)` The method allows to obtain SessionManagerHandler object by the strategy.

    - ### Methods inherited from interface tigase.sys.OnlineJidsReporter

      `containsJid, containsJidLocally, containsJidLocally, getConnectionIdsForJid, hasCompleteJidsInfo`

    - ### Methods inherited from interface tigase.stats.StatisticHolder

      `everyHour, everyMinute, everySecond, getStatistics, setStatisticsPrefix, statisticExecutedIn`

- - ### Method Detail

    - #### handleLocalPresenceSet

          void handleLocalPresenceSet(XMPPResourceConnection conn)

      Method description
      Parameters:
        `conn` -

    - #### handleLocalResourceBind

          void handleLocalResourceBind(XMPPResourceConnection conn)

      Method description
      Parameters:
        `conn` -

    - #### handleLocalUserLogin

          void handleLocalUserLogin(BareJID userId,
                                    XMPPResourceConnection conn)

      Method description
      Parameters:
        `userId` -
        `conn` -

    - #### handleLocalUserLogout

          void handleLocalUserLogout(BareJID userId,
                                     XMPPResourceConnection conn)

      Method description
      Parameters:
        `userId` -
        `conn` -

    - #### handleLocalUserChangedConnId

          void handleLocalUserChangedConnId(BareJID userId,
                                            XMPPResourceConnection conn,
                                            JID oldConnId,
                                            JID newConnId)

    - #### getInfo

          String getInfo()

      Method description
      Returns:
        a value of `String`

    - #### handleLocalPacket

          void handleLocalPacket(Packet packet,
                                 XMPPResourceConnection conn)

      Method description
      Parameters:
        `packet` -
        `conn` -

    - #### nodeConnected

          void nodeConnected(JID node)

      This is a handler method which is called when a new node connects to the cluster.
      Parameters:
        `node` - is a cluster node id.

    - #### nodeDisconnected

          void nodeDisconnected(JID node)

      This is a handler method which is called when a node disconnects from the cluster.
      Parameters:
        `node` - is a cluster node id.

    - #### processPacket

          boolean processPacket(Packet packet,
                                XMPPResourceConnection conn)

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

    - #### getNodesConnected

          List<JID> getNodesConnected()

      The method returns all cluster nodes currently connected to the cluster node.
      Returns:
        List of all cluster nodes currently connected to the cluster node.

    - #### getConnectionRecord

          E getConnectionRecord(JID jid)

      Returns a ConnectionRecord object associated with this user's full JID if it exists in the cache or null if it does not. All parts of the user's JID are checked and ConnectionRecord is returned only if there is a match for all parts.
      Parameters:
        `jid` - is an instance of the user's full JID.
      Returns:
        ConnectionRecord instance associated with given user's JID or null if there is no ConnectionRecord in the cache.

    - #### getConnectionRecordInstance

          E getConnectionRecordInstance()

      Method description
      Returns:
        a value of `E`

    - #### getConnectionRecords

          Set<E> getConnectionRecords(BareJID bareJID)

      Returns a set with all ConnectionRecords found in the cache for a given user ID, that is BareJID. In other words all user's resources/connectionIDs found in the cache associated with user's account.
      Parameters:
        `bareJID` - is an instance of the user's BareJID, that is account ID.
      Returns:
        a Set instance with all ConnectionRecords found for a given BareJID. Note, the result may be null or it maybe an empty Set or non-empty set.

    - #### getDefaults

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

      This method is used for configuration purpose. Following the convention used in the Tigase project this method is supposed to provide configuration defaults. All parameters which exist in configuration file overwrite corresponding default parameters. If some parameters are missing in configuration file defaults are used then. A compiled set of parameters is then passed to `setProperties` method.
      Parameters:
        `params` - a `Map` with properties loaded from init.properties file which should be used for generating defaults.
      Returns:
        a `Map` with all the class default configuration parameters.

    - #### getInternalCacheData

          @Deprecated
          Object getInternalCacheData()

      Deprecated.
      Note! This is not for a common use method. This is for debugging and diagnostic purposes only and maybe removed or changed at any time in the future. It returns a content of an internal cache from the strategy. Regardless of the cache data organization inside the strategy, it is returned here in a common format. It may be a copy or a direct reference to internal data. Therefore this is unmodifiable instance of the cache. Generating results of this structure may be a costly operation, therefore it must not be called frequently.
      Returns:
        an Object with content of an internal cache data.

    - #### getStatistics

          void getStatistics(StatisticsList list)

      Add the strategy statistics to the List.
      Parameters:
        `list` -

    - #### setClusterController

          void setClusterController(ClusterControllerIfc clComp)

      Method description
      Parameters:
        `clComp` -

    - #### setProperties

          void setProperties(Map<String,Object> props)

      Method used to pass configuration parameters to the class. Parameters are stored in `Map` which contains compiles set of defaults overwritten by parameters loaded from configuration file. If he implementation took a good care of providing defaults for all parameters no parameter should be missing.
      Parameters:
        `props` - a `Map` with all configuration parameters for the class.

    - #### setSessionManagerHandler

          void setSessionManagerHandler(SessionManagerClusteredIfc sm)

      The method allows to obtain SessionManagerHandler object by the strategy. The object is mainly used to access local VHosts configuration and check the ID of the local session manager.
      Parameters:
        `sm` - is an instance of the SessionManagerHandler class.

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