geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecr...@apache.org
Subject svn commit: r599573 - in /geronimo/sandbox/monitoring/client/client-war/src/main: java/org/apache/geronimo/plugins/monitoring/client/ webapp/WEB-INF/view/
Date Thu, 29 Nov 2007 20:58:27 GMT
Author: ecraig
Date: Thu Nov 29 12:58:22 2007
New Revision: 599573

URL: http://svn.apache.org/viewvc?rev=599573&view=rev
Log:
GERONIMO-3649
monitoring client needs to have links on the side fixed
Patch by Viet Nguyen



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/monitoringEditServer.jsp
    geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringNormal.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=599573&r1=599572&r2=599573&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
Thu Nov 29 12:58:22 2007
@@ -187,31 +187,35 @@
             String mbean = actionRequest.getParameter("mbean");
             actionResponse.setRenderParameter("mbean", mbean);
         }
-        else if (action.equals("stopThread"))
+        else if (action.equals("stopThread") || action.equals("disableServerViewQuery"))
         {
             String server_id = actionRequest.getParameter("server_id");
+            String message = stopThread(server_id);
             actionResponse.setRenderParameter("server_id", server_id);
+            actionResponse.setRenderParameter("message", message);
         }
-        else if (action.equals("startThread"))
+        else if (action.equals("startThread") || action.equals("enableServerViewQuery"))
         {
             String server_id = actionRequest.getParameter("server_id");
-            String snapshotDuration = actionRequest
-                    .getParameter("snapshotDuration");
+            String snapshotDuration = actionRequest.getParameter("snapshotDuration");
+            String message = startThread(server_id, new Long(snapshotDuration));
+            actionResponse.setRenderParameter("message", message);
             actionResponse.setRenderParameter("server_id", server_id);
-            actionResponse.setRenderParameter("snapshotDuration",
-                    snapshotDuration);
+            actionResponse.setRenderParameter("snapshotDuration", snapshotDuration);
         }
-        else if (action.equals("disableServer"))
+        else if (action.equals("disableServer") || action.equals("disableEditServer"))
         {
             String server_id = actionRequest.getParameter("server_id");
+            actionResponse.setRenderParameter("server_id", server_id);;
             actionResponse.setRenderParameter("message", alterServerState(
                     server_id, false));
         }
-        else if (action.equals("enableServer"))
+        else if (action.equals("enableServer") || action.equals("enableEditServer"))
         {
             String server_id = actionRequest.getParameter("server_id");
             actionResponse.setRenderParameter("message", alterServerState(
                     server_id, true));
+            actionResponse.setRenderParameter("server_id", server_id);;
         }
         else if (action.equals("testAddServerConnection"))
         {
@@ -369,7 +373,7 @@
         else if (action.equals("stopThread"))
         {
             String server_id = request.getParameter("server_id");
-            String message = stopThread(server_id);
+            String message = request.getParameter("message");
             request.setAttribute("message", message);
             normalView.include(request, response);
 
@@ -379,11 +383,19 @@
             String server_id = request.getParameter("server_id");
             Long snapshotDuration = java.lang.Long.parseLong(request
                     .getParameter("snapshotDuration"));
-            String message = startThread(server_id, snapshotDuration);
+            String message = request.getParameter("message");
             request.setAttribute("message", message);
             normalView.include(request, response);
 
         }
+        else if (action.equals("disableServerViewQuery") || action.equals("enableServerViewQuery"))
+        {
+            String server_id = request.getParameter("server_id");
+            String message = request.getParameter("message");
+            request.setAttribute("message", message);
+            request.setAttribute("server_id", server_id);
+            viewServer.include(request, response);
+        }
         else
         {
             request.setAttribute("message", request.getParameter("message"));
@@ -527,6 +539,18 @@
                             .getParameter("server_id"));
             request.setAttribute("snapshot", request.getParameter("snapshot"));
             editServer.include(request, response);
+        }
+        else if(action.equals("disableEditServer") || action.equals("enableEditServer"))
+        {
+            request.setAttribute("message", request.getParameter("message"));
+            request.setAttribute("server_id", request.getParameter("server_id"));
+            editServer.include(request, response);
+        }
+        else if(action.equals("disableServer") || action.equals("enableServer"))
+        {
+            request.setAttribute("message", request.getParameter("message"));
+            request.setAttribute("server_id", request.getParameter("server_id"));
+            normalView.include(request, response);
         }
         else
         {

Modified: geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp?rev=599573&r1=599572&r2=599573&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp
(original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp
Thu Nov 29 12:58:22 2007
@@ -70,6 +70,7 @@
 String added = "";
 String modified = "";
 String last_seen = "";
+boolean enabled = true;
 
 if (rs.next()) {
     // name == "" when user has not submitted anything
@@ -83,6 +84,7 @@
     added = rs.getString("added");
     modified = rs.getString("modified");
     last_seen = rs.getString("last_seen");
+    enabled = rs.getInt("enabled") == 1 ? true : false;
     try {
         // close connection before using the MRCConnector
         con.close();
@@ -265,7 +267,17 @@
                         &nbsp;<br />
                         <ul>
                         <li><a onclick="document.editServer.action.value='testEditServerConnection';
document.editServer.mode.value='edit'; if(validate()) document.editServer.submit();" href="#">Test
these settings</a></li>
-                        <li><a href="<portlet:actionURL portletMode="edit"><portlet:param
name="action" value="disableServer" /><portlet:param name="server_id" value="<%=server_id%>"
/></portlet:actionURL>">Disable this server</a></li>
+                        <% 
+                        if(enabled) {
+                        %>
+                            <li><a href="<portlet:actionURL portletMode="edit"><portlet:param
name="action" value="disableEditServer" /><portlet:param name="server_id" value="<%=server_id%>"
/></portlet:actionURL>">Disable this server</a></li>
+                        <%
+                        } else {
+                        %>
+                            <li><a href="<portlet:actionURL portletMode="edit"><portlet:param
name="action" value="enableEditServer" /><portlet:param name="server_id" value="<%=server_id%>"
/></portlet:actionURL>">Enable this server</a></li>
+                        <%
+                        }
+                        %>
                         <li><a href="<portlet:actionURL portletMode="edit"><portlet:param
name="action" value="deleteServer" /><portlet:param name="server_id" value="<%=server_id%>"
/></portlet:actionURL>">Delete this server</a></li>
                         <li><a href="<portlet:actionURL portletMode="edit"><portlet:param
name="action" value="showAddServer" /></portlet:actionURL>">Add a new server</a></li>
                         </ul>

Modified: geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp?rev=599573&r1=599572&r2=599573&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
(original)
+++ geronimo/sandbox/monitoring/client/client-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
Thu Nov 29 12:58:22 2007
@@ -70,7 +70,6 @@
   <td class="${backgroundClass}" width="15%" align="center"><%=rs.getString("added").substring(0,16)%></td>
   <td class="${backgroundClass}" width="15%" align="center"><%=rs.getString("modified").substring(0,16)%></td>
   <td class="${backgroundClass}" width="15%" align="center"><a href="<portlet:actionURL
portletMode="edit"><portlet:param name="action" value="showEditView" /><portlet:param
name="view_id" value="<%=rs.getString("view_id")%>" /></portlet:actionURL>"><img
border=0 src="/monitoring/images/edit-b.png">Edit</a></td>
-  <td class="${backgroundClass}" width="15%" align="center"><a href="<portlet:actionURL
portletMode="edit"><portlet:param name="action" value="disableView" /><portlet:param
name="view_id" value="<%=rs.getString("view_id")%>" /></portlet:actionURL>"><img
border=0 src="/monitoring/images/close-b.png">Disable</a></td>
  </tr>
  <%
  }
@@ -127,18 +126,18 @@
      String name = serverInfos.get(i).name;
      boolean online = false;
      boolean collecting = false;
-     MRCConnector MRCConnection = null;
+     MRCConnector mrc = null;
      Long snapshotDuration = new Long(0);
      if (enabled) {
 	     try {
-	         MRCConnection = new MRCConnector(ip, username, password);
+	         mrc = new MRCConnector(ip, username, password);
 	         online = true;
 	     } catch (Exception e) {
 	         online = false;
 	     }
 	     try {
-	         snapshotDuration = MRCConnection.getSnapshotDuration();
-	         if (MRCConnection.isSnapshotRunning())
+	         snapshotDuration = mrc.getSnapshotDuration();
+	         if (mrc.isSnapshotRunning())
 	             collecting = true;
 	         else
 	             collecting = false;

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=599573&r1=599572&r2=599573&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 Nov 29 12:58:22 2007
@@ -49,7 +49,7 @@
 Vector <StatsGraph> GraphVector = new Vector<StatsGraph>();
 GraphsBuilder run = new GraphsBuilder(con);
 
-MRCConnector MRCConnection = null;
+MRCConnector mrc = null;
 
 boolean isOnline = true;
 boolean collecting = false;
@@ -90,7 +90,8 @@
     String modified = rs.getString("modified").substring(0,16);
     rs.close();
     try {
-        MRCConnection = new MRCConnector(ip, username, password);
+        mrc = new MRCConnector(ip, username, password);
+        
         //TODO: Fix update here
         //DBase = new DBManager();
         //con = DBase.getConnection();
@@ -98,10 +99,10 @@
         //pStmt.executeUpdate();
         //con.close();
         
-        availableBeansMap = MRCConnection.getFreeStatisticsProviderBeanNamesMap();
-        trackedBeansMap = MRCConnection.getTrackedBeansMap();
-        snapshotDuration = (Long)MRCConnection.getSnapshotDuration()/1000/60;
-        if (MRCConnection.isSnapshotRunning())
+        availableBeansMap = mrc.getFreeStatisticsProviderBeanNamesMap();
+        trackedBeansMap = mrc.getTrackedBeansMap();
+        snapshotDuration = (Long)mrc.getSnapshotDuration()/1000/60;
+        if (mrc.isSnapshotRunning())
             collecting = true;
         else
             collecting = false;
@@ -256,8 +257,8 @@
             for (Iterator <String> it = trackedBeansMap.keySet().iterator(); it.hasNext();)
             {
                 String prettyBean = it.next().toString();
-                Set<String> statAttributes = MRCConnection.getStatAttributesOnMBean(trackedBeansMap.get(prettyBean));
-                HashMap<String, Long> beanStats = MRCConnection.getStats(trackedBeansMap.get(prettyBean));
+                Set<String> statAttributes = mrc.getStatAttributesOnMBean(trackedBeansMap.get(prettyBean));
+                HashMap<String, Long> beanStats = mrc.getStats(trackedBeansMap.get(prettyBean));
                 if ((counter%3) == 0)
                 {
                  %>
@@ -329,6 +330,17 @@
                         <li><a href="<portlet:actionURL portletMode="edit"><portlet:param
name="action" value="showEditServer" /><portlet:param name="server_id" value="<%=server_id%>"
/></portlet:actionURL>">Modify this server</a></li>
                         <li><a href="<portlet:actionURL portletMode="edit"><portlet:param
name="action" value="disableServer" /><portlet:param name="server_id" value="<%=server_id%>"
/></portlet:actionURL>">Disable this server</a></li>
                         <li><a href="<portlet:actionURL portletMode="edit"><portlet:param
name="action" value="showAddServer" /></portlet:actionURL>">Add a new server</a></li>
+                        <%
+                        if(collecting) {
+                        %>
+                            <li><a href="<portlet:actionURL portletMode="view"><portlet:param
name="action" value="disableServerViewQuery" /><portlet:param name="server_id" value="<%=server_id%>"
/></portlet:actionURL>">Disable Query</a></li>
+                        <%
+                        } else {
+                        %>
+                            <li><a href="<portlet:actionURL portletMode="view"><portlet:param
name="action" value="enableServerViewQuery" /><portlet:param name="server_id" value="<%=server_id%>"
/><portlet:param name="snapshotDuration" value="<%= "" + (snapshotDuration * 1000
* 60) %>" /></portlet:actionURL>">Enable Query</a></li>
+                        <%
+                        }
+                        %>
                         </ul>
                         &nbsp;<br />
                     </td>   



Mime
View raw message