|
|||||||||
| Home >> All >> com >> further >> jaudit >> [ http overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.further.jaudit.http
Class StatisticsBean

java.lang.Objectcom.further.jaudit.http.StatisticsBean
- public class StatisticsBean
- extends java.lang.Object
The statistics bean is responsible for iterating the entire source base and compiling summary statistics about the source files. These stats include:
- Number of files
- Percent of files that have been audited
- Percent of files that are compliant (passing audit)
- Minimum audit age
- Maximum audit age
- For each metric, what percent of files have each value.
- Since:
- 1.0
- Version:
- $Id: StatisticsBean.java,v 1.1.1.1 2001/10/11 16:42:10 krisw Exp $
| Field Summary | |
private int |
auditCount
The number of files in the system that have been audited at least once |
private java.util.Set |
auditDateSet
The set of audit dates for all the files in the system, for the last registered audit. |
private org.apache.log4j.Category |
category
log4j audit debugging channel |
private int |
compliantCount
The number of files in the system that passed their last registered audit |
private int |
fileCount
The number of files in the system |
private java.util.Map |
fullNameMap
A map of metric abbreviations to metric full names. |
private java.util.Map |
metricMap
The map of metrics. |
private com.further.jaudit.SourceDirectory |
rootDirectory
The root source directory being traversed. |
| Constructor Summary | |
StatisticsBean()
Create a new StatisticsBean. |
|
| Method Summary | |
private void |
buildStatistics(com.further.jaudit.SourceFile sourceFile)
Build the statistics for an individual source file. |
void |
compileStatistics()
The compile statistics method causes the statistics bean to traverse the the entire source tree and build the statistics for the sourcebase. |
java.lang.String |
getAuditPercent()
Get the number of files in the system that have been audited. |
java.lang.String |
getCompliantPercent()
Get the percentage of files in the system whose last audit was compliant. |
int |
getFileCount()
Get the number of files in the system. |
java.lang.String |
getFilePercentage(java.lang.String id,
java.lang.String value)
Get the percentage of files that have the given metric value, for the specified metric id and metric value. |
java.lang.String |
getFullName(java.lang.String id)
Get the full name of the given metric from the metric abbreviation. |
java.util.Iterator |
getMetricIterator()
Get an iterator over the defined metrics in the system. |
java.util.Date |
getNewestAuditDate()
Get the newest audit date from the entire set of audit dates for the files in the system. |
private com.further.jaudit.AuditRecord |
getNewestAuditRecord(java.util.List auditRecords)
Retreive the newest audit record from the given list of audit records. |
java.util.Date |
getOldestAuditDate()
Get the oldest audit date from the entire set of audit dates for the files in the system. |
java.util.Iterator |
getValuesIterator(java.lang.String id)
Get an iterator over the values of a particular metric. |
private void |
incrementMetricCount(java.lang.String id,
java.lang.String value)
Increment the count of a given metric value and metric id. |
private void |
traverseDirectory(com.further.jaudit.SourceDirectory sourceDirectory)
The recursive call to traverse the source files in a given directory. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
category
private org.apache.log4j.Category category
- log4j audit debugging channel
fileCount
private int fileCount
- The number of files in the system
auditCount
private int auditCount
- The number of files in the system that have been audited at least once
compliantCount
private int compliantCount
- The number of files in the system that passed their last registered audit
auditDateSet
private java.util.Set auditDateSet
- The set of audit dates for all the files in the system, for the last
registered audit.
metricMap
private java.util.Map metricMap
- The map of metrics. Each key in this map is a string metric abbreviation,
and each value is another HashMap. The keys in the target map are the
metric values and the values in the map are the count of files that have
that value for the metric (as an Integer).
rootDirectory
private com.further.jaudit.SourceDirectory rootDirectory
- The root source directory being traversed. This is independent of the
current directory in the DirectoryBean
fullNameMap
private java.util.Map fullNameMap
- A map of metric abbreviations to metric full names. This is built
at construction time from the list of metrics in the system, and queried
to build the statistics display page.
| Constructor Detail |
StatisticsBean
public StatisticsBean()
- Create a new StatisticsBean. This is the required empty constructor
to use the bean from a jsp. Use compileStatistics()
in order to prepare the statistics.
| Method Detail |
getFileCount
public int getFileCount()
- Get the number of files in the system. This is the compiled count
of all the individual source files in all the directories.
getAuditPercent
public java.lang.String getAuditPercent()
- Get the number of files in the system that have been audited. This
is the files that have ever had an audit registered, rather than
the files that have a current audit.
getCompliantPercent
public java.lang.String getCompliantPercent()
- Get the percentage of files in the system whose last audit was compliant.
That is, the number of files that do not need to be modified to
bring them up to compliance.
getNewestAuditDate
public java.util.Date getNewestAuditDate()
- Get the newest audit date from the entire set of audit dates for the
files in the system.
getOldestAuditDate
public java.util.Date getOldestAuditDate()
- Get the oldest audit date from the entire set of audit dates for the
files in the system.
getMetricIterator
public java.util.Iterator getMetricIterator()
- Get an iterator over the defined metrics in the system. The values
returned by the iterator are string keys that can be used to access
the values for that metric and what percentage of source files have
that metric value
getValuesIterator
public java.util.Iterator getValuesIterator(java.lang.String id)
- Get an iterator over the values of a particular metric. This iterator
returns string values that can be used (along with the metric id) to
retreive the percentage of files that have that given metric value
getFilePercentage
public java.lang.String getFilePercentage(java.lang.String id, java.lang.String value)
- Get the percentage of files that have the given metric value, for the
specified metric id and metric value. This returns a floating point
percentage between 0.0 and 100.0
traverseDirectory
private void traverseDirectory(com.further.jaudit.SourceDirectory sourceDirectory) throws java.io.IOException
- The recursive call to traverse the source files in a given directory.
This first calls itself on all subdirectories in the directory, then
iterates over all the files in the directory compiling the statistics
for those files.
buildStatistics
private void buildStatistics(com.further.jaudit.SourceFile sourceFile)
- Build the statistics for an individual source file. This method was
refactored out for readabilitys sake from traverseDirectory, and is
only called from there.
getNewestAuditRecord
private com.further.jaudit.AuditRecord getNewestAuditRecord(java.util.List auditRecords)
- Retreive the newest audit record from the given list of audit
records. This does a simple O(n) pass over the list of audit records,
assuming they are stored unorderd.
incrementMetricCount
private void incrementMetricCount(java.lang.String id, java.lang.String value)
- Increment the count of a given metric value and metric id. This method
updates the metricMap to increment the integer value at the value entry
if it exists, and sets it to 1 if it does not.
getFullName
public java.lang.String getFullName(java.lang.String id)
- Get the full name of the given metric from the metric abbreviation.
This is used for displaying the statistics summary in stats.jsp
compileStatistics
public void compileStatistics()
throws java.io.IOException
- The compile statistics method causes the statistics bean to traverse the
the entire source tree and build the statistics for the sourcebase. This
is the one driver method that must be called before querying the statistics
for display
|
|||||||||
| Home >> All >> com >> further >> jaudit >> [ http overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.further.jaudit.http.StatisticsBean