001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: RPCException.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.rpc.api;
025:
026: /**
027: * Exception thrown if there is a failure in the response done by the remote
028: * side.
029: * @author Florent Benoit
030: */
031: public class RPCException extends Exception {
032:
033: /**
034: * Id for serializable class.
035: */
036: private static final long serialVersionUID = -8386978969361863691L;
037:
038: /**
039: * Is that the wrapped Exception is an application exception or not ? (chapter 14.2.1 of EJB 3.0 specification).
040: */
041: private boolean applicationException = false;
042:
043: /**
044: * Constructs a new runtime exception with <code>null</code> as its detail
045: * message. The cause is not initialized, and may subsequently be
046: * initialized by a call to {@link #initCause}.
047: */
048: public RPCException() {
049: super ();
050: }
051:
052: /**
053: * Constructs a new runtime exception with the specified detail message. The
054: * cause is not initialized, and may subsequently be initialized by a call
055: * to {@link #initCause}.
056: * @param message the detail message. The detail message is saved for later
057: * retrieval by the {@link #getMessage()} method.
058: */
059: public RPCException(final String message) {
060: super (message);
061: }
062:
063: /**
064: * Constructs a new runtime exception with the specified detail message and
065: * cause.
066: * <p>
067: * Note that the detail message associated with <code>cause</code> is
068: * <i>not</i> automatically incorporated in this runtime exception's detail
069: * message.
070: * @param message the detail message (which is saved for later retrieval by
071: * the {@link #getMessage()} method).
072: * @param cause the cause (which is saved for later retrieval by the
073: * {@link #getCause()} method). (A <tt>null</tt> value is
074: * permitted, and indicates that the cause is nonexistent or
075: * unknown.)
076: */
077: public RPCException(final String message, final Throwable cause) {
078: super (message, cause);
079: }
080:
081: /**
082: * Constructs a new exception with the specified cause and a detail message
083: * of <tt>(cause==null ? null : cause.toString())</tt> (which typically
084: * contains the class and detail message of <tt>cause</tt>). This
085: * constructor is useful for exceptions that are little more than wrappers
086: * for other throwables (for example, {@link
087: * java.security.PrivilegedActionException}).
088: * @param cause the cause (which is saved for later retrieval by the
089: * {@link #getCause()} method). (A <tt>null</tt> value is
090: * permitted, and indicates that the cause is nonexistent or
091: * unknown.)
092: * @since 1.4
093: */
094: public RPCException(final Throwable cause) {
095: super (cause);
096: }
097:
098: /**
099: * @return true if the wrapped exception is an application exception
100: */
101: public boolean isApplicationException() {
102: return applicationException;
103: }
104:
105: /**
106: * Mark this exception as an application exception (wrapped exception).
107: */
108: public void setApplicationException() {
109: this .applicationException = true;
110: }
111: }
|