tigase.cluster.strategy
Class SMNonCachingAllNodes

java.lang.Object
  extended by tigase.cluster.strategy.SMNonCachingAllNodes
All Implemented Interfaces:
ClusteringStrategyIfc, OnlineJidsReporter

public class SMNonCachingAllNodes
extends Object
implements ClusteringStrategyIfc

Created: May 13, 2009 9:53:44 AM

Version:
$Rev: 1998 $
Author:
Artur Hefczyc

Constructor Summary
SMNonCachingAllNodes()
           
 
Method Summary
 boolean containsJid(tigase.xmpp.JID jid)
           
 List<tigase.xmpp.JID> getAllNodes()
          The method retutns all cluster nodes currently connected to the cluster.
 tigase.xmpp.JID[] getConnectionIdsForJid(tigase.xmpp.JID jid)
           
 Map<String,Object> getDefaults(Map<String,Object> params)
          This method is used for configuration purpose.
 List<tigase.xmpp.JID> getNodesForJid(tigase.xmpp.JID jid)
          Returns a List of all cluster nodes on which the given user session can exist.
 void getStatistics(StatisticsList list)
          Add the strategy statistics to the List.
 boolean hasCompleteJidsInfo()
           
 boolean needsSync()
          This method returns 'true' if it needs online users syncronization upon the node connection to the cluster.
 void nodeConnected(tigase.xmpp.JID jid)
          This is a handler method which is called when a new node connects to the cluster.
 void nodeDisconnected(tigase.xmpp.JID jid)
          This is a handler method which is called when a node disconnects from the cluster.
 void setProperties(Map<String,Object> props)
          Method used to pass configuration parameters to the class.
 void userDisconnected(tigase.xmpp.JID sm, Queue<Packet> results, tigase.xmpp.JID jid)
          This is a handler method which is called when a user disconnects from some node in the cluster.
 void usersConnected(tigase.xmpp.JID sm, Queue<Packet> results, tigase.xmpp.JID... jid)
          This is a handler method which is called when a user connects to some node in the cluster.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMNonCachingAllNodes

public SMNonCachingAllNodes()
Method Detail

getDefaults

public Map<String,Object> getDefaults(Map<String,Object> params)
Description copied from interface: ClusteringStrategyIfc
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.

Specified by:
getDefaults in interface ClusteringStrategyIfc
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.

setProperties

public void setProperties(Map<String,Object> props)
Description copied from interface: ClusteringStrategyIfc
Method used to pass configuration parameters to the class. Parameters are stored in Map which contains compiles set of defaults overwriten by parameters loaded from configuration file. If he implementation took a good care of providing defaults for all parameters no parameter should be missing.

Specified by:
setProperties in interface ClusteringStrategyIfc
Parameters:
props - a Map with all configuration parameters for the class.

getNodesForJid

public List<tigase.xmpp.JID> getNodesForJid(tigase.xmpp.JID jid)
Description copied from interface: ClusteringStrategyIfc
Returns a List of all cluster nodes on which the given user session can exist. In the simplest scenario it can always return all cluster nodes as in theory the user can connect to any node if it is not on the local node. More specialized implementation can know kind of hashing algorithm which is used for binding a specific user to a specific node or the implementation can keep track of all connected users to all nodes and 'know' where is the user connected at any given time. In theory it can also return 'null' it it 'knows' the user is offline.

Specified by:
getNodesForJid in interface ClusteringStrategyIfc
Parameters:
jid - is a user full JID.
Returns:
List of cluster nodes to which the user can be connected.

nodeConnected

public void nodeConnected(tigase.xmpp.JID jid)
Description copied from interface: ClusteringStrategyIfc
This is a handler method which is called when a new node connects to the cluster.

Specified by:
nodeConnected in interface ClusteringStrategyIfc
Parameters:
jid - is a cluster node id.

nodeDisconnected

public void nodeDisconnected(tigase.xmpp.JID jid)
Description copied from interface: ClusteringStrategyIfc
This is a handler method which is called when a node disconnects from the cluster.

Specified by:
nodeDisconnected in interface ClusteringStrategyIfc
Parameters:
jid - is a cluster node id.

usersConnected

public void usersConnected(tigase.xmpp.JID sm,
                           Queue<Packet> results,
                           tigase.xmpp.JID... jid)
Description copied from interface: ClusteringStrategyIfc
This is a handler method which is called when a user connects to some node in the cluster.

Specified by:
usersConnected in interface ClusteringStrategyIfc
Parameters:
sm - is a cluster node id where the jid is connected to.
results - is a collection of packets which can be generated upon the user connection by the implementation.
jid - is a list of full user JIDs which just connected to the cluster. Normally there is only one JID provided, however, in some cases (during syncronization) there might be more than one.

userDisconnected

public void userDisconnected(tigase.xmpp.JID sm,
                             Queue<Packet> results,
                             tigase.xmpp.JID jid)
Description copied from interface: ClusteringStrategyIfc
This is a handler method which is called when a user disconnects from some node in the cluster.

Specified by:
userDisconnected in interface ClusteringStrategyIfc
Parameters:
sm - is a cluster node id from which the user disconnected.
results - is a collection of packets which can be generated upon the user disconnection by the implementation.
jid - us a user full JID just disconnected from the cluster.

getAllNodes

public List<tigase.xmpp.JID> getAllNodes()
Description copied from interface: ClusteringStrategyIfc
The method retutns all cluster nodes currently connected to the cluster.

Specified by:
getAllNodes in interface ClusteringStrategyIfc
Returns:
List of all cluster nodes currently connected to the cluster.

needsSync

public boolean needsSync()
Description copied from interface: ClusteringStrategyIfc
This method returns 'true' if it needs online users syncronization upon the node connection to the cluster. Normally it should return 'false'. It it return 'true' then the synchronization starts. All online users from all other nodes would sent in batches and the synchronization can take any amount of time.

Specified by:
needsSync in interface ClusteringStrategyIfc
Returns:
a boolean value whether synchronization is needed.

getStatistics

public void getStatistics(StatisticsList list)
Description copied from interface: ClusteringStrategyIfc
Add the strategy statistics to the List.

Specified by:
getStatistics in interface ClusteringStrategyIfc

hasCompleteJidsInfo

public boolean hasCompleteJidsInfo()
Specified by:
hasCompleteJidsInfo in interface OnlineJidsReporter

containsJid

public boolean containsJid(tigase.xmpp.JID jid)
Specified by:
containsJid in interface OnlineJidsReporter

getConnectionIdsForJid

public tigase.xmpp.JID[] getConnectionIdsForJid(tigase.xmpp.JID jid)
Specified by:
getConnectionIdsForJid in interface OnlineJidsReporter


Copyright © 2001-2006 Tigase Developers Team. All rights Reserved.