org.apache.jetspeed.statistics
Interface PortalStatistics


public interface PortalStatistics

The PortletStatistics interface provides an API for logging portlet statistics. Each log entry is formatted in the Apache Common Log Format (CLF) . Each CLF log entry has the following form:

"%h %l %u %t \"%r\" %>s %b"

where:

Here's an example of a CLF log entry:

 
 192.168.2.3 - johndoe [25/Oct/2005:11:44:40 PDT] "GET
 /jetspeed/DatabaseBrowserTest HTTP/1.1" 200 -
 
 

The PortletStatistics interface overloads the %r field of the CLF format, depending on the type of information being logged:

 
 LOG TYPE FORMAT OF %r FIELD -------------- ----------------------------
 Portlet access "PORTLET " Page access "PAGE
 " User logout "LOGOUT"
 
 

Version:
$Id: $
Author:
David Sean Taylor , Mark Orciuch , Richard Klein

Field Summary
static String HTTP_INTERNAL_ERROR
           
static String HTTP_NOT_FOUND
           
static String HTTP_OK
           
static String HTTP_UNAUTHORIZED
           
static String QUERY_TYPE_PAGE
           
static String QUERY_TYPE_PORTLET
           
static String QUERY_TYPE_USER
           
 
Method Summary
 StatisticsQueryCriteria createStatisticsQueryCriteria()
          Factory to create new statistics query criteria
 void forceFlush()
          force the database loggers to flush out
 DataSource getDataSource()
           
 AggregateStatistics getDefaultEmptyAggregateStatistics()
          Factory to create new, empty, aggregate statistics object.
 List getListOfLoggedInUsers()
           
 int getNumberOfCurrentUsers()
           
 int getNumberOfLoggedInUsers()
           
 void logPageAccess(RequestContext request, String statusCode, long msElapsedTime)
          Logs an access to a page.
 void logPortletAccess(RequestContext request, String portlet, String statusCode, long msElapsedTime)
          Logs an access to a portlet.
 void logUserLogin(RequestContext request, long msElapsedLoginTime)
          Logs a user logout event.
 void logUserLogout(String ipAddress, String userName, long msSessionLength)
          Logs a user logout event.
 AggregateStatistics queryStatistics(StatisticsQueryCriteria criteria)
           
 

Field Detail

QUERY_TYPE_PORTLET

static final String QUERY_TYPE_PORTLET
See Also:
Constant Field Values

QUERY_TYPE_USER

static final String QUERY_TYPE_USER
See Also:
Constant Field Values

QUERY_TYPE_PAGE

static final String QUERY_TYPE_PAGE
See Also:
Constant Field Values

HTTP_OK

static final String HTTP_OK
See Also:
Constant Field Values

HTTP_UNAUTHORIZED

static final String HTTP_UNAUTHORIZED
See Also:
Constant Field Values

HTTP_NOT_FOUND

static final String HTTP_NOT_FOUND
See Also:
Constant Field Values

HTTP_INTERNAL_ERROR

static final String HTTP_INTERNAL_ERROR
See Also:
Constant Field Values
Method Detail

logPortletAccess

void logPortletAccess(RequestContext request,
                      String portlet,
                      String statusCode,
                      long msElapsedTime)
Logs an access to a portlet.

Parameters:
request - current request info object
portlet - portlet being logged
statusCode - HTTP status code.
msElapsedTime - elapsed time the portlet took to render

logPageAccess

void logPageAccess(RequestContext request,
                   String statusCode,
                   long msElapsedTime)
Logs an access to a page.

Parameters:
request - current request info object
statusCode - HTTP status code
msElapsedTime - elapsed time the page took to render

logUserLogout

void logUserLogout(String ipAddress,
                   String userName,
                   long msSessionLength)
Logs a user logout event. The %s (HTTP status code) field of the log entry will be set to 200 (OK).

Parameters:
request - current request info object
msElapsedTime - elapsed time that the user was logged in

logUserLogin

void logUserLogin(RequestContext request,
                  long msElapsedLoginTime)
Logs a user logout event. The %s (HTTP status code) field of the log entry will be set to 200 (OK).

Parameters:
request - current request info object
msElapsedLoginTime - time it took the user to login

getNumberOfCurrentUsers

int getNumberOfCurrentUsers()
Returns:
returns the current number of logged in users

forceFlush

void forceFlush()
force the database loggers to flush out


getDataSource

DataSource getDataSource()
Returns:
DataSource in use by the logger useful for writing decent tests

queryStatistics

AggregateStatistics queryStatistics(StatisticsQueryCriteria criteria)
                                    throws InvalidCriteriaException
Throws:
InvalidCriteriaException

getNumberOfLoggedInUsers

int getNumberOfLoggedInUsers()

getListOfLoggedInUsers

List getListOfLoggedInUsers()

createStatisticsQueryCriteria

StatisticsQueryCriteria createStatisticsQueryCriteria()
Factory to create new statistics query criteria

Returns:
a newly create statistics empty criteria

getDefaultEmptyAggregateStatistics

AggregateStatistics getDefaultEmptyAggregateStatistics()
Factory to create new, empty, aggregate statistics object.

Returns:
unpopulated AggregateStatistics object


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.