001: package com.bostechcorp.cbesb.common.runtime;
002:
003: /**
004: * An exception which represent the ChainBuilder ESB Runtime component exception.
005: * This is a base class for exceptions of ChainBuilder ESB runtime.
006: *
007: * @author elu
008: *
009: */
010:
011: public class CbesbException extends Exception {
012:
013: public static String SUBMIT_BUG = "Please submit a bug.";
014:
015: public static String ENCODING_ERR_UTF8_2_STR = "Unable to convert utf-8 Byte Arary to a String.";
016: public static String ENCODING_MSG_STR_2_utf8 = "Unable to convert a String to utf-8 Byte Arary.";
017:
018: /**
019: *
020: */
021: private static final long serialVersionUID = 1456983950258103691L;
022:
023: private String remedy;
024:
025: /**
026: * Default Constructor
027: */
028: public CbesbException() {
029: super ();
030:
031: }
032:
033: /**
034: * Constructor.
035: *
036: * @param message
037: * @param cause
038: */
039: public CbesbException(String message, Throwable cause) {
040: super (message, cause);
041: }
042:
043: /**
044: * Constructor.
045: *
046: * @param message
047: * @param remedy
048: * @param cause
049: */
050: public CbesbException(String message, String remedy, Throwable cause) {
051: super (message, cause);
052: this .remedy = remedy;
053: }
054:
055: /**
056: * Constructor.
057: *
058: * @param message
059: */
060: public CbesbException(String message) {
061: super (message);
062:
063: }
064:
065: /**
066: * Constructor.
067: *
068: * @param message
069: */
070: public CbesbException(String message, String remedy) {
071: this (message);
072: this .remedy = remedy;
073: }
074:
075: /**
076: * Constructor.
077: *
078: * @param cause
079: */
080: public CbesbException(Throwable cause) {
081: super (cause);
082: }
083:
084: /**
085: * Return a user-friendly message to the end user to help diagnose the problem.
086: * It should be overwriten by child classes.
087: *
088: */
089: public String getFriedlyMessage() {
090: return getMessage();
091: }
092:
093: /**
094: * @return the remedy
095: */
096: public String getRemedy() {
097: return remedy;
098: }
099:
100: /**
101: * @param remedy the remedy to set
102: */
103: public void setRemedy(String remedy) {
104: this .remedy = remedy;
105: }
106:
107: public static CbesbException create(Exception e) {
108: if (e instanceof CbesbException)
109: return (CbesbException) e;
110: else {
111: return new CbesbException(e);
112: }
113: }
114:
115: }
|