01: /**
02: * Copyright 2003 IBM Corporation and Sun Microsystems, Inc.
03: * All rights reserved.
04: * Use is subject to license terms.
05: */package javax.portlet;
06:
07: /**
08: ** The <CODE>WindowStateException</CODE> is thrown when a portlet
09: ** tries to use a window state that is not supported by the current
10: ** runtime environment or the portlet.
11: **/
12:
13: public class WindowStateException extends PortletException {
14:
15: private transient WindowState _state = null;
16:
17: /**
18: * Constructs a new portlet state exception with the given text. The
19: * portlet container may use the text write it to a log.
20: *
21: * @param text
22: * the exception text
23: * @param state
24: * the state causing the exception
25: */
26:
27: public WindowStateException(String text, WindowState state) {
28: super (text);
29: _state = state;
30: }
31:
32: /**
33: * Constructs a new portlet state exception when the portlet needs to do
34: * the following:
35: * <ul>
36: * <il>throw an exception
37: * <li>include a message about the "root cause" that interfered
38: * with its normal operation
39: * <li>include a description message
40: * </ul>
41: *
42: * @param text
43: * the exception text
44: * @param cause
45: * the root cause
46: * @param state
47: * the state causing the exception
48: */
49:
50: public WindowStateException(String text, Throwable cause,
51: WindowState state) {
52: super (text, cause);
53: _state = state;
54: }
55:
56: /**
57: * Constructs a new portlet state exception when the portlet needs to throw an
58: * exception. The exception message is based on the localized message
59: * of the underlying exception.
60: *
61: * @param cause
62: * the root cause
63: * @param state
64: * the state causing the exception
65: */
66:
67: public WindowStateException(Throwable cause, WindowState state) {
68: super (cause);
69: _state = state;
70: }
71:
72: /**
73: * Returns the portlet state causing this exception.
74: *
75: * @return the window state causing this exception
76: */
77:
78: public WindowState getState() {
79: return _state;
80: }
81: }
|