org.andromda.core.common
Class ExceptionRecorder

java.lang.Object
  extended by org.andromda.core.common.ExceptionRecorder

public final class ExceptionRecorder
extends Object

ExceptionRecorder provides a function to record an exception to a file along with the trace data if active.

Author:
Martin West, Bob Fields

Field Summary
(package private) static String FILE_HEADER
          File header constant
(package private) static String INFORMATION_UNAVAILABLE
          Information not available constant
(package private) static String RUN_JDK
          Run line jdk constant
(package private) static String RUN_SYSTEM
          Run line system constant
 
Method Summary
 File getExceptionDirectory()
          Returns the directory to which the exceptions are written.
protected  String getUniqueName(String prefix)
          Gets a unique file name.
static ExceptionRecorder instance()
          Gets the shared instance of the ExceptionRecorder.
 String record(String errorMessage, Throwable throwable)
          

Writes out the exception to a file along with trace data if active.

 String record(String message, Throwable throwable, String prefix)
          

Writes out the exception to a file along with trace data if active.

 String record(Throwable throwable)
          

Writes out the exception to a file along with trace data if active.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_HEADER

static final String FILE_HEADER
File header constant

See Also:
Constant Field Values

RUN_SYSTEM

static final String RUN_SYSTEM
Run line system constant

See Also:
Constant Field Values

RUN_JDK

static final String RUN_JDK
Run line jdk constant

See Also:
Constant Field Values

INFORMATION_UNAVAILABLE

static final String INFORMATION_UNAVAILABLE
Information not available constant

See Also:
Constant Field Values
Method Detail

instance

public static ExceptionRecorder instance()
Gets the shared instance of the ExceptionRecorder.

Returns:
the shared ExceptionRecorder instance.

record

public String record(Throwable throwable)

Writes out the exception to a file along with trace data if active. The file name is of the form sYYMMDDHHMMSS <_nn>.exc where YY..SS is the timestamp <_nn>is an ascending sequence number when multiple exceptions occur in the same second. Returns the filename of the generated exception report.

Parameters:
throwable - to record.
Returns:
record("", throwable, "S")

record

public String record(String errorMessage,
                     Throwable throwable)

Writes out the exception to a file along with trace data if active. The file name is of the form sYYMMDDHHMMSS <_nn>.exc where YY..SS is the timestamp <_nn>is an ascending sequence number when multiple exceptions occur in the same second. Returns the filename of the generated exception report.

Parameters:
errorMessage - to log with the exception report.
throwable - to record.
Returns:
record(errorMessage, throwable, "S")

record

public String record(String message,
                     Throwable throwable,
                     String prefix)

Writes out the exception to a file along with trace data if active. The file name is of the form sYYMMDDHHMMSS <_nn>.exc where YY..SS is the timestamp <_nn>is an ascending sequence number when multiple exceptions occur in the same second.

Parameters:
message - diagnostic message
throwable - exception to record.
prefix - for the file name.
Returns:
result string

getUniqueName

protected String getUniqueName(String prefix)
Gets a unique file name.

Parameters:
prefix -
Returns:
uniqueName

getExceptionDirectory

public File getExceptionDirectory()
Returns the directory to which the exceptions are written.

Returns:
the exception directory as a java.io.File instance.


Copyright © 2003-2012 AndroMDA.org. All Rights Reserved.