01: //** Copyright Statement ***************************************************
02: //The Salmon Open Framework for Internet Applications (SOFIA)
03: // Copyright (C) 1999 - 2002, Salmon LLC
04: //
05: // This program is free software; you can redistribute it and/or
06: // modify it under the terms of the GNU General Public License version 2
07: // as published by the Free Software Foundation;
08: //
09: // This program is distributed in the hope that it will be useful,
10: // but WITHOUT ANY WARRANTY; without even the implied warranty of
11: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: // GNU General Public License for more details.
13: //
14: // You should have received a copy of the GNU General Public License
15: // along with this program; if not, write to the Free Software
16: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: //
18: // For more information please visit http://www.salmonllc.com
19: //** End Copyright Statement ***************************************************
20: package com.salmonllc.portlet;
21:
22: import javax.portlet.PortletException;
23:
24: /**
25: * A special exception handled by the SalmonPortlet. This is used by the framework and should not be called directly. Instead use the method handlePortletException in JspController to report errors to the SalmonPortlet
26: */
27: public class SalmonPortletException extends PortletException {
28: PortletException _realException;
29: boolean _logMessage;
30: boolean _throwMessage;
31: String _displayMessage;
32:
33: public SalmonPortletException(PortletException realException,
34: boolean logMessage, boolean throwMessage,
35: String displayMessage) {
36: _realException = realException;
37: _logMessage = logMessage;
38: _throwMessage = throwMessage;
39: _displayMessage = displayMessage;
40: }
41:
42: /**
43: * @return true to log this message to the message log
44: */
45: public boolean getLogMessage() {
46: return _logMessage;
47: }
48:
49: /**
50: * @return the actual exception that caused this one
51: */
52: public PortletException getRealException() {
53: return _realException;
54: }
55:
56: /**
57: * @return whether or not the portlet should throw the message to the portal
58: */
59: public boolean getThrowMessage() {
60: return _throwMessage;
61: }
62:
63: /**
64: * @return a String to display or null if nothing should display in the portlet
65: */
66: public String getDisplayMessage() {
67: return _displayMessage;
68: }
69:
70: void messageLogged() {
71: _logMessage = false;
72: }
73:
74: }
|