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 the exception text
22: * @param state the state causing the exception
23: */
24:
25: public WindowStateException(String text, WindowState state) {
26: super (text);
27: _state = state;
28: }
29:
30: /**
31: * Constructs a new portlet state exception when the portlet needs to do
32: * the following:
33: * <ul>
34: * <il>throw an exception
35: * <li>include a message about the "root cause" that interfered
36: * with its normal operation
37: * <li>include a description message
38: * </ul>
39: *
40: * @param text the exception text
41: * @param cause the root cause
42: * @param state the state causing the exception
43: */
44:
45: public WindowStateException(String text, Throwable cause,
46: WindowState state) {
47: super (text, cause);
48: _state = state;
49: }
50:
51: /**
52: * Constructs a new portlet state exception when the portlet needs to throw an
53: * exception. The exception message is based on the localized message
54: * of the underlying exception.
55: *
56: * @param cause the root cause
57: * @param state the state causing the exception
58: */
59:
60: public WindowStateException(Throwable cause, WindowState state) {
61: super (cause);
62: _state = state;
63: }
64:
65: /**
66: * Returns the portlet state causing this exception.
67: *
68: * @return the window state causing this exception
69: */
70:
71: public WindowState getState() {
72: return _state;
73: }
74: }
|