Class s2iError

java.lang.Object
  |
  +--s2iError

public class s2iError
extends java.lang.Object

A class for reporting SpiTran messages using any combination of a modal dialog, a log file, and stdout printing.

Author:
Anish Malhotra, Cadence Design Systems
See Also:
s2iDBOpenListener

Field Summary
private static boolean DBG_MSG
          Show DEBUG messages?
static int DEBUG
          This is a debug message, only shown in debug mode.
static int DISPLAY
          Show the message in stdout.
private static java.lang.String DLG_TITLE
          Title for popup dialog windows.
static int ERR
          This is an error message.
static int FATAL
          This is a fatal error message.
static int INFO
          This is an information message.
static int LOG
          Show the message the SpiTran.log file.
private static java.io.PrintWriter logFile
          The log file.
static java.lang.String LogFileName
          Name of the log file.
private static boolean logOpen
          Is the log file open?
private static int MAXLOGS
          Number of log file versions to archive.
static int N_SEVERITIES
          The highest severity code allowed.
static int POPUP
          Show the message in a popup modal dialog.
static int QUEST
          This is a question message, requiring a response.
private static java.lang.String[] SEV_STR
          Vector of message prefix strings for each severity level.
static int WARN
          This is a warning message.
 
Constructor Summary
s2iError()
           
 
Method Summary
(package private) static void ()
           
(package private) static void ()
           
static void closeLog()
          Close the log file.
static void Debug(java.lang.String msg)
          Show a debug message.
static boolean IsLogOpen()
          Determine if the log file is open.
static void main(java.lang.String[] args)
          Test the s2iError class.
private static void mvLogs()
          Archive previous log files by renaming them with number suffixes.
private static java.lang.String nxtLogName(java.lang.String Name)
          Does the following conversion: SpiTran.log --> SpiTran.log,1 --> SpiTran.log,2 --> SpiTran.log,3
private static boolean openLog()
          Open an existing Log File and appends to it.
static boolean openNewLog()
          Open the log file.
private static void PrintDlgMsg(java.lang.String Msg, int severity, java.awt.Component parent)
          Show a message in a dialog box.
private static void PrintLogMsg(java.lang.String Msg, int severity)
          Show a message by printing to stdout.
static void PrintMsg(java.lang.String Msg, int severity, int Options, java.awt.Component parent)
          Show a message using all specified means.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

POPUP

public static final int POPUP
Show the message in a popup modal dialog.

LOG

public static final int LOG
Show the message the SpiTran.log file.

DISPLAY

public static final int DISPLAY
Show the message in stdout.

DEBUG

public static final int DEBUG
This is a debug message, only shown in debug mode.

QUEST

public static final int QUEST
This is a question message, requiring a response.

INFO

public static final int INFO
This is an information message.

WARN

public static final int WARN
This is a warning message.

ERR

public static final int ERR
This is an error message.

FATAL

public static final int FATAL
This is a fatal error message. The application will quit.

N_SEVERITIES

public static final int N_SEVERITIES
The highest severity code allowed.

SEV_STR

private static final java.lang.String[] SEV_STR
Vector of message prefix strings for each severity level.

LogFileName

public static final java.lang.String LogFileName
Name of the log file.

logFile

private static java.io.PrintWriter logFile
The log file.

DLG_TITLE

private static final java.lang.String DLG_TITLE
Title for popup dialog windows.

MAXLOGS

private static final int MAXLOGS
Number of log file versions to archive.

logOpen

private static boolean logOpen
Is the log file open?

DBG_MSG

private static final boolean DBG_MSG
Show DEBUG messages?
Constructor Detail

s2iError

public s2iError()
Method Detail

static void ()

static void ()

Debug

public static final void Debug(java.lang.String msg)
Show a debug message. This is printed to the log and stdout if in DEBUG mode.
Parameters:
Msg - The debug message String

PrintMsg

public static final void PrintMsg(java.lang.String Msg,
                                  int severity,
                                  int Options,
                                  java.awt.Component parent)
Show a message using all specified means.
Parameters:
Msg - The message String
The - severity level, one of: DEBUG QUEST INFO WARN ERR FATAL
Options - Any combination of: POPUP LOG DISPLAY
parent - Determines the Frame in which the dialog is displayed. If null, or if the parent Component has no Frame, a default Frame is used.

PrintDlgMsg

private static final void PrintDlgMsg(java.lang.String Msg,
                                      int severity,
                                      java.awt.Component parent)
Show a message in a dialog box.
Parameters:
Msg - The message String
The - severity level, one of: DEBUG QUEST INFO WARN ERR FATAL
parent - Determines the Frame in which the dialog is displayed. If null, or if the parent Component has no Frame, a default Frame is used.

PrintLogMsg

private static final void PrintLogMsg(java.lang.String Msg,
                                      int severity)
Show a message by printing to stdout.
Parameters:
Msg - The message String
The - severity level, one of: DEBUG QUEST INFO WARN ERR FATAL

nxtLogName

private static java.lang.String nxtLogName(java.lang.String Name)
Does the following conversion: SpiTran.log --> SpiTran.log,1 --> SpiTran.log,2 --> SpiTran.log,3
Parameters:
Name - Name String of the current log file.
Returns:
Name String of the next log file.

mvLogs

private static final void mvLogs()
Archive previous log files by renaming them with number suffixes.

openLog

private static final boolean openLog()
Open an existing Log File and appends to it. Not Yet implemented - hence private.

openNewLog

public static final boolean openNewLog()
                                throws java.io.IOException
Open the log file. This archives previous log files and starts a new one.
Returns:
true if the file was opened
Throws:
java.io.IOException -  

closeLog

public static final void closeLog()
Close the log file.

IsLogOpen

public static final boolean IsLogOpen()
Determine if the log file is open.
Returns:
true if the log file is currently open.

main

public static void main(java.lang.String[] args)
Test the s2iError class.
Parameters:
args - unused