public interface ReceiverTaskIfc
StanzaReceiver
task which can receive XMPP packets
to do something with them. It may produce new XMPP packets in exchange
to send them back or to other users.
Created: Wed May 9 13:52:57 2007
Modifier and Type | Method and Description |
---|---|
void |
destroy(Queue<Packet> results)
destroy method is called when the task is being permanently
deleted. |
Map<String,PropertyItem> |
getDefaultParams()
getDefaultParams method return task instance default configuration
parameters. |
String |
getDescription()
getDescription method returns a description for task instance. |
String |
getHelp()
getHelp method returns task help information. |
ReceiverTaskIfc |
getInstance()
getInstance method returns new task instance of this type. |
JID |
getJID()
getJID method returns task instance
Jabber ID. |
Map<String,PropertyItem> |
getParams()
getParams method return task instance configuration parameters. |
Map<JID,RosterItem> |
getRoster()
getRoster returns roster that is a collection with
all users subscribed to this task. |
void |
getStatistics(StatisticsList list)
Method description
|
List<StatRecord> |
getStats()
getStats method retorns list of statistics records. |
String |
getType()
getType method returns the task type name. |
void |
init(Queue<Packet> results)
init method initializes task. |
boolean |
isAdmin(JID jid)
isAdmin method checks whether user given as parameter is one
of defined admins. |
void |
processPacket(Packet packet,
Queue<Packet> results)
processPacket method takes a packet addressed to this task
as a parameter and does something with the packet. |
void |
removeSubscribers(Queue<Packet> results,
JID... subscr)
Method description
|
void |
setJID(JID jid)
setJID method sets tasks Jabber ID, unique
ID which is used to identify the task. |
void |
setParams(Map<String,Object> params)
setParams method sets Map with configuration
parameters. |
void |
setRosterItemModerationAccepted(RosterItem ri,
boolean accepted)
Method description
|
void |
setStanzaReceiver(StanzaReceiverIfc srecv)
Method description
|
void destroy(Queue<Packet> results)
destroy
method is called when the task is being permanently
deleted. The method should take care of sending notification to all
subscribed users that the task is being deleted and should also clear
databases from all task data.results
- a Queue
value with all packets needed to send
upon task deletion.void init(Queue<Packet> results)
init
method initializes task. It allows also for a task to
send initial stanzas to user like available
presence or any other stanza which does make sense to
send at startup time.results
- a Queue<Packet>
is a collection of
result packets to send out.void processPacket(Packet packet, Queue<Packet> results)
processPacket
method takes a packet addressed to this task
as a parameter and does something with the packet. If as a result of
input packet processing it generates some other packets to send they
should be included in the results
queue.packet
- a Packet
input packet for processing.results
- a Queue<Packet>
is a collection of
result packets to send out.void removeSubscribers(Queue<Packet> results, JID... subscr)
results
- is a Queue<Packet>
subscr
- is a JID
Map<String,PropertyItem> getDefaultParams()
getDefaultParams
method return task instance default configuration
parameters. The map should contains all possible parameters accepted by
the task in setParams
method. Values may be empty but may
not be null
. All of parameters should be converted to
String
type to make it possible to display them in ad-hoc
command x-form. Parameters then should be converted back to whatever format
is needed when passed back in setParams
method.
For more detailed information about configuration parameters please refer
to setParams
method.Map
value with task instance configuration parameters.setParams(Map)
String getDescription()
getDescription
method returns a description for task instance.
Let's say the user want's to create new Interest group for
cyclists. This property allows to set some more detailed information about
the group like: This is group of ppl interested in mountain cycling
near Cambridge.
The description is set via properties using DESCRIPTION_PROP_KEY
.String
value of task instance description;String getHelp()
getHelp
method returns task help information. This
general information about tasks abilties so when the user selects
task for creation he might know what the task is about. This is more
like class description rather then instance description.String
value of task class help information.ReceiverTaskIfc getInstance()
getInstance
method returns new task instance of this type.
This is something like Class.newInstance()
but as this method
is called on the already created instance there is no danger of the number
of exceptions which could be normally thrown.ReceiverTaskIfc
new task instance of this type.JID getJID()
getJID
method returns task instance
Jabber ID. Refer to corresponding set
method for more details.String
value of task instance JID,setJID(tigase.xmpp.JID)
Map<String,PropertyItem> getParams()
getParams
method return task instance configuration parameters.
For more detailed information about configuration parameters please refer
to corresponding set
method.Map
value with task instance configuration parameters.setParams(Map)
Map<JID,RosterItem> getRoster()
getRoster
returns roster
that is a collection with
all users subscribed to this task.Map
value with all user subscribed to this task.void getStatistics(StatisticsList list)
list
- is a StatisticsList
List<StatRecord> getStats()
getStats
method retorns list of statistics records. Have a look
at StatRecord
description for more details.List
of statistics records.StatRecord
String getType()
getType
method returns the task type name. This
name is displayed on the list of all tasks available for creation.
This is not a nick name of created task this is something more like
"Drupal forums connector" or "Interest group".
Like a Java class name is unique in JVM the task name must be
also inique for StanzaReceiver.
Look at
task nick name for more details.String
value of the task name.boolean isAdmin(JID jid)
isAdmin
method checks whether user given as parameter is one
of defined admins. If user is the task owner it is also considered to be
task administrator.jid
- a String
value of user JID.boolean
value true if given user is either task admin
or task owner.void setJID(JID jid)
setJID
method sets tasks Jabber ID, unique
ID which is used to identify the task. Example of the resulting
Jabber ID for domain tigase.org
and
StanzaReceiver
component name srec
would be:
devs@srec.tigase.org
.
There can be many tasks of the same type (having the same
TaskType) but they have to have distinct JIDs.
Examples of possible JIDs names are: "admin-forum@srec.tigase.org",
"cycling-interest-group@srec.tigase.org".jid
- a String
value of the nick name.void setParams(Map<String,Object> params)
setParams
method sets Map
with configuration
parameters. Some parameters are predefined and common for most of task
types but some tasks may require/accept extra parameters to work properly.params
- a Map
value with configuration parameters.void setRosterItemModerationAccepted(RosterItem ri, boolean accepted)
ri
- is a RosterItem
accepted
- is a boolean
void setStanzaReceiver(StanzaReceiverIfc srecv)
srecv
- is a StanzaReceiverIfc
Copyright © 2018 "Tigase, Inc.". All rights reserved.