com.jalios.jcms.stat
Class StatManager

java.lang.Object
  extended by com.jalios.jcms.stat.StatManager
All Implemented Interfaces:
JcmsConstants, JaliosConstants

public class StatManager
extends Object
implements JcmsConstants

This class manages access log and produces statistics reports.

Since:
jcms-5.0.0
Version:
$Revision: 24572 $
Author:
Jean-Philippe Encausse

Field Summary
protected static Map analyseMap
           
static long MAX_REQUEST_DURATION
           
static long REQUEST_TIMEOUT
           
static String REVISION
           
static long SESSION_TIMEOUT
           
static String STAT_FILE_PATTERN
           
protected static org.apache.oro.text.regex.Pattern[][] STAT_IGNORE_PATTERN
           
static String STAT_REPORT_PATTERN
           
static ReadWriteAccessController statrwac
           
 
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, CRYPT_MD5, CRYPT_UNDEFINED, CRYPT_UNIX, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, ICON_ARCHIVE, ICON_LOCK, ICON_LOCK_STRONG, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, JALIOS_JUNIT_PROP, JCMS_CADDY, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_DEEP_COPY, OP_DEEP_DELETE, OP_DELETE, OP_MERGE, OP_UPDATE, PDATE_SEARCH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SESSION_AUTHORIZED_FILENAMES_SET, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
 
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
 
Constructor Summary
StatManager()
           
 
Method Summary
static StatHandler analyse(StatReport report, Member loggedMember, boolean join)
          Analyse a report of stats from now - report.periodicity
static StatHandler analyse(StatReport report, Member loggedMember, boolean join, long oldDate, long nowDate)
          Analyse a report of stats from olddate to nowdate
static void analyseAndRender(StatReport report, Member loggedMember)
          Analyse and Render a report of stats
static void analyseAndRender(StatReport report, Member loggedMember, long oldDate, long nowDate)
          Analyse and Render a report of stats
static void appendStatEntry(javax.servlet.http.HttpServletRequest request, long startPageRequest)
          Append a stat entry (called byte doStats.jsp)
static void appendStatEntry(javax.servlet.http.HttpServletRequest request, long startPageRequest, long endPageRequest)
          Append a stat entry (called byte doStats.jsp)
protected static StatHandler buildStatHandler(long oldDate, long nowDate, PortalElement report)
          Build the StatHandler
static boolean canAnalyze()
           
static boolean canAnalyze(StatReport report, Member member)
          Check if analyse can be done on this report.
static boolean canAnalyze(StatReport report, Member member, StatHandler statHandler)
          Check if analyse can be done on this report.
static boolean canResolveHost()
           
static boolean canStat()
           
static void checkRequestDuration(javax.servlet.http.HttpServletRequest req, long startPageRequest)
          This method warn if a request duratino is too long
static StatListener createStatListener(PortletStat portlet, PortalElement report)
          Instanciate a StatListener from a given portlet calling StatPolicy hooks
static StatListener createStatListener(PortletStat portlet, PortalElement report, String clazzstr)
          Instanciate a StatListener from a given portlet without any other check
protected static String dataToString(Data data)
           
protected static String dataToString(Data[] data)
           
static Map getAllReport()
          Build a [Map of Workspace] > [Map of Report] > [Set of Report Version]
static Map getAllReport(Workspace workspace)
          Return all the Files representing a given report for a given workspace
static Set getAllReport(Workspace workspace, StatReport report)
          Return all the Files representing a given report for a given workspace
static Set getExistingStatFiles(long oldDate, long nowDate)
          Return the list of stat files that exist between date1 and date2.
static org.apache.oro.text.regex.Pattern[][] getIgnorePattern(Channel channel)
          Return all the Pattern to find stat line to escape.
static Date getReportDate(String reportName)
           
static long getRequestTimeOut()
           
static long getSessionTimeOut()
           
static StatAnalyser getStatAnalyser(StatReport report, boolean remove)
          Return and remove the StatAnalyser of the given Report
static Set getStatPortletSet(PortalElement portal)
          Get all portletStat under the given PortalElement
static String getStatReportDirectory(String workspaceId, String reportId)
          Return the directory where to generate all the stats
static String getStatReportFile(long date)
          Return the directory where to generate all the stats
static MonitoredInputStream getStatStream(long oldDate, long nowDate)
          Return the MonitoredInputStream of stat files that exist between date1 and date2.
static Set getWorkspaceSet(StatReport report)
          Get all the workspace to use for this report.
static boolean isGlobalReport(StatReport report)
          Indicate if the Report is a Channel Report or a Workspace Report Look for channel properties definition.
static void lockAnalyse(boolean lock, StatReport report, StatAnalyser analyser)
          Lock the analyse for a given report.
static boolean matchPattern(StatEntry entry)
          Check if the StatEntry match a pattern.
static void render(StatHandler statHandler, StatReport report, Member member)
          Render the statsReport.jsp to an HTMLFile
protected static void renderPortlet(StatHandler statHandler, PortalElement portlet, Member loggedMember, String statDirectory, String jspKey, String jsp, String html, Workspace workspace)
          Try to render a Portlet from a JSP to an html file The rendering folder should be created
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

STAT_FILE_PATTERN

public static final String STAT_FILE_PATTERN
See Also:
Constant Field Values

STAT_REPORT_PATTERN

public static final String STAT_REPORT_PATTERN
See Also:
Constant Field Values

SESSION_TIMEOUT

public static final long SESSION_TIMEOUT

REQUEST_TIMEOUT

public static final long REQUEST_TIMEOUT

MAX_REQUEST_DURATION

public static final long MAX_REQUEST_DURATION

STAT_IGNORE_PATTERN

protected static org.apache.oro.text.regex.Pattern[][] STAT_IGNORE_PATTERN

statrwac

public static final ReadWriteAccessController statrwac

analyseMap

protected static final Map analyseMap
Constructor Detail

StatManager

public StatManager()
Method Detail

checkRequestDuration

public static void checkRequestDuration(javax.servlet.http.HttpServletRequest req,
                                        long startPageRequest)
This method warn if a request duratino is too long

Parameters:
req - the ServletRequest
startPageRequest - the starting page request

appendStatEntry

public static void appendStatEntry(javax.servlet.http.HttpServletRequest request,
                                   long startPageRequest)
                            throws IOException
Append a stat entry (called byte doStats.jsp)

Parameters:
request - the request
startPageRequest - the starting time of this page
Throws:
IOException
Since:
jcms-4.0

appendStatEntry

public static void appendStatEntry(javax.servlet.http.HttpServletRequest request,
                                   long startPageRequest,
                                   long endPageRequest)
                            throws IOException
Append a stat entry (called byte doStats.jsp)

Parameters:
request - the request
startPageRequest - the starting time of this page
Throws:
IOException
Since:
jcms-4.0

dataToString

protected static String dataToString(Data data)

dataToString

protected static String dataToString(Data[] data)

getIgnorePattern

public static org.apache.oro.text.regex.Pattern[][] getIgnorePattern(Channel channel)
Return all the Pattern to find stat line to escape. The pattern are listed in the channel properties.

Parameters:
channel -
Since:
jcms-4.0

matchPattern

public static boolean matchPattern(StatEntry entry)
Check if the StatEntry match a pattern.

Parameters:
entry -
Returns:
boolean
Since:
jcms-5.0.0 TODO: Can be greatly optimized ...

getStatAnalyser

public static StatAnalyser getStatAnalyser(StatReport report,
                                           boolean remove)
Return and remove the StatAnalyser of the given Report

Parameters:
report -
Returns:
the StatAnalyser of this report
Since:
jcms-5.0.0

analyse

public static StatHandler analyse(StatReport report,
                                  Member loggedMember,
                                  boolean join)
                           throws Exception
Analyse a report of stats from now - report.periodicity

Parameters:
report - the StatReport
loggedMember - the Member doing analyse
join - Should wait end of analyse
Returns:
StatHandler
Throws:
Exception
Since:
jcms-4.1

analyse

public static StatHandler analyse(StatReport report,
                                  Member loggedMember,
                                  boolean join,
                                  long oldDate,
                                  long nowDate)
                           throws Exception
Analyse a report of stats from olddate to nowdate

Parameters:
report - the StatReport
loggedMember - the Member doing analyse
join - Should wait end of analyse
nowDate - the analyse date
Returns:
StatHandler
Throws:
Exception
Since:
jcms-5.0.3

analyseAndRender

public static void analyseAndRender(StatReport report,
                                    Member loggedMember)
                             throws Exception
Analyse and Render a report of stats

Parameters:
report - the StatReport
loggedMember - the Member doing analyse
Throws:
Exception
Since:
jcms-4.1

analyseAndRender

public static void analyseAndRender(StatReport report,
                                    Member loggedMember,
                                    long oldDate,
                                    long nowDate)
                             throws Exception
Analyse and Render a report of stats

Parameters:
report - the StatReport
loggedMember - the Member doing analyse
nowDate - the starting date
Throws:
Exception
Since:
jcms-5.0.3

lockAnalyse

public static void lockAnalyse(boolean lock,
                               StatReport report,
                               StatAnalyser analyser)
Lock the analyse for a given report.

Parameters:
lock - the action to do : lock or unlock
report - the report to work with
analyser - the analyser doing the job
Since:
jcms-5.0.0

canAnalyze

public static boolean canAnalyze(StatReport report,
                                 Member member)
Check if analyse can be done on this report.

Parameters:
report -
member -
Returns:
true if analyse can be done
Since:
jcms-5.0.0

canAnalyze

public static boolean canAnalyze(StatReport report,
                                 Member member,
                                 StatHandler statHandler)
Check if analyse can be done on this report.

Parameters:
report -
member -
statHandler -
Returns:
true if analyse can be done
Since:
jcms-5.0.0

renderPortlet

protected static void renderPortlet(StatHandler statHandler,
                                    PortalElement portlet,
                                    Member loggedMember,
                                    String statDirectory,
                                    String jspKey,
                                    String jsp,
                                    String html,
                                    Workspace workspace)
                             throws Exception
Try to render a Portlet from a JSP to an html file The rendering folder should be created

Throws:
Exception
Since:
jcms-4.0

render

public static void render(StatHandler statHandler,
                          StatReport report,
                          Member member)
Render the statsReport.jsp to an HTMLFile

Parameters:
statHandler -
Since:
jcms-4.0

buildStatHandler

protected static StatHandler buildStatHandler(long oldDate,
                                              long nowDate,
                                              PortalElement report)
                                       throws Exception
Build the StatHandler

Parameters:
oldDate -
nowDate -
report -
Returns:
StatHandler
Throws:
Exception

getStatReportDirectory

public static String getStatReportDirectory(String workspaceId,
                                            String reportId)
Return the directory where to generate all the stats

Returns:
String
Since:
jcms-4.0

getStatReportFile

public static String getStatReportFile(long date)
Return the directory where to generate all the stats

Parameters:
date -
Returns:
String
Since:
jcms-4.1

getReportDate

public static Date getReportDate(String reportName)

getAllReport

public static Set getAllReport(Workspace workspace,
                               StatReport report)
Return all the Files representing a given report for a given workspace

Parameters:
workspace -
report -
Returns:
a Set of File
Since:
jcms-4.1

getAllReport

public static Map getAllReport(Workspace workspace)
Return all the Files representing a given report for a given workspace

Parameters:
workspace -
Returns:
a Set of File
Since:
jcms-4.1

getAllReport

public static Map getAllReport()
Build a [Map of Workspace] > [Map of Report] > [Set of Report Version]

Returns:
a Map
Since:
jcms-4.1

createStatListener

public static StatListener createStatListener(PortletStat portlet,
                                              PortalElement report)
Instanciate a StatListener from a given portlet calling StatPolicy hooks

Parameters:
portlet -
Returns:
StatListener
Since:
jcms-4.0

createStatListener

public static StatListener createStatListener(PortletStat portlet,
                                              PortalElement report,
                                              String clazzstr)
Instanciate a StatListener from a given portlet without any other check

Parameters:
portlet -
Returns:
StatListener
Since:
jcms-5.6.0

getStatStream

public static MonitoredInputStream getStatStream(long oldDate,
                                                 long nowDate)
Return the MonitoredInputStream of stat files that exist between date1 and date2.

Parameters:
oldDate - the date from which the analyse start
nowDate - the date from which the analyse end
Returns:
List

getExistingStatFiles

public static Set getExistingStatFiles(long oldDate,
                                       long nowDate)
Return the list of stat files that exist between date1 and date2.

Parameters:
oldDate - the date from which the analyse start
nowDate - the date from which the analyse end
Returns:
List

getStatPortletSet

public static Set getStatPortletSet(PortalElement portal)
Get all portletStat under the given PortalElement

Parameters:
portal -
Returns:
A Set of PortletStat

getWorkspaceSet

public static Set getWorkspaceSet(StatReport report)
Get all the workspace to use for this report. If the report is declared in channel properties then a report will be generated for each workspace

Parameters:
report - the report to work with
Returns:
a Set of Workspace to use for report rendering
Since:
jcms-4.1

isGlobalReport

public static boolean isGlobalReport(StatReport report)
Indicate if the Report is a Channel Report or a Workspace Report Look for channel properties definition.

Parameters:
report -
Returns:
true if Report is a Channel Report
Since:
jcms-5.0.0

getSessionTimeOut

public static long getSessionTimeOut()

getRequestTimeOut

public static long getRequestTimeOut()

canAnalyze

public static boolean canAnalyze()

canStat

public static boolean canStat()

canResolveHost

public static boolean canResolveHost()


Copyright © 2001-2007 Jalios SA. All Rights Reserved.