tigase.server.gateways
Interface GatewayListener

All Known Implementing Classes:
Gateway

public interface GatewayListener

Implementation of this class can listen for an XMPP packet received from somewhere. Created: Mon Nov 12 13:00:01 2007

Version:
$Rev: 899 $
Author:
Artur Hefczyc

Method Summary
 String decodeLegacyName(String jid)
          The decodeLegacyName method is used to do the opposite processing to the formatJID(...) method.
 String formatJID(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, Throwable exc)
          The gatewayException method should be called when the exception occurs in side the gateway connection library.
 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 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.
 

Method Detail

packetReceived

void packetReceived(Packet packet)
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.

Parameters:
packet - a Packet value with the data packet received from the external network.

logout

void logout(GatewayConnection gc)
The logout method is called when the connection to the external network has been terminated (closed).

Parameters:
gc - a GatewayConnection value of this object identifying the user connection to the external network.

loginCompleted

void loginCompleted(GatewayConnection gc)
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.

Parameters:
gc - a GatewayConnection value of this object identifying the user connection to the external network.

gatewayException

void gatewayException(GatewayConnection gc,
                      Throwable exc)
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.

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

void userRoster(GatewayConnection gc)
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.

Parameters:
gc - a GatewayConnection value of this object identifying the user connection to the external network.

updateStatus

void updateStatus(GatewayConnection gc,
                  RosterItem item)
The updateStatus method is called to update status of the single roster contact.

Parameters:
gc - a GatewayConnection value of this object identifying the user connection to the external network.
item - a RosterItem value of the roster contact.

formatJID

String formatJID(String legacyName)
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.

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

String decodeLegacyName(String jid)
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.

Parameters:
jid - a String value
Returns:
a String value


Copyright © 2001-2006 Tigase Developers Team. All rights Reserved.