org.andromda.core.common
Class ExceptionRecorder

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

public class ExceptionRecorder
extends java.lang.Object

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

Author:
Martin West

Method Summary
 java.io.File getExceptionDirectory()
          Returns the directory to which the exceptions are written.
protected  java.lang.String getUniqueName(java.lang.String prefix)
          Gets a unique file name.
static ExceptionRecorder instance()
          Gets the shared instance of the ExceptionRecorder.
 java.lang.String record(java.lang.String errorMessage, java.lang.Throwable throwable)
          

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

 java.lang.String record(java.lang.String message, java.lang.Throwable throwable, java.lang.String prefix)
          

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

 java.lang.String record(java.lang.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
 

Method Detail

instance

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

Returns:
the shared ExceptionRecorder instance.

record

public java.lang.String record(java.lang.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.

record

public java.lang.String record(java.lang.String errorMessage,
                               java.lang.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.

record

public java.lang.String record(java.lang.String message,
                               java.lang.Throwable throwable,
                               java.lang.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.

getUniqueName

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


getExceptionDirectory

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

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


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