Table of Contents
To make it easier to get into the code below are defined basic terms in the Tigase server world and there is a brief explanation how the server is designed and implemented. This document also points you to basic interfaces and implementations which can be used as example code reference.
Logically all server code can be divided into 3 kinds of modules: components, plug-ins and connectors.
There is an API defined for each kind of above modules and all you have to do is enable the implementation of that specific interface. Then the module can be loaded to the server based on it’s configuration settings. There is also abstract classes available, implementing these interfaces to make development easier.
Here is a brief list of all interfaces to look at and for more details you have to refer to the guide for specific kind of module.
This is list of interfaces to look at when you work on a new component:
ServerComponent
and is required to implement by components which want to receive data packets like session manager and c2s connection manager.Instead of implementing above interfaces directly I would recommend to extend one of existing abstract classes which take care of the most of "dirty and boring" stuff. Here is a list the most useful abstract classes:
ServerComponent
, MessageReceiver
, Configurable
and StatisticsContainer
. AbstractMessageReceiver also manages internal data queues using it’s own threads which prevents dead-locks from resource starvation. It offers even-driven data processing which means whenever packet arrives the abstract void processPacket(Packet packet);
method is called to process it. You have to implement this abstract method in your component, if your component wants to send a packet (in response to data it received for example).
boolean addOutPacket(Packet packet)
AbstractMessageReceiver
abstract class. As the name says this class takes care of all network connection management stuff. If your component needs to send and receive data directly from the network (like c2s connection, s2s connection or external component) you should use this implementation as a basic class. It takes care of all things related to networking, I/O, reconnecting, listening on socket, connecting and so on. If you extend this class you have to expect data coming from to sources: from the MessageRouter
and this is when theabstract void processPacket(Packet packet);
method is called and from network connection and then the
abstract Queue processSocketData(XMPPIOService serv);
method is called.
All Tigase plugins currently implemented are located in package: tigase.xmpp.impl. You can use this code as a sample code base. There are 3 types of plug-ins and they are defined in interfaces located in tigase.xmpp
package: