geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akulshresh...@apache.org
Subject svn commit: r591545 - in /geronimo/sandbox/monitoring/client/client-war/src/main: java/org/apache/geronimo/plugins/monitoring/client/ webapp/WEB-INF/view/
Date Sat, 03 Nov 2007 02:58:06 GMT
Author: akulshreshtha
Date: Fri Nov  2 19:58:05 2007
New Revision: 591545

URL: http://svn.apache.org/viewvc?rev=591545&view=rev
Log:
GERONIMO-3577 Monitoring Client: Patch by Erik B. Craig

Added:
    geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
  (with props)
Modified:
    geronimo/sandbox/monitoring/client/client-war/src/main/java/org/apache/geronimo/plugins/monitoring/client/MonitoringPortlet.java
    geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringAddServer.jsp
    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/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=591545&r1=591544&r2=591545&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
Fri Nov  2 19:58:05 2007
@@ -47,6 +47,8 @@
 
     private static final String      ADDVIEW_JSP        = "/WEB-INF/view/monitoringAddView.jsp";
 
+    private static final String      ADDGRAPH_JSP       = "/WEB-INF/view/monitoringAddGraph.jsp";
+
     private static final String      VIEWSERVER_JSP     = "/WEB-INF/view/monitoringViewServer.jsp";
 
     private static final String      EDITSERVER_JSP     = "/WEB-INF/view/monitoringEditServer.jsp";
@@ -71,6 +73,8 @@
 
     private PortletRequestDispatcher addView;
 
+    private PortletRequestDispatcher addGraph;
+
     private PortletRequestDispatcher viewServer;
 
     private PortletRequestDispatcher editServer;
@@ -115,6 +119,19 @@
         {
             addView(actionRequest, actionResponse);
         }
+        else if (action.equals("showAddGraph"))
+        {
+            String server_id = actionRequest.getParameter("server_id");
+            actionResponse.setRenderParameter("server_id", server_id);
+            String mbean = actionRequest.getParameter("mbean");
+            actionResponse.setRenderParameter("mbean", mbean);
+            String dataname = actionRequest.getParameter("dataname");
+            actionResponse.setRenderParameter("dataname", dataname);
+        }
+        else if (action.equals("saveAddGraph"))
+        {
+            addGraph(actionRequest, actionResponse);
+        }
         else if (action.equals("deleteView"))
         {
             deleteView(actionRequest, actionResponse);
@@ -586,6 +603,22 @@
             request.setAttribute("message", message);
             normalView.include(request, response);
         }
+        else if (action.equals("showAddGraph"))
+        {
+            String server_id = request.getParameter("server_id");
+            request.setAttribute("server_id", server_id);
+            String mbean = request.getParameter("mbean");
+            request.setAttribute("mbean", mbean);
+            String dataname = request.getParameter("dataname");
+            request.setAttribute("dataname", dataname);
+            addGraph.include(request, response);
+        }
+        else if (action.equals("saveAddGraph"))
+        {
+            String message = request.getParameter("message");
+            request.setAttribute("message", message);
+            normalView.include(request, response);
+        }
         else if (action.equals("deleteView"))
         {
             String message = request.getParameter("message");
@@ -873,6 +906,56 @@
         }
     }
 
+    protected void addGraph(ActionRequest actionRequest,
+            ActionResponse actionResponse)
+    {
+        DBManager DBase = new DBManager();
+        Connection con = DBase.getConnection();
+        String name = actionRequest.getParameter("name");
+        String description = actionRequest.getParameter("description");
+        String server_id = actionRequest.getParameter("server_id");
+        String xlabel = actionRequest.getParameter("xlabel");
+        String ylabel = actionRequest.getParameter("ylabel");
+        String timeframe = actionRequest.getParameter("timeframe");
+        String mbean = actionRequest.getParameter("mbean");
+        String dataname = actionRequest.getParameter("dataname");
+        try
+        {
+            PreparedStatement pStmt = con
+                    .prepareStatement("INSERT INTO graphs (server_id, name, description,
timeframe, mbean, dataname1, xlabel, ylabel, data1operation, operation, data2operation, dataname2,
warninglevel1, warninglevel2, added, modified, last_seen) VALUES ("
+                            + server_id
+                            + ",'"
+                            + name
+                            + "','"
+                            + description
+                            + "',"
+                            + timeframe
+                            + ",'"
+                            + mbean
+                            + "','"
+                            + dataname
+                            + "','"
+                            + xlabel
+                            + "','"
+                            + ylabel
+                            + "','D','/','D','time',500.0,1024.0,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)");
+            pStmt.executeUpdate();
+            con.close();
+            actionResponse.setRenderParameter("message",
+                    "<font color=\"green\"><strong><li>Graph " + name
+                            + " has been added.</li></strong></font>");
+            return;
+
+        }
+        catch (Exception e)
+        {
+            actionResponse.setRenderParameter("message",
+                    "<font color=\"red\"><strong><li>Error adding graph</li></strong></font>"
+                            + e.getMessage());
+            return;
+        }
+    }
+
     @Override
     public void init(PortletConfig portletConfig) throws PortletException
     {
@@ -885,6 +968,8 @@
                 EDITVIEW_JSP);
         addView = portletConfig.getPortletContext().getRequestDispatcher(
                 ADDVIEW_JSP);
+        addGraph = portletConfig.getPortletContext().getRequestDispatcher(
+                ADDGRAPH_JSP);
         viewServer = portletConfig.getPortletContext().getRequestDispatcher(
                 VIEWSERVER_JSP);
         editServer = portletConfig.getPortletContext().getRequestDispatcher(
@@ -910,6 +995,7 @@
         pageView = null;
         editView = null;
         addView = null;
+        addGraph = null;
         viewServer = null;
         editServer = null;
         addServer = null;

Added: geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp?rev=591545&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
(added)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
Fri Nov  2 19:58:05 2007
@@ -0,0 +1,193 @@
+<%--
+   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.util.HashMap" %>
+<%@ page import="java.util.TreeMap" %>
+<%@ 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 message = (String) request.getAttribute("message");
+String mbean = (String) request.getAttribute("mbean");
+String dataname = (String) request.getAttribute("dataname");
+String server_id = (String) request.getAttribute("server_id");
+
+if (message == null)
+    message = new String("");
+
+
+%>
+<!-- <head> -->
+
+    <style type='text/css'>
+    </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='';
+}
+function validate() {
+   if (! (document.addGraph.name.value 
+      && document.addGraph.description.value 
+      && document.addGraph.dataname.value
+      && document.addGraph.mbean.value ))
+   {
+      alert("Name, Description, Dataname and mbean are all required fields");
+      return false;
+   }
+   return;
+}
+function noAlpha(obj){
+    reg = /[^0-9]/g;
+    obj.value =  obj.value.replace(reg,"");
+ }
+
+//-->
+</script>
+<!-- </head> -->
+        <a HREF="javascript:history.go(-1)"><< Back</a><br>
+            <%
+ if (!message.equals(""))
+ {
+ %>
+<div align="left" style="width: 500px">
+<%=message %><br>
+</div>
+<%} %>
+<table>
+    <tr>
+        <!-- Body -->
+        <td width="90%" align="left" valign="top">
+            <p>
+            <font face="Verdana" size="+1">
+            Add a Graph
+            </font>
+            </p>         
+            <p>
+  <form onsubmit="return validate();" name="addGraph" method="POST" action="<portlet:actionURL
portletMode="edit"><portlet:param name="action" value="saveAddGraph"/></portlet:actionURL>">
+  <table cellpadding="1" cellspacing="1">
+   <tr>
+      <td>Server:</td>
+      <td>&nbsp;</td>
+      <td align="right"><input type="text" name="server_id" readonly="readonly"
value="<%=server_id %>"></td>
+      <td></td>
+    </tr>
+    <tr>
+      <td>Name:</td>
+      <td>&nbsp;</td>
+      <td align="right"><input type="text" name="name" value=""></td>
+      <td></td>
+    </tr>
+    <tr>
+      <td>Description:</td>
+      <td>&nbsp;</td>
+      <td align="right"><textarea rows="5" cols="50" name="description"></textarea></td>
+      <td></td>
+    </tr>
+    <tr>
+      <td>X Axis label:</td>
+      <td>&nbsp;</td>
+      <td align="right"><input type="text" name="xlabel" value=""/></td>
+      <td></td>
+    </tr>
+    <tr>
+      <td>Y Axis label:</td>
+      <td>&nbsp;</td>
+      <td align="right"><input type="text" name="ylabel" value=""/></td>
+      <td></td>
+    </tr>
+    <tr>
+        <td>Timeframe:</td>
+        <td>&nbsp;</td>
+        <td align="right"><input type="text" width="5" size="4" name="timeframe"
onKeyUp='noAlpha(this)' onKeyPress='noAlpha(this)' value="60"/></td>
+        <td> minutes</td>
+      </tr>
+    <tr>
+      <td>Mbean:</td>
+      <td>&nbsp;</td>
+      <td align="right"><input type="text" readonly="readonly" name="mbean" value="<%=mbean
%>"/></td>
+      <td></td>
+    </tr>
+    <tr>
+      <td>Data Name:</td>
+      <td>&nbsp;</td>
+      <td align="right"><input type="text" readonly="readonly" name="dataname" value="<%=dataname
%>"/></td>
+      <td></td>
+    </tr>
+    <tr><td colspan="2"><font size="-2">&nbsp;</font></td></tr>
+    <tr>
+      <td colspan="1" align="left"><button type="button" value="Cancel" onclick="javascript:history.go(-1)">Cancel</button></td>
+      <td>&nbsp;</td>
+      <td colspan="1" align="right"><input type="submit" value="Add" /></td>
+      <td></td>
+    </tr>
+  </table>
+  </form>
+
+            </p>
+
+        </td>
+     
+         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+
+        <!-- Geronimo Links -->
+        <td valign="top">
+
+            <table width="100%" style="border-bottom: 1px solid #2581c7;" cellspacing="1"
cellpadding="1">
+                <tr>
+                    <td class="DarkBackground" align="left" nowrap>
+                        <font face="Verdana" size="+1">Actions</font>
+                    </td>
+                </tr>
+                <tr>
+                    <td bgcolor="#FFFFFF" nowrap>
+                        &nbsp;<br />
+                        <ul>
+                        
+                        </ul>
+                        &nbsp;<br />
+                    </td>   
+                </tr>
+            </table>
+            
+        </td>        
+    </tr>
+</table>
+
+
+
+

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

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

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

Modified: geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringAddServer.jsp
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringAddServer.jsp?rev=591545&r1=591544&r2=591545&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringAddServer.jsp
(original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringAddServer.jsp
Fri Nov  2 19:58:05 2007
@@ -78,11 +78,6 @@
     reg = /[^0-9]/g;
     obj.value =  obj.value.replace(reg,"");
  }
-function onClick(href)
-{
-window.location = href+"&ip="+document.addServer.ip.value;
-return false;
-}
 
 //-->
 </script>

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=591545&r1=591544&r2=591545&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
Fri Nov  2 19:58:05 2007
@@ -258,7 +258,7 @@
                 {
                     String dataName = itt.next().toString();
                 %>
-                    <tr><td><%=dataName%></td><td><%=beanStats.get(dataName)
%></td></tr>
+                    <tr><td><a href="<portlet:actionURL portletMode="edit"><portlet:param
name="action" value="showAddGraph" /><portlet:param name="server_id" value="<%=server_id%>"
/><portlet:param name="mbean" value="<%=trackedBeansMap.get(prettyBean)%>" /><portlet:param
name="dataname" value="<%=dataName%>" /></portlet:actionURL>"><%=dataName%></a></td><td><%=beanStats.get(dataName)
%></td></tr>
                 <%
                 }
                 %>
@@ -417,6 +417,7 @@
     <%
     rs.close();
     }%>
+
 
 
 



Mime
View raw message