org.apache.jetspeed.services.portletstats
Class JetspeedPortletStatsService

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.apache.jetspeed.services.portletstats.JetspeedPortletStatsService
All Implemented Interfaces:
org.apache.turbine.services.Initable, PortletStatsService, org.apache.turbine.services.Service

public class JetspeedPortletStatsService
extends org.apache.turbine.services.TurbineBaseService
implements PortletStatsService

Simple implementation of the PortletStatsService. This implementation uses Apache Common Log Format (CLF) as its default log format. This format uses the following pattern string: "%h %l %u %t \"%r\" %>s %b", where:

Here's an example log entry:

127.0.0.1 - turbine [26/Aug/2002:11:44:40 -0500] "GET /jetspeed/DatabaseBrowserTest HTTP/1.1" 200 -

TODO:

Version:
$Id: JetspeedPortletStatsService.java,v 1.6 2004/04/06 21:34:01 morciuch Exp $
Author:
Mark Orciuch

Field Summary
protected  java.lang.String dateFormat
          Date format to use in the log entry.
protected static java.lang.String defaultLogFormat
          The default log format pattern string to use with the following elements:
    remote address always "-" user name timestamp request method context portlet name request protocol status code always "-" unless logLoadTime is true
protected  java.text.SimpleDateFormat formatter
          Date formatter
protected static JetspeedLogger logger
          Static initialization of the logger for this class
protected  boolean logLoadTime
          Log portlet load time instead of bytes sent (which is always zero)
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.jetspeed.services.portletstats.PortletStatsService
SERVICE_NAME
 
Constructor Summary
JetspeedPortletStatsService()
           
 
Method Summary
protected  java.lang.String getLogMessage(org.apache.turbine.util.RunData data, Portlet portlet, java.lang.String statusCode, long time)
          Formats log message
 void init(javax.servlet.ServletConfig conf)
          This is the early initialization method called by the Turbine Service framework
 boolean isEnabled()
          Returns sevice enabled state
 void logAccess(org.apache.turbine.util.RunData data, Portlet portlet, java.lang.String statusCode)
          Formats log message using default load time
 void logAccess(org.apache.turbine.util.RunData data, Portlet portlet, java.lang.String statusCode, long time)
          Logs portlet access.
 boolean setEnabled(boolean state)
          Sets service enabled state
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, init, shutdown
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker, shutdown
 

Field Detail

logger

protected static final JetspeedLogger logger
Static initialization of the logger for this class


defaultLogFormat

protected static final java.lang.String defaultLogFormat
The default log format pattern string to use with the following elements:
  1. remote address
  2. always "-"
  3. user name
  4. timestamp
  5. request method
  6. context
  7. portlet name
  8. request protocol
  9. status code
  10. always "-" unless logLoadTime is true

See Also:
Constant Field Values

dateFormat

protected java.lang.String dateFormat
Date format to use in the log entry. Should conform to standard format used by the SimpleDateFormat class.


formatter

protected java.text.SimpleDateFormat formatter
Date formatter


logLoadTime

protected boolean logLoadTime
Log portlet load time instead of bytes sent (which is always zero)

Constructor Detail

JetspeedPortletStatsService

public JetspeedPortletStatsService()
Method Detail

init

public void init(javax.servlet.ServletConfig conf)
          throws org.apache.turbine.services.InitializationException
This is the early initialization method called by the Turbine Service framework

Throws:
org.apache.turbine.services.InitializationException

isEnabled

public boolean isEnabled()
Description copied from interface: PortletStatsService
Returns sevice enabled state

Specified by:
isEnabled in interface PortletStatsService
Returns:
true if service is enabled
See Also:
PortletStatsService.isEnabled()

setEnabled

public boolean setEnabled(boolean state)
Description copied from interface: PortletStatsService
Sets service enabled state

Specified by:
setEnabled in interface PortletStatsService
Parameters:
state - new state
Returns:
original service enabled state
See Also:
PortletStatsService.setEnabled(boolean)

logAccess

public void logAccess(org.apache.turbine.util.RunData data,
                      Portlet portlet,
                      java.lang.String statusCode,
                      long time)
Description copied from interface: PortletStatsService
Logs portlet access.

Specified by:
logAccess in interface PortletStatsService
Parameters:
data - Current request info object
portlet - Portlet being logged
statusCode - HTTP status code. For now, either 200 (successfull) or 401 (unauthorized)
See Also:
PortletStatsService.logAccess(org.apache.turbine.util.RunData, org.apache.jetspeed.portal.Portlet, java.lang.String)

getLogMessage

protected java.lang.String getLogMessage(org.apache.turbine.util.RunData data,
                                         Portlet portlet,
                                         java.lang.String statusCode,
                                         long time)
                                  throws java.lang.Exception
Formats log message

Parameters:
data -
portlet -
statusCode -
time -
Returns:
Formatted message
Throws:
java.lang.Exception

logAccess

public void logAccess(org.apache.turbine.util.RunData data,
                      Portlet portlet,
                      java.lang.String statusCode)
Formats log message using default load time

Specified by:
logAccess in interface PortletStatsService
Parameters:
data -
portlet -
statusCode -


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.