tigase.server.sreceiver
Class ShortNewsPublisher

java.lang.Object
  extended by tigase.server.sreceiver.AbstractReceiverTask
      extended by tigase.server.sreceiver.RepoRosterTask
          extended by tigase.server.sreceiver.ShortNewsPublisher
All Implemented Interfaces:
ReceiverTaskIfc

public class ShortNewsPublisher
extends RepoRosterTask

This subscription tasks allows you to publish short news on your site. In fact this task behaves exactly as NewsDistributor tasks but it also writes all messages content to a table in database. Web application can then read content from this table and publish it on the Web site. Format of the table is as follows (schema definition in MySQL script):

 create table short_news (
   -- Automatic record ID
   snid            bigint unsigned NOT NULL auto_increment,
   -- Automaticly generated timestamp and automaticly updated on change
   publishing_time timestamp,
   -- Optional news type: 'shorts', 'minis', 'techs', 'funs'....
   news_type                            varchar(10),
   -- Author JID
   author          varchar(128) NOT NULL,
   -- Short subject - this is short news, right?
   subject         varchar(128) NOT NULL,
   -- Short news message - this is short news, right?
   body            varchar(1024) NOT NULL,
   primary key(snid),
   key publishing_date (publishing_date),
   key author (author)
 ) default character set utf8;
 
Created: Sat May 26 10:25:42 2007

Version:
$Rev: 1542 $
Author:
Artur Hefczyc

Field Summary
 
Fields inherited from class tigase.server.sreceiver.AbstractReceiverTask
local_domain
 
Constructor Summary
ShortNewsPublisher()
           
 
Method Summary
 void destroy(java.util.Queue<Packet> results)
          destroy method is called when the task is being permanently deleted.
 java.util.Map<java.lang.String,PropertyItem> getDefaultParams()
          getDefaultParams method return task instance default configuration parameters.
 java.lang.String getHelp()
          getHelp method returns task help information.
 java.lang.String getType()
          getType method returns the task type name.
protected  void processMessage(Packet packet, java.util.Queue<Packet> results)
           
 void setParams(java.util.Map<java.lang.String,java.lang.Object> map)
          Describe setParams method here.
 
Methods inherited from class tigase.server.sreceiver.RepoRosterTask
addToRoster, loadRoster, removeFromRoster, setRosterItemAdmin, setRosterItemModerationAccepted, setRosterItemOwner, setRosterItemSubscribed
 
Methods inherited from class tigase.server.sreceiver.AbstractReceiverTask
addNewSubscribers, addOutPacket, addToRoster, getDescription, getInstance, getJID, getParams, getRoster, getRosterItem, getStats, init, isAdmin, isAllowedToPost, isAllowedToSubscribe, processPacket, removeSubscribers, setJID, setRosterItemOnline, setStanzaReceiver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShortNewsPublisher

public ShortNewsPublisher()
Method Detail

getType

public java.lang.String getType()
Description copied from interface: ReceiverTaskIfc
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.

getHelp

public java.lang.String getHelp()
Description copied from interface: ReceiverTaskIfc
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.

setParams

public void setParams(java.util.Map<java.lang.String,java.lang.Object> map)
Description copied from class: AbstractReceiverTask
Describe setParams method here.

Specified by:
setParams in interface ReceiverTaskIfc
Overrides:
setParams in class RepoRosterTask
Parameters:
map - a Map value

destroy

public void destroy(java.util.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
Overrides:
destroy in class RepoRosterTask
Parameters:
results - a Queue value with all packets needed to send upon task deletion.

getDefaultParams

public java.util.Map<java.lang.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
Overrides:
getDefaultParams in class AbstractReceiverTask
Returns:
a Map value with task instance configuration parameters.
See Also:
ReceiverTaskIfc.setParams(Map)

processMessage

protected void processMessage(Packet packet,
                              java.util.Queue<Packet> results)
Overrides:
processMessage in class AbstractReceiverTask


Copyright © 2009 Tigase. All Rights Reserved.