thinkmap.server
Class StatisticsWrapper

java.lang.Object
  extended by thinkmap.server.StatisticsWrapper
All Implemented Interfaces:
IDataSource

public class StatisticsWrapper
extends Object
implements IDataSource

StatisticsWrapper collects information about a datasource as it runs.

Version:
$Revision: 1.5 $

Constructor Summary
StatisticsWrapper(IDataSource ids, int searchHistory)
          Creates a new StatisticsWrapper object.
 
Method Summary
 IEntityHandler createRequest(IEntityHandler callback)
          Create a request.
 float getAveTime(int messageType)
          Get the average time taken to service requests of the specified type.
 IDataSource getDataSource()
          Get the datasource to collect statistics about.
 long getHits(int messageType)
          Get the number of requests served of the specified type.
 int getMaxTime(int messageType)
          Get the maximum time taken to service a request of the specified type.
 String[] getSearchHistory()
          Get the array of items that have been searched for.
 int getSearchHistorySize()
          Get the maximum number of items stored in the history.
 Element getStatusXML(Document doc)
          Add XML for these statistics to a node
 long getTotalTime(int messageType)
          Get the total time taken to service requests of the specified type.
 void reset()
          Reset all statitics
 void setDataSource(IDataSource ids)
          Set the datasource to collect statistics about.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatisticsWrapper

public StatisticsWrapper(IDataSource ids,
                         int searchHistory)
Creates a new StatisticsWrapper object.

Parameters:
ids - IDatasource to collect statistics about
searchHistory - number of items to keep in history
Method Detail

setDataSource

public void setDataSource(IDataSource ids)
Set the datasource to collect statistics about.

Parameters:
ids - underlying datasource

getDataSource

public IDataSource getDataSource()
Get the datasource to collect statistics about.

Returns:
underlying datasource

getSearchHistorySize

public int getSearchHistorySize()
Get the maximum number of items stored in the history.

Returns:
maximum history size

getSearchHistory

public String[] getSearchHistory()
Get the array of items that have been searched for.

Returns:
search history

getHits

public long getHits(int messageType)
Get the number of requests served of the specified type.

Parameters:
messageType - message type
Returns:
hit count for messageType

getMaxTime

public int getMaxTime(int messageType)
Get the maximum time taken to service a request of the specified type.

Parameters:
messageType - message type
Returns:
maximum time for messageType

getTotalTime

public long getTotalTime(int messageType)
Get the total time taken to service requests of the specified type.

Parameters:
messageType - message type
Returns:
total time taken for messageType

getAveTime

public float getAveTime(int messageType)
Get the average time taken to service requests of the specified type.

Parameters:
messageType - message type
Returns:
average time taken for messageType

createRequest

public IEntityHandler createRequest(IEntityHandler callback)
Description copied from interface: IDataSource
Create a request. The server and client's IEntityHandlers are linked.

Specified by:
createRequest in interface IDataSource
Parameters:
callback - The IEntityHandler that will recieve the response.
Returns:
The IEntityHandler for sending a request.

reset

public void reset()
Reset all statitics


getStatusXML

public Element getStatusXML(Document doc)
Add XML for these statistics to a node



Copyright © 2013 Thinkmap, Inc. All Rights Reserved.