View Javadoc

1   /*
2    * Copyright 2003,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  /*
17   * This source code implements specifications defined by the Java
18   * Community Process. In order to remain compliant with the specification
19   * DO NOT add / change / or delete method signatures!
20   */
21  package javax.portlet;
22  
23  /***
24   ** The <CODE>WindowStateException</CODE> is thrown when a portlet
25   ** tries to use a window state that is not supported by the current
26   ** runtime environment or the portlet.
27   **/
28  
29  public class WindowStateException extends PortletException
30  {
31  
32  
33    private transient WindowState _state = null;
34  
35    /***
36     * Constructs a new portlet state exception with the given text. The
37     * portlet container may use the text write it to a log.
38     *
39     * @param   text
40     *          the exception text
41     * @param   state
42     *          the state causing the exception
43     */
44  
45    public WindowStateException (String text, WindowState state)
46    {
47      super (text);
48      _state = state;
49    }
50  
51    /***
52     * Constructs a new portlet state exception when the portlet needs to do
53     * the following:
54     * <ul>
55     * <il>throw an exception 
56     * <li>include a message about the "root cause" that interfered
57     *     with its normal operation
58     * <li>include a description message
59     * </ul>
60     *
61     * @param   text
62     *          the exception text
63     * @param   cause
64     *          the root cause
65     * @param   state
66     *          the state causing the exception
67     */
68    
69    public WindowStateException (String text, Throwable cause, WindowState state)
70    {
71      super(text, cause);
72      _state = state;
73    }
74  
75    /***
76     * Constructs a new portlet state exception when the portlet needs to throw an
77     * exception. The exception message is based on the localized message
78     * of the underlying exception.
79     *
80     * @param   cause
81     *          the root cause
82     * @param   state
83     *          the state causing the exception
84     */
85  
86    public WindowStateException (Throwable cause, WindowState state)
87    {
88      super(cause);
89      _state = state;
90    }
91  
92    /***
93     * Returns the portlet state causing this exception.
94     * 
95     * @return  the window state causing this exception
96     */
97  
98    public WindowState getState()
99    {
100     return _state;
101   }
102 }