WikiPageStats#

Introduction#

As a JSPWiki administrator you need some statistical information about the pages in your wiki.


The information I'd like to see per page is the following:

  • Page Name
  • Creator
  • Creation Date/Time
  • Last Modified Date/Time
  • Last Modified By
  • Current Page Size
  • Number of versions
  • Total size of all versions
  • Number of Attachments
  • Total size of Attachments
  • Number of incoming wikilinks
  • Number of outgoing wikilinks

The information should be presentable in a tabular form where you can sort it and filter it (like the %%Sortable and %%table-filter).

The following interfaces/classes are planned :

  • a bean class that represents one Wiki Page with getters/setters for all the above fields
  • an interface that describes the actions that can be performed on the statistics of a page
  • a basic class that implements this interface based on the current JSPWiki provider
  • a factory class that creates and gathers all the WikiPageStat objects. This class should provide public methods that return a List of (populated) WikiPageStat objects. (optionally with a pattern as filter to return a subset of the pagestats)
  • a class that provides the information to the end user :
    • a JSPWiki plugin to provide the info in HTML format
    • an MBean ?
    • a class to provide the stats in xml format for automated processing afterwards

Security#

Security is important because sensitive meta data of pages are provided, for now the access to this function should be limited to administrators.
Another reason to limit access is the fact that gathering all this info might generate quite some load on the server.

Interfaces/classes#

com.ecyd.jspwiki.stats.WikiPageStatBean#

This Bean class represents all information of a Wiki page. For now we only deal with regular WikiPages, not attachments. Although attachment information is part of some Wiki pages.

com.ecyrd.jspwiki.stats.WikiPageStatUtilInterface#

This interface describes all the actions that can be done with (collections of) WikiPageStat objects.
To mention a few :
public List<WikiPageStat> getAllWikiPageStats();returns a List of WikiPageStat objects, if necessary the new List is built, or a cached version is returned
public void sortWikiPageStats(String field); sorts the internally kept (cached) list of pages by the supplied field
public void addWikiPageStat(WikiPageStat myNewWikiPageStat); add a WikiPage to the collection
public void refreshStats(); rebuilds a complete new List of WikiPageStat objects, and of course updates te TimeStamp
public Date getTimeStamp(); returns a Date object representing the date/time the List of WikiPageStat objects has been created (how actual is the data)
public int getTotalNumberOfPages()returns the total number of pages found during the last refresh or update of the stats
public int getAveragePageSize()returns the average size of all pages (in bytes) found during the last refresh of the stats
public long getTotalSize()returns the sum of the size of all versions of all pages and their attachments, this should give you an estimate on the used disk space.
more to come-

com.ecyrd.jspwiki.stats.WikiPageStatUtility#

This class implements the above interface. It can cache the statistics in an internally kept List of WikiPageStat objects.
Note that the freshness of this data strongly depends on how frequently the wiki is updated.

It is (in the future) also possible that on every change in the wiki, the statistics are updated. Note that updating the statistics might be a heavy process if we decide to also update all the totals and averages the we cache internally.

The WikiPageStatUtility is once instantiated by the WikiEngine during startup. A new property (usePageStatistics) determines whether this happens or not, the default is compatible with the current situation, so no stats.

A reference to the WikiPageStatUtility can be obtained also via the WikiEngine, and this is what the Plugin should do.

com.ecyrd.jspwiki.stats.WikiPageStatPlugin#

This is a regular JSPWiki Plugin that should use the WikiPageStatUtility to get all information and present it i a tabular form in your browser. Optional parameters can be used to limit the amount of rows or columns.