This is list of interfaces to look at when you work on a new component:

  1. tigase.server.ServerComponent - This is the very basic interface for component. All components must implement it.
  2. tigase.server.MessageReceiver - This interface extends ServerComponent and is required to implement by components which want to receive data packets like session manager and c2s connection manager.
  3. tigase.conf.Configurable - Implementing this interface is required to make it configurable. For each object of this type, configuration is pushed to it at any time at runtime. This is necessary to make it possible to change configuration at runtime. Be careful to implement this properly as it can cause issues for modules that cannot be configured.
  4. tigase.disco.XMPPService - Objects using this interface can respond to "ServiceDiscovery" requests.
  5. tigase.stats.StatisticsContainer - Objects using this interface can return runtime statistics. Any object can collect job statistics and implementing this interface guarantees that statistics will be presented in consisted way to user who wants to see them.

Instead of implementing above interfaces directly, it is recommended 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:

  • tigase.server.AbstractMessageReceiver - Implements 4 basic interfaces:

    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)
  • tigase.server.ConnectionManager - This is an extension of 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 the abstract void processPacket(Packet packet); method is called and second, from network connection and then the abstract Queue processSocketData(XMPPIOService serv); method is called.