|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GatewayListener
Implementation of this class can listen for an XMPP packet received from somewhere. Created: Mon Nov 12 13:00:01 2007
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 |
---|
void packetReceived(Packet packet)
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
.
packet
- a Packet
value with the data packet received
from the external network.void logout(GatewayConnection gc)
logout
method is called when the connection to the external
network has been terminated (closed).
gc
- a GatewayConnection
value of this
object
identifying the user connection to the external network.void loginCompleted(GatewayConnection gc)
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.
gc
- a GatewayConnection
value of this
object
identifying the user connection to the external network.void gatewayException(GatewayConnection gc, Throwable exc)
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.
gc
- a GatewayConnection
value of this
object
identifying the user connection to the external network.exc
- a Throwable
value of the exception thrown.void userRoster(GatewayConnection gc)
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.
gc
- a GatewayConnection
value of this
object
identifying the user connection to the external network.void updateStatus(GatewayConnection gc, RosterItem item)
updateStatus
method is called to update status of the single
roster contact.
gc
- a GatewayConnection
value of this
object
identifying the user connection to the external network.item
- a RosterItem
value of the roster contact.String formatJID(String legacyName)
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.
legacyName
- a String
value of the user ID in the external
network.
String
value of the transormed user ID to the Jabber's
form valid for this gateway deployment - including correct gateway domain name.String decodeLegacyName(String jid)
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.
jid
- a String
value
String
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |