KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > portlet > PortletModeException


1 /**
2   * Copyright 2003 IBM Corporation and Sun Microsystems, Inc.
3   * All rights reserved.
4   * Use is subject to license terms.
5   */

6
7 package javax.portlet;
8
9 /**
10  * The <CODE>PortletModeException</CODE> is thrown when a portlet
11  * tries to use or set a portlet mode that is not supported by the current
12  * runtime environment or the portlet.
13  */

14
15 public class PortletModeException extends PortletException
16 {
17
18   private transient PortletMode _mode = null;
19
20   /**
21    * Constructs a new portlet mode exception with the given text and the
22    * portlet mode that caused this exception. The
23    * portlet container may use the text and portlet mode write it to a log.
24    *
25    * @param text
26    * the exception text
27    * @param mode
28    * the mode causing the exception
29    */

30
31   public PortletModeException (String JavaDoc text, PortletMode mode)
32   {
33     super (text);
34     _mode = mode;
35   }
36
37   /**
38    * Constructs a new portlet mode exception when the portlet needs to do
39    * the following:
40    * <ul>
41    * <il>throw an exception
42    * <li>include a message about the "root cause" that interfered
43    * with its normal operation
44    * <li>include a description message
45    * <li>include the portlet mode that caused this exception
46    * </ul>
47    *
48    * @param text
49    * the exception text
50    * @param cause
51    * the root cause
52    * @param mode
53    * the mode causing the exception
54    */

55   
56   public PortletModeException (String JavaDoc text, Throwable JavaDoc cause, PortletMode mode)
57   {
58     super(text, cause);
59     _mode = mode;
60   }
61
62   /**
63    * Constructs a new portlet mode exception when the portlet needs to throw an
64    * exception. The exception message is based on the localized message
65    * of the underlying exception and the portlet mode that caused this exception.
66    *
67    * @param cause
68    * the root cause
69    * @param mode
70    * the mode causing the exception
71    */

72
73   public PortletModeException (Throwable JavaDoc cause, PortletMode mode)
74   {
75     super(cause);
76     _mode = mode;
77   }
78
79   /**
80    * Returns the unsupported portlet mode causing this exception.
81    *
82    * @return the portlet mode that caused this exception
83    */

84
85   public PortletMode getMode()
86   {
87     return _mode;
88   }
89 }
90
Popular Tags