KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > resource > cci > ResourceWarning


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package javax.resource.cci;
25
26 /**
27  * A <code>ResourceWarning</code> provides information on warnings related to
28  * execution of an interaction with an EIS. Warnings are silently
29  * chained to the object whose method caused it to be reported.
30  *
31  * @see Interaction#getWarnings
32  */

33 public class ResourceWarning extends javax.resource.ResourceException JavaDoc {
34
35     /**
36      * Constructs a new instance with null as its detail message.
37      */

38     public ResourceWarning() { super(); }
39
40     /**
41      * Constructs a new instance with the specified detail message.
42      *
43      * @param message the detail message.
44      */

45     public ResourceWarning(String JavaDoc message) {
46     super(message);
47     }
48
49     /**
50      * Constructs a new throwable with the specified cause.
51      *
52      * @param cause a chained exception of type
53      * <code>Throwable</code>.
54      */

55     public ResourceWarning(Throwable JavaDoc cause) {
56     super(cause);
57     }
58
59     /**
60      * Constructs a new throwable with the specified detail message and cause.
61      *
62      * @param message the detail message.
63      *
64      * @param cause a chained exception of type
65      * <code>Throwable</code>.
66      */

67     public ResourceWarning(String JavaDoc message, Throwable JavaDoc cause) {
68     super(message, cause);
69     }
70
71     /**
72      * Constructs a new throwable with the specified detail message and
73      * an error code.
74      *
75      * @param message a description of the exception.
76      * @param errorCode a string specifying the vendor specific error code.
77      */

78     public ResourceWarning(String JavaDoc message, String JavaDoc errorCode) {
79     super(message, errorCode);
80     }
81   
82     /**
83      * Retrieves the warning chained to this <code>ResourceWarning</code>
84      * object.
85      *
86      * @return next <code>ResourceWarning</code> in the chain; null if none.
87      *
88      * @deprecated J2SE release 1.4 supports a chained exception facility
89      * that allows any throwable to know about another throwable, if any,
90      * that caused it to get thrown. Refer to <code>getCause</code> and
91      * <code>initCause</code> methods of the
92      * <code>java.lang.Throwable</code> class.
93      */

94     public ResourceWarning JavaDoc getLinkedWarning() {
95     try {
96         return ((ResourceWarning JavaDoc)getLinkedException());
97     }
98     catch (ClassCastException JavaDoc ex) {
99         return null;
100     }
101     }
102   
103     /**
104      * Adds an <code>ResourceWarning</code> object to the end of the chain.
105      *
106      * @param warning <code>ResourceWarning</code> to be added to the chain.
107      *
108      * @deprecated J2SE release 1.4 supports a chained exception facility
109      * that allows any throwable to know about another throwable, if any,
110      * that caused it to get thrown. Refer to <code>getCause</code> and
111      * <code>initCause</code> methods of the
112      * <code>java.lang.Throwable</code> class.
113      */

114     public void setLinkedWarning(ResourceWarning JavaDoc warning) {
115     setLinkedException(warning);
116     }
117 }
118
Popular Tags