Class ServersCacheStatsGenerator
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.xml.AbstractXMLProducer
-
- org.apache.cocoon.generation.AbstractGenerator
-
- org.apache.cocoon.generation.ServiceableGenerator
-
- org.ametys.web.cache.monitoring.ui.ServersCacheStatsGenerator
-
- All Implemented Interfaces:
Poolable,Recyclable,Disposable,Component,LogEnabled,Serviceable,Generator,SitemapModelComponent,XMLProducer
public class ServersCacheStatsGenerator extends ServiceableGenerator
Cache stats generator grouping data collected across each server cache (http server/front/back)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classServersCacheStatsGenerator.BackStatsEntryObject model representing an entry of stats for a back resource (ie.protected classServersCacheStatsGenerator.FrontFromFrontStatsEntryObject model representing an entry of stats for a front resource, coming from the Front (direct request to tomcat, bypassing any HTTP server if any).protected classServersCacheStatsGenerator.FrontFromHTTPServerStatsEntryObject model representing an entry of stats for a front resource, coming from httpserverprotected classServersCacheStatsGenerator.RawStatsEntryObject model representing a raw entry of stats retrieved through the DB.
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,ServersCacheStatsGenerator.BackStatsEntry>_backStatsMap containing back stats entries classified by pathprotected Map<String,Map<String,ServersCacheStatsGenerator.FrontFromFrontStatsEntry>>_fromFrontOnlyStatsMultimap containing (only) front stats entries classified by site name and pathprotected Map<String,Map<String,ServersCacheStatsGenerator.FrontFromHTTPServerStatsEntry>>_fromHTTPServerStatsMultimap containing httpserver stats entries classified by site name and pathprotected Map<String,Multimap<String,String>>_pathMapsMultimaps representing the all the paths to the resources in a recursive way.protected Multimap<String,String>_pathSanitizerThis multimap associates site names to a list of prefix.protected ResourceStatisticsComponent_resourceStatisticsCmpResource statistics componentprotected SiteManager_siteManagerAmetys resolverprotected static String[]_SPECIAL_PATH_PREFIXSList of paths used to during the sanitize process of the server path-
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
manager
-
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
-
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
-
-
Constructor Summary
Constructors Constructor Description ServersCacheStatsGenerator()
-
Method Summary
-
Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
dispose
-
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
setup
-
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
-
-
-
-
Field Detail
-
_SPECIAL_PATH_PREFIXS
protected static final String[] _SPECIAL_PATH_PREFIXS
List of paths used to during the sanitize process of the server path
-
_resourceStatisticsCmp
protected ResourceStatisticsComponent _resourceStatisticsCmp
Resource statistics component
-
_siteManager
protected SiteManager _siteManager
Ametys resolver
-
_pathSanitizer
protected Multimap<String,String> _pathSanitizer
This multimap associates site names to a list of prefix. This is needed to sanitize the server path.
-
_pathMaps
protected Map<String,Multimap<String,String>> _pathMaps
Multimaps representing the all the paths to the resources in a recursive way. The map key's are the site names.
-
_fromHTTPServerStats
protected Map<String,Map<String,ServersCacheStatsGenerator.FrontFromHTTPServerStatsEntry>> _fromHTTPServerStats
Multimap containing httpserver stats entries classified by site name and path
-
_fromFrontOnlyStats
protected Map<String,Map<String,ServersCacheStatsGenerator.FrontFromFrontStatsEntry>> _fromFrontOnlyStats
Multimap containing (only) front stats entries classified by site name and path
-
_backStats
protected Map<String,ServersCacheStatsGenerator.BackStatsEntry> _backStats
Map containing back stats entries classified by path
-
-
Constructor Detail
-
ServersCacheStatsGenerator
public ServersCacheStatsGenerator()
-
-
Method Detail
-
service
public void service(ServiceManager sm) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classServiceableGenerator- Throws:
ServiceException
-
generate
public void generate() throws IOException, SAXException, ProcessingException
-
recycle
public void recycle()
- Specified by:
recyclein interfaceRecyclable- Overrides:
recyclein classAbstractGenerator
-
_getStatsFromDb
private List<ServersCacheStatsGenerator.RawStatsEntry> _getStatsFromDb(String siteName) throws ProcessingException
Retrieves raw statistics information- Parameters:
siteName- The site name- Returns:
- a list of
ServersCacheStatsGenerator.RawStatsEntry - Throws:
ProcessingException- if an error occurs
-
_processCacheStatsResultSet
private List<ServersCacheStatsGenerator.RawStatsEntry> _processCacheStatsResultSet(List<Map<String,Object>> rawCacheStats) throws SQLException
- Throws:
SQLException
-
_initializeStats
private void _initializeStats(List<ServersCacheStatsGenerator.RawStatsEntry> rawStats)
Organize the different Map of stats- Parameters:
rawStats- the raw statistics
-
_addToHTTPServerStats
private void _addToHTTPServerStats(ServersCacheStatsGenerator.FrontFromHTTPServerStatsEntry httpServerEntry)
-
_addToFrontOnlyStats
private void _addToFrontOnlyStats(ServersCacheStatsGenerator.FrontFromFrontStatsEntry frontEntry)
-
_registerPath
private void _registerPath(String serverSite, String path)
-
_internalRegisterPath
private void _internalRegisterPath(Multimap<String,String> pathMap, String consumed, LinkedList<String> tail)
Populate the path map using recursion.- Parameters:
pathMap- Multimap representing the paths to the resources within a site.consumed- the consumed part of the current path being registered.tail- tail of the current path being registered. The tail will be consumed in the recursive nested calls of this internal function.
-
_saxStatsBySite
private void _saxStatsBySite(Site site) throws SAXException
- Throws:
SAXException
-
_saxStatsEntry
private void _saxStatsEntry(String name, String path, Multimap<String,String> pathMap, Map<String,ServersCacheStatsGenerator.FrontFromHTTPServerStatsEntry> httpServerEntries, Map<String,ServersCacheStatsGenerator.FrontFromFrontStatsEntry> frontEntries) throws SAXException
- Throws:
SAXException
-
_saxStatsHTTPServerEntry
private void _saxStatsHTTPServerEntry(ServersCacheStatsGenerator.FrontFromHTTPServerStatsEntry httpServerEntry) throws SAXException
- Throws:
SAXException
-
_saxStatsFrontEntry
private void _saxStatsFrontEntry(ServersCacheStatsGenerator.FrontFromFrontStatsEntry frontEntry) throws SAXException
- Throws:
SAXException
-
_saxStatsBackEntry
private void _saxStatsBackEntry(ServersCacheStatsGenerator.BackStatsEntry backEntry) throws SAXException
- Throws:
SAXException
-
_saxStatsOrphanEntries
private void _saxStatsOrphanEntries() throws SAXException
- Throws:
SAXException
-
__addAttrIfNotNull
private void __addAttrIfNotNull(AttributesImpl attrs, String localName, String value)
-
__addAttrIfNotNull
private void __addAttrIfNotNull(AttributesImpl attrs, String localName, Boolean value)
-
-