001: /**
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: * ServerSideException
022: * LPS
023: * Oct 29, 2007
024: */package com.bostechcorp.cbesb.console.common;
025:
026: import com.google.gwt.user.client.rpc.IsSerializable;
027:
028: /**
029: * It is very import for RPC method, if you want to throw an Exception,
030: * you must throw a ServerSideException, otherwise you need to return a object extends BaseRpcResultInfo
031: *
032: */
033: public class ServerSideException extends Exception implements
034: IsSerializable {
035: private static final long serialVersionUID = 1621068800665407958L;
036:
037: private String serverStackTrace = null;
038: private String message = null;
039:
040: public String getMessage() {
041: return message;
042: }
043:
044: public void setMessage(String message) {
045: this .message = message;
046: }
047:
048: /**
049: *
050: */
051: public ServerSideException() {
052: }
053:
054: /**
055: * @param message
056: */
057: public ServerSideException(String message) {
058: super (message);
059: this .message = message;
060:
061: serverStackTrace = ExceptionUtil.stackTraceString(this ) + "\n";
062:
063: }
064:
065: /**
066: * @param message
067: */
068: public ServerSideException(String message, Throwable cause) {
069: super (message);
070: this .message = message;
071: if (cause instanceof ServerSideException) {
072: serverStackTrace = cause.toString()
073: + "\n"
074: + ((ServerSideException) cause)
075: .getServerStackTrace();
076: } else
077: serverStackTrace = cause.toString() + "\n"
078: + ExceptionUtil.stackTraceString(cause) + "\n";
079: }
080:
081: /**
082: * @param cause
083: */
084: public ServerSideException(Throwable cause) {
085: super (cause);
086: message = cause.toString();
087: if (cause instanceof ServerSideException) {
088: serverStackTrace = cause.toString()
089: + "\n"
090: + ((ServerSideException) cause)
091: .getServerStackTrace();
092: } else {
093: serverStackTrace = "ServerSideException's Content------>";
094: serverStackTrace += message + "\n"
095: + ExceptionUtil.stackTraceString(cause) + "\n";
096: }
097: }
098:
099: public String toString() {
100: return getMessage();
101: }
102:
103: public String getServerStackTrace() {
104: return this.serverStackTrace;
105: }
106:
107: }
|