org.apache.cocoon.profiling.statistics
Class CollectorImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.profiling.statistics.CollectorImpl
All Implemented Interfaces:
Disposable, Component, Contextualizable, LogEnabled, Serviceable, ThreadSafe, Collector, Store

public class CollectorImpl
extends AbstractLogEnabled
implements Collector, Store, ThreadSafe, Serviceable, Disposable, Contextualizable

Implementation for the statistics component. In order to prevent an out of memory exception we implement the Store interface (dummy implementation) so we can register this component with the StoreJanitor component which will invoke this component to free memory in case of low memory.

Since:
2.1.10
Version:
$Id: CollectorImpl.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Field Summary
protected  Context context
          The component context.
protected  boolean isCollecting
          Are we currently collecting?
protected  StoreJanitor janitor
          The store janitor for registering ourself.
protected  ServiceManager manager
          The service manager.
protected  Map pageReports
          All page reports.
protected  Map reports
          All reports.
 
Fields inherited from interface org.apache.excalibur.store.Store
PERSISTENT_STORE, ROLE, TRANSIENT_STORE
 
Constructor Summary
CollectorImpl()
           
 
Method Summary
 void addStatistics(Statistics stats)
          Add a new statistics object.
 void clear()
           
 boolean containsKey(Object arg0)
           
 void contextualize(Context c)
           
 void dispose()
           
 void free()
           
 Object get(Object arg0)
           
 Collection getPageReports()
          Collection of PageReports.
protected  String getRequestKey()
           
 Collection getStatistics()
          Collection of Reports.
 boolean isCollectingStatistics()
           
 Enumeration keys()
           
 void remove(Object arg0)
           
 void service(ServiceManager aManager)
           
 void setCollectingStatistics(boolean value)
           
 int size()
           
 void store(Object arg0, Object arg1)
           
 
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
 

Field Detail

isCollecting

protected boolean isCollecting
Are we currently collecting?


reports

protected Map reports
All reports.


pageReports

protected Map pageReports
All page reports.


janitor

protected StoreJanitor janitor
The store janitor for registering ourself.


manager

protected ServiceManager manager
The service manager.


context

protected Context context
The component context.

Constructor Detail

CollectorImpl

public CollectorImpl()
Method Detail

contextualize

public void contextualize(Context c)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Throws:
ContextException
See Also:
Contextualizable.contextualize(org.apache.avalon.framework.context.Context)

service

public void service(ServiceManager aManager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

dispose

public void dispose()
Specified by:
dispose in interface Disposable
See Also:
Disposable.dispose()

addStatistics

public void addStatistics(Statistics stats)
Description copied from interface: Collector
Add a new statistics object.

Specified by:
addStatistics in interface Collector
See Also:
Collector.addStatistics(org.apache.cocoon.profiling.statistics.Statistics)

getStatistics

public Collection getStatistics()
Description copied from interface: Collector
Collection of Reports.

Specified by:
getStatistics in interface Collector
See Also:
Collector.getStatistics()

getPageReports

public Collection getPageReports()
Description copied from interface: Collector
Collection of PageReports.

Specified by:
getPageReports in interface Collector
See Also:
Collector.getPageReports()

isCollectingStatistics

public boolean isCollectingStatistics()
Specified by:
isCollectingStatistics in interface Collector
See Also:
Collector.isCollectingStatistics()

setCollectingStatistics

public void setCollectingStatistics(boolean value)
Specified by:
setCollectingStatistics in interface Collector
See Also:
Collector.setCollectingStatistics(boolean)

clear

public void clear()
Specified by:
clear in interface Collector
Specified by:
clear in interface Store
See Also:
Collector.clear()

getRequestKey

protected String getRequestKey()

containsKey

public boolean containsKey(Object arg0)
Specified by:
containsKey in interface Store
See Also:
Store.containsKey(java.lang.Object)

free

public void free()
Specified by:
free in interface Store
See Also:
Store.free()

get

public Object get(Object arg0)
Specified by:
get in interface Store
See Also:
Store.get(java.lang.Object)

keys

public Enumeration keys()
Specified by:
keys in interface Store
See Also:
Store.keys()

remove

public void remove(Object arg0)
Specified by:
remove in interface Store
See Also:
Store.remove(java.lang.Object)

size

public int size()
Specified by:
size in interface Store
See Also:
Store.size()

store

public void store(Object arg0,
                  Object arg1)
           throws IOException
Specified by:
store in interface Store
Throws:
IOException
See Also:
Store.store(java.lang.Object, java.lang.Object)


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.