|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jalios.jcms.analytics.AnalyticsManager
public class AnalyticsManager
AnalyticsManager use for JCMS analytics
Nested Class Summary | |
---|---|
static class |
AnalyticsManager.ContentTopMapComparator
|
class |
AnalyticsManager.dataMixInFilter
|
class |
AnalyticsManager.DoubleEntryComparator
|
class |
AnalyticsManager.DoubleMapComparator
|
class |
AnalyticsManager.MemberMixInFilter
|
class |
AnalyticsManager.TopDoubleMapComparator
|
class |
AnalyticsManager.TopMapComparator
|
Fields inherited from interface com.jalios.util.JPropertiesListener |
---|
REVISION |
Method Summary | |
---|---|
void |
addAgent(AbstractStatisticAgent agent)
add a AbstractStatisticAgent to agent list |
static Set<AbstractReportMetric> |
aggregateAllUrid(Set<AbstractReportMetric> originalSet,
Class<? extends AbstractReportMetric> clazz)
Aggregate all urid report in global report (day by day) |
static void |
aggregateDateKeyDoubleMap(Map<Date,Double> origMap,
Map<Date,Double> mapToAdd)
|
static void |
aggregateKeyContentTopMap(Map<String,ContentTopValue> origContentTopMap,
Map<String,ContentTopValue> mapToAdd)
|
static void |
aggregateKeyIntegerMap(Map<String,Integer> origMap,
Map<String,Integer> mapToAdd)
|
static void |
aggregateKeyLongMap(Map<String,Long> origMap,
Map<String,Long> mapToAdd)
|
static void |
appendEventData(EventData eventData)
Append a data event |
static void |
appendEventData(EventData eventData,
javax.servlet.http.HttpServletRequest request)
Append a data event |
static void |
appendEventData(EventData eventData,
javax.servlet.http.HttpServletRequest request,
File eventDirectory)
Append a data event |
static void |
appendPageEvent(javax.servlet.http.HttpServletRequest request,
long startPageRequest)
Append a page event (like previous page stat mechanism) |
protected static void |
appendPageEvent(javax.servlet.http.HttpServletRequest request,
long startPageRequest,
long endPageRequest,
long eventDate,
File eventDirectory)
Append a page event (like previous page stat mechanism) |
static void |
completeMetricObjectSet(Set<AbstractReportMetric> originalSet,
Date startDate,
Date endDate,
Locale locale,
Class<? extends AbstractReportMetric> clazz)
Update the provided set with some empty report metric instance if any are missing in specified interval |
void |
deleteAnalyze(AnalyzeListener listener)
Delete a AnalyzeListener from the current AnalyzeListener List |
static Map<String,String> |
generateAccessContextMap(javax.servlet.http.HttpServletRequest request,
EventData eventData)
|
static String |
getActionFromOp(int opAction)
|
List<AbstractStatisticAgent> |
getAgents()
Get AbstractStatisticAgent list (a copy of internal agent list) |
static SortedSet<String> |
getBots(String userAgent)
|
static SortedSet<String> |
getBrowsers(String userAgent)
|
static Set<Workspace> |
getCompatibleWorkspaceSet()
Get compatible workspaces for analyze (workspace model are ignored) (without any right check) |
static Set<Workspace> |
getCompatibleWorkspaceSet(Member loggedMember)
Get compatible workspaces for analyze (workspace model are ignored) |
List<AnalyzeListener> |
getCurrentAnalyzeListener()
Retrieve the current analyze listener |
static Map<String,ContentTopValue> |
getDeserializedContentTopMap(Map<String,String> contentTopMap)
Convert a Map of String to map of ContentTopValue |
File |
getEventDirectory()
Retrieve event data directory |
File |
getEventFile(File directory,
Date date)
Retrieve event data file for a date |
static AnalyticsManager |
getInstance()
|
org.codehaus.jackson.map.ObjectMapper |
getObjectMapper()
get the ObjectMapper (cached in the class) |
Map<String,String> |
getRequestCustomContextMap(javax.servlet.http.HttpServletRequest request)
Get the context Map which will be merge with existing context if it exists before writing EventData |
static Map<String,String> |
getSerializedContentTopMap(Map<String,ContentTopValue> contentTopMap)
Convert a Map of ContentTopValue to map of String |
static SortedMap<String,ContentTopValue> |
getSortedContentTopMap(Map<String,ContentTopValue> origContentTopMap,
int nbMaxElt)
|
SortedMap<String,Double> |
getSortedTopDoubleMap(Map<String,Double> topMap,
int nbMaxElt)
|
SortedMap<String,Integer> |
getSortedTopMap(Map<String,Integer> topMap,
int nbMaxElt)
|
Map<String,String> |
getThreadLocalCustomContextMap()
Get the context Map which will be merge with existing context if it exists before writing EventData context map will be get from a ThreadLocal object |
static String |
getUrlSubString(String value,
int maxLength)
|
static Calendar |
getUtcTime(Date reportDate,
Locale userLocale)
Retrieve a UTC time from a date |
void |
initAlarms()
init analytics alarm use to compute day aggregation |
static boolean |
isBot(EventData data)
|
static boolean |
isValidOperationAction(String opAction)
|
static Map<String,Map<Date,Double>> |
keptBest(Map<String,Map<Date,Double>> dataMap,
int nbElement,
String othersKey)
Compute a new map by top x data and grouping other data. |
static Map<String,Map<Date,Double>> |
normalizeMap(Map<String,Map<Date,Double>> dataMap)
Normalize a Map |
static void |
processQueries(Map<String,String> ctxMap)
|
void |
propertiesChange(JProperties properties)
Invoked after properties have been modified in JCMS and save on disk. |
List<EventData> |
readEventFile(File file)
Read EventData from a file |
void |
reinitAlarms()
ReinitAlarms (remove all analytics alarms from analytics alarm manager and init alarms) |
void |
removeAgent(AbstractStatisticAgent agent)
remove a AbstractStatisticAgent from agent list |
static void |
removeToDayMetric(Set<AbstractReportMetric> originalSet)
Remove today metric, because this metric is not done. |
void |
runDayAgent()
run day agent with management of missing aggregation (manual run) |
void |
runDayAgent(Date startDate,
Date endDate,
Set<Workspace> workspaceSet,
String urid,
File eventDirectory,
Set<AbstractStatisticAgent> dayAgentList,
boolean scheduled,
boolean globalAnalyze)
Run day agent in a specific period |
void |
runDayAgent(Date startDate,
Date endDate,
Workspace workspace,
String urid,
boolean scheduled,
boolean globalAnalyze)
Run day agent in a specific period |
void |
runDayAgentFromAlarm()
run day agent with management of missing aggregation (from an alarm). |
String |
serializeEvent(EventData data)
Serialize an EventData in a string |
static String |
toJSON(Object obj)
|
void |
writeEvent(EventData data)
Write an EventData in the file |
void |
writeEvent(File eventDirectory,
EventData data)
Write an EventData in the file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ANALYTICS_RESOLVEHOST_PROP
public static final String Safari
public static final String Chrome
public static final String DOWNLOAD
public static final String IPADDRESS
public static final String METHODE
public static final String REFERER
public static final String SCHEME
public static final String SERVERNAME
public static final String URI
public static final String QUERYSTRING
public static final String SESSIONID
public static final String USERAGENT
public static final String ZONE
public static final String MEMO
public static final String NAME
public static final String SERVERPORT
public static final String LOCALE
public static final String DATESTART
public static final String DATEEND
public static final String DATA
public static final String DATA_TYPE
public static final String MEMBER
public static final String GROUPS
public static final String PORTAL
public static final String PORTAL_TITLE
public static final String WORKSPACE
public static final String CURRENTCAT
public static final String PORTALCAT
public static final String CTXTCAT
public static final String PUBLICATION
public static final String BROWSER
public static final String OS
public static final String COUNTRY
public static final String LANGUAGE
public static final String SEARCH_FULLTEXT
public static final String SEARCH_CATEGORY
public static final String SEARCH_GROUPS
public static final String SEARCH_MEMBERS
public static final String SEARCH_TYPES
public static final String SEARCH_SORT
public static final String SEARCH_HIST
public static final String URID
public static final String AUDIENCEMENT
public static final String XFORWARD
public static final String PRINT_VIEW
public static final String IS_BOT
public static final String DATA_WORKSPACES
public static final String OLD_DATA_WORKSPACES
public static final int PATTERN_NOT_PROCESSED
public static final int PATTERN_PROCESSED_TRUE
public static final int PATTERN_PROCESSED_FALSE
public static final String BROWSERS_PROP
public static final String OS_PROP
public static final String BOT_PROP
public static final org.apache.oro.text.regex.Pattern PATTERN_BOT
public static final org.apache.oro.text.regex.Pattern PATTERN_BROWSER
public static final org.apache.oro.text.regex.Pattern PATTERN_OS
public static final String CORE
public static final String ACCESS
public static final String OPENAPI
public static final String AC_SEARCH
public static final String CSRF_ERROR
public static final String AUTH_FAIL
public static final String OPENAPI_UNAVAILABLE
public static final String OPENAPI_DISABLED
public static final String OPENAPI_ERROR
public static final String OPENAPI_READ_ACCESS_DISABLED
public static final String OPENAPI_READ_ACCESS_FORBIDDEN
public static final String OPENAPI_WRITE_ACCESS_DISABLED
public static final String OPENAPI_WRITE_ACCESS_FORBIDDEN
public static final String OPENAPI_OK
public static final DateFormat DATE_FORMAT
Method Detail |
---|
public static AnalyticsManager getInstance()
public void propertiesChange(JProperties properties)
JPropertiesListener
You cannot alter the value received in parameters.
propertiesChange
in interface JPropertiesListener
properties
- the properties which have been modified (may not contain all JCMS properties)public void writeEvent(EventData data) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, IOException
EventData
in the file
data
- the EventData
org.codehaus.jackson.JsonGenerationException
- Exception thrown when eventData is save as JSON data
org.codehaus.jackson.map.JsonMappingException
- Exception thrown when eventData is save as JSON data
IOException
- Exception thrown when eventData is save as JSON datapublic void writeEvent(File eventDirectory, EventData data) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, IOException
EventData
in the file
eventDirectory
- the events data directorydata
- the EventData
org.codehaus.jackson.JsonGenerationException
- Exception thrown when eventData is save as JSON data
org.codehaus.jackson.map.JsonMappingException
- Exception thrown when eventData is save as JSON data
IOException
- Exception thrown when eventData is save as JSON datapublic String serializeEvent(EventData data) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, IOException
EventData
in a string
data
- the EventData
org.codehaus.jackson.JsonGenerationException
- Exception thrown when eventData is save as JSON data
org.codehaus.jackson.map.JsonMappingException
- Exception thrown when eventData is save as JSON data
IOException
- Exception thrown when eventData is save as JSON datapublic List<EventData> readEventFile(File file) throws IOException
EventData
from a file
file
- the file to read
EventData
IOException
- Exception thrown when reading the filepublic File getEventDirectory()
public File getEventFile(File directory, Date date)
date
- the date used to compute the filenamedirectory
- the directory File
public org.codehaus.jackson.map.ObjectMapper getObjectMapper()
ObjectMapper
(cached in the class)
ObjectMapper
public void addAgent(AbstractStatisticAgent agent)
AbstractStatisticAgent
to agent list
agent
- the AbstractStatisticAgent
to addpublic void removeAgent(AbstractStatisticAgent agent)
AbstractStatisticAgent
from agent list
agent
- the AbstractStatisticAgent
to removepublic List<AbstractStatisticAgent> getAgents()
AbstractStatisticAgent
list (a copy of internal agent list)
public Map<String,String> getRequestCustomContextMap(javax.servlet.http.HttpServletRequest request)
Map
which will be merge with existing context if it exists before writing EventData
request
- the current HttpServletRequest
(if null, context map will be get from a ThreadLocal object)
public Map<String,String> getThreadLocalCustomContextMap()
Map
which will be merge with existing context if it exists before writing EventData
context map will be get from a ThreadLocal object
public static void appendEventData(EventData eventData) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, IOException
eventData
- the EventData
to save. Context map will be extended if getRequestCustomContextMap(HttpServletRequest)
or getThreadLocalCustomContextMap()
contains something
org.codehaus.jackson.JsonGenerationException
- thrown when saving EventData
org.codehaus.jackson.map.JsonMappingException
- thrown when saving EventData
IOException
- thrown when saving EventData
public static void appendEventData(EventData eventData, javax.servlet.http.HttpServletRequest request) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, IOException
eventData
- the EventData
to save. Context map will be extended if getRequestCustomContextMap(HttpServletRequest)
or getThreadLocalCustomContextMap()
contains somethingrequest
- the current HttpServletRequest
used to get extendedContextMap. See getRequestCustomContextMap(HttpServletRequest)
for more information
org.codehaus.jackson.JsonGenerationException
- thrown when saving EventData
org.codehaus.jackson.map.JsonMappingException
- thrown when saving EventData
IOException
- thrown when saving EventData
public static void appendEventData(EventData eventData, javax.servlet.http.HttpServletRequest request, File eventDirectory) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, IOException
eventData
- the EventData
to save. Context map will be extended if getRequestCustomContextMap(HttpServletRequest)
or getThreadLocalCustomContextMap()
contains somethingrequest
- the current HttpServletRequest
used to get extendedContextMap getRequestCustomContextMap(HttpServletRequest)
for more informationeventDirectory
- the directory in which event should be saved
org.codehaus.jackson.JsonGenerationException
- thrown when saving EventData
org.codehaus.jackson.map.JsonMappingException
- thrown when saving EventData
IOException
- thrown when saving EventData
public static void appendPageEvent(javax.servlet.http.HttpServletRequest request, long startPageRequest) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, IOException
request
- the current HttpServletRequest
startPageRequest
- the start time of the page request
org.codehaus.jackson.JsonGenerationException
- thrown when saving EventData
org.codehaus.jackson.map.JsonMappingException
- thrown when saving EventData
IOException
- thrown when saving EventData
protected static void appendPageEvent(javax.servlet.http.HttpServletRequest request, long startPageRequest, long endPageRequest, long eventDate, File eventDirectory) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, IOException
request
- the current HttpServletRequest
rstartPageRequest
- the start time of the page requestendPageRequest
- the end time of the page requesteventDate
- the Date of the eventeventDirectory
- the directory in which event should be saved
org.codehaus.jackson.JsonGenerationException
- thrown when saving EventData
org.codehaus.jackson.map.JsonMappingException
- thrown when saving EventData
IOException
- thrown when saving EventData
public static Map<String,String> generateAccessContextMap(javax.servlet.http.HttpServletRequest request, EventData eventData)
public static SortedSet<String> getBrowsers(String userAgent)
public static SortedSet<String> getBots(String userAgent)
public static void processQueries(Map<String,String> ctxMap)
public void runDayAgent(Date startDate, Date endDate, Workspace workspace, String urid, boolean scheduled, boolean globalAnalyze)
startDate
- the start day of the periodendDate
- the end day of the periodworkspace
- Workspace
to limit analyze (null for all workspaces)urid
- the urid used in analysisscheduled
- is the run a manual run or from a schedule (alarm)globalAnalyze
- do global analyze (workspace == null in agent and report)public void runDayAgent(Date startDate, Date endDate, Set<Workspace> workspaceSet, String urid, File eventDirectory, Set<AbstractStatisticAgent> dayAgentList, boolean scheduled, boolean globalAnalyze)
startDate
- the start day of the periodendDate
- the end day of the periodurid
- the urid used in analysisworkspaceSet
- Workspace
Set to limit analyze (null for all workspaces)eventDirectory
- the directory in which events file are presentdayAgentList
- Set
of agent to runscheduled
- is the run a manual run or from alarmglobalAnalyze
- do global analyze (workspace == null in agent and report)public List<AnalyzeListener> getCurrentAnalyzeListener()
List
of AnalyzeListener
public void deleteAnalyze(AnalyzeListener listener)
AnalyzeListener
from the current AnalyzeListener
List
listener
- the AnalyzeListener
to removepublic void initAlarms()
public void reinitAlarms()
public void runDayAgentFromAlarm()
public void runDayAgent()
public static Calendar getUtcTime(Date reportDate, Locale userLocale)
reportDate
- the dateuserLocale
- the locale
public static void completeMetricObjectSet(Set<AbstractReportMetric> originalSet, Date startDate, Date endDate, Locale locale, Class<? extends AbstractReportMetric> clazz) throws InstantiationException, IllegalAccessException
originalSet
- the original Set of AbstractReportMetricstartDate
- the start date of the intervalendDate
- the end date of the intervallocale
- the current locale (used to compute Calendar object)clazz
- AbstractReportMetric subclass to instantiate
IllegalAccessException
- Exception thrown during the execution
InstantiationException
- Exception thrown during the executionpublic static Set<AbstractReportMetric> aggregateAllUrid(Set<AbstractReportMetric> originalSet, Class<? extends AbstractReportMetric> clazz) throws InstantiationException, IllegalAccessException
originalSet
- the original Set of AbstractReportMetricclazz
- AbstractReportMetric subclass to instantiate
IllegalAccessException
- Exception thrown during the execution
InstantiationException
- Exception thrown during the executionpublic static void aggregateKeyIntegerMap(Map<String,Integer> origMap, Map<String,Integer> mapToAdd)
public static void aggregateKeyLongMap(Map<String,Long> origMap, Map<String,Long> mapToAdd)
public static void aggregateDateKeyDoubleMap(Map<Date,Double> origMap, Map<Date,Double> mapToAdd)
public SortedMap<String,Integer> getSortedTopMap(Map<String,Integer> topMap, int nbMaxElt)
public SortedMap<String,Double> getSortedTopDoubleMap(Map<String,Double> topMap, int nbMaxElt)
public static Map<String,ContentTopValue> getDeserializedContentTopMap(Map<String,String> contentTopMap)
ContentTopValue
contentTopMap
- the Map
Map
public static Map<String,String> getSerializedContentTopMap(Map<String,ContentTopValue> contentTopMap)
ContentTopValue
to map of String
contentTopMap
- the Map
Map
public static void aggregateKeyContentTopMap(Map<String,ContentTopValue> origContentTopMap, Map<String,ContentTopValue> mapToAdd)
public static SortedMap<String,ContentTopValue> getSortedContentTopMap(Map<String,ContentTopValue> origContentTopMap, int nbMaxElt)
public static String getActionFromOp(int opAction)
public static boolean isValidOperationAction(String opAction)
public static String getUrlSubString(String value, int maxLength)
public static String toJSON(Object obj)
public static void removeToDayMetric(Set<AbstractReportMetric> originalSet)
originalSet
- the AbstractReportMetric
Set
public static boolean isBot(EventData data)
public static Set<Workspace> getCompatibleWorkspaceSet()
Set
of compatible Workspace
public static Set<Workspace> getCompatibleWorkspaceSet(Member loggedMember)
loggedMember
- Member to check rights
Set
of compatible Workspace
public static Map<String,Map<Date,Double>> normalizeMap(Map<String,Map<Date,Double>> dataMap)
dataMap
- the map to normalize
public static Map<String,Map<Date,Double>> keptBest(Map<String,Map<Date,Double>> dataMap, int nbElement, String othersKey)
dataMap
- the data mapnbElement
- the number of non grouped elementothersKey
- the key of grouped element
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |