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$
Author:
Artur Hefczyc

Constructor Summary
SMNonCachingAllNodes()
           
 
Method Summary
 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
 ConnectionRecord getConnectionRecord(tigase.xmpp.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.
 Set<ConnectionRecord> getConnectionRecords(tigase.xmpp.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)
          Method description
 Object getInternalCacheData()
          Deprecated. 
 List<tigase.xmpp.JID> getNodesForJid(tigase.xmpp.JID jid)
          Method description
 List<tigase.xmpp.JID> getNodesForPacketForward(tigase.xmpp.JID fromNode, Set<tigase.xmpp.JID> visitedNodes, Packet packet)
          The method allows the strategy implementation to control to which cluster nodes forward the given packet.
 List<tigase.xmpp.JID> getNodesForUserConnect(tigase.xmpp.JID jid)
          The method allows the strategy implementation to control to which cluster nodes send the notification about user's new connection event.
 List<tigase.xmpp.JID> getNodesForUserDisconnect(tigase.xmpp.JID jid)
          The method allows the strategy implementation to control to which cluster nodes send the notification about user's disconnection event.
 void getStatistics(StatisticsList list)
          Method description
 boolean hasCompleteJidsInfo()
          Method description
protected  boolean isSuitableForForward(Packet packet)
           
 boolean needsSync()
          Method description
 void nodeConnected(tigase.xmpp.JID jid)
          Method description
 void nodeDisconnected(tigase.xmpp.JID jid)
          Method description
 void presenceUpdate(tigase.xml.Element presence, ConnectionRecord rec)
          The method is called on user's presence update received from a remote cluster node.
 void setProperties(Map<String,Object> props)
          Method description
 void setSessionManagerHandler(SessionManagerHandler sm)
          The method allows to obtain SessionManagerHandler object by the strategy.
 void userDisconnected(Queue<Packet> results, ConnectionRecord rec)
          Method description
 void usersConnected(Queue<Packet> results, ConnectionRecord... rec)
          Method description
 
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

setSessionManagerHandler

public void setSessionManagerHandler(SessionManagerHandler sm)
Description copied from interface: ClusteringStrategyIfc
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.

Specified by:
setSessionManagerHandler in interface ClusteringStrategyIfc
Parameters:
sm - is an instance of the SessionManagerHandler class.

containsJid

public boolean containsJid(tigase.xmpp.BareJID jid)
Method description

Specified by:
containsJid in interface OnlineJidsReporter
Parameters:
jid -
Returns:

getAllNodes

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

Specified by:
getAllNodes in interface ClusteringStrategyIfc
Returns:

getConnectionIdsForJid

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

Specified by:
getConnectionIdsForJid in interface OnlineJidsReporter
Parameters:
jid -
Returns:

getDefaults

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

Specified by:
getDefaults in interface ClusteringStrategyIfc
Parameters:
params -
Returns:

getNodesForJid

public List<tigase.xmpp.JID> getNodesForJid(tigase.xmpp.JID jid)
Method description

Specified by:
getNodesForJid in interface ClusteringStrategyIfc
Parameters:
jid -
Returns:

getStatistics

public void getStatistics(StatisticsList list)
Method description

Specified by:
getStatistics in interface ClusteringStrategyIfc
Parameters:
list -

hasCompleteJidsInfo

public boolean hasCompleteJidsInfo()
Method description

Specified by:
hasCompleteJidsInfo in interface OnlineJidsReporter
Returns:

needsSync

public boolean needsSync()
Method description

Specified by:
needsSync in interface ClusteringStrategyIfc
Returns:

nodeConnected

public void nodeConnected(tigase.xmpp.JID jid)
Method description

Specified by:
nodeConnected in interface ClusteringStrategyIfc
Parameters:
jid -

nodeDisconnected

public void nodeDisconnected(tigase.xmpp.JID jid)
Method description

Specified by:
nodeDisconnected in interface ClusteringStrategyIfc
Parameters:
jid -

setProperties

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

Specified by:
setProperties in interface ClusteringStrategyIfc
Parameters:
props -

userDisconnected

public void userDisconnected(Queue<Packet> results,
                             ConnectionRecord rec)
Method description

Specified by:
userDisconnected in interface ClusteringStrategyIfc
Parameters:
sm -
results -
jid -

usersConnected

public void usersConnected(Queue<Packet> results,
                           ConnectionRecord... rec)
Method description

Specified by:
usersConnected in interface ClusteringStrategyIfc
Parameters:
sm -
results -
jid -

getNodesForPacketForward

public List<tigase.xmpp.JID> getNodesForPacketForward(tigase.xmpp.JID fromNode,
                                                      Set<tigase.xmpp.JID> visitedNodes,
                                                      Packet packet)
Description copied from interface: ClusteringStrategyIfc
The method allows the strategy implementation to control to which cluster nodes forward the given packet. It may offer a different algorithm for message broadcasting and different for presences, for example.

Specified by:
getNodesForPacketForward in interface ClusteringStrategyIfc
Parameters:
fromNode - a source address if the packet was forwarded from a different node, this may be null if the packet was generated on this node.
visitedNodes - a list of cluster nodes through which the packet already traveled, this parameter can be null if the packet was generated on this node
packet - a packet which is supposed to be sent to other node.
Returns:
a list of cluster nodes JIDs to which the packet should be sent.

isSuitableForForward

protected boolean isSuitableForForward(Packet packet)

getNodesForUserConnect

public List<tigase.xmpp.JID> getNodesForUserConnect(tigase.xmpp.JID jid)
Description copied from interface: ClusteringStrategyIfc
The method allows the strategy implementation to control to which cluster nodes send the notification about user's new connection event.

Specified by:
getNodesForUserConnect in interface ClusteringStrategyIfc
Returns:
a list of cluster nodes JIDs to which the notification should be sent.

getNodesForUserDisconnect

public List<tigase.xmpp.JID> getNodesForUserDisconnect(tigase.xmpp.JID jid)
Description copied from interface: ClusteringStrategyIfc
The method allows the strategy implementation to control to which cluster nodes send the notification about user's disconnection event.

Specified by:
getNodesForUserDisconnect in interface ClusteringStrategyIfc
Returns:
a list of cluster nodes JIDs to which the notification should be sent.

getInternalCacheData

@Deprecated
public Object getInternalCacheData()
Deprecated. 

Description copied from interface: ClusteringStrategyIfc
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.

Specified by:
getInternalCacheData in interface ClusteringStrategyIfc
Returns:
an Object with content of an internal cache data.

getConnectionRecords

public Set<ConnectionRecord> getConnectionRecords(tigase.xmpp.BareJID bareJID)
Description copied from interface: ClusteringStrategyIfc
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.

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

getConnectionRecord

public ConnectionRecord getConnectionRecord(tigase.xmpp.JID jid)
Description copied from interface: ClusteringStrategyIfc
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.

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

presenceUpdate

public void presenceUpdate(tigase.xml.Element presence,
                           ConnectionRecord rec)
Description copied from interface: ClusteringStrategyIfc
The method is called on user's presence update received from a remote cluster node. The clustering strategy may choose to cache the presence locally if necessary.

Specified by:
presenceUpdate in interface ClusteringStrategyIfc
Parameters:
presence - Packet received from a remote cluster node.
rec - is an instance of the user's ConnectionRecord.


Copyright © 2013 Tigase. All rights reserved.