KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmanage > webui > actions > config > alert > SelectAlertSourceTypeAction


1 /**
2 * Copyright (c) 2004-2005 jManage.org
3 *
4 * This is a free software; you can redistribute it and/or
5 * modify it under the terms of the license at
6 * http://www.jmanage.org.
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */

14 package org.jmanage.webui.actions.config.alert;
15
16 import org.jmanage.webui.actions.BaseAction;
17 import org.jmanage.webui.util.WebContext;
18 import org.jmanage.webui.util.RequestParams;
19 import org.jmanage.webui.util.Utils;
20 import org.jmanage.webui.forms.AlertForm;
21 import org.jmanage.core.config.AlertSourceConfig;
22 import org.jmanage.core.config.ApplicationConfig;
23 import org.apache.struts.action.ActionForm;
24 import org.apache.struts.action.ActionMapping;
25 import org.apache.struts.action.ActionForward;
26
27 import javax.servlet.http.HttpServletResponse JavaDoc;
28 import javax.servlet.http.HttpServletRequest JavaDoc;
29
30 /**
31  *
32  * <p>
33  * Date: Aug 3, 2005
34  * @author Rakesh Kalra
35  */

36 public class SelectAlertSourceTypeAction extends BaseAction{
37
38     public ActionForward execute(WebContext context,
39                                  ActionMapping mapping,
40                                  ActionForm actionForm,
41                                  HttpServletRequest JavaDoc request,
42                                  HttpServletResponse JavaDoc response)
43             throws Exception JavaDoc {
44
45
46         AlertForm alertForm = (AlertForm)actionForm;
47         String JavaDoc sourceType = alertForm.getAlertSourceType();
48         assert sourceType != null;
49         ApplicationConfig appConfig= context.getApplicationConfig();
50         if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_GAUGE_MONITOR)){
51             String JavaDoc url = "/config/showMBeans.do?"
52                     + RequestParams.APPLICATION_ID + "="
53                     + appConfig.getApplicationId() + "&"
54                     + RequestParams.END_URL + "="
55                     + Utils.urlEncode("/config/showAddAlert.do")+ "&"
56                     + RequestParams.MULTIPLE + "=false&"
57                     + RequestParams.ALERT_SOURCE_TYPE + "="
58                     + AlertSourceConfig.SOURCE_TYPE_GAUGE_MONITOR + "&"
59                     + RequestParams.DATA_TYPE + "=java.lang.Number&"
60                     //+ RequestParams.DATA_TYPE + "=javax.management.openmbean.CompositeData&"
61
+ RequestParams.NAVIGATION + "=Add Alert";
62             return new ActionForward(url);
63         } else if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_STRING_MONITOR)){
64             String JavaDoc url = "/config/showMBeans.do?"
65                     + RequestParams.APPLICATION_ID + "="
66                     + appConfig.getApplicationId() + "&"
67                     + RequestParams.END_URL + "="
68                     + Utils.urlEncode("/config/showAddAlert.do")+ "&"
69                     + RequestParams.MULTIPLE + "=false&"
70                     + RequestParams.ALERT_SOURCE_TYPE + "="
71                     + AlertSourceConfig.SOURCE_TYPE_STRING_MONITOR +"&"
72                     + RequestParams.DATA_TYPE + "=java.lang.String&"
73                     //+ RequestParams.DATA_TYPE + "=javax.management.openmbean.CompositeData&"
74
+ RequestParams.NAVIGATION + "=Add Alert";;
75             return new ActionForward(url);
76         }
77         return mapping.findForward(sourceType);
78     }
79 }
80
Popular Tags