tigase.server.sreceiver
Class StanzaReceiver

java.lang.Object
  extended by tigase.server.AbstractMessageReceiver
      extended by tigase.server.sreceiver.StanzaReceiver
All Implemented Interfaces:
Configurable, XMPPService, MessageReceiver, ServerComponent, StatisticsContainer

public class StanzaReceiver
extends AbstractMessageReceiver
implements Configurable, XMPPService

This is a sibbling of StanzaSender class and offers just an opposite functionaity. It can receive XMPP packets to do something with them. And what to do it depends on the destination address. Destination address points to certain receiver task and this is up to task to decide what to do with the stanza. Task address is just a usuall Jabber ID: task-short-name@srec.tigase.org.

Like public chat rooms in MUC tasks can be preconfigured in the StanzaReceiver configuration or can be created on demand using ad-hoc commands and service-discovery. User can subscribe to some tasks and can add them to the roster just like a normal contacts. This allows to use the functionality from all existing clients without implementing any special protocols or extensions.

Possible tasks are:

Task creation parameters:

There can be also some per task specific settings...

Created: Wed May 9 08:27:22 2007

Version:
$Rev: 853 $
Author:
Artur Hefczyc

Field Summary
 
Fields inherited from class tigase.server.AbstractMessageReceiver
HOUR, MAX_QUEUE_SIZE_PROP_KEY, MAX_QUEUE_SIZE_PROP_VAL, maxQueueSize, MINUTE, SECOND
 
Fields inherited from interface tigase.conf.Configurable
ADMINS_PROP_KEY, BOSH_COMP_CLASS_NAME, C2S_COMP_CLASS_NAME, DEF_HOSTNAME_PROP_KEY, 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_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_COMP_CLASS_NAME, SM_COMP_CLASS_NAME, SRECV_COMP_CLASS_NAME, SSEND_COMP_CLASS_NAME, TRUSTED_PROP_KEY, 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
StanzaReceiver()
           
 
Method Summary
protected  boolean addOutPacket(Packet packet)
           
protected  void addTaskInstance(ReceiverTaskIfc task)
          Describe addTaskInstance method here.
protected  void addTaskInstance(java.lang.String task_type, java.lang.String task_name, java.util.Map<java.lang.String,java.lang.Object> task_params)
           
 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)
          Describe getDiscoInfo method here.
 java.util.List<tigase.xml.Element> getDiscoItems(java.lang.String node, java.lang.String jid)
           
protected  java.util.Map<java.lang.String,ReceiverTaskIfc> getTaskInstances()
           
protected  java.util.Map<java.lang.String,TaskType> getTaskTypes()
           
protected  boolean isAdmin(java.lang.String jid)
           
protected  boolean isAllowedCreate(java.lang.String jid, java.lang.String task_type)
           
 void processPacket(Packet packet)
          Describe processPacket method here.
 void processPacket(Packet packet, java.util.Queue<Packet> results)
          processPacket method is here to process packets addressed directly to the hostname, mainly commands, ad-hoc commands in particular.
protected  void removeTaskInstance(ReceiverTaskIfc task)
           
protected  void removeTaskSubscribers(ReceiverTaskIfc task, java.lang.String... subscr)
           
protected  void saveTaskToRepository(ReceiverTaskIfc task)
           
 void setProperties(java.util.Map<java.lang.String,java.lang.Object> props)
          Describe setProperties method here.
 
Methods inherited from class tigase.server.AbstractMessageReceiver
addOutPacketNB, addOutPackets, addPacket, addPackets, addRegexRouting, addRouting, clearRegexRoutings, clearRoutings, getDefHostName, getDefMaxQueueSize, getName, getRegexRoutings, getRoutings, getStatistics, isInRegexRoutings, isInRoutings, myDomain, release, removeRegexRouting, removeRouting, setMaxQueueSize, setName, setParent, 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
release, setName
 

Constructor Detail

StanzaReceiver

public StanzaReceiver()
Method Detail

isAllowedCreate

protected boolean isAllowedCreate(java.lang.String jid,
                                  java.lang.String task_type)

addTaskInstance

protected void addTaskInstance(java.lang.String task_type,
                               java.lang.String task_name,
                               java.util.Map<java.lang.String,java.lang.Object> task_params)

addTaskInstance

protected void addTaskInstance(ReceiverTaskIfc task)
Describe addTaskInstance method here.

Parameters:
task - a ReceiverTaskIfc value

removeTaskInstance

protected void removeTaskInstance(ReceiverTaskIfc task)

removeTaskSubscribers

protected void removeTaskSubscribers(ReceiverTaskIfc task,
                                     java.lang.String... subscr)

getTaskTypes

protected java.util.Map<java.lang.String,TaskType> getTaskTypes()

getTaskInstances

protected java.util.Map<java.lang.String,ReceiverTaskIfc> getTaskInstances()

saveTaskToRepository

protected void saveTaskToRepository(ReceiverTaskIfc task)
                             throws TigaseDBException
Throws:
TigaseDBException

setProperties

public void setProperties(java.util.Map<java.lang.String,java.lang.Object> props)
Describe setProperties method here.

Specified by:
setProperties in interface Configurable
Overrides:
setProperties in class AbstractMessageReceiver
Parameters:
props - a Map value

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

isAdmin

protected boolean isAdmin(java.lang.String jid)

processPacket

public void processPacket(Packet packet)
Describe processPacket method here.

Specified by:
processPacket in class AbstractMessageReceiver
Parameters:
packet - a Packet value

processPacket

public void processPacket(Packet packet,
                          java.util.Queue<Packet> results)
processPacket method is here to process packets addressed directly to the hostname, mainly commands, ad-hoc commands in particular.

Specified by:
processPacket in interface ServerComponent
Overrides:
processPacket in class AbstractMessageReceiver
Parameters:
packet - a Packet value is command for processing.

getDiscoInfo

public tigase.xml.Element getDiscoInfo(java.lang.String node,
                                       java.lang.String jid)
Describe getDiscoInfo method here.

Specified by:
getDiscoInfo in interface XMPPService
Parameters:
node - a String value
jid - a String value
Returns:
an Element value

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

getDiscoItems

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

addOutPacket

protected boolean addOutPacket(Packet packet)
Overrides:
addOutPacket in class AbstractMessageReceiver


Copyright © 2008 Tigase. All Rights Reserved.