001: /*
002: * The contents of this file are subject to the Sapient Public License
003: * Version 1.0 (the "License"); you may not use this file except in compliance
004: * with the License. You may obtain a copy of the License at
005: * http://carbon.sf.net/License.html.
006: *
007: * Software distributed under the License is distributed on an "AS IS" basis,
008: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
009: * the specific language governing rights and limitations under the License.
010: *
011: * The Original Code is The Carbon Component Framework.
012: *
013: * The Initial Developer of the Original Code is Sapient Corporation
014: *
015: * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
016: */
017:
018: package org.sape.carbon.core.exception;
019:
020: import java.io.Serializable;
021:
022: import org.sape.carbon.core.util.classify.SeverityEnum;
023:
024: /**
025: * <p>This interface represents the responsibilities of an exception delegate
026: * in the Carbon Core exception subsystem. This system provide a simple
027: * functionality for providing special handling during the throwing of
028: * exceptions by replacing the delegate and what it does.</p>
029: *
030: * <P>The contract for <code>ExceptionDelegate</code> implementation's is that
031: * they should expect to have ever set method called except the cause which is
032: * optional. Once that is done, the handle exception method will be called in
033: * order to allow the delegate to do any special handling or notifications it
034: * likes.</P>
035: *
036: * Copyright 2002 Sapient
037: * @since carbon 1.0
038: * @author Greg Hinkle, April 2002
039: * @version $Revision: 1.16 $($Author: dvoet $ / $Date: 2003/05/05 21:21:21 $)
040: * @stereotype singleton
041: */
042: public interface ExceptionDelegate extends Serializable {
043:
044: /**
045: * Sets the throwable which is requesting the creation of this delegate.
046: * @param delegatee the delegatee this delegate is working for
047: */
048: void setDelegatee(Throwable delegatee);
049:
050: /**
051: * Gets the delegatee, or the exception object that is being managed
052: * by this delegate.
053: * @return the exception object that is managed by this delegate.
054: */
055: Throwable getDelegatee();
056:
057: /**
058: * Sets the string explanation of this exception.
059: * @param message The string explanation of this exception
060: */
061: void setMessage(String message);
062:
063: /**
064: * Gets the message for this exception.
065: * @return the message of this exception
066: */
067: String getMessage();
068:
069: /**
070: * Sets the previous exception that caused this failure to happen.
071: * @param cause the previous failure
072: */
073: void setCause(Throwable cause);
074:
075: /**
076: * Retrieves the reason thsi failed.
077: * @return the reason for this failure.
078: */
079: Throwable getCause();
080:
081: /**
082: * Sets the location that this exception occurred..
083: * @param exceptionSource the location this exception was thrown
084: * */
085: void setExceptionSource(Class exceptionSource);
086:
087: /**
088: * The location that this exception was created.
089: * @return the source location for this failure
090: * */
091: Class getExceptionSource();
092:
093: /**
094: * Sets the harshness or how serious this failure is.
095: * @param severity the seriousness of the failure
096: */
097: void setSeverity(SeverityEnum severity);
098:
099: /**
100: * Retrieves the harshness or how serious this failure is.
101: * @return the seriousness of this failure
102: */
103: SeverityEnum getSeverity();
104:
105: /**
106: * This method is called once the object is fully populated and can
107: * handle this method in many different ways such as logging it.
108: */
109: void handleException();
110:
111: }
|