org.ceryle.wiki.plugin.mostpopular
Class MostPopularListener

java.lang.Object
  extended by org.ceryle.wiki.plugin.mostpopular.MostPopularListener
All Implemented Interfaces:
WikiEventListener, EventListener

public class MostPopularListener
extends Object
implements WikiEventListener

Implements WikiEventListener to listen for page hit events for the MostPopularPlugin. Since only one of these instances is meant to exist for each WikiEngine, this is also where the hit count for each page is stored and processed, i.e., the guts of the plugin. Serialization and deserialization of the page cache between sessions is also handled here.

Since:
2.4.15
Author:
Murray Altheim

Constructor Summary
MostPopularListener(WikiEngine engine)
          Constructor with the WikiEngine this listener is meant to service.
 
Method Summary
 void actionPerformed(WikiEvent event)
           
protected  String getCreated(int style)
          Returns the timestamp of the creation time of the cache, as a String.
 String[] getPageList(Collection exclusions)
          Return the current "hit report" as an array of String objects, each a link to a wiki page.
 int hitsForPage(String pagename)
          Return the hit count for the provided page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MostPopularListener

public MostPopularListener(WikiEngine engine)
Constructor with the WikiEngine this listener is meant to service.

Method Detail

hitsForPage

public int hitsForPage(String pagename)
Return the hit count for the provided page. This returns -1 if the page is not in the cache.


getPageList

public String[] getPageList(Collection exclusions)
Return the current "hit report" as an array of String objects, each a link to a wiki page. The list is sorted by the popularity of the pages. If the exclusions parameter is non-null, the list of pages (as Strings) it contains will be removed from the returned array.


actionPerformed

public void actionPerformed(WikiEvent event)
Specified by:
actionPerformed in interface WikiEventListener

getCreated

protected String getCreated(int style)
Returns the timestamp of the creation time of the cache, as a String. If style is negative or is an unacceptable value, returns a default style. This will process any of the styles defined in Java's DateFormat class, e.g., DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, DateFormat.FULL, etc.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.