KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > webapp > jonasadmin > service > ListServicesAction


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: ListServicesAction.java,v 1.12 2005/07/25 22:53:28 vivekl Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.webapp.jonasadmin.service;
27
28 import java.io.IOException JavaDoc;
29 import java.util.ArrayList JavaDoc;
30 import java.util.Collections JavaDoc;
31
32 import javax.servlet.ServletException JavaDoc;
33 import javax.servlet.http.HttpServletRequest JavaDoc;
34 import javax.servlet.http.HttpServletResponse JavaDoc;
35
36 import org.apache.struts.action.ActionForm;
37 import org.apache.struts.action.ActionForward;
38 import org.apache.struts.action.ActionMapping;
39 import org.objectweb.jonas.jmx.JonasObjectName;
40 import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx;
41 import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
42 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
43
44 /**
45  * @author Michel-Ange ANTON
46  */

47
48 public class ListServicesAction extends JonasBaseAction {
49
50 // --------------------------------------------------------- Public Methods
51

52     public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form
53         , HttpServletRequest JavaDoc p_Request, HttpServletResponse JavaDoc p_Response)
54         throws IOException JavaDoc, ServletException JavaDoc {
55
56         // Force the node selected in tree
57
m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER) + WhereAreYou.NODE_SEPARATOR
58             + "services", true);
59
60         // no Form used
61
try {
62             ArrayList JavaDoc al = new ArrayList JavaDoc();
63             // Detail Service
64
al.add(new ServiceItem(m_Resources.getMessage("treenode.jonas.server.services.ear")
65                 , JonasAdminJmx.hasMBeanName(JonasObjectName.earService())
66                 , "ActionListAppContainers"));
67             al.add(new ServiceItem(m_Resources.getMessage(
68                 "treenode.jonas.server.services.ejbContainers")
69                 , JonasAdminJmx.hasMBeanName(JonasObjectName.ejbService()), "ActionListContainers"));
70             al.add(new ServiceItem(m_Resources.getMessage("treenode.jonas.server.services.web")
71                 , JonasAdminJmx.hasMBeanName(JonasObjectName.webContainerService())
72                 , "ActionListWebContainers"));
73             al.add(new ServiceItem(m_Resources.getMessage("treenode.jonas.server.services.database")
74                 , JonasAdminJmx.hasMBeanName(JonasObjectName.databaseService())
75                 , "ActionListDatabases"));
76             al.add(new ServiceItem(m_Resources.getMessage("treenode.jonas.server.services.resource")
77                 , JonasAdminJmx.hasMBeanName(JonasObjectName.resourceService())
78                 , "ActionListResourceAdapters"));
79             al.add(new ServiceItem(m_Resources.getMessage(
80                 "treenode.jonas.server.services.transaction")
81                 , JonasAdminJmx.hasMBeanName(JonasObjectName.transactionService())
82                 , "ActionEditJtmService"));
83             al.add(new ServiceItem(m_Resources.getMessage("treenode.jonas.server.services.jms")
84                 , JonasAdminJmx.hasMBeanName(JonasObjectName.jmsService()), "ActionEditJmsService"));
85             al.add(new ServiceItem(m_Resources.getMessage("treenode.jonas.server.services.mail")
86                 , JonasAdminJmx.hasMBeanName(JonasObjectName.mailService())
87                 , "ActionEditMailService"));
88             al.add(new ServiceItem(m_Resources.getMessage("treenode.jonas.server.services.security")
89                 , JonasAdminJmx.hasMBeanName(JonasObjectName.securityService())
90                 , "ActionEditServiceSecurity"));
91             al.add(new ServiceItem(m_Resources.getMessage("treenode.jonas.server.services.discovery")
92                     , JonasAdminJmx.hasMBeanName(JonasObjectName.discoveryService())
93                     , "ActionEditServiceDiscovery"));
94             al.add(new ServiceItem(m_Resources.getMessage("treenode.jonas.server.services.webservices")
95                     , JonasAdminJmx.hasMBeanName(JonasObjectName.wsService())
96                     , "ActionListWebService"));
97
98             // sort
99
Collections.sort(al, new ServiceItemByNameComparator());
100             // Set list in the request
101
p_Request.setAttribute("listServices", al);
102         }
103         catch (Throwable JavaDoc t) {
104             addGlobalError(t);
105             saveErrors(p_Request, m_Errors);
106             return (p_Mapping.findForward("Global Error"));
107         }
108         // Forward to the jsp.
109
return (p_Mapping.findForward("Services"));
110     }
111 }
112
Popular Tags