01: /**
02: *
03: * Copyright 2003-2004 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package javax.xml.registry;
17:
18: /**
19: * Signals that a JAXR exception has occurred.
20: * Note that the Exception chaining here is different from JDK1.4
21: *
22: * @version $Revision$ $Date$
23: */
24: public class JAXRException extends Exception implements JAXRResponse {
25:
26: /**
27: *
28: */
29: private static final long serialVersionUID = 1L;
30: protected Throwable cause = null;
31:
32: public JAXRException() {
33: }
34:
35: public JAXRException(String message) {
36: super (message);
37: }
38:
39: public JAXRException(Throwable cause) {
40: super (cause);
41: this .cause = cause;
42: }
43:
44: public JAXRException(String message, Throwable cause) {
45: super (message, cause);
46: this .cause = cause;
47: }
48:
49: public synchronized Throwable initCause(Throwable cause) {
50:
51: if (this .cause != null) {
52: throw new IllegalStateException("Cannot overwrite cause");
53: }
54:
55: this .cause = cause;
56: return this ;
57: }
58:
59: public String getMessage() {
60: String message = super .getMessage();
61: return (message == null && cause != null) ? cause.getMessage()
62: : message;
63: }
64:
65: public Throwable getCause() {
66: return cause;
67: }
68:
69: public String getRequestId() {
70: return null;
71: }
72:
73: public int getStatus() {
74: return 0;
75: }
76:
77: public boolean isAvailable() throws JAXRException {
78: return true;
79: }
80: }
|