geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecr...@apache.org
Subject svn commit: r601966 - in /geronimo/sandbox/monitoring/client/client-war/src/main: java/org/apache/geronimo/plugins/monitoring/client/MRCConnector.java webapp/WEB-INF/view/monitoringViewServer.jsp
Date Fri, 07 Dec 2007 02:56:48 GMT
Author: ecraig
Date: Thu Dec  6 18:56:41 2007
New Revision: 601966

URL: http://svn.apache.org/viewvc?rev=601966&view=rev
Log:
GERONIMO-3679

Montitoring console should display 'available statistics' in a more 
organized way

Patch by Viet Nguyen

Modified:
    geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MRCConnector.java
    geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp

Modified: geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MRCConnector.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MRCConnector.java?rev=601966&r1=601965&r2=601966&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MRCConnector.java
(original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MRCConnector.java
Thu Dec  6 18:56:41 2007
@@ -610,7 +610,7 @@
         }
         return beanMap;
     }
-
+    
     @SuppressWarnings("unchecked")
     public boolean stopTrackingMbean(String MBean) throws Exception
     {

Modified: geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp?rev=601966&r1=601965&r2=601966&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
(original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
Thu Dec  6 18:56:41 2007
@@ -18,10 +18,11 @@
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
 <%@ page import="org.apache.geronimo.plugins.monitoring.client.StatsGraph" %>
 <%@ page import="org.apache.geronimo.plugins.monitoring.client.GraphsBuilder" %>
-<%@ page import="java.util.Vector" %>
+<%@ page import="java.util.ArrayList" %>
 <%@ page import="java.util.Set" %>
-<%@ page import="java.util.Iterator" %>
 <%@ page import="java.util.HashMap" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="java.util.Map" %>
 <%@ page import="java.util.TreeMap" %>
 <%@ page import="java.lang.String" %>
 <%@ page import="java.sql.Connection" %>
@@ -316,28 +317,60 @@
                 </tr>
 
                         
-                        <%
-                        try{
-                        for (Iterator <String> it = trackedBeansMap.keySet().iterator();
it.hasNext();)   
-                        {
-                            String prettyBean = it.next().toString();
-                          %>
-                                           <tr>
-                    <td width=95% bgcolor="#FFFFFF" nowrap>
-                           <%=prettyBean%>
-                           </td>
-                    <td align="right" width=5% bgcolor="#f2f2f2" nowrap>
-                    <a href="<portlet:actionURL portletMode="view"><portlet:param
name="action" value="stopTrackingMbean" /><portlet:param name="server_id" value="<%=server_id%>"
/><portlet:param name="mbean" value="<%=trackedBeansMap.get(prettyBean)%>" /></portlet:actionURL>"><img
border=0 src="/monitoring/images/close-b.png"></a><br>
-                                        </td>     
-                </tr>
-                        <%
+                 <%
+                 try {
+                     // store all mbeans into a map [category --> list of mbeans)
+                     TreeMap<String, ArrayList<String>> trackedCategoryMap =
new TreeMap<String, ArrayList<String>>();
+                     for(Iterator<String> it = trackedBeansMap.keySet().iterator();
it.hasNext(); ) {
+                         String mbeanPretty = it.next();
+                         String mbean = trackedBeansMap.get(mbeanPretty); // full mbean name
+                         String[] params = mbean.split(",");
+                         String category = "Other";
+                         for(int i = 0 ; i < params.length; i++) {
+                             if(params[i].startsWith("j2eeType=")) {
+                                 // we've found our category, so stop it
+                                 category = params[i].split("=")[1];
+                                 if(category.equalsIgnoreCase("gbean")) {
+                                     category = "Other";
+                                 }
+                                 break;
+                             }
                          }
-                        }
-                        catch (Exception e)
-                        {
-                            
-                        }
-                        %> 
+                         ArrayList<String> currList = trackedCategoryMap.get(category);
+                         if(currList == null) {
+                             currList = new ArrayList<String>();
+                         }
+                         currList.add(mbean);
+                         trackedCategoryMap.put(category, currList);
+                     }
+                     // view all mbeans by category
+	                 for (Iterator <String> it = trackedCategoryMap.keySet().iterator();
it.hasNext();) {
+	                     String category = it.next().toString();
+	                     out.println("<tr><td colspan=2 bgcolor=\"#DCDCDC\"><b>"
+ category + "</b></td></tr>");
+	                     ArrayList<String> mbeanList = trackedCategoryMap.get(category);
+	                     for(int i = 0 ; i < mbeanList.size(); i++) {
+	                         String prettyBean = null;
+	                         boolean found = false;
+	                         for(Iterator<String> itt = trackedBeansMap.keySet().iterator();
itt.hasNext() && !found; ) {
+	                             String currPrettyBean = itt.next();
+	                             if(trackedBeansMap.get(currPrettyBean).equals(mbeanList.get(i)))
{
+	                                 prettyBean = currPrettyBean;
+	                                 found = true;
+	                             }
+	                         }
+	                   %>
+			             <tr>
+			                 <td width=95% bgcolor="#FFFFFF" nowrap><%=prettyBean%></td>
+			                 <td align="right" width=5% bgcolor="#f2f2f2" nowrap>
+			                     <a href="<portlet:actionURL portletMode="view"><portlet:param
name="action" value="stopTrackingMbean" /><portlet:param name="server_id" value="<%=server_id%>"
/><portlet:param name="mbean" value="<%=mbeanList.get(i)%>" /></portlet:actionURL>"><img
border=0 src="/monitoring/images/close-b.png"></a><br>
+			                 </td>
+			             </tr>
+	                 <%
+	                     }
+	                 }
+                 } catch (Exception e) {
+                 }
+                 %> 
             </table>
 
             <br>
@@ -352,31 +385,59 @@
                         
                         <%
                         try {
-                        for (Iterator <String> it = availableBeansMap.keySet().iterator();
it.hasNext();)   
-                        {
-                            String prettyBean = it.next().toString();
-                          %>
-                                           <tr>
-                    <td width=95% bgcolor="#FFFFFF" nowrap>
-                           <%=prettyBean%>
-                           </td>
-                    <td align="right" width=5% bgcolor="#f2f2f2" nowrap>
-                    <a href="<portlet:actionURL portletMode="view"><portlet:param
name="action" value="startTrackingMbean" /><portlet:param name="server_id" value="<%=server_id%>"
/><portlet:param name="mbean" value="<%=availableBeansMap.get(prettyBean)%>" /></portlet:actionURL>"><img
border=0 src="/monitoring/images/max-b.png"></a><br>
-                                        </td>     
-                </tr>
-                        <%
-                         }
+                            // store all mbeans into a map [category --> list of mbeans)
+                            TreeMap<String, ArrayList<String>> availableCategoryMap
= new TreeMap<String, ArrayList<String>>();
+                            for(Iterator<String> it = availableBeansMap.keySet().iterator();
it.hasNext(); ) {
+                                String mbeanPretty = it.next();
+                                String mbean = availableBeansMap.get(mbeanPretty); // full
mbean name
+                                String[] params = mbean.split(",");
+                                String category = "Other";
+                                for(int i = 0 ; i < params.length; i++) {
+                                    if(params[i].startsWith("j2eeType=")) {
+                                        // we've found our category, so stop it
+                                        category = params[i].split("=")[1];
+                                        if(category.equalsIgnoreCase("gbean")) {
+                                            category = "Other";
+                                        }
+                                        break;
+                                    }
+                                }
+                                ArrayList<String> currList = availableCategoryMap.get(category);
+                                if(currList == null) {
+                                    currList = new ArrayList<String>();
+                                }
+                                currList.add(mbean);
+                                availableCategoryMap.put(category, currList);
+                            }
+                            // view all mbeans by category
+                            for (Iterator <String> it = availableCategoryMap.keySet().iterator();
it.hasNext();) {
+                                String category = it.next().toString();
+                                out.println("<tr><td colspan=2 bgcolor=\"#DCDCDC\"><b>"
+ category + "</b></td></tr>");
+                                ArrayList<String> mbeanList = availableCategoryMap.get(category);
+                                for(int i = 0 ; i < mbeanList.size(); i++) {
+                                    String prettyBean = null;
+                                    boolean found = false;
+                                    for(Iterator<String> itt = availableBeansMap.keySet().iterator();
itt.hasNext() && !found; ) {
+                                        String currPrettyBean = itt.next();
+                                        if(availableBeansMap.get(currPrettyBean).equals(mbeanList.get(i)))
{
+                                            prettyBean = currPrettyBean;
+                                            found = true;
+                                        }
+                                    }
+                              %>
+	                           <tr>
+	                               <td width=95% bgcolor="#FFFFFF" nowrap><%=prettyBean%></td>
+	                               <td align="right" width=5% bgcolor="#f2f2f2" nowrap>
+	                                   <a href="<portlet:actionURL portletMode="view"><portlet:param
name="action" value="startTrackingMbean" /><portlet:param name="server_id" value="<%=server_id%>"
/><portlet:param name="mbean" value="<%=mbeanList.get(i)%>" /></portlet:actionURL>"><img
border=0 src="/monitoring/images/max-b.png"></a><br>
+	                               </td>     
+	                           </tr>
+	                        <%
+	                            }
+                            }
+                        } catch (Exception e) {
                         }
-                        catch (Exception e)
-                        {
-                            
-                        }
-                        %>                  
-                    
-                      
-
+                        %>
             </table>
-            
         </td>        
     </tr>
 </table>



Mime
View raw message