001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)ManagementRemoteException.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.esb.management.common;
030:
031: import java.io.PrintStream;
032: import java.io.PrintWriter;
033: import java.io.Serializable;
034:
035: import com.sun.jbi.ui.common.JBIManagementMessage;
036: import com.sun.jbi.ui.common.JBIRemoteException;
037:
038: /**
039: * A Remote Exception class that saves the cause exception stack trace in a
040: * buffer for serialization. By throwing this exception on jmx server side on
041: * mbean operations and attributes, we don't have to include the cause exception
042: * classes on the client side. This class also allows the server side code to
043: * add error code, so that the remote client can get the error code and display
044: * the message from its local bundle.
045: *
046: * @author graj
047: */
048: public class ManagementRemoteException extends JBIRemoteException
049: implements Serializable {
050:
051: static final long serialVersionUID = 4431187824092164710L;
052:
053: /**
054: * @param message
055: */
056: public ManagementRemoteException(String message) {
057: super (message);
058: }
059:
060: /**
061: * @param cause
062: */
063: public ManagementRemoteException(Throwable cause) {
064: super (cause);
065: }
066:
067: /**
068: * @param message
069: * @param cause
070: */
071: public ManagementRemoteException(String message, Throwable cause) {
072: super (message, cause);
073: }
074:
075: /**
076: *
077: * @param jbiRemoteException
078: */
079: public ManagementRemoteException(
080: JBIRemoteException jbiRemoteException) {
081: super (jbiRemoteException);
082: }
083:
084: /**
085: * Return an instance of JBIRemoteException
086: * @return JBIRemoteException
087: */
088: public JBIRemoteException getJBIRemoteException() {
089: return this ;
090: }
091:
092: /**
093: * initializes the stacktrace and messages from cause
094: *
095: * @param aCause
096: * a cause
097: */
098: public void initCauseTrace(Throwable aCause) {
099: super .initCauseTrace(aCause);
100: }
101:
102: /**
103: * Returns the detail message string of this throwable.
104: *
105: * @return the detail message string of this <tt>Throwable</tt> instance
106: * (which may be <tt>null</tt>). + the cause messages
107: */
108: public String getMessage() {
109: return super .getMessage();
110: }
111:
112: /**
113: * gets the cuase trace in a string buffer
114: *
115: * @return trace in a string buffer
116: */
117: public String[] getCauseMessageTrace() {
118: return super .getCauseMessageTrace();
119: }
120:
121: /**
122: * gets the cuase trace in a string buffer
123: *
124: * @return trace in a string buffer
125: */
126: public StringBuffer getCauseStackTrace() {
127: return super .getCauseStackTrace();
128: }
129:
130: /**
131: * override method
132: *
133: * @param s
134: * writer
135: */
136: public void printStackTrace(PrintWriter s) {
137: super .printStackTrace(s);
138: }
139:
140: /**
141: * override method
142: *
143: * @param s
144: * stream
145: */
146: public void printStackTrace(PrintStream s) {
147: super .printStackTrace(s);
148: }
149:
150: /**
151: * retrieves the exception message and try to construct the jbi mgmt message
152: *
153: * @return JBIManagementMessage object
154: */
155: public JBIManagementMessage extractJBIManagementMessage() {
156: return super .extractJBIManagementMessage();
157: }
158:
159: /**
160: * filters the jmx exception and wraps the root cause user exception in the
161: * JBIRemoteException
162: *
163: * @param jmxEx
164: * exception
165: * @return remote exception
166: */
167: public static ManagementRemoteException filterJmxExceptions(
168: Exception jmxEx) {
169: JBIRemoteException exception = JBIRemoteException
170: .filterJmxExceptions(jmxEx);
171: return new ManagementRemoteException(exception);
172: }
173:
174: }
|