src.modules
Class THSNewsModule

java.lang.Object
  extended bysrc.server.ModuleClass
      extended bysrc.modules.THSNewsModule
All Implemented Interfaces:
EventReceiver, Module

public class THSNewsModule
extends ModuleClass
implements EventReceiver

Module to fetch news from THS website. Last updated $Date: 2005/08/09 21:00:20 $ by $Author: andreas $ Changelog: $Log: THSNewsModule.html,v $ Revision 1.1.1.1 2005/08/09 21:00:20 andreas Initial entry Revision 1.4 2005/05/11 07:01:51 andreas The Module interface no longer extends the EventReceiver interface. All modules (or other classes) that wants events now have to implement the EventReceiver interface. Revision 1.3 2005/05/04 12:16:11 andreas Removed warnings. Revision 1.2 2005/05/04 11:23:16 linus Added easter egg module and updated modules to work with new modul structure. Revision 1.1 2005/05/02 15:34:21 linus Minor changes.

Version:
$Revision: 1.1.1.1 $ TODO
Author:
linus

Constructor Summary
THSNewsModule()
           
 
Method Summary
 boolean isValidCache(ModuleQuery query, long cacheAge)
           
 boolean isValidCache(ModuleQuery query, java.lang.String cachedUserId, long cacheAge)
          Checks if a cached result is valid or not based on how long ago the result was cached.
 Package processQuery(ModuleQuery query)
          Process a user sent query.
 void triggerEvent(java.lang.String eventId)
          Triggers an event with a specific id.
 void updateCalendar()
           
 
Methods inherited from class src.server.ModuleClass
getModuleMeta, processSettingRequest, processSettingRequest, setModuleMeta
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

THSNewsModule

public THSNewsModule()
Method Detail

isValidCache

public boolean isValidCache(ModuleQuery query,
                            long cacheAge)

processQuery

public Package processQuery(ModuleQuery query)
Description copied from interface: Module
Process a user sent query. This is very individual depending on the service provided by the module.

Specified by:
processQuery in interface Module
Parameters:
query - The user sent query.
Returns:
An ErrorPackage if an error occured while processing the query, an OutputPackage with the result otherwise.

triggerEvent

public void triggerEvent(java.lang.String eventId)
Description copied from interface: EventReceiver
Triggers an event with a specific id. An process can send out events to specified eventreceivers which can then act as they please. Normally this is used for time based reminders.

Specified by:
triggerEvent in interface EventReceiver
Parameters:
eventId - The event's id as defined when the event was registered.

updateCalendar

public void updateCalendar()

isValidCache

public boolean isValidCache(ModuleQuery query,
                            java.lang.String cachedUserId,
                            long cacheAge)
Description copied from interface: Module
Checks if a cached result is valid or not based on how long ago the result was cached. Some services might work fine with returning very old cached results, for instance the result of a map service wont change (often at least) and most cache ages would then be valid. Other things like news services on the other hand should not allow a long cache age.

Specified by:
isValidCache in interface Module
Parameters:
query - The user query that resulted in the cached result. The user's query parameters are identical to the cached query parameters.
cachedUserId - The userId of the query that is cached.
cacheAge - The number of seconds that has elapsed since the cached version was cached.
Returns:
True if the cache should be concidered to still be valid. False otherwise.