com.sun.jini.tool.envcheck
Class Reporter

java.lang.Object
  extended by com.sun.jini.tool.envcheck.Reporter

public abstract class Reporter
extends Object

A class which provides a standard way to report the results of a test.


Nested Class Summary
static class Reporter.Message
          A container of message information to be processed by Reporter.
 
Field Summary
static int ERROR
          the level at which error messages are generated
private static int errorCount
          the error count
private static boolean explain
          flag controlling display of explanation text
private static HashSet explanationsGiven
          table of explanations which have been output, to inhibit duplicates
static int INFO
          the level at which information messages are generated
private static String[] msgHeaders
          the header labels for the test result records
private static int reportingLevel
          the display reportingLevel
private static String sourceString
          the header label for the source record
private static boolean traces
          flag controlling printing stack traces
static int WARNING
          the level at which warning messages are generated
private static int warningCount
          the warning count
 
Constructor Summary
private Reporter()
           
 
Method Summary
static int getErrorCount()
          Get the total number of error records that were generated.
static int getWarningCount()
          Get the total number of warning records that were generated.
static void print(Reporter.Message message)
          Generate the output for message .
static void print(Reporter.Message message, String source)
          Generate the output for message.
private static void printExplanation(Reporter.Message message)
          Output the explanation text supplied by message.
static void setExplanation(boolean explain)
          Set the explanation generation flag;
static void setLevel(int level)
          Set the reporting level.
static void setPrintTraces(boolean traces)
          Set the flag controlling printing of stack traces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INFO

public static final int INFO
the level at which information messages are generated

See Also:
Constant Field Values

WARNING

public static final int WARNING
the level at which warning messages are generated

See Also:
Constant Field Values

ERROR

public static final int ERROR
the level at which error messages are generated

See Also:
Constant Field Values

sourceString

private static String sourceString
the header label for the source record


msgHeaders

private static String[] msgHeaders
the header labels for the test result records


explain

private static boolean explain
flag controlling display of explanation text


reportingLevel

private static int reportingLevel
the display reportingLevel


warningCount

private static int warningCount
the warning count


errorCount

private static int errorCount
the error count


traces

private static boolean traces
flag controlling printing stack traces


explanationsGiven

private static HashSet explanationsGiven
table of explanations which have been output, to inhibit duplicates

Constructor Detail

Reporter

private Reporter()
Method Detail

setLevel

public static void setLevel(int level)
Set the reporting level. No validity checks are done.

Parameters:
level - the max level to generate output

setExplanation

public static void setExplanation(boolean explain)
Set the explanation generation flag;

Parameters:
explain - the value to set the flag to

setPrintTraces

public static void setPrintTraces(boolean traces)
Set the flag controlling printing of stack traces.

Parameters:
traces - if true, print stack traces

print

public static void print(Reporter.Message message)
Generate the output for message . This method is silent if the message level is less than reportLevel. If explain is true, the explanation text will be output only the first time it is encountered.

Parameters:
message - the Message to print

print

public static void print(Reporter.Message message,
                         String source)
Generate the output for message. This method is silent if the message level is less than Reporter.level. If Reporter.explain is true, the explanation text will be output only the first time it is encountered. If source is null, the source record is not output. If the message level is error or warning, the appropriate counter is updated.

Parameters:
message - the Message to print
source - additional information identifying the component under test

printExplanation

private static void printExplanation(Reporter.Message message)
Output the explanation text supplied by message. If there is no explanation text, or if the text has been output previously, this method returns. Otherwise the text is output. Formatting is applied if message.formatExplanation() returns true.

Parameters:
message - the Message to explain

getWarningCount

public static int getWarningCount()
Get the total number of warning records that were generated.

Returns:
the warning count

getErrorCount

public static int getErrorCount()
Get the total number of error records that were generated.

Returns:
the error count


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.