E
- public class DefaultClusteringStrategyAbstract<E extends ConnectionRecordIfc> extends Object implements ClusteringStrategyIfc<E>
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 and Description |
---|
DefaultClusteringStrategyAbstract()
Constructs ...
|
Modifier and Type | Method and Description |
---|---|
void |
addCommandListener(CommandListener cmd)
Method description
|
boolean |
containsJid(tigase.xmpp.BareJID jid)
The method checks whether the given JID is known to the installation,
either user connected to local machine or any of the cluster nodes.
|
boolean |
containsJidLocally(tigase.xmpp.BareJID jid)
The method checks whether the given JID is known to local cluster node
as connected user.
|
boolean |
containsJidLocally(tigase.xmpp.JID jid)
The method checks whether the given JID is known to local cluster node
as connected user.
|
List<tigase.xmpp.JID> |
getAllNodes()
The method returns all cluster nodes currently connected to the cluster.
|
tigase.xmpp.JID[] |
getConnectionIdsForJid(tigase.xmpp.BareJID jid)
Retrieve all connection IDs (CIDs) for the given user.
|
E |
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.
|
E |
getConnectionRecordInstance()
Method description
|
Set<E> |
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)
This method is used for configuration purpose.
|
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
|
SessionManagerClusteredIfc |
getSM() |
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 |
handleLocalUserLogin(tigase.xmpp.BareJID userId,
XMPPResourceConnection conn)
Method description
|
void |
handleLocalUserLogout(tigase.xmpp.BareJID userId,
XMPPResourceConnection conn)
Method description
|
boolean |
hasCompleteJidsInfo()
Indicates whether given
OnlineJidsReporter contains complete
information about connected JIDs. |
protected boolean |
isSuitableForForward(Packet packet)
Method description
|
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.
|
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 used to pass configuration parameters to the class.
|
void |
setSessionManagerHandler(SessionManagerClusteredIfc sm)
The method allows to obtain SessionManagerHandler object by the strategy.
|
String |
toString() |
protected ClusterControllerIfc cluster
protected SessionManagerClusteredIfc sm
protected CopyOnWriteArrayList<tigase.xmpp.JID> cl_nodes_list
public DefaultClusteringStrategyAbstract()
public final void addCommandListener(CommandListener cmd)
cmd
- public boolean containsJid(tigase.xmpp.BareJID jid)
OnlineJidsReporter
containsJid
in interface OnlineJidsReporter
jid
- a user's JID for whom we query information.public boolean containsJidLocally(tigase.xmpp.BareJID jid)
OnlineJidsReporter
containsJidLocally
in interface OnlineJidsReporter
jid
- a user's JID for whom we query informationpublic boolean containsJidLocally(tigase.xmpp.JID jid)
OnlineJidsReporter
containsJidLocally
in interface OnlineJidsReporter
jid
- a user's JID for whom we query informationpublic void handleLocalPacket(Packet packet, XMPPResourceConnection conn)
ClusteringStrategyIfc
handleLocalPacket
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
public void handleLocalPresenceSet(XMPPResourceConnection conn)
ClusteringStrategyIfc
handleLocalPresenceSet
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
public void handleLocalResourceBind(XMPPResourceConnection conn)
ClusteringStrategyIfc
handleLocalResourceBind
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
public void handleLocalUserLogin(tigase.xmpp.BareJID userId, XMPPResourceConnection conn)
ClusteringStrategyIfc
handleLocalUserLogin
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
public void handleLocalUserLogout(tigase.xmpp.BareJID userId, XMPPResourceConnection conn)
ClusteringStrategyIfc
handleLocalUserLogout
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
public void nodeConnected(tigase.xmpp.JID jid)
ClusteringStrategyIfc
nodeConnected
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
jid
- is a cluster node id.public void nodeDisconnected(tigase.xmpp.JID jid)
ClusteringStrategyIfc
nodeDisconnected
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
jid
- is a cluster node id.public boolean processPacket(Packet packet, XMPPResourceConnection conn)
ClusteringStrategyIfc
processPacket
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
boolean
public boolean sendToNextNode(tigase.xmpp.JID fromNode, Set<tigase.xmpp.JID> visitedNodes, Map<String,String> data, Packet packet)
fromNode
- data
- packet
- to be sent to a next cluster nodevisitedNodes
- a list of nodes already visited by the packet.public List<tigase.xmpp.JID> getAllNodes()
ClusteringStrategyIfc
getAllNodes
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
public tigase.xmpp.JID[] getConnectionIdsForJid(tigase.xmpp.BareJID jid)
OnlineJidsReporter
getConnectionIdsForJid
in interface OnlineJidsReporter
jid
- id of the user for which we want to retrieve the list.JID
containing all Connection IDs (CIDs) for
the given user.public E getConnectionRecord(tigase.xmpp.JID jid)
ClusteringStrategyIfc
getConnectionRecord
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
jid
- is an instance of the user's full JID.public E getConnectionRecordInstance()
ClusteringStrategyIfc
getConnectionRecordInstance
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
E
public Set<E> getConnectionRecords(tigase.xmpp.BareJID bareJID)
ClusteringStrategyIfc
getConnectionRecords
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
bareJID
- is an instance of the user's BareJID, that is account ID.public Map<String,Object> getDefaults(Map<String,Object> params)
ClusteringStrategyIfc
setProperties
method.getDefaults
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
params
- a Map
with properties loaded from init.properties
file which should be used for generating defaults.Map
with all the class default configuration
parameters.public String getInfo()
ClusteringStrategyIfc
getInfo
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
String
@Deprecated public Object getInternalCacheData()
ClusteringStrategyIfc
getInternalCacheData
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
public List<tigase.xmpp.JID> getNodesForPacketForward(tigase.xmpp.JID fromNode, Set<tigase.xmpp.JID> visitedNodes, Packet packet)
fromNode
- visitedNodes
- packet
- List
public void getStatistics(StatisticsList list)
ClusteringStrategyIfc
getStatistics
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
public boolean hasCompleteJidsInfo()
OnlineJidsReporter
OnlineJidsReporter
contains complete
information about connected JIDs.hasCompleteJidsInfo
in interface OnlineJidsReporter
true
if the informations are complete, false
otherwise.public void setClusterController(ClusterControllerIfc clComp)
ClusteringStrategyIfc
setClusterController
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
public void setProperties(Map<String,Object> props)
ClusteringStrategyIfc
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.setProperties
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
props
- a Map
with all configuration parameters for the
class.public void setSessionManagerHandler(SessionManagerClusteredIfc sm)
ClusteringStrategyIfc
setSessionManagerHandler
in interface ClusteringStrategyIfc<E extends ConnectionRecordIfc>
sm
- is an instance of the SessionManagerHandler class.protected boolean isSuitableForForward(Packet packet)
packet
- boolean
public SessionManagerClusteredIfc getSM()
Copyright © 2014 "Tigase, Inc.". All rights reserved.