tigase.server.xmppclient

## Class SeeOtherHost

- java.lang.Object
- - tigase.server.xmppclient.SeeOtherHost

- All Implemented Interfaces:
    SeeOtherHostIfc
  Direct Known Subclasses:
    SeeOtherHostHashed

      public class SeeOtherHost
      extends Object
      implements SeeOtherHostIfc

  Default and basic implementation of SeeOtherHost returning same host as the initial one
  Author:
    Wojtek

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface tigase.server.xmppclient.SeeOtherHostIfc

      `SeeOtherHostIfc.Phase`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected List<tigase.xmpp.BareJID>` | `defaultHost`

    - ### 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 and Description
    `SeeOtherHost()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `tigase.xmpp.BareJID` | `findHostForJID(tigase.xmpp.BareJID jid, tigase.xmpp.BareJID host)` Finds an appropriate host for a given JID
    `void` | `getDefaults(Map<String,Object> defs, Map<String,Object> params)`
    `tigase.xml.Element` | `getStreamError(String xmlns, tigase.xmpp.BareJID destination)` Returns Element object containing stream:error message
    `boolean` | `isEnabled(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 phase
    `void` | `setNodes(List<tigase.xmpp.BareJID> nodes)` Sets list of available nodes in cluster environment
    `void` | `setProperties(Map<String,Object> props)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### defaultHost

          protected List<tigase.xmpp.BareJID> defaultHost

  - ### Constructor Detail

    - #### SeeOtherHost

          public SeeOtherHost()

  - ### Method Detail

    - #### findHostForJID

          public tigase.xmpp.BareJID findHostForJID(tigase.xmpp.BareJID jid,
                                           tigase.xmpp.BareJID host)

      Description copied from interface: `SeeOtherHostIfc`
      Finds an appropriate host for a given JID
      Specified by:
        `findHostForJID` in interface `SeeOtherHostIfc`
      Parameters:
        `jid` - is a user JID extracted from the stream open attributes
        `host` - 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

    - #### getDefaults

          public void getDefaults(Map<String,Object> defs,
                         Map<String,Object> params)

      Specified by:
        `getDefaults` in interface `SeeOtherHostIfc`

    - #### setProperties

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

      Specified by:
        `setProperties` in interface `SeeOtherHostIfc`

    - #### setNodes

          public void setNodes(List<tigase.xmpp.BareJID> nodes)

      Description copied from interface: `SeeOtherHostIfc`
      Sets list of available nodes in cluster environment
      Specified by:
        `setNodes` in interface `SeeOtherHostIfc`
      Parameters:
        `nodes` - current list of nodes

    - #### getStreamError

          public tigase.xml.Element getStreamError(String xmlns,
                                          tigase.xmpp.BareJID destination)

      Description copied from interface: `SeeOtherHostIfc`
      Returns Element object containing stream:error message
      Specified by:
        `getStreamError` in interface `SeeOtherHostIfc`
      Parameters:
        `xmlns` - xml namespace of the element
        `destination` - BareJID address of the redirect destination
      Returns:
        element containing stream:error message

    - #### isEnabled

          public boolean isEnabled(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 interface `SeeOtherHostIfc`
      Parameters:
        `ph` - phase for which the check should be performed
      Returns:
        boolean value indicating whether to perform or not redirect for the phase passed as argument

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