tigase.server.sreceiver

## Class AbstractReceiverTask

- java.lang.Object
- - tigase.server.sreceiver.AbstractReceiverTask

- All Implemented Interfaces:
    ReceiverTaskIfc
  Direct Known Subclasses:
    RepoRosterTask, TesterTask

      public abstract class AbstractReceiverTask
      extends Object
      implements ReceiverTaskIfc

  Describe class AbstractReceiverTask here. Created: Fri May 11 08:34:04 2007
  Version:
    $Rev$
  Author:
    Artur Hefczyc

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractReceiverTask()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addNewSubscribers(Queue<Packet> results, JID... new_subscr)` Describe `addNewSubscribers` method here.
    `protected boolean` | `addOutPacket(Packet packet)` Method description
    `RosterItem` | `addToRoster(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.
    `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.
    `RosterItem` | `getRosterItem(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(JID jid)` `isAdmin` method checks whether user given as parameter is one of defined admins.
    `boolean` | `isAllowedToPost(JID buddy)` Method description
    `boolean` | `isAllowedToSubscribe(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(JID jid)` Method description
    `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> 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

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface tigase.server.sreceiver.ReceiverTaskIfc

      `getHelp, getType`

- - ### Constructor Detail

    - #### AbstractReceiverTask

          public AbstractReceiverTask()

  - ### Method Detail

    - #### addNewSubscribers

          public void addNewSubscribers(Queue<Packet> results,
                                        JID... new_subscr)

      Describe `addNewSubscribers` method here.
      Parameters:
        `results` -
        `new_subscr` - a `String[]` value

    - #### addToRoster

          public void addToRoster(RosterItem ri)

      Method description
      Parameters:
        `ri` -

    - #### addToRoster

          public RosterItem addToRoster(JID jid)

      Method description
      Parameters:
        `jid` -

    - #### destroy

          public void destroy(Queue<Packet> results)

      Description copied from interface: `ReceiverTaskIfc`
      `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.
      Specified by:
        `destroy` in interface `ReceiverTaskIfc`
      Parameters:
        `results` - a `Queue` value with all packets needed to send upon task deletion.

    - #### getDefaultParams

          public Map<String,PropertyItem> getDefaultParams()

      Description copied from interface: `ReceiverTaskIfc`
      `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.
      Specified by:
        `getDefaultParams` in interface `ReceiverTaskIfc`
      Returns:
        a `Map` value with task instance configuration parameters.
      See Also:
        `ReceiverTaskIfc.setParams(Map)`

    - #### getDescription

          public String getDescription()

      Description copied from interface: `ReceiverTaskIfc`
      `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`.
      Specified by:
        `getDescription` in interface `ReceiverTaskIfc`
      Returns:
        a `String` value of task instance description;

    - #### getInstance

          public ReceiverTaskIfc getInstance()

      Description copied from interface: `ReceiverTaskIfc`
      `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.
      Specified by:
        `getInstance` in interface `ReceiverTaskIfc`
      Returns:
        a `ReceiverTaskIfc` new task instance of this type.

    - #### getJID

          public JID getJID()

      Description copied from interface: `ReceiverTaskIfc`
      `getJID` method returns task instance Jabber ID. Refer to corresponding `set` method for more details.
      Specified by:
        `getJID` in interface `ReceiverTaskIfc`
      Returns:
        a `String` value of task instance JID,
      See Also:
        `ReceiverTaskIfc.setJID(tigase.xmpp.JID)`

    - #### getParams

          public Map<String,PropertyItem> getParams()

      Description copied from interface: `ReceiverTaskIfc`
      `getParams` method return task instance configuration parameters. For more detailed information about configuration parameters please refer to corresponding `set` method.
      Specified by:
        `getParams` in interface `ReceiverTaskIfc`
      Returns:
        a `Map` value with task instance configuration parameters.
      See Also:
        `ReceiverTaskIfc.setParams(Map)`

    - #### getRoster

          public Map<JID,RosterItem> getRoster()

      Description copied from interface: `ReceiverTaskIfc`
      `getRoster` returns `roster` that is a collection with all users subscribed to this task.
      Specified by:
        `getRoster` in interface `ReceiverTaskIfc`
      Returns:
        a `Map` value with all user subscribed to this task.

    - #### getRosterItem

          public RosterItem getRosterItem(JID jid)

      Method description
      Parameters:
        `jid` -

    - #### getStatistics

          public void getStatistics(StatisticsList list)

      Description copied from interface: `ReceiverTaskIfc`
      Method description
      Specified by:
        `getStatistics` in interface `ReceiverTaskIfc`
      Parameters:
        `list` - is a `StatisticsList`

    - #### getStats

          public List<StatRecord> getStats()

      Description copied from interface: `ReceiverTaskIfc`
      `getStats` method retorns list of statistics records. Have a look at `StatRecord` description for more details.
      Specified by:
        `getStats` in interface `ReceiverTaskIfc`
      Returns:
        a `List` of statistics records.
      See Also:
        `StatRecord`

    - #### init

          public void init(Queue<Packet> results)

      Description copied from interface: `ReceiverTaskIfc`
      `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.
      Specified by:
        `init` in interface `ReceiverTaskIfc`
      Parameters:
        `results` - a `Queue<Packet>` is a collection of result packets to send out.

    - #### isAdmin

          public boolean isAdmin(JID jid)

      Description copied from interface: `ReceiverTaskIfc`
      `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.
      Specified by:
        `isAdmin` in interface `ReceiverTaskIfc`
      Parameters:
        `jid` - a `String` value of user JID.
      Returns:
        a `boolean` value true if given user is either task admin or task owner.

    - #### isAllowedToPost

          public boolean isAllowedToPost(JID buddy)

      Method description
      Parameters:
        `buddy` -

    - #### isAllowedToSubscribe

          public boolean isAllowedToSubscribe(JID buddy)

      Method description
      Parameters:
        `buddy` -

    - #### processPacket

          public void processPacket(Packet packet,
                                    Queue<Packet> results)

      Description copied from interface: `ReceiverTaskIfc`
      `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.
      Specified by:
        `processPacket` in interface `ReceiverTaskIfc`
      Parameters:
        `packet` - a `Packet` input packet for processing.
        `results` - a `Queue<Packet>` is a collection of result packets to send out.

    - #### removeFromRoster

          public RosterItem removeFromRoster(JID jid)

      Method description
      Parameters:
        `jid` -

    - #### removeSubscribers

          public void removeSubscribers(Queue<Packet> results,
                                        JID... subscr)

      Description copied from interface: `ReceiverTaskIfc`
      Method description
      Specified by:
        `removeSubscribers` in interface `ReceiverTaskIfc`
      Parameters:
        `results` - is a `Queue<Packet>`
        `subscr` - is a `JID`

    - #### setJID

          public void setJID(JID jid)

      Description copied from interface: `ReceiverTaskIfc`
      `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".
      Specified by:
        `setJID` in interface `ReceiverTaskIfc`
      Parameters:
        `jid` - a `String` value of the nick name.

    - #### setParams

          public void setParams(Map<String,Object> map)

      Description copied from interface: `ReceiverTaskIfc`
      `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.
      Specified by:
        `setParams` in interface `ReceiverTaskIfc`
      Parameters:
        `map` - a `Map` value with configuration parameters.

    - #### setRosterItemAdmin

          public void setRosterItemAdmin(RosterItem ri,
                                         boolean admin)

      Method description
      Parameters:
        `ri` -
        `admin` -

    - #### setRosterItemModerationAccepted

          public void setRosterItemModerationAccepted(RosterItem ri,
                                                      boolean accepted)

      Description copied from interface: `ReceiverTaskIfc`
      Method description
      Specified by:
        `setRosterItemModerationAccepted` in interface `ReceiverTaskIfc`
      Parameters:
        `ri` - is a `RosterItem`
        `accepted` - is a `boolean`

    - #### setRosterItemOnline

          public void setRosterItemOnline(RosterItem ri,
                                          boolean online)

      Method description
      Parameters:
        `ri` -
        `online` -

    - #### setRosterItemOwner

          public void setRosterItemOwner(RosterItem ri,
                                         boolean owner)

      Method description
      Parameters:
        `ri` -
        `owner` -

    - #### setRosterItemSubscribed

          public void setRosterItemSubscribed(RosterItem ri,
                                              boolean subscribed)

      Method description
      Parameters:
        `ri` -
        `subscribed` -

    - #### setStanzaReceiver

          public void setStanzaReceiver(StanzaReceiverIfc srecv)

      Description copied from interface: `ReceiverTaskIfc`
      Method description
      Specified by:
        `setStanzaReceiver` in interface `ReceiverTaskIfc`
      Parameters:
        `srecv` - is a `StanzaReceiverIfc`

    - #### addOutPacket

          protected boolean addOutPacket(Packet packet)

      Method description
      Parameters:
        `packet` -

    - #### processMessage

          protected void processMessage(Packet packet,
                                        Queue<Packet> results)

      Method description
      Parameters:
        `packet` -
        `results` -

Copyright © 2018 "Tigase, Inc.". All rights reserved.