com.xpn.xwiki.stats.impl
Class XWikiStatsServiceImpl

java.lang.Object
  extended by com.xpn.xwiki.stats.impl.XWikiStatsServiceImpl
All Implemented Interfaces:
XWikiStatsService, org.xwiki.observation.EventListener

public class XWikiStatsServiceImpl
extends Object
implements XWikiStatsService, org.xwiki.observation.EventListener

Store and retrieve statistics.

Version:
$Id: bd3dbd5a5cb5a3d67340a8f98689cc34cbdf71db $

Constructor Summary
XWikiStatsServiceImpl()
           
 
Method Summary
 Map<?,?> getActionStatistics(String action, Scope scope, Period period, Duration step, XWikiContext context)
          Shows how the statistics for the specified action have evolved over the specified period of time.
 List<DocumentStats> getBackLinkStatistics(String domain, Scope scope, Period period, Range range, XWikiContext context)
          Retrieves back-link statistics.
 DocumentStats getDocDayStats(String docname, String action, Date day, XWikiContext context)
          Gets day statistics on a document for a specific action.
 DocumentStats getDocMonthStats(String docname, String action, Date month, XWikiContext context)
          Gets monthly statistics on a document for a specific action.
 DocumentStats getDocTotalStats(String docname, String action, XWikiContext context)
          Gets total statistics on a document for a specific action.
 List<DocumentStats> getDocumentStatistics(String action, Scope scope, Period period, Range range, XWikiContext context)
          Retrieves document statistics.
 List<org.xwiki.observation.event.Event> getEvents()
           
 String getName()
           
 Collection<Object> getRecentActions(String action, int size, XWikiContext context)
          Return the statistics action stored.
 List<RefererStats> getRefererStatistics(String domain, Scope scope, Period period, Range range, XWikiContext context)
          Retrieves referrer statistics.
 List<?> getRefMonthStats(String docName, Date month, XWikiContext context)
          Gets monthly referer statistics.
 List<VisitStats> getVisitStatistics(String action, Period period, Range range, XWikiContext context)
          Retrieves visit statistics.
 void init(XWikiContext context)
          Methods called just one time at XWiki initialization.
 void onEvent(org.xwiki.observation.event.Event event, Object source, Object data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XWikiStatsServiceImpl

public XWikiStatsServiceImpl()
Method Detail

getName

public String getName()
Specified by:
getName in interface org.xwiki.observation.EventListener

getEvents

public List<org.xwiki.observation.event.Event> getEvents()
Specified by:
getEvents in interface org.xwiki.observation.EventListener

init

public void init(XWikiContext context)
Description copied from interface: XWikiStatsService
Methods called just one time at XWiki initialization.

Specified by:
init in interface XWikiStatsService
Parameters:
context - the XWiki context.

getRecentActions

public Collection<Object> getRecentActions(String action,
                                           int size,
                                           XWikiContext context)
Description copied from interface: XWikiStatsService
Return the statistics action stored.

Specified by:
getRecentActions in interface XWikiStatsService
Parameters:
action - the action.
size - the maximum size of the list to return.
context - the XWiki context.
Returns:
the list of recent statistics action stored.

onEvent

public void onEvent(org.xwiki.observation.event.Event event,
                    Object source,
                    Object data)
Specified by:
onEvent in interface org.xwiki.observation.EventListener

getActionStatistics

public Map<?,?> getActionStatistics(String action,
                                    Scope scope,
                                    Period period,
                                    Duration step,
                                    XWikiContext context)
Description copied from interface: XWikiStatsService
Shows how the statistics for the specified action have evolved over the specified period of time.

Specified by:
getActionStatistics in interface XWikiStatsService
Parameters:
action - the action for which to retrieve statistics.
scope - the set of documents to consider.
period - the period of time.
step - the step used for sampling the period.
context - the XWiki context.
Returns:
a map of (date, actionCount) pairs.

getDocumentStatistics

public List<DocumentStats> getDocumentStatistics(String action,
                                                 Scope scope,
                                                 Period period,
                                                 Range range,
                                                 XWikiContext context)
Description copied from interface: XWikiStatsService
Retrieves document statistics.

Specified by:
getDocumentStatistics in interface XWikiStatsService
Parameters:
action - the action the results should be ordered by. It can be one of: "view", "save" or "download". If the action is "view" then the documents are ordered by the number of times they have been viewed so far.
scope - the set of documents for which to retrieve statistics.
period - the period of time.
range - the sub-range to return from the entire result set. Use this parameter for pagination.
context - the XWiki context.
Returns:
A list of DocumentStats objects

getBackLinkStatistics

public List<DocumentStats> getBackLinkStatistics(String domain,
                                                 Scope scope,
                                                 Period period,
                                                 Range range,
                                                 XWikiContext context)
Description copied from interface: XWikiStatsService
Retrieves back-link statistics.

Specified by:
getBackLinkStatistics in interface XWikiStatsService
Parameters:
domain - the domain used for filtering the results.
scope - the scope of referred documents for which to retrieve statistics.
period - the period of time.
range - the sub-range to return from the entire result set. Use this parameter for pagination.
context - the XWiki context.
Returns:
a list of DocumentStats objects.

getRefererStatistics

public List<RefererStats> getRefererStatistics(String domain,
                                               Scope scope,
                                               Period period,
                                               Range range,
                                               XWikiContext context)
Description copied from interface: XWikiStatsService
Retrieves referrer statistics.

Specified by:
getRefererStatistics in interface XWikiStatsService
Parameters:
domain - the domain for which to retrieve statistics. To retrieve statistics for all domains use the empty string.
scope - the scope of referred documents to use for filtering the results.
period - the period of time.
range - the sub-range to return from the entire result set. Use this parameter for pagination.
context - the XWiki context.
Returns:
a list of RefererStats objects.

getVisitStatistics

public List<VisitStats> getVisitStatistics(String action,
                                           Period period,
                                           Range range,
                                           XWikiContext context)
Description copied from interface: XWikiStatsService
Retrieves visit statistics.

Specified by:
getVisitStatistics in interface XWikiStatsService
Parameters:
action - the action the results should be ordered by. It can be one of: "view", "save" or "download". If the action is "view" then the visitors are ordered by the number of pages they have viewed so far.
period - the period of time.
range - the sub-range to return from the entire result set. Use this parameter for pagination.
context - the XWiki context.
Returns:
a list of VisitStats objects.

getDocTotalStats

public DocumentStats getDocTotalStats(String docname,
                                      String action,
                                      XWikiContext context)
Description copied from interface: XWikiStatsService
Gets total statistics on a document for a specific action.

Specified by:
getDocTotalStats in interface XWikiStatsService
Parameters:
docname - fully qualified document name.
action - can be "view", "edit", "save", etc..
context - the XWiki context.
Returns:
DocumentStats - statistics object.

getDocMonthStats

public DocumentStats getDocMonthStats(String docname,
                                      String action,
                                      Date month,
                                      XWikiContext context)
Description copied from interface: XWikiStatsService
Gets monthly statistics on a document for a specific action.

Specified by:
getDocMonthStats in interface XWikiStatsService
Parameters:
docname - fully qualified document name.
action - can be "view", "edit", "save", etc..
month - the month.
context - the XWiki context.
Returns:
DocumentStats - statistics object.

getDocDayStats

public DocumentStats getDocDayStats(String docname,
                                    String action,
                                    Date day,
                                    XWikiContext context)
Description copied from interface: XWikiStatsService
Gets day statistics on a document for a specific action.

Specified by:
getDocDayStats in interface XWikiStatsService
Parameters:
docname - fully qualified document name.
action - can be "view", "edit", "save", etc..
day - the day.
context - the XWiki context.
Returns:
DocumentStats - statistics object.

getRefMonthStats

public List<?> getRefMonthStats(String docName,
                                Date month,
                                XWikiContext context)
                         throws XWikiException
Description copied from interface: XWikiStatsService
Gets monthly referer statistics.

Specified by:
getRefMonthStats in interface XWikiStatsService
Parameters:
docName - fully qualified document name.
month - the month.
context - the XWiki context.
Returns:
the monthly referer statistics.
Throws:
XWikiException - error when searching for referer statistics.


Copyright © 2004-2013 XWiki. All Rights Reserved.