geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akulshresh...@apache.org
Subject svn commit: r587875 - in /geronimo/sandbox/monitoring/client/client-war/src/main: java/org/apache/geronimo/plugins/monitoring/client/ webapp/WEB-INF/view/
Date Wed, 24 Oct 2007 12:25:37 GMT
Author: akulshreshtha
Date: Wed Oct 24 05:25:37 2007
New Revision: 587875

URL: http://svn.apache.org/viewvc?rev=587875&view=rev
Log:
GERONIMO-3550 Monitoring Client: Default Server view page, Patch by Erik B. Craig

Added:
    geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
  (with props)
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/java/org/apache/geronimo/plugins/monitoring/client/MonitoringPortlet.java

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=587875&r1=587874&r2=587875&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
Wed Oct 24 05:25:37 2007
@@ -20,8 +20,8 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Properties;
+import java.util.Set;
 
-import javax.management.MBeanServerConnection;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 
@@ -30,8 +30,6 @@
 public class MRCConnector
 {
 
-    private static final String              PATH             = "geronimo:ServiceModule=org.apache.geronimo.monitor/MRC/1.0/car,J2EEServer=geronimo,name=MasterRemoteControl,j2eeType=GBean";
-    private static MBeanServerConnection     mbServerConn;
     private static Long                      SnapshotDuration = new Long(0);
     private static MasterRemoteControlRemote mrc              = null;
 
@@ -154,5 +152,17 @@
     public boolean isSnapshotRunning() throws Exception
     {
         return mrc.isSnapshotRunning();
+    }
+
+    @SuppressWarnings("unchecked")
+    public Set<String> getAllMbeanNames() throws Exception
+    {
+        return mrc.getAllMBeanNames();
+    }
+
+    @SuppressWarnings("unchecked")
+    public Set<String> getStatisticsProviderMBeanNames() throws Exception
+    {
+        return mrc.getStatisticsProviderMBeanNames();
     }
 }

Modified: geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MonitoringPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MonitoringPortlet.java?rev=587875&r1=587874&r2=587875&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MonitoringPortlet.java
(original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MonitoringPortlet.java
Wed Oct 24 05:25:37 2007
@@ -43,6 +43,8 @@
 
     private static final String      PAGEVIEW_JSP      = "/WEB-INF/view/monitoringPage.jsp";
 
+    private static final String      VIEWSERVER_JSP    = "/WEB-INF/view/monitoringViewServer.jsp";
+
     private static final String      MBEAN_JSP         = "/WEB-INF/view/monitoringMbean.jsp";
 
     private static final String      TIMEFRAME_JSP     = "/WEB-INF/view/monitoringTimeframe.jsp";
@@ -57,6 +59,8 @@
 
     private PortletRequestDispatcher pageView;
 
+    private PortletRequestDispatcher viewServer;
+
     private PortletRequestDispatcher mBeanView;
 
     private PortletRequestDispatcher timeFrameView;
@@ -78,6 +82,11 @@
             String view_id = actionRequest.getParameter("view_id");
             actionResponse.setRenderParameter("view_id", view_id);
         }
+        else if (action.equals("showServer"))
+        {
+            String server_id = actionRequest.getParameter("server_id");
+            actionResponse.setRenderParameter("server_id", server_id);
+        }
         else if (action.equals("stopThread"))
         {
             String server_id = actionRequest.getParameter("server_id");
@@ -107,6 +116,12 @@
             request.setAttribute("view_id", view_id);
             pageView.include(request, response);
         }
+        else if (action.equals("showServer"))
+        {
+            String server_id = request.getParameter("server_id");
+            request.setAttribute("server_id", server_id);
+            viewServer.include(request, response);
+        }
         else if (action.equals("stopThread"))
         {
             PreparedStatement pStmt = null;
@@ -310,6 +325,8 @@
                 NORMALVIEW_JSP);
         pageView = portletConfig.getPortletContext().getRequestDispatcher(
                 PAGEVIEW_JSP);
+        viewServer = portletConfig.getPortletContext().getRequestDispatcher(
+                VIEWSERVER_JSP);
         mBeanView = portletConfig.getPortletContext().getRequestDispatcher(
                 MBEAN_JSP);
         timeFrameView = portletConfig.getPortletContext().getRequestDispatcher(
@@ -327,6 +344,7 @@
     {
         normalView = null;
         pageView = null;
+        viewServer = null;
         mBeanView = null;
         timeFrameView = null;
         maximizedView = null;

Added: 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=587875&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
(added)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
Wed Oct 24 05:25:37 2007
@@ -0,0 +1,271 @@
+<%--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+--%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ 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.Set" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="java.lang.String" %>
+<%@ page import="java.sql.Connection" %>
+<%@ page import="java.sql.DatabaseMetaData" %>
+<%@ page import="java.sql.PreparedStatement" %>
+<%@ page import="java.sql.ResultSet" %>
+<%@ page import="java.sql.SQLException" %>
+<%@ page import="org.apache.geronimo.plugins.monitoring.client.util.*" %>
+<%@ page import="org.apache.geronimo.console.util.PortletManager" %>
+<%@ page import="org.apache.geronimo.plugins.monitoring.client.MRCConnector" %>
+<portlet:defineObjects/>
+
+<%
+
+String server_id = (String) request.getAttribute("server_id"); 
+
+DBManager DBase = new DBManager();
+Connection con = DBase.getConnection();
+
+PreparedStatement pStmt = con.prepareStatement("SELECT * FROM servers WHERE enabled=1 AND
server_id="+server_id);
+ResultSet rs2 = pStmt.executeQuery();
+pStmt = con.prepareStatement("SELECT * FROM graphs WHERE enabled=1 AND server_id="+server_id);
+ResultSet rs = pStmt.executeQuery();
+Vector <StatsGraph> GraphVector = new Vector<StatsGraph>();
+GraphsBuilder run = new GraphsBuilder(con);
+while (rs.next())
+{   
+    GraphVector.add(run.buildOneDB(14, rs.getInt("GRAPH_ID"))); 
+}
+
+if (rs2.next())
+{
+    MRCConnector MRCConnection = new MRCConnector(rs2.getString("ip"), rs2
+            .getString("username"), rs2.getString("password"));
+    Set <String> trackedMbeans = MRCConnection.getStatisticsProviderMBeanNames();
+
+    
+
+    
+%>
+<!-- <head> -->
+
+    <style type='text/css'>
+    <%
+    for (StatsGraph graph : GraphVector) 
+            out.println(graph.getDiv());
+
+    %>
+    </style>
+    <script type='text/javascript' src='/dojo/dojo.js'>
+    </script>
+        <script type = "text/javascript">
+<!--
+function hide(x) {
+document.getElementById(x).style.display='none';
+}
+function show(x) {
+document.getElementById(x).style.display='';
+}
+//-->
+</script>
+    <script type='text/javascript'>
+    var dojoConfig =
+    {
+        isDebug:true
+    };
+    dojo.require("dojo.collections.Store");
+    dojo.require("dojo.charting.Chart");
+    dojo.require('dojo.json');
+    <% for (StatsGraph graph : GraphVector)
+       out.println(graph.getJS());
+
+    %>
+    </script>
+<!-- </head> -->
+
+<table>
+    <tr>
+        <!-- Body -->
+        <td width="90%" align="left" valign="top">
+            <a HREF="javascript:history.go(-1)"><< Back</a>
+            <p>
+            <font face="Verdana" size="+1">
+            <%=rs2.getString("name")%>
+            </font>
+            </p>         
+            <p><%=rs2.getString("ip")%></p>
+<% for (StatsGraph graph : GraphVector) 
+{
+%>
+<p>
+<div id="<%=graph.getDivName()%>Head" "style="background-color: #f2f2f2; border-top:
1px solid #2581c7; margin: 0px; width: 670px; height: 10px;"><div align="left" style="background-color:
#f2f2f2; float:left; text-align:left; width:500px;"><%=graph.getName()%></div><div
align=right style="background-color: #f2f2f2; float:left; width:170px; text-align:right;"><a
href="#" onClick="hide('<%=graph.getDivName()%>')">_</a>&nbsp;<a href="#"
onClick="show('<%=graph.getDivName()%>')">+</a>&nbsp;<a href="#" onClick="hide('<%=graph.getDivName()%>');hide('<%=graph.getDivName()%>Head');">X</a></div></div>
+<%=graph.getDivImplement()%>
+</p>
+<%
+}
+%>
+
+        </td>
+     
+         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+
+        <!-- Geronimo Links -->
+        <td valign="top">
+
+            <table width="100%" style="border-bottom: 1px solid #2581c7;" cellspacing="0"
cellpadding="3">
+                <tr>
+                    <td class="DarkBackground" align="left" nowrap>
+                        <font face="Verdana" size="+1">Actions</font>
+                    </td>
+                </tr>
+                <tr>
+                    <td bgcolor="#FFFFFF" nowrap>
+                        &nbsp;<br />
+                        <ul>
+                        <li><a href="#">Modify this server</a></li>
+                        <li><a href="#">Add a new server</a></li>
+                        </ul>
+                        &nbsp;<br />
+                    </td>   
+                </tr>
+            </table>
+            <br>
+            <br>
+            <table style="border-bottom: 1px solid #2581c7;" width="100%" cellspacing="0"
cellpadding="3">
+                <tr>
+                    <td colspan="2" class="DarkBackground" align="left" nowrap>
+                        <font face="Verdana" size="+1">Statistics Collected</font>
+                    </td>
+                </tr>
+                <tr>
+                    <td width=95% bgcolor="#FFFFFF" nowrap>
+                        &nbsp;<br />
+                        <ul>
+                        <li><a href="#">Mbean1</a></li>
+                        <li><a href="#">Mbean2</a></li>
+                        <li><a href="#">Mbean3</a></li>
+                        <li><a href="#">Mbean4</a></li>
+                        </ul>
+                        &nbsp;<br />
+                    </td>
+                    <td align="right" width=5% bgcolor="#FFFFFF" nowrap>
+                        &nbsp;<br />
+                        <a href="#">x</a><br />
+                        <a href="#">x</a><br />
+                        <a href="#">x</a><br />
+                        <a href="#">x</a><br />
+                        &nbsp;<br />
+                    </td>     
+                </tr>
+            </table>
+
+            <br>
+            <br>
+            <table style="border-bottom: 1px solid #2581c7;" width="100%" cellspacing="0"
cellpadding="3">
+                <tr>
+                    <td colspan="2" class="DarkBackground" align="left" nowrap>
+                        <font face="Verdana" size="+1">Statistics Available</font>
+                    </td>
+                </tr>
+                <tr>
+                    <td width=95% bgcolor="#FFFFFF" nowrap>
+                        &nbsp;<br />
+                        <ul>
+                        
+                        <%
+                        Iterator it = trackedMbeans.iterator(); 
+                        while  ( it.hasNext() )   
+                        {
+                           String[] temparray1 = it.next().toString().split("name=");
+                           String[] temparray2 = temparray1[1].split(",");
+                           String[] temparray3 = temparray2[0].split("/");
+                           String mbeanOut = null;
+                           if (temparray3.length > 1)
+                               mbeanOut = temparray3[1];
+                           else
+                               mbeanOut = temparray2[0];
+                         %>
+                           
+                           <li><a href="#"><%=mbeanOut%></a></li>
+                        <%
+                         }
+                        %>                  
+                        </ul>
+                        &nbsp;<br />
+                    </td>
+                    <td align="right" width=5% bgcolor="#FFFFFF" nowrap>
+                        &nbsp;<br />
+                        
+                        <%
+                        for (int i = 0; i < trackedMbeans.size(); i++)
+                        {
+                            %>
+                            <a href="#">+</a><br>
+                           <%
+                        }
+                        %>
+                        &nbsp;<br />
+                    </td>     
+                </tr>
+            </table>
+            
+        </td>        
+    </tr>
+</table>
+<%}
+    else
+    {%>
+<table>
+    <tr>
+        <!-- Body -->
+        <td width="90%" align="left" valign="top">
+            <a HREF="javascript:history.go(-1)"><< Back</a>
+            <p>
+            <font face="Verdana" size="+1">
+            Server does not exist or is disabled
+            </font>
+            </p>         
+
+        </td>
+     
+         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+
+        <!-- Geronimo Links -->
+        <td valign="top">
+
+            <table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
+                <tr>
+                    <td class="DarkBackground" align="left" nowrap>
+                        <font face="Verdana" size="+1">Actions</font>
+                    </td>
+                </tr>
+                <tr>
+                    <td bgcolor="#FFFFFF" nowrap>
+                        &nbsp;<br />
+                        <ul>
+                        <li><a href="#">Add a new server</a></li>
+                        </ul>
+                        &nbsp;<br />
+                    </td>   
+                </tr>
+            </table>
+
+        </td>  
+    </tr>
+</table>
+    <%}%>
+
+

Propchange: geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message