tigase.server.gateways
Class Gateway

java.lang.Object
  extended by tigase.server.AbstractMessageReceiver
      extended by tigase.server.gateways.Gateway
All Implemented Interfaces:
Configurable, XMPPService, GatewayListener, MessageReceiver, ServerComponent, StatisticsContainer, VHostListener

public class Gateway
extends AbstractMessageReceiver
implements Configurable, XMPPService, GatewayListener

Describe class Gateway here. Created: Thu Nov 8 08:54:23 2007

Version:
$Rev: 1246 $
Author:
Artur Hefczyc

Field Summary
static java.lang.String GEN_GW_ADMINS
           
static java.lang.String GEN_GW_DB
           
static java.lang.String GEN_GW_DB_URI
           
static java.lang.String GW_CLASS_NAME_PROP_KEY
           
static java.lang.String GW_CLASS_NAME_PROP_VAL
           
static java.lang.String GW_DOMAIN_NAME_PROP_KEY
           
static java.lang.String GW_DOMAIN_NAME_PROP_VAL
           
static java.lang.String GW_MODERATED_PROP_KEY
           
static boolean GW_MODERATED_PROP_VAL
           
static java.lang.String GW_REPO_CLASS_PROP_KEY
           
static java.lang.String GW_REPO_URL_PROP_KEY
           
 
Fields inherited from class tigase.server.AbstractMessageReceiver
HOUR, MAX_QUEUE_SIZE_PROP_KEY, MAX_QUEUE_SIZE_PROP_VAL, maxQueueSize, MINUTE, SECOND, vHostManager
 
Fields inherited from interface tigase.conf.Configurable
ADMINS_PROP_KEY, BOSH_COMP_CLASS_NAME, C2S_CLUST_COMP_CLASS_NAME, C2S_COMP_CLASS_NAME, CL_COMP_CLASS_NAME, CLUSTER_CONECT, CLUSTER_CONTR_CLASS_NAME, CLUSTER_LISTEN, CLUSTER_MODE, CLUSTER_NODES, CLUSTER_NODES_PROP_KEY, COMPONENT_ID_PROP_KEY, DEF_BOSH_NAME, DEF_C2S_NAME, DEF_CL_COMP_NAME, DEF_CLUST_CONTR_NAME, DEF_EXT_COMP_NAME, DEF_HOSTNAME_PROP_KEY, DEF_S2S_NAME, DEF_SM_NAME, DEF_SRECV_NAME, DEF_SSEND_NAME, DEF_STATS_NAME, DEF_VHOST_MAN_NAME, DERBY_REPO_CLASS_PROP_VAL, DERBY_REPO_URL_PROP_VAL, DRUPAL_REPO_CLASS_PROP_VAL, DRUPAL_REPO_URL_PROP_VAL, EXT_COMP_CLASS_NAME, GEN_ADMINS, GEN_AUTH_DB, GEN_AUTH_DB_URI, GEN_COMP_CLASS, GEN_COMP_NAME, GEN_CONF, GEN_CONFIG, GEN_CONFIG_ALL, GEN_CONFIG_COMP, GEN_CONFIG_CS, GEN_CONFIG_DEF, GEN_CONFIG_SM, GEN_DEBUG, GEN_EXT_COMP, GEN_MAX_QUEUE_SIZE, GEN_SM_PLUGINS, GEN_SREC_ADMINS, GEN_SREC_DB, GEN_SREC_DB_URI, GEN_TEST, GEN_TRUSTED, GEN_USER_DB, GEN_USER_DB_URI, GEN_VIRT_HOSTS, HOSTNAMES_PROP_KEY, LIBRESOURCE_REPO_CLASS_PROP_VAL, LIBRESOURCE_REPO_URL_PROP_VAL, MYSQL_REPO_CLASS_PROP_VAL, MYSQL_REPO_URL_PROP_VAL, NULL_ROUTING, PGSQL_REPO_CLASS_PROP_VAL, PGSQL_REPO_URL_PROP_VAL, ROUTER_COMP_CLASS_NAME, S2S_CLUST_COMP_CLASS_NAME, S2S_COMP_CLASS_NAME, SM_CLUS_COMP_CLASS_NAME, SM_COMP_CLASS_NAME, SRECV_COMP_CLASS_NAME, SSEND_COMP_CLASS_NAME, STATS_CLASS_NAME, TIGASE_AUTH_REPO_CLASS_PROP_VAL, TIGASE_AUTH_REPO_URL_PROP_VAL, TIGASE_CUSTOM_AUTH_REPO_CLASS_PROP_VAL, TRUSTED_PROP_KEY, VHOST_MAN_CLASS_NAME, XML_REPO_CLASS_PROP_VAL, XML_REPO_URL_PROP_VAL
 
Fields inherited from interface tigase.disco.XMPPService
CMD_FEATURES, DEF_FEATURES, INFO_XMLNS, ITEMS_XMLNS
 
Constructor Summary
Gateway()
           
 
Method Summary
 java.lang.String decodeLegacyName(java.lang.String jid)
          The decodeLegacyName method is used to do the opposite processing to the formatJID(...) method.
 java.lang.String formatJID(java.lang.String legacyName)
          The formatJID method is used to transform the external network user ID to the Jabber ID for this gateway.
 void gatewayException(GatewayConnection gc, java.lang.Throwable exc)
          The gatewayException method should be called when the exception occurs in side the gateway connection library.
 java.util.Map<java.lang.String,java.lang.Object> getDefaults(java.util.Map<java.lang.String,java.lang.Object> params)
          Returns defualt configuration settings for this object.
 java.util.List<tigase.xml.Element> getDiscoFeatures()
          Returns features for top level disco info
 tigase.xml.Element getDiscoInfo(java.lang.String node, java.lang.String jid)
           
 java.util.List<tigase.xml.Element> getDiscoItems(java.lang.String node, java.lang.String jid)
           
 void loginCompleted(GatewayConnection gc)
          The loginCompleted method is called when the login to the external network has been completed.
 void logout(GatewayConnection gc)
          The logout method is called when the connection to the external network has been terminated (closed).
 void packetReceived(Packet packet)
          The packetReceived method is called when data packet has been received from the external network.
 void processPacket(Packet packet)
           
 void setProperties(java.util.Map<java.lang.String,java.lang.Object> props)
          Sets all configuration properties for object.
 void updateStatus(GatewayConnection gc, RosterItem item)
          The updateStatus method is called to update status of the single roster contact.
 void userRoster(GatewayConnection gc)
          The userRoster method should be called whenever the user roster in the external network has changed.
 
Methods inherited from class tigase.server.AbstractMessageReceiver
addOutPacket, addOutPacketNB, addOutPackets, addPacket, addPacketNB, addPackets, addRegexRouting, clearRegexRoutings, everyMinute, everySecond, getComponentId, getDefHostName, getMaxQueueSize, getName, getRegexRoutings, getStatistics, handlesLocalDomains, handlesNameSubdomains, handlesNonLocalDomains, initializationCompleted, isInRegexRoutings, isLocalDomain, isLocalDomainOrComponent, processPacket, release, removeRegexRouting, setMaxQueueSize, setName, setParent, setVHostManager, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface tigase.conf.Configurable
getName
 
Methods inherited from interface tigase.server.ServerComponent
getComponentId, initializationCompleted, processPacket, release, setName
 

Field Detail

GEN_GW_DB

public static final java.lang.String GEN_GW_DB
See Also:
Constant Field Values

GEN_GW_DB_URI

public static final java.lang.String GEN_GW_DB_URI
See Also:
Constant Field Values

GEN_GW_ADMINS

public static final java.lang.String GEN_GW_ADMINS
See Also:
Constant Field Values

GW_REPO_CLASS_PROP_KEY

public static final java.lang.String GW_REPO_CLASS_PROP_KEY
See Also:
Constant Field Values

GW_REPO_URL_PROP_KEY

public static final java.lang.String GW_REPO_URL_PROP_KEY
See Also:
Constant Field Values

GW_CLASS_NAME_PROP_KEY

public static final java.lang.String GW_CLASS_NAME_PROP_KEY
See Also:
Constant Field Values

GW_CLASS_NAME_PROP_VAL

public static final java.lang.String GW_CLASS_NAME_PROP_VAL
See Also:
Constant Field Values

GW_DOMAIN_NAME_PROP_KEY

public static final java.lang.String GW_DOMAIN_NAME_PROP_KEY
See Also:
Constant Field Values

GW_DOMAIN_NAME_PROP_VAL

public static final java.lang.String GW_DOMAIN_NAME_PROP_VAL
See Also:
Constant Field Values

GW_MODERATED_PROP_KEY

public static final java.lang.String GW_MODERATED_PROP_KEY
See Also:
Constant Field Values

GW_MODERATED_PROP_VAL

public static final boolean GW_MODERATED_PROP_VAL
See Also:
Constant Field Values
Constructor Detail

Gateway

public Gateway()
Method Detail

setProperties

public void setProperties(java.util.Map<java.lang.String,java.lang.Object> props)
Description copied from class: AbstractMessageReceiver
Sets all configuration properties for object.

Specified by:
setProperties in interface Configurable
Overrides:
setProperties in class AbstractMessageReceiver

getDefaults

public java.util.Map<java.lang.String,java.lang.Object> getDefaults(java.util.Map<java.lang.String,java.lang.Object> params)
Description copied from class: AbstractMessageReceiver
Returns defualt configuration settings for this object.

Specified by:
getDefaults in interface Configurable
Overrides:
getDefaults in class AbstractMessageReceiver

formatJID

public java.lang.String formatJID(java.lang.String legacyName)
Description copied from interface: GatewayListener
The formatJID method is used to transform the external network user ID to the Jabber ID for this gateway. Normally the method calls: XMLUtils.escape(legacyName.replace("@", "%") + "@" + myDomain()) but this maybe changed in the future therefore it is recomended to use this method instead of internal implementation.

Specified by:
formatJID in interface GatewayListener
Parameters:
legacyName - a String value of the user ID in the external network.
Returns:
a String value of the transormed user ID to the Jabber's form valid for this gateway deployment - including correct gateway domain name.

decodeLegacyName

public java.lang.String decodeLegacyName(java.lang.String jid)
Description copied from interface: GatewayListener
The decodeLegacyName method is used to do the opposite processing to the formatJID(...) method. It extracts user ID used in the external network from the Jabber's ID used in this Gateway deployment. Normally it calls the following method: XMLUtils.unescape(jid).split("@")[0].replace("%", "@") but this can be changed in the future, therefore using this method is recommended over own implementations.

Specified by:
decodeLegacyName in interface GatewayListener
Parameters:
jid - a String value
Returns:
a String value

processPacket

public void processPacket(Packet packet)
Specified by:
processPacket in class AbstractMessageReceiver

getDiscoFeatures

public java.util.List<tigase.xml.Element> getDiscoFeatures()
Description copied from interface: XMPPService
Returns features for top level disco info

Specified by:
getDiscoFeatures in interface XMPPService
Returns:

getDiscoItems

public java.util.List<tigase.xml.Element> getDiscoItems(java.lang.String node,
                                                        java.lang.String jid)
Specified by:
getDiscoItems in interface XMPPService

getDiscoInfo

public tigase.xml.Element getDiscoInfo(java.lang.String node,
                                       java.lang.String jid)
Specified by:
getDiscoInfo in interface XMPPService

packetReceived

public void packetReceived(Packet packet)
Description copied from interface: GatewayListener
The packetReceived method is called when data packet has been received from the external network. The data received from the external must be translated to one of packets known in the XMPP network: message or presence or iq.

Specified by:
packetReceived in interface GatewayListener
Parameters:
packet - a Packet value with the data packet received from the external network.

logout

public void logout(GatewayConnection gc)
Description copied from interface: GatewayListener
The logout method is called when the connection to the external network has been terminated (closed).

Specified by:
logout in interface GatewayListener
Parameters:
gc - a GatewayConnection value of this object identifying the user connection to the external network.

loginCompleted

public void loginCompleted(GatewayConnection gc)
Description copied from interface: GatewayListener
The loginCompleted method is called when the login to the external network has been completed. Normally when login() method is called the whole process make take some time (establishing network connectio, authenticating and so on...). Therefore it is recommended that the login() method returns immediately and the process is run in background (in threads pooling). Therefore on the successful loging completion this method must be called.

Specified by:
loginCompleted in interface GatewayListener
Parameters:
gc - a GatewayConnection value of this object identifying the user connection to the external network.

gatewayException

public void gatewayException(GatewayConnection gc,
                             java.lang.Throwable exc)
Description copied from interface: GatewayListener
The gatewayException method should be called when the exception occurs in side the gateway connection library. Normally the exception is recorded in the log file and no more actions are performed. If the exception is severe and irrecoverable then the GatewayConnection should call logout(...) method.

Specified by:
gatewayException in interface GatewayListener
Parameters:
gc - a GatewayConnection value of this object identifying the user connection to the external network.
exc - a Throwable value of the exception thrown.

userRoster

public void userRoster(GatewayConnection gc)
Description copied from interface: GatewayListener
The userRoster method should be called whenever the user roster in the external network has changed. After (inside) this call GatewayConnection.getRoster() method is called to retrieve user roster from the gateway connection.

Specified by:
userRoster in interface GatewayListener
Parameters:
gc - a GatewayConnection value of this object identifying the user connection to the external network.

updateStatus

public void updateStatus(GatewayConnection gc,
                         RosterItem item)
Description copied from interface: GatewayListener
The updateStatus method is called to update status of the single roster contact.

Specified by:
updateStatus in interface GatewayListener
Parameters:
gc - a GatewayConnection value of this object identifying the user connection to the external network.
item - a RosterItem value of the roster contact.


Copyright © 2008 Tigase. All Rights Reserved.