Source Code Cross Referenced for ListMBeanOperationsAction.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » webapp » jonasadmin » mbean » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.webapp.jonasadmin.mbean 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: ListMBeanOperationsAction.java 9680 2006-10-06 12:08:33Z danesa $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas.webapp.jonasadmin.mbean;
025:
026:        import java.io.IOException;
027:        import java.util.ArrayList;
028:        import java.util.Collections;
029:        import java.util.Comparator;
030:
031:        import javax.management.MBeanInfo;
032:        import javax.management.MBeanOperationInfo;
033:        import javax.management.MBeanParameterInfo;
034:        import javax.management.ObjectName;
035:        import javax.servlet.ServletException;
036:        import javax.servlet.http.HttpServletRequest;
037:        import javax.servlet.http.HttpServletResponse;
038:
039:        import org.apache.struts.action.ActionForm;
040:        import org.apache.struts.action.ActionForward;
041:        import org.apache.struts.action.ActionMapping;
042:        import org.objectweb.jonas.jmx.JonasManagementRepr;
043:        import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
044:
045:        /**
046:         * List of all Operations for a MBean.
047:         *
048:         * @author Michel-Ange ANTON
049:         */
050:
051:        public final class ListMBeanOperationsAction extends
052:                ListMBeanDetailsAction {
053:
054:            // --------------------------------------------------------- Public Methods
055:
056:            public ActionForward executeAction(ActionMapping p_Mapping,
057:                    ActionForm p_Form, HttpServletRequest p_Request,
058:                    HttpServletResponse p_Response) throws IOException,
059:                    ServletException {
060:
061:                try {
062:                    // Save current action
063:                    setAction(ACTION_OPERATIONS);
064:                    // Parameter
065:                    String sSelect = p_Request.getParameter("select");
066:                    // get server name
067:                    WhereAreYou oWhere = (WhereAreYou) p_Request.getSession()
068:                            .getAttribute(WhereAreYou.SESSION_NAME);
069:                    String serverName = oWhere.getCurrentJonasServerName();
070:
071:                    // Create a request attribute with our collection of MBeans
072:                    ArrayList list = new ArrayList();
073:
074:                    // Get all infos of a MBean
075:                    ObjectName on = new ObjectName(sSelect);
076:                    MbeanItem oItem = MbeanItem.build(on);
077:                    MBeanInfo oMBeanInfo = JonasManagementRepr.getMBeanInfo(on,
078:                            serverName);
079:                    // Get attributes infos
080:                    MBeanOperationInfo[] aoMBeanOperationInfo = oMBeanInfo
081:                            .getOperations();
082:                    if (aoMBeanOperationInfo.length > 0) {
083:                        // Loop to append each attribute node
084:                        for (int i = 0; i < aoMBeanOperationInfo.length; i++) {
085:                            list.add(new ViewMBeanOperations(
086:                                    aoMBeanOperationInfo[i]));
087:                        }
088:                        // Sort
089:                        Collections.sort(list, new MBeanOperationsByName());
090:                    }
091:                    // Set the beans
092:                    p_Request.setAttribute("MBean", oItem);
093:                    p_Request.setAttribute("MBeanOperations", list);
094:                    // Active and save filtering display if not exists
095:                    MbeanFilteringForm oForm = (MbeanFilteringForm) m_Session
096:                            .getAttribute("mbeanFilteringForm");
097:                    if (oForm == null) {
098:                        oForm = new MbeanFilteringForm();
099:                        oForm.reset(p_Mapping, p_Request);
100:                        m_Session.setAttribute("mbeanFilteringForm", oForm);
101:                    }
102:                    oForm.setSelectedName(sSelect);
103:
104:                    // Force the node selected in tree when the direct is used (MBeans list)
105:                    StringBuffer sbBranch = new StringBuffer("domain*mbeans");
106:                    sbBranch.append(WhereAreYou.NODE_SEPARATOR);
107:                    sbBranch.append(sSelect);
108:                    m_WhereAreYou.selectNameNode(sbBranch.toString(), true);
109:                } catch (Throwable t) {
110:                    addGlobalError(t);
111:                    saveErrors(p_Request, m_Errors);
112:                    return (p_Mapping.findForward("Global Error"));
113:                }
114:                // Forward to the corresponding display page
115:                return p_Mapping.findForward("List MBean Operations");
116:            }
117:
118:            // --------------------------------------------------------- Inner Classes
119:
120:            public class ViewMBeanOperations {
121:                private String name;
122:                private String returnType;
123:                private String impact;
124:                private String parameters;
125:                private String description;
126:
127:                public ViewMBeanOperations() {
128:                }
129:
130:                public ViewMBeanOperations(MBeanOperationInfo po_Ope) {
131:                    setName(po_Ope.getName());
132:                    setReturnType(po_Ope.getReturnType());
133:                    setDescription(po_Ope.getDescription());
134:                    // Impact
135:                    switch (po_Ope.getImpact()) {
136:                    case MBeanOperationInfo.ACTION:
137:                        setImpact("Action");
138:                        break;
139:                    case MBeanOperationInfo.ACTION_INFO:
140:                        setImpact("Action info");
141:                        break;
142:                    case MBeanOperationInfo.INFO:
143:                        setImpact("Info");
144:                        break;
145:                    default:
146:                        setImpact("Unknown");
147:                    }
148:                    // Parameters
149:                    StringBuffer sb = new StringBuffer();
150:                    MBeanParameterInfo[] oParams = po_Ope.getSignature();
151:                    for (int i = 0; i < oParams.length; i++) {
152:                        sb.append(oParams[i].getType());
153:                        sb.append(" ");
154:                        sb.append(oParams[i].getName());
155:                        if (i < (oParams.length - 1)) {
156:                            sb.append(", ");
157:                        }
158:                    }
159:                    setParameters(sb.toString());
160:                }
161:
162:                public String getName() {
163:                    return name;
164:                }
165:
166:                public void setName(String name) {
167:                    this .name = name;
168:                }
169:
170:                public String getReturnType() {
171:                    return returnType;
172:                }
173:
174:                public void setReturnType(String returnType) {
175:                    this .returnType = returnType;
176:                }
177:
178:                public String getImpact() {
179:                    return impact;
180:                }
181:
182:                public void setImpact(String impact) {
183:                    this .impact = impact;
184:                }
185:
186:                public String getParameters() {
187:                    return parameters;
188:                }
189:
190:                public void setParameters(String parameters) {
191:                    this .parameters = parameters;
192:                }
193:
194:                public String getDescription() {
195:                    return description;
196:                }
197:
198:                public void setDescription(String description) {
199:                    this .description = description;
200:                }
201:            }
202:
203:            public class MBeanOperationsByName implements  Comparator {
204:
205:                public int compare(Object p_O1, Object p_O2) {
206:                    ViewMBeanOperations o1 = (ViewMBeanOperations) p_O1;
207:                    ViewMBeanOperations o2 = (ViewMBeanOperations) p_O2;
208:                    return o1.getName().compareToIgnoreCase(o2.getName());
209:                }
210:
211:                public boolean equals(Object p_Obj) {
212:                    if (p_Obj instanceof  ViewMBeanOperations) {
213:                        return true;
214:                    }
215:                    return false;
216:                }
217:            }
218:
219:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.