tigase.server.sreceiver

## Interface ReceiverTaskIfc

- All Known Implementing Classes:
    AbstractReceiverTask, NewsDistributor, PubSubTestsTask, RepoRosterTask, ShortNewsPublisher, SystemMonitorTask, TesterTask

      public interface ReceiverTaskIfc

  This is `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

  Version:
    $Rev$
  Author:
    Artur Hefczyc

- - ### Method Summary

    Methods
    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.
    `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.
    `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(tigase.xmpp.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, 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> params)` `setParams` method sets `Map` with configuration parameters.
    `void` | `setRosterItemModerationAccepted(RosterItem ri, boolean accepted)` Method description
    `void` | `setStanzaReceiver(StanzaReceiverIfc srecv)` Method description

- - ### Method Detail

    - #### destroy

          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.
      Parameters:
        `results` - a `Queue` value with all packets needed to send upon task deletion.

    - #### init

          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.
      Parameters:
        `results` - a `Queue` is a collection of result packets to send out.

    - #### processPacket

          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.
      Parameters:
        `packet` - a `Packet` input packet for processing.
        `results` - a `Queue` is a collection of result packets to send out.

    - #### removeSubscribers

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

      Method description
      Parameters:
        `results` - is a `Queue`
        `subscr` - is a `JID`

    - #### getDefaultParams

          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.
      Returns:
        a `Map` value with task instance configuration parameters.
      See Also:
        `setParams(Map)`

    - #### getDescription

          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`.
      Returns:
        a `String` value of task instance description;

    - #### getHelp

          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.
      Returns:
        a `String` value of task class help information.

    - #### getInstance

          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.
      Returns:
        a `ReceiverTaskIfc` new task instance of this type.

    - #### getJID

          tigase.xmpp.JID getJID()

      `getJID` method returns task instance Jabber ID. Refer to corresponding `set` method for more details.
      Returns:
        a `String` value of task instance JID,
      See Also:
        `setJID(tigase.xmpp.JID)`

    - #### getParams

          Map<String,PropertyItem> getParams()

      `getParams` method return task instance configuration parameters. For more detailed information about configuration parameters please refer to corresponding `set` method.
      Returns:
        a `Map` value with task instance configuration parameters.
      See Also:
        `setParams(Map)`

    - #### getRoster

          Map<tigase.xmpp.JID,RosterItem> getRoster()

      `getRoster` returns `roster` that is a collection with all users subscribed to this task.
      Returns:
        a `Map` value with all user subscribed to this task.

    - #### getStatistics

          void getStatistics(StatisticsList list)

      Method description
      Parameters:
        `list` - is a `StatisticsList`

    - #### getStats

          List<StatRecord> getStats()

      `getStats` method retorns list of statistics records. Have a look at `StatRecord` description for more details.
      Returns:
        a `List` of statistics records.
      See Also:
        `StatRecord`

    - #### getType

          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.
      Returns:
        a `String` value of the task name.

    - #### isAdmin

          boolean isAdmin(tigase.xmpp.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.
      Parameters:
        `jid` - a `String` value of user JID.
      Returns:
        a `boolean` value true if given user is either task admin or task owner.

    - #### setJID

          void setJID(tigase.xmpp.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".
      Parameters:
        `jid` - a `String` value of the nick name.

    - #### setParams

          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.
      Parameters:
        `params` - a `Map` value with configuration parameters.

    - #### setRosterItemModerationAccepted

          void setRosterItemModerationAccepted(RosterItem ri,
                                             boolean accepted)

      Method description
      Parameters:
        `ri` - is a `RosterItem`
        `accepted` - is a `boolean`

    - #### setStanzaReceiver

          void setStanzaReceiver(StanzaReceiverIfc srecv)

      Method description
      Parameters:
        `srecv` - is a `StanzaReceiverIfc`

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