com.stratelia.silverpeas.silverstatistics.control
Class SilverStatisticsManager

java.lang.Object
  extended by com.stratelia.silverpeas.silverstatistics.control.SilverStatisticsManager
All Implemented Interfaces:
SchedulerEventListener

public class SilverStatisticsManager
extends Object
implements SchedulerEventListener

SilverStatisticsManager is the tool used in silverpeas to compute statistics for connexions, files size and components access. This is a singleton class. yet, the single instance is managed by the IoC container that will invoke the initSilverStatisticsManager() method for initializing it.

Author:
Marc Guillemin

Method Summary
 void addStatAccess(String userId, Date dateAccess, String peasType, String spaceId, String componentId)
          Method declaration
 void addStatConnection(String userId, Date dateConnection, int count, long duration)
          Method declaration
 void addStatSize(Date date, String dirName, long dirSize)
          Method declaration
 void addStatVolume(String userId, long volume, Date dateAccess, String peasType, String spaceId, String componentId)
          Method declaration
 void doCumulStat(Date currentDate)
          Method declaration
 void doGetStatSize(Date currentDate)
          For each directory compute the size of all its files and the size of all its subdirectories recursively.
 void doGetStatVolume(Date currentDate)
          Method declaration
static SilverStatisticsManager getInstance()
          SilverStatisticsManager is a singleton
 void initSchedulerStatistics(String aCronString, String jobName, String methodeName)
          Sets up the scheduling of the specified statistics computation at given moments in time as specified by the Unix-like cron expression.
 void initSilverStatisticsManager()
          Init attributes.
 void jobFailed(SchedulerEvent anEvent)
          Invoked when the normal execution thread of a job is broken by an exception.
 void jobSucceeded(SchedulerEvent anEvent)
          Invoked when the execution of a job has been completed correctly.
static void setInstanceForTest(SilverStatisticsManager instanceForTest)
          This method must be used only by unit tests.
 void triggerFired(SchedulerEvent anEvent)
          Invoked when a job trigger fires the execution of a job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initSilverStatisticsManager

public void initSilverStatisticsManager()
Init attributes. This method is invoked by the IoC container. Don't invoke it!


getInstance

public static SilverStatisticsManager getInstance()
SilverStatisticsManager is a singleton

Returns:

setInstanceForTest

public static void setInstanceForTest(SilverStatisticsManager instanceForTest)
This method must be used only by unit tests.


initSchedulerStatistics

public void initSchedulerStatistics(String aCronString,
                                    String jobName,
                                    String methodeName)
                             throws SchedulerException,
                                    ParseException
Sets up the scheduling of the specified statistics computation at given moments in time as specified by the Unix-like cron expression.

Parameters:
aCronString - the cron expression.
jobName - the name of the computation to schedule.
methodeName - the name of the method that performs the computation.
Throws:
SchedulerException - if the computation scheduling failed.
ParseException - if the cron expression is malformed.

doGetStatVolume

public void doGetStatVolume(Date currentDate)
Method declaration

Parameters:
currentDate -
See Also:

doGetStatSize

public void doGetStatSize(Date currentDate)
                   throws ExecutionException,
                          InterruptedException
For each directory compute the size of all its files and the size of all its subdirectories recursively.

Parameters:
currentDate -
Throws:
ExecutionException
InterruptedException
See Also:

doCumulStat

public void doCumulStat(Date currentDate)
Method declaration

Parameters:
currentDate -
See Also:

addStatVolume

public void addStatVolume(String userId,
                          long volume,
                          Date dateAccess,
                          String peasType,
                          String spaceId,
                          String componentId)
Method declaration

Parameters:
userId -
volume -
dateAccess -
peasType -
spaceId -
componentId -
See Also:

addStatAccess

public void addStatAccess(String userId,
                          Date dateAccess,
                          String peasType,
                          String spaceId,
                          String componentId)
Method declaration

Parameters:
userId -
dateAccess -
peasType -
spaceId -
componentId -
See Also:

addStatConnection

public void addStatConnection(String userId,
                              Date dateConnection,
                              int count,
                              long duration)
Method declaration

Parameters:
userId -
dateConnection -
count -
duration -
See Also:

addStatSize

public void addStatSize(Date date,
                        String dirName,
                        long dirSize)
Method declaration

Parameters:
date -
dirName -
dirSize -
See Also:

triggerFired

public void triggerFired(SchedulerEvent anEvent)
                  throws Exception
Description copied from interface: SchedulerEventListener
Invoked when a job trigger fires the execution of a job. The call of this method occurs before the actual job execution. So, wether an error occurs during the processing of this call, it is considered as a job failure and as consequency an event about a job failure will be sent to the listener. The processing of this event can be, for example for preparing the resources before the job execution or performing the execution of the job itself (delegation).

Specified by:
triggerFired in interface SchedulerEventListener
Parameters:
anEvent - the event coming from the trigger firing.
Throws:
Exception

jobSucceeded

public void jobSucceeded(SchedulerEvent anEvent)
Description copied from interface: SchedulerEventListener
Invoked when the execution of a job has been completed correctly. The job execution is considered as completed when it ends without raising any exceptions. The processing of this call can be, for example, for freeing the resources after a job completion.

Specified by:
jobSucceeded in interface SchedulerEventListener
Parameters:
anEvent - the event coming from the job completion.

jobFailed

public void jobFailed(SchedulerEvent anEvent)
Description copied from interface: SchedulerEventListener
Invoked when the normal execution thread of a job is broken by an exception. When an exception is thrown by the job execution, the exception is catched by the scheduler that then considers the job has failed and thus send an event about that failure. The processing of this event can be, for example, for freeing correctly the resources after a job failure or to run a rollback or a retry process.

Specified by:
jobFailed in interface SchedulerEventListener
Parameters:
anEvent - the event coming from the job failure.


Copyright © 2016 Silverpeas. All Rights Reserved.