KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > jmx > browser > web > action > ClearNotificationAction


1 /*
2
3  * EJTools, the Enterprise Java Tools
4
5  *
6
7  * Distributable under LGPL license.
8
9  * See terms of license at www.gnu.org.
10
11  */

12
13 package org.ejtools.jmx.browser.web.action;
14
15
16
17 import java.io.IOException JavaDoc;
18
19 import java.util.Locale JavaDoc;
20
21
22
23 import javax.servlet.ServletContext JavaDoc;
24
25 import javax.servlet.ServletException JavaDoc;
26
27 import javax.servlet.http.HttpServletRequest JavaDoc;
28
29 import javax.servlet.http.HttpServletResponse JavaDoc;
30
31
32
33 import org.apache.struts.action.Action;
34
35 import org.apache.struts.action.ActionError;
36
37 import org.apache.struts.action.ActionErrors;
38
39 import org.apache.struts.action.ActionForm;
40
41 import org.apache.struts.action.ActionForward;
42
43 import org.apache.struts.action.ActionMapping;
44
45 import org.apache.struts.util.MessageResources;
46
47 import org.ejtools.jmx.browser.web.Constants;
48
49 import org.ejtools.jmx.browser.web.JMXContainer;
50
51
52
53 /**
54
55  * Description of the Class
56
57  *
58
59  * @author letiemble
60
61  * @created 12 novembre 2001
62
63  * @version $Revision: 1.6 $
64
65  * @todo Javadoc to complete
66
67  */

68
69 public class ClearNotificationAction extends Action
70
71 {
72
73    /** Constructor for the FilterAction object */
74
75    public ClearNotificationAction() { }
76
77
78
79
80
81    /**
82
83     * Description of the Method
84
85     *
86
87     * @param mapping Description of the Parameter
88
89     * @param form Description of the Parameter
90
91     * @param request Description of the Parameter
92
93     * @param response Description of the Parameter
94
95     * @return Description of the Return Value
96
97     * @exception IOException Description of the Exception
98
99     * @exception ServletException Description of the Exception
100
101     */

102
103    public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
104
105       throws IOException JavaDoc, ServletException JavaDoc
106
107    {
108
109       // Extract attributes we will need
110

111       Locale JavaDoc locale = getLocale(request);
112
113       MessageResources messages = getResources();
114
115
116
117       // Validate the request parameters specified by the user
118

119       ActionErrors errors = new ActionErrors();
120
121
122
123       ServletContext JavaDoc context = this.getServlet().getServletContext();
124
125       JMXContainer tree = (JMXContainer) context.getAttribute(Constants.TREE);
126
127
128
129       if (tree != null)
130
131       {
132
133          tree.clearNotifications();
134
135       }
136
137       else
138
139       {
140
141          errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("web.error.cannot.connect"));
142
143       }
144
145
146
147       // Report any errors we have discovered back to the original form
148

149       if (!errors.empty())
150
151       {
152
153          saveErrors(request, errors);
154
155          return (mapping.findForward("error"));
156
157       }
158
159
160
161       return (mapping.findForward("view"));
162
163    }
164
165 }
166
167
Popular Tags