org.sape.carbon.core.exception
Class DefaultExceptionDelegateImpl

java.lang.Object
  |
  +--org.sape.carbon.core.exception.DefaultExceptionDelegateImpl
All Implemented Interfaces:
ExceptionDelegate, Serializable
Direct Known Subclasses:
GUIExceptionDelegate

public class DefaultExceptionDelegateImpl
extends Object
implements ExceptionDelegate

This is the default implementation of the exception delegate interface to support basic exception handling as well as auto-logging of the exception.

Copyright 2002 Sapient

Since:
carbon 1.0
Version:
$Revision: 1.13 $($Author: dvoet $ / $Date: 2003/05/05 21:21:21 $)
Author:
Greg Hinkle, April 2002
See Also:
Serialized Form

Field Summary
private  Throwable cause
          The cause or previous exception of this exception.
private  Throwable delegatee
          The exception object that this object is acting as the delegate for.
private  Class exceptionSource
          The source indicates the class and optionally the method from which this exception originated.
private  String message
          The string message for this exception.
private  SeverityEnum severity
          The severity of this exception (how bad it was).
 
Constructor Summary
DefaultExceptionDelegateImpl()
          Default public constructor.
 
Method Summary
 Throwable getCause()
          Gets the previousException
 String getClassName()
          Returns the class name of the underlying exception.
 Throwable getDelegatee()
          Gets the deleagatee
 Class getExceptionSource()
          Returns the producerId of the underlying exception.
 String getMessage()
          calls toString
 SeverityEnum getSeverity()
          Returns te severity of the underlying exception.
 void handleException()
          This implementations handles the exception by logging its stack trace printout to the static logging service.
 void setCause(Throwable cause)
          Sets the causal or previous exception of the current exception being handled by this delegate.
 void setDelegatee(Throwable delegatee)
          Sets the throwable which is requesting the creation of this delegate.
 void setExceptionSource(Class exceptionSource)
          This is the class and method from which this exception eminates.
 void setMessage(String message)
          Sets the string explanation of this exception
 void setSeverity(SeverityEnum severity)
          Sets the severity of the exception.
 String toString()
          This method builds a recursive view of this exception and its message as well as its cause or previous exception and so on.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

delegatee

private Throwable delegatee
The exception object that this object is acting as the delegate for.


message

private String message
The string message for this exception.


cause

private Throwable cause
The cause or previous exception of this exception.


exceptionSource

private Class exceptionSource
The source indicates the class and optionally the method from which this exception originated.


severity

private SeverityEnum severity
The severity of this exception (how bad it was).

Constructor Detail

DefaultExceptionDelegateImpl

public DefaultExceptionDelegateImpl()
Default public constructor.

Method Detail

handleException

public void handleException()
This implementations handles the exception by logging its stack trace printout to the static logging service.

Specified by:
handleException in interface ExceptionDelegate

getCause

public Throwable getCause()
Gets the previousException

Specified by:
getCause in interface ExceptionDelegate
Returns:
String - previousException

getSeverity

public SeverityEnum getSeverity()
Returns te severity of the underlying exception.

Specified by:
getSeverity in interface ExceptionDelegate
Returns:
int The severity of the underlying exception.

getExceptionSource

public Class getExceptionSource()
Returns the producerId of the underlying exception.

Specified by:
getExceptionSource in interface ExceptionDelegate
Returns:
int The producerId of the underlying exception.

getClassName

public String getClassName()
Returns the class name of the underlying exception.

Returns:
String The class name of the underlying exception.

getMessage

public String getMessage()
calls toString

Specified by:
getMessage in interface ExceptionDelegate
Returns:
String - an error string based on exception's values

getDelegatee

public Throwable getDelegatee()
Gets the deleagatee

Specified by:
getDelegatee in interface ExceptionDelegate
Returns:
The exception that is using this delegate

setCause

public void setCause(Throwable cause)
Sets the causal or previous exception of the current exception being handled by this delegate. This helps support the Exception Levelization pattern in which exceptions can be wrapped in other exceptions to create a common and consistent interface for a particular service as well as complete encapsulation of the implementation of that service.

Specified by:
setCause in interface ExceptionDelegate
Parameters:
cause - The causal or previous exception

setDelegatee

public void setDelegatee(Throwable delegatee)
Sets the throwable which is requesting the creation of this delegate.

Specified by:
setDelegatee in interface ExceptionDelegate
Parameters:
delegatee - the delegatee this delegate is working for

setMessage

public void setMessage(String message)
Sets the string explanation of this exception

Specified by:
setMessage in interface ExceptionDelegate
Parameters:
message - The string explanation of this exception

setSeverity

public void setSeverity(SeverityEnum severity)
Sets the severity of the exception. This is used to determine how bad an exception is and is also used to integrate with the logging service during the default handling of an exception.

Specified by:
setSeverity in interface ExceptionDelegate
Parameters:
severity - the Severity of the exception

setExceptionSource

public void setExceptionSource(Class exceptionSource)
This is the class and method from which this exception eminates. This is normally passed during exception creation in order to get the exact location of the failure. It is also used to integrate with logging service's filter functionality in order to pin-point problems in certain services by whatching the occurances in only one area of the system.

Specified by:
setExceptionSource in interface ExceptionDelegate
Parameters:
exceptionSource - the class and method of this exception

toString

public String toString()
This method builds a recursive view of this exception and its message as well as its cause or previous exception and so on.

Overrides:
toString in class Object
Returns:
the String view of the current exception


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.