Package tigase.server.xmppclient
Class SeeOtherHost
- java.lang.Object
-
- tigase.server.xmppclient.SeeOtherHost
-
- All Implemented Interfaces:
Initializable
,Lifecycle
,SeeOtherHostIfc
- Direct Known Subclasses:
SeeOtherHostHashed
@Bean(name="seeOtherHost", parent=ClientConnectionManager.class, active=true) @ClusterModeRequired(active=false) public class SeeOtherHost extends java.lang.Object implements SeeOtherHostIfc, Initializable
Default and basic implementation of SeeOtherHost returning same host as the initial one- Author:
- Wojtek
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SeeOtherHost.SeeOtherHostVHostItemExtension
static class
SeeOtherHost.SeeOtherHostVHostItemExtensionProvider
-
Nested classes/interfaces inherited from interface tigase.server.xmppclient.SeeOtherHostIfc
SeeOtherHostIfc.Phase
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<BareJID>
defaultHost
protected EventBus
eventBus
static java.lang.String
REDIRECTION_ENABLED
protected VHostManagerIfc
vHostManager
-
Fields inherited from interface tigase.server.xmppclient.SeeOtherHostIfc
CM_SEE_OTHER_HOST_ACTIVE, CM_SEE_OTHER_HOST_CLASS_PROP_DEF_VAL, CM_SEE_OTHER_HOST_CLASS_PROP_DEF_VAL_CLUSTER, CM_SEE_OTHER_HOST_CLASS_PROP_KEY, CM_SEE_OTHER_HOST_CLASS_PROPERTY, CM_SEE_OTHER_HOST_DEFAULT_HOST, CM_SEE_OTHER_HOST_DEFAULT_PORT
-
-
Constructor Summary
Constructors Constructor Description SeeOtherHost()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BareJID
findHostForJID(BareJID jid, BareJID host)
Finds an appropriate host for a given JIDvoid
initialize()
Method will be called, when bean will be created, configured and ready to use.boolean
isEnabled(VHostItem vHost, SeeOtherHostIfc.Phase ph)
Performs check whether redirect is enabled in the given phase by default see-other-host redirect is only active in stream:open phaseprotected boolean
isNodeShutdown(BareJID jid)
protected void
nodeShutdown(ShutdownEvent event)
void
setDefaultHost(java.util.List<BareJID> defaultHost)
void
setNodes(java.util.List<JID> nodes)
Sets list of available nodes in cluster environmentvoid
start()
void
stop()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface tigase.server.xmppclient.SeeOtherHostIfc
getStreamError, isRedirectionRequired
-
-
-
-
Field Detail
-
REDIRECTION_ENABLED
public static final java.lang.String REDIRECTION_ENABLED
- See Also:
- Constant Field Values
-
defaultHost
@ConfigField(desc="Default host to redirect to") protected java.util.List<BareJID> defaultHost
-
vHostManager
@Inject protected VHostManagerIfc vHostManager
-
-
Method Detail
-
findHostForJID
public BareJID findHostForJID(BareJID jid, BareJID host)
Description copied from interface:SeeOtherHostIfc
Finds an appropriate host for a given JID- Specified by:
findHostForJID
in interfaceSeeOtherHostIfc
- Parameters:
jid
- is a user JID extracted from the stream open attributeshost
- is "this" host to which the user is now connected and which calls the method- Returns:
- BareJID of possible host to which the user should connect or NULL
-
initialize
public void initialize()
Description copied from interface:Initializable
Method will be called, when bean will be created, configured and ready to use.- Specified by:
initialize
in interfaceInitializable
-
setDefaultHost
public void setDefaultHost(java.util.List<BareJID> defaultHost)
-
setNodes
public void setNodes(java.util.List<JID> nodes)
Description copied from interface:SeeOtherHostIfc
Sets list of available nodes in cluster environment- Specified by:
setNodes
in interfaceSeeOtherHostIfc
- Parameters:
nodes
- current list of nodes
-
isEnabled
public boolean isEnabled(VHostItem vHost, SeeOtherHostIfc.Phase ph)
Description copied from interface:SeeOtherHostIfc
Performs check whether redirect is enabled in the given phase by default see-other-host redirect is only active in stream:open phase- Specified by:
isEnabled
in interfaceSeeOtherHostIfc
- Parameters:
vHost
- vHost for which redirection should be performedph
- phase for which the check should be performed- Returns:
- boolean value indicating whether to perform or not redirect for the phase passed as argument
-
isNodeShutdown
protected boolean isNodeShutdown(BareJID jid)
-
nodeShutdown
@HandleEvent protected void nodeShutdown(ShutdownEvent event)
-
-