Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.further.jaudit
Class SystemConfiguration  view SystemConfiguration download SystemConfiguration.java

java.lang.Object
  extended bycom.further.jaudit.SystemConfiguration

public class SystemConfiguration
extends java.lang.Object

The system configuration holds the static configuration for the audit system, including what metrics are collected and what their names are, and the base directory of the source tree that is to be audited. The configuration itself is done using XML and parsed using xerces SAX2 parser. DTD and an example configuration are in jaudit/resource/xml.

Since:
1.0
Version:
$Id: SystemConfiguration.java,v 1.1.1.1 2001/10/11 16:42:08 krisw Exp $

Nested Class Summary
private static class SystemConfiguration.ConfigurationHandler
          Configuration file parser handler.
private static class SystemConfiguration.MetricCreator
          The metric creator is responsible for receiving raw unparsed string values from the SAX parser, then assembling them to produce concrete metric instances.
 
Field Summary
private static long auditFrequency
          The number of milliseconds between source audits.
private static java.lang.String backgroundColor
          The user specified background color
private static org.apache.log4j.Category category
          log4j audit channel
private static java.lang.String commentColor
          The user specified comment color
private static java.lang.String failedAuditColor
          The color for a file that has failed audit
private static java.lang.String foregroundColor
          The user specified foreground color
private static boolean formatSource
          Should the output source be formatted using a pretty printer, or should it come out as text/plain
private static java.util.Set ignoredDirectories
          The set of ignored directories when doing a directory listing.
private static java.lang.String keywordColor
          The user specified keyword color
private static java.lang.String linkColor
          The color for links in the html page
private static java.util.Map metricCreatorMap
          The map of active MetricCreator objects in the system.
private static java.lang.String passedAuditColor
          The color for a file that has passed audit
private static java.lang.String rootSourceDirectory
          The root source directory.
private static java.lang.String unauditedColor
          The color for a file that needs to be audited, either due to age or complete lack of all audits
private static java.lang.String vlinkColor
          The color for viewed links in the html output
 
Constructor Summary
private SystemConfiguration()
          SystemConfiguration objects are not creatable.
 
Method Summary
private static void addIgnoredDirectory(java.lang.String directory)
          Set the given directory name as an ignored directory, so it will not show up in source listings.
static SourceMetric createMetric(java.lang.String id)
          Create a metric for a given metric abbreviation.
static java.util.List createMetrics()
          Create a new set of metrics, initializing defaults and ranges.
static long getAuditFrequency()
          Retreive the audit frequency for the source files in milliseconds.
static java.lang.String getBackgroundColor()
          Get the background color that the user selected.
static java.lang.String getCommentColor()
          Get the comment color that the user selected.
static java.lang.String getFailedAuditColor()
          Get the failing audit color the user selected
static java.lang.String getForegroundColor()
          Get the foreground color that the user selected, in the format XXXXXX, which is the hex RGB of the color without the leading #
static boolean getFormatSource()
          Should the displayed source code be formatted using a pretty printer, or should it be displayed entirely unformatted as text/plain?
static java.lang.String getKeywordColor()
          Get the keyword color that the user selected.
static java.lang.String getLinkColor()
          Get the link color that the user selected.
static java.lang.String getPassedAuditColor()
          Get the passing audit color the user selected
static java.lang.String getRootSourceDirectory()
          Retreive the root directory for the source code to collect metrics for.
static java.lang.String getUnauditedColor()
          Get the unaudited color the user selected
static java.lang.String getVlinkColor()
          Get the vlink color that the user selected.
static boolean isIgnoredDirectory(java.lang.String directory)
          Is the given directory an ignored directory? If it is ignored, it should not show up in directory listings.
static void parseConfiguration(java.lang.String configurationFile)
          Load the configuration file at the given path.
private static void validateConfiguration()
          Validate the entire set of metric creators and the root source directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

category

private static org.apache.log4j.Category category
log4j audit channel


rootSourceDirectory

private static java.lang.String rootSourceDirectory
The root source directory. Every directory under this directory is assumed to contain source, and all files in this directory are candidates for audit if they have the correct file extension.


ignoredDirectories

private static java.util.Set ignoredDirectories
The set of ignored directories when doing a directory listing. This is used, among other things, to ignore the CVS directories that many projects have


formatSource

private static boolean formatSource
Should the output source be formatted using a pretty printer, or should it come out as text/plain


auditFrequency

private static long auditFrequency
The number of milliseconds between source audits. An audit older than this value is flagged as "expired", and the file is considered to be equivilent to unaudited


foregroundColor

private static java.lang.String foregroundColor
The user specified foreground color


backgroundColor

private static java.lang.String backgroundColor
The user specified background color


keywordColor

private static java.lang.String keywordColor
The user specified keyword color


commentColor

private static java.lang.String commentColor
The user specified comment color


passedAuditColor

private static java.lang.String passedAuditColor
The color for a file that has passed audit


failedAuditColor

private static java.lang.String failedAuditColor
The color for a file that has failed audit


unauditedColor

private static java.lang.String unauditedColor
The color for a file that needs to be audited, either due to age or complete lack of all audits


linkColor

private static java.lang.String linkColor
The color for links in the html page


vlinkColor

private static java.lang.String vlinkColor
The color for viewed links in the html output


metricCreatorMap

private static java.util.Map metricCreatorMap
The map of active MetricCreator objects in the system. These are built during configuration parsing, then used in the factory methods to create the metric sets used in the system. The map keys are the metric abbreviations and the values are the MetricCreators.

Constructor Detail

SystemConfiguration

private SystemConfiguration()
SystemConfiguration objects are not creatable. All public functionality of the SystemConfiguration is accessed through static functions.

Method Detail

addIgnoredDirectory

private static void addIgnoredDirectory(java.lang.String directory)
Set the given directory name as an ignored directory, so it will not show up in source listings.


isIgnoredDirectory

public static boolean isIgnoredDirectory(java.lang.String directory)
Is the given directory an ignored directory? If it is ignored, it should not show up in directory listings.


validateConfiguration

private static void validateConfiguration()
                                   throws ConfigurationException
Validate the entire set of metric creators and the root source directory. This is done at bootstrap to ensure configuration integrity, and causes the system to not start up if it fails. Once run, we can be sure that the metric creators are logically consistent and can be used in the factory methods.


getAuditFrequency

public static long getAuditFrequency()
Retreive the audit frequency for the source files in milliseconds. If the source file audit is older than this value, the file should be reaudited.


getFormatSource

public static boolean getFormatSource()
Should the displayed source code be formatted using a pretty printer, or should it be displayed entirely unformatted as text/plain?


getRootSourceDirectory

public static java.lang.String getRootSourceDirectory()
Retreive the root directory for the source code to collect metrics for. This is the base of the source directory, and must exist.


getForegroundColor

public static java.lang.String getForegroundColor()
Get the foreground color that the user selected, in the format XXXXXX, which is the hex RGB of the color without the leading #


getBackgroundColor

public static java.lang.String getBackgroundColor()
Get the background color that the user selected.


getLinkColor

public static java.lang.String getLinkColor()
Get the link color that the user selected.


getVlinkColor

public static java.lang.String getVlinkColor()
Get the vlink color that the user selected.


getKeywordColor

public static java.lang.String getKeywordColor()
Get the keyword color that the user selected.


getCommentColor

public static java.lang.String getCommentColor()
Get the comment color that the user selected.


getPassedAuditColor

public static java.lang.String getPassedAuditColor()
Get the passing audit color the user selected


getFailedAuditColor

public static java.lang.String getFailedAuditColor()
Get the failing audit color the user selected


getUnauditedColor

public static java.lang.String getUnauditedColor()
Get the unaudited color the user selected


createMetrics

public static java.util.List createMetrics()
Create a new set of metrics, initializing defaults and ranges. This set is determined by the system configuration, and will be used for all source audits in the system.


createMetric

public static SourceMetric createMetric(java.lang.String id)
Create a metric for a given metric abbreviation. This is the simple factory method used for individual metric creation.


parseConfiguration

public static void parseConfiguration(java.lang.String configurationFile)
                               throws ConfigurationException
Load the configuration file at the given path. This loads all the system configuration data, including the metric types to load, and all of the source directory paths.