KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > core > exception > ExceptionDelegate


1 /*
2  * The contents of this file are subject to the Sapient Public License
3  * Version 1.0 (the "License"); you may not use this file except in compliance
4  * with the License. You may obtain a copy of the License at
5  * http://carbon.sf.net/License.html.
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is The Carbon Component Framework.
12  *
13  * The Initial Developer of the Original Code is Sapient Corporation
14  *
15  * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16  */

17
18 package org.sape.carbon.core.exception;
19
20 import java.io.Serializable JavaDoc;
21
22 import org.sape.carbon.core.util.classify.SeverityEnum;
23
24 /**
25  * <p>This interface represents the responsibilities of an exception delegate
26  * in the Carbon Core exception subsystem. This system provide a simple
27  * functionality for providing special handling during the throwing of
28  * exceptions by replacing the delegate and what it does.</p>
29  *
30  * <P>The contract for <code>ExceptionDelegate</code> implementation's is that
31  * they should expect to have ever set method called except the cause which is
32  * optional. Once that is done, the handle exception method will be called in
33  * order to allow the delegate to do any special handling or notifications it
34  * likes.</P>
35  *
36  * Copyright 2002 Sapient
37  * @since carbon 1.0
38  * @author Greg Hinkle, April 2002
39  * @version $Revision: 1.16 $($Author: dvoet $ / $Date: 2003/05/05 21:21:21 $)
40  * @stereotype singleton
41  */

42 public interface ExceptionDelegate extends Serializable JavaDoc {
43
44
45     /**
46      * Sets the throwable which is requesting the creation of this delegate.
47      * @param delegatee the delegatee this delegate is working for
48      */

49     void setDelegatee(Throwable JavaDoc delegatee);
50
51     /**
52      * Gets the delegatee, or the exception object that is being managed
53      * by this delegate.
54      * @return the exception object that is managed by this delegate.
55      */

56     Throwable JavaDoc getDelegatee();
57
58     /**
59      * Sets the string explanation of this exception.
60      * @param message The string explanation of this exception
61      */

62     void setMessage(String JavaDoc message);
63
64     /**
65      * Gets the message for this exception.
66      * @return the message of this exception
67      */

68     String JavaDoc getMessage();
69
70     /**
71      * Sets the previous exception that caused this failure to happen.
72      * @param cause the previous failure
73      */

74     void setCause(Throwable JavaDoc cause);
75
76     /**
77      * Retrieves the reason thsi failed.
78      * @return the reason for this failure.
79      */

80     Throwable JavaDoc getCause();
81
82     /**
83      * Sets the location that this exception occurred..
84      * @param exceptionSource the location this exception was thrown
85      * */

86     void setExceptionSource(Class JavaDoc exceptionSource);
87
88     /**
89      * The location that this exception was created.
90      * @return the source location for this failure
91      * */

92     Class JavaDoc getExceptionSource();
93
94     /**
95      * Sets the harshness or how serious this failure is.
96      * @param severity the seriousness of the failure
97      */

98     void setSeverity(SeverityEnum severity);
99
100     /**
101      * Retrieves the harshness or how serious this failure is.
102      * @return the seriousness of this failure
103      */

104     SeverityEnum getSeverity();
105
106     /**
107      * This method is called once the object is fully populated and can
108      * handle this method in many different ways such as logging it.
109      */

110     void handleException();
111
112 }
113
Popular Tags