KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmanage > webui > actions > config > ShowMBeanAction


1 /**
2  * Copyright 2004-2005 jManage.org
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 package org.jmanage.webui.actions.config;
17
18 import org.apache.struts.action.ActionForward;
19 import org.apache.struts.action.ActionMapping;
20 import org.apache.struts.action.ActionForm;
21 import org.jmanage.webui.util.*;
22 import org.jmanage.webui.actions.BaseAction;
23 import org.jmanage.webui.forms.AttributeSelectionForm;
24 import org.jmanage.core.services.MBeanService;
25 import org.jmanage.core.services.ServiceFactory;
26
27 import javax.servlet.http.HttpServletRequest JavaDoc;
28 import javax.servlet.http.HttpServletResponse JavaDoc;
29 import java.util.Map JavaDoc;
30
31 /**
32  * Date: Jun 28, 2005 9:12:52 PM
33  * @author Bhavana
34  * @author Shashank Bellary
35  */

36 public class ShowMBeanAction extends BaseAction {
37     public ActionForward execute(WebContext context,
38                                  ActionMapping mapping,
39                                  ActionForm actionForm,
40                                  HttpServletRequest JavaDoc request,
41                                  HttpServletResponse JavaDoc response)
42             throws Exception JavaDoc {
43
44         AttributeSelectionForm form = (AttributeSelectionForm)actionForm;
45         MBeanService mbeanService = ServiceFactory.getMBeanService();
46         Map JavaDoc domainToObjectNameListMap = mbeanService.queryMBeansOutputMap
47                         (Utils.getServiceContext(context),form.getObjectName(),
48                                 request.getParameterValues(RequestParams.DATA_TYPE),
49                                 request.getParameter(RequestParams.APPLY_ATTRIB_FILTER));
50         request.setAttribute("domainToObjectNameListMap", domainToObjectNameListMap);
51         /*set current page for navigation*/
52         request.setAttribute(RequestAttributes.NAV_CURRENT_PAGE, form.getNavigation());
53         if("true".equals(request.getParameter(RequestParams.SHOW_END_URL))){
54             ActionForward forward =
55                     new ActionForward(request.getParameter(RequestParams.END_URL));
56             return forward;
57         }
58         return mapping.findForward(Forwards.SUCCESS);
59     }
60 }
61
Popular Tags