public abstract class AbstractReceiverTask extends Object implements ReceiverTaskIfc
| Constructor and Description |
|---|
AbstractReceiverTask() |
| Modifier and Type | Method and Description |
|---|---|
void |
addNewSubscribers(Queue<Packet> results,
tigase.xmpp.JID... new_subscr)
Describe
addNewSubscribers method here. |
protected boolean |
addOutPacket(Packet packet)
Method description
|
RosterItem |
addToRoster(tigase.xmpp.JID jid)
Method description
|
void |
addToRoster(RosterItem ri)
Method 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. |
ReceiverTaskIfc |
getInstance()
getInstance method returns new task instance of this type. |
tigase.xmpp.JID |
getJID()
getJID method returns task instance
Jabber ID. |
Map<String,PropertyItem> |
getParams()
getParams method return task instance configuration parameters. |
Map<tigase.xmpp.JID,RosterItem> |
getRoster()
getRoster returns roster that is a collection with
all users subscribed to this task. |
RosterItem |
getRosterItem(tigase.xmpp.JID jid)
Method description
|
void |
getStatistics(StatisticsList list)
Method description
|
List<StatRecord> |
getStats()
getStats method retorns list of statistics records. |
void |
init(Queue<Packet> results)
init method initializes task. |
boolean |
isAdmin(tigase.xmpp.JID jid)
isAdmin method checks whether user given as parameter is one
of defined admins. |
boolean |
isAllowedToPost(tigase.xmpp.JID buddy)
Method description
|
boolean |
isAllowedToSubscribe(tigase.xmpp.JID buddy)
Method description
|
protected void |
processMessage(Packet packet,
Queue<Packet> results)
Method description
|
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. |
RosterItem |
removeFromRoster(tigase.xmpp.JID jid)
Method description
|
void |
removeSubscribers(Queue<Packet> results,
tigase.xmpp.JID... subscr)
Method description
|
void |
setJID(tigase.xmpp.JID jid)
setJID method sets tasks Jabber ID, unique
ID which is used to identify the task. |
void |
setParams(Map<String,Object> map)
setParams method sets Map with configuration
parameters. |
void |
setRosterItemAdmin(RosterItem ri,
boolean admin)
Method description
|
void |
setRosterItemModerationAccepted(RosterItem ri,
boolean accepted)
Method description
|
void |
setRosterItemOnline(RosterItem ri,
boolean online)
Method description
|
void |
setRosterItemOwner(RosterItem ri,
boolean owner)
Method description
|
void |
setRosterItemSubscribed(RosterItem ri,
boolean subscribed)
Method description
|
void |
setStanzaReceiver(StanzaReceiverIfc srecv)
Method description
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHelp, getTypepublic void addNewSubscribers(Queue<Packet> results, tigase.xmpp.JID... new_subscr)
addNewSubscribers method here.results - new_subscr - a String[] valuepublic void addToRoster(RosterItem ri)
ri - public RosterItem addToRoster(tigase.xmpp.JID jid)
jid - public void destroy(Queue<Packet> results)
ReceiverTaskIfcdestroy 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.destroy in interface ReceiverTaskIfcresults - a Queue value with all packets needed to send
upon task deletion.public Map<String,PropertyItem> getDefaultParams()
ReceiverTaskIfcgetDefaultParams 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.getDefaultParams in interface ReceiverTaskIfcMap value with task instance configuration parameters.ReceiverTaskIfc.setParams(Map)public String getDescription()
ReceiverTaskIfcgetDescription 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.getDescription in interface ReceiverTaskIfcString value of task instance description;public ReceiverTaskIfc getInstance()
ReceiverTaskIfcgetInstance 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.getInstance in interface ReceiverTaskIfcReceiverTaskIfc new task instance of this type.public tigase.xmpp.JID getJID()
ReceiverTaskIfcgetJID method returns task instance
Jabber ID. Refer to corresponding set
method for more details.getJID in interface ReceiverTaskIfcString value of task instance JID,ReceiverTaskIfc.setJID(tigase.xmpp.JID)public Map<String,PropertyItem> getParams()
ReceiverTaskIfcgetParams method return task instance configuration parameters.
For more detailed information about configuration parameters please refer
to corresponding set method.getParams in interface ReceiverTaskIfcMap value with task instance configuration parameters.ReceiverTaskIfc.setParams(Map)public Map<tigase.xmpp.JID,RosterItem> getRoster()
ReceiverTaskIfcgetRoster returns roster that is a collection with
all users subscribed to this task.getRoster in interface ReceiverTaskIfcMap value with all user subscribed to this task.public RosterItem getRosterItem(tigase.xmpp.JID jid)
jid - public void getStatistics(StatisticsList list)
ReceiverTaskIfcgetStatistics in interface ReceiverTaskIfclist - is a StatisticsListpublic List<StatRecord> getStats()
ReceiverTaskIfcgetStats method retorns list of statistics records. Have a look
at StatRecord description for more details.getStats in interface ReceiverTaskIfcList of statistics records.StatRecordpublic void init(Queue<Packet> results)
ReceiverTaskIfcinit 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.init in interface ReceiverTaskIfcresults - a Queue<Packet> is a collection of
result packets to send out.public boolean isAdmin(tigase.xmpp.JID jid)
ReceiverTaskIfcisAdmin 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.isAdmin in interface ReceiverTaskIfcjid - a String value of user JID.boolean value true if given user is either task admin
or task owner.public boolean isAllowedToPost(tigase.xmpp.JID buddy)
buddy - public boolean isAllowedToSubscribe(tigase.xmpp.JID buddy)
buddy - public void processPacket(Packet packet, Queue<Packet> results)
ReceiverTaskIfcprocessPacket 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.processPacket in interface ReceiverTaskIfcpacket - a Packet input packet for processing.results - a Queue<Packet> is a collection of
result packets to send out.public RosterItem removeFromRoster(tigase.xmpp.JID jid)
jid - public void removeSubscribers(Queue<Packet> results, tigase.xmpp.JID... subscr)
ReceiverTaskIfcremoveSubscribers in interface ReceiverTaskIfcresults - is a Queue<Packet>subscr - is a JIDpublic void setJID(tigase.xmpp.JID jid)
ReceiverTaskIfcsetJID 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".setJID in interface ReceiverTaskIfcjid - a String value of the nick name.public void setParams(Map<String,Object> map)
ReceiverTaskIfcsetParams 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.setParams in interface ReceiverTaskIfcmap - a Map value with configuration parameters.public void setRosterItemAdmin(RosterItem ri, boolean admin)
ri - admin - public void setRosterItemModerationAccepted(RosterItem ri, boolean accepted)
ReceiverTaskIfcsetRosterItemModerationAccepted in interface ReceiverTaskIfcri - is a RosterItemaccepted - is a booleanpublic void setRosterItemOnline(RosterItem ri, boolean online)
ri - online - public void setRosterItemOwner(RosterItem ri, boolean owner)
ri - owner - public void setRosterItemSubscribed(RosterItem ri, boolean subscribed)
ri - subscribed - public void setStanzaReceiver(StanzaReceiverIfc srecv)
ReceiverTaskIfcsetStanzaReceiver in interface ReceiverTaskIfcsrecv - is a StanzaReceiverIfcprotected boolean addOutPacket(Packet packet)
packet - Copyright © 2015 "Tigase, Inc.". All rights reserved.