geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r720024 [3/5] - in /geronimo/server/trunk: ./ plugingroups/javaee5-jetty/ plugingroups/javaee5-jetty/src/main/history/ plugingroups/javaee5-tomcat/ plugingroups/javaee5-tomcat/src/main/history/ plugins/monitoring/ plugins/monitoring/agent-c...
Date Sun, 23 Nov 2008 18:32:02 GMT
Added: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/Node.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/Node.java?rev=720024&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/Node.java (added)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/Node.java Sun Nov 23 10:32:00 2008
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+
+
+package org.apache.geronimo.monitoring.console.data;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Column;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+@Entity(name = "node")
+@NamedQuery(name = "allNodes", query = "SELECT a FROM node a")
+public class Node {
+    @Id
+    private String name;
+    private String userName;
+    @Column(length = 1024)
+    private String password;
+    private String protocol;
+    private String host;
+    private int port = -1;
+    private String urlPath;
+    private boolean local;
+
+    private boolean enabled = true;
+
+//    @ManyToOne(fetch= FetchType.EAGER, cascade={CascadeType.PERSIST})
+//    @JoinColumn(
+//        name="cluster", referencedColumnName="name"
+//    )
+//    private JpaClusterInfo cluster;
+//
+//
+//
+//    public JpaClusterInfo getCluster() {
+//        return cluster;
+//    }
+//
+//    public void setCluster(JpaClusterInfo cluster) {
+//        this.cluster = cluster;
+//    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getProtocol() {
+        return protocol;
+    }
+
+    public void setProtocol(String protocol) {
+        this.protocol = protocol;
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    public String getUrlPath() {
+        return urlPath;
+    }
+
+    public void setUrlPath(String urlPath) {
+        this.urlPath = urlPath;
+    }
+
+    public boolean isLocal() {
+        return local;
+    }
+
+    public void setLocal(boolean local) {
+        this.local = local;
+    }
+
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+}

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/Node.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/Node.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/Node.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/View.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/View.java?rev=720024&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/View.java (added)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/View.java Sun Nov 23 10:32:00 2008
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+
+
+package org.apache.geronimo.monitoring.console.data;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToMany;
+import javax.persistence.CascadeType;
+import javax.persistence.FetchType;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.GeneratedValue;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+@Entity(name="mview")
+@NamedQuery(name = "allViews", query = "SELECT a FROM mview a")
+public class View {
+
+    @Id
+    @GeneratedValue
+    private int id;
+
+    private String name;
+    private String description;
+    private boolean enabled;
+
+
+    @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE},
+            mappedBy = "views",
+            fetch = FetchType.EAGER)
+    private List<Graph> graphs = new ArrayList<Graph>();
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    public List<Graph> getGraphs() {
+        return graphs;
+    }
+
+    public void setGraphs(List<Graph> graphs) {
+        this.graphs = graphs;
+    }
+
+    public String getIdString() {
+        return "" + id;
+    }
+}

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/View.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/View.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/View.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/util/DBManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/util/DBManager.java?rev=720024&r1=720023&r2=720024&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/util/DBManager.java (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/util/DBManager.java Sun Nov 23 10:32:00 2008
@@ -73,14 +73,13 @@
         return initialized;
     }
 
-    private boolean checkTables()
+    private boolean checkTables(String name)
     {
         try
         {
-            DatabaseMetaData metadata = null;
-            metadata = con.getMetaData();
+            DatabaseMetaData metadata = con.getMetaData();
             String[] names = { "TABLE" };
-            ResultSet tableNames = metadata.getTables(null, null, null, names);
+            ResultSet tableNames = metadata.getTables(null, null, name, names);
 
             if (tableNames.next())
             {
@@ -103,63 +102,69 @@
     private boolean initializeDB()
     {
         boolean success = false;
-        if (checkTables())
-            return true;
+//        if (checkTables())
+//            return true;
         try
         {
-            PreparedStatement pStmt = con
+            if (!checkTables("SERVERS")) {
+                PreparedStatement pStmt = con
                     .prepareStatement("CREATE TABLE servers("
-                            + "server_id   INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1),"
-                            + "enabled     SMALLINT DEFAULT 1 NOT NULL,"
-                            + "name        VARCHAR(128) DEFAULT NULL,"
-                            + "ip          VARCHAR(128) UNIQUE NOT NULL,"
-                            + "port        INTEGER NOT NULL,"
-                            + "protocol    INTEGER DEFAULT 1 NOT NULL,"
-                            + "username    VARCHAR(128) NOT NULL,"
-                            + "password    VARCHAR(1024) NOT NULL,"
-                            + "added       TIMESTAMP NOT NULL,"
-                            + "modified    TIMESTAMP NOT NULL,"
-                            + "last_seen   TIMESTAMP NOT NULL" + ")");
-            pStmt.executeUpdate();
-            pStmt = con
-                    .prepareStatement("CREATE TABLE graphs("
-                            + "graph_id    INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1),"
-                            + "enabled     SMALLINT NOT NULL DEFAULT 1,"
-                            + "server_id   INTEGER NOT NULL DEFAULT 0,"
-                            + "name        VARCHAR(128) UNIQUE NOT NULL,"
-                            + "description LONG VARCHAR DEFAULT NULL,"
-                            + "timeframe   INTEGER NOT NULL DEFAULT 60,"
-                            + "mbean       VARCHAR(512) NOT NULL,"
-                            + "data1operation  CHAR DEFAULT NULL,"
-                            + "dataname1   VARCHAR(128) NOT NULL,"
-                            + "operation   VARCHAR(128) DEFAULT NULL,"
-                            + "data2operation  CHAR DEFAULT NULL,"
-                            + "dataname2   VARCHAR(128) DEFAULT NULL,"
-                            + "xlabel      VARCHAR(128) DEFAULT NULL,"
-                            + "ylabel      VARCHAR(128) DEFAULT NULL,"
-                            + "warninglevel1   FLOAT DEFAULT NULL,"
-                            + "warninglevel2   FLOAT DEFAULT NULL,"
-                            + "color       VARCHAR(6) NOT NULL DEFAULT '1176c2',"
-                            + "last_js     LONG VARCHAR DEFAULT NULL,"
-                            + "added       TIMESTAMP NOT NULL,"
-                            + "modified    TIMESTAMP NOT NULL,"
-                            + "archive     SMALLINT NOT NULL DEFAULT 0,"
-                            + "last_seen   TIMESTAMP NOT NULL" + ")");
-            pStmt.executeUpdate();
-            pStmt = con
-                    .prepareStatement("CREATE TABLE views("
-                            + "view_id     INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1),"
-                            + "enabled     SMALLINT NOT NULL DEFAULT 1,"
-                            + "name        VARCHAR(128) NOT NULL,"
-                            + "description LONG VARCHAR DEFAULT NULL,"
-                            + "graph_count INTEGER NOT NULL DEFAULT 0,"
-                            + "added       TIMESTAMP NOT NULL,"
-                            + "modified    TIMESTAMP NOT NULL)");
-            pStmt.executeUpdate();
-            pStmt = con.prepareStatement("CREATE TABLE views_graphs("
-                    + "view_id     INTEGER NOT NULL,"
-                    + "graph_id     INTEGER NOT NULL)");
-            pStmt.executeUpdate();
+                                + "server_id   INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1),"
+                                + "enabled     SMALLINT DEFAULT 1 NOT NULL,"
+                                + "name        VARCHAR(128) DEFAULT NULL,"
+                                + "ip          VARCHAR(128) UNIQUE NOT NULL,"
+                                + "port        INTEGER NOT NULL,"
+                                + "protocol    INTEGER DEFAULT 1 NOT NULL,"
+                                + "username    VARCHAR(128) NOT NULL,"
+                                + "password    VARCHAR(1024) NOT NULL,"
+                                + "added       TIMESTAMP NOT NULL,"
+                                + "modified    TIMESTAMP NOT NULL,"
+                                + "last_seen   TIMESTAMP NOT NULL" + ")");
+                pStmt.executeUpdate();
+            }
+//            pStmt = con
+//                    .prepareStatement("CREATE TABLE graphs("
+//                            + "graph_id    INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1),"
+//                            + "enabled     SMALLINT NOT NULL DEFAULT 1,"
+//                            + "server_id   INTEGER NOT NULL DEFAULT 0,"
+//                            + "name        VARCHAR(128) UNIQUE NOT NULL,"
+//                            + "description LONG VARCHAR DEFAULT NULL,"
+//                            + "timeframe   INTEGER NOT NULL DEFAULT 60,"
+//                            + "mbean       VARCHAR(512) NOT NULL,"
+//                            + "data1operation  CHAR DEFAULT NULL,"
+//                            + "dataname1   VARCHAR(128) NOT NULL,"
+//                            + "operation   VARCHAR(128) DEFAULT NULL,"
+//                            + "data2operation  CHAR DEFAULT NULL,"
+//                            + "dataname2   VARCHAR(128) DEFAULT NULL,"
+//                            + "xlabel      VARCHAR(128) DEFAULT NULL,"
+//                            + "ylabel      VARCHAR(128) DEFAULT NULL,"
+//                            + "warninglevel1   FLOAT DEFAULT NULL,"
+//                            + "warninglevel2   FLOAT DEFAULT NULL,"
+//                            + "color       VARCHAR(6) NOT NULL DEFAULT '1176c2',"
+//                            + "last_js     LONG VARCHAR DEFAULT NULL,"
+//                            + "added       TIMESTAMP NOT NULL,"
+//                            + "modified    TIMESTAMP NOT NULL,"
+//                            + "archive     SMALLINT NOT NULL DEFAULT 0,"
+//                            + "last_seen   TIMESTAMP NOT NULL" + ")");
+//            pStmt.executeUpdate();
+            if (!checkTables("VIEWS")) {
+                PreparedStatement pStmt = con
+                        .prepareStatement("CREATE TABLE views("
+                                + "view_id     INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1),"
+                                + "enabled     SMALLINT NOT NULL DEFAULT 1,"
+                                + "name        VARCHAR(128) NOT NULL,"
+                                + "description LONG VARCHAR DEFAULT NULL,"
+                                + "graph_count INTEGER NOT NULL DEFAULT 0,"
+                                + "added       TIMESTAMP NOT NULL,"
+                                + "modified    TIMESTAMP NOT NULL)");
+                pStmt.executeUpdate();
+            }
+            if (!checkTables("views_graphs")) {
+                PreparedStatement pStmt = con.prepareStatement("CREATE TABLE views_graphs("
+                        + "view_id     INTEGER NOT NULL,"
+                        + "graph_id     INTEGER NOT NULL)");
+                pStmt.executeUpdate();
+            }
             success = true;
         }
         catch (SQLException e)

Added: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/classes/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/classes/META-INF/persistence.xml?rev=720024&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/classes/META-INF/persistence.xml (added)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/classes/META-INF/persistence.xml Sun Nov 23 10:32:00 2008
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+
+    <persistence-unit transaction-type="JTA" name="jpa/monitoring">
+
+        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+        <jta-data-source>MonitoringClientDS</jta-data-source>
+        <non-jta-data-source>NoTxMonitoringClientDS</non-jta-data-source>
+        <class>org.apache.geronimo.monitoring.console.data.Graph</class>
+        <class>org.apache.geronimo.monitoring.console.data.View</class>
+        <class>org.apache.geronimo.monitoring.console.data.Node</class>
+        <exclude-unlisted-classes>true</exclude-unlisted-classes>
+        <properties>
+            <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.DerbyDictionary"/>
+            <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+            <property name="openjpa.Sequence" value="table(Table=OPENJPASEQ, Increment=100)"/>
+        </properties>
+    </persistence-unit>
+</persistence>

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/classes/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/classes/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/classes/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp?rev=720024&r1=720023&r2=720024&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp Sun Nov 23 10:32:00 2008
@@ -14,109 +14,93 @@
    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="java.util.Set"%>
-<%@ page import="java.util.Iterator"%>
-<%@ page import="java.util.TreeMap"%>
-<%@ page import="java.util.ArrayList"%>
-<%@ page import="java.lang.String"%>
-<%@ page import="java.sql.Connection"%>
-<%@ page import="java.sql.PreparedStatement"%>
-<%@ page import="java.sql.ResultSet"%>
-<%@ page import="org.apache.geronimo.monitoring.console.util.DBManager"%>
-<%@ page import="org.apache.geronimo.monitoring.console.MRCConnector"%>
-<portlet:defineObjects />
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+<%@ page import="java.util.ArrayList" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="java.util.Set" %>
+<%@ page import="java.util.TreeMap" %>
+<%@ page import="org.apache.geronimo.monitoring.console.MRCConnector" %>
+<%@ page import="org.apache.geronimo.monitoring.console.data.Node" %>
+<portlet:defineObjects/>
 
 <%
-            String message = (String) request.getAttribute("message");
-            String mbean = (String) request.getAttribute("mbean");
-            String dataname1 = (String) request.getAttribute("dataname");
-            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");
-            ResultSet rs = pStmt.executeQuery();
-            MRCConnector mrc = null;
-            ArrayList<String> serverIds = new ArrayList<String>();
-            ArrayList<String> serverNames = new ArrayList<String>();
-            Long snapshotDuration = 5L;
-
-            if (message == null)
-                message = new String("");
-            if (mbean == null)
-                mbean = new String("");
-            if (dataname1 == null)
-                dataname1 = new String("");
-            if (server_id == null)
-                server_id = new String("");
+    String message = (String) request.getAttribute("message");
+    if (message == null)
+        message = "";
+    String mbean = (String) request.getAttribute("mbean");
+    if (mbean == null)
+        mbean = "";
+    String dataname1 = (String) request.getAttribute("dataname");
+    if (dataname1 == null)
+        dataname1 = "";
+    String server_id = (String) request.getAttribute("server_id");
+    if (server_id == null)
+        server_id = "";
+    Long snapshotDuration = 5L;
+
+    List<Node> nodes = (List<Node>) request.getAttribute("nodes");
+
+    ArrayList<String> serverIds = new ArrayList<String>();
+    ArrayList<String> serverNames = new ArrayList<String>();
+
 %>
 <script type="text/javascript">
-var serverBeans = new Array();
-var serverPrettyBeans = new Array();
-var serverBeanStatAttributes = new Array();
-var server_id = "<%=server_id%>";
-var mbean = "<%=mbean%>";
-var dataname1 = "<%=dataname1%>";
+    var serverBeans = new Object();
+    var serverPrettyBeans = new Object();
+    var serverBeanStatAttributes = new Object();
+    var server_id = "<%=server_id%>";
+    var mbean = "<%=mbean%>";
+    var dataname1 = "<%=dataname1%>";
 
 
-<%
-while (rs.next())
-{
-    TreeMap <String,String> trackedBeansMap = null;
-    try {
-        mrc = new MRCConnector(       rs.getString("ip"), 
-                                                rs.getString("username"), 
-                                                rs.getString("password"),
-                                                rs.getInt("port"),
-                                                rs.getInt("protocol"));
-        trackedBeansMap = mrc.getTrackedBeansMap();
-        serverIds.add(rs.getString("server_id"));
-        serverNames.add(rs.getString("name") +" - "+rs.getString("ip"));
-        snapshotDuration = mrc.getSnapshotDuration();
-        %>
-        serverBeans[<%=rs.getString("server_id")%>] = new Array();
-        serverPrettyBeans[<%=rs.getString("server_id")%>] = new Array();
-        serverBeanStatAttributes[<%=rs.getString("server_id")%>] = new Array();
-        <%
-        int i = 0;
-        for (Iterator <String> it = trackedBeansMap.keySet().iterator(); it.hasNext();)
-            {
-                String prettyBean = it.next().toString();
-                Set<String> statAttributes = mrc.getStatAttributesOnMBean(trackedBeansMap.get(prettyBean));
-                %>
-                serverBeans[<%=rs.getString("server_id")%>][<%=i%>]="<%=trackedBeansMap.get(prettyBean)%>";
-                serverPrettyBeans[<%=rs.getString("server_id")%>][<%=i%>]="<%=prettyBean%>";
-                serverBeanStatAttributes[<%=rs.getString("server_id")%>][<%=i%>] = new Array();
-                <%
-                int j = 0;
-                for (Iterator <String> itt = statAttributes.iterator(); itt.hasNext();)
-                {
-                    %>
-                    serverBeanStatAttributes[<%=rs.getString("server_id")%>][<%=i%>][<%=j%>]="<%=itt.next().toString()%>";
-                    <%
-                    j++;
-                }
-                i++;
-            }       
-         %>
-             
-        <%
+    <%
+for (Node node: nodes) {
+try {
+String name = node.getName();
+   MRCConnector  mrc = new MRCConnector(node);
+    TreeMap <String,String> trackedBeansMap = mrc.getTrackedBeansMap();
+    serverIds.add(name);
+    serverNames.add(name +" - "+node.getHost());
+    snapshotDuration = mrc.getSnapshotDuration();
+    %>
+    serverBeans["<%=name%>"] = new Array();
+    serverPrettyBeans["<%=name%>"] = new Array();
+    serverBeanStatAttributes["<%=name%>"] = new Array();
+    <%
+int i = 0;
+for(Map.Entry<String, String> entry: trackedBeansMap.entrySet()){
+    String prettyBean = entry.getKey();
+    Set<String> statAttributes = mrc.getStatAttributesOnMBean(entry.getValue());
+    %>
+    serverBeans["<%=name%>"][<%=i%>] = "<%=entry.getValue()%>";
+    serverPrettyBeans["<%=name%>"][<%=i%>] = "<%=prettyBean%>";
+    serverBeanStatAttributes["<%=name%>"][<%=i%>] = new Array();
+    <%
+    int j = 0;
+    for(String statAttribute: statAttributes){
+    %>
+    serverBeanStatAttributes["<%=name%>"][<%=i%>][<%=j%>] = "<%=statAttribute%>";
+    <%
+               j++;
+           }
+           i++;
+       }
+    %>
+
+    <%
     }
     catch (Exception e)
     {
         e.printStackTrace();
     }
     %>
-    
-<%}
 
-%>
+    <%}
+
+    %>
 </script>
-<!-- <head> -->
 
 <style type='text/css'>
 </style>
@@ -124,42 +108,42 @@
 <!--
 
 function hide(x) {
-document.getElementById(x).style.display='none';
+    document.getElementById(x).style.display = 'none';
 }
 function show(x) {
-document.getElementById(x).style.display='';
+    document.getElementById(x).style.display = '';
 }
-function validate(duration) 
+function validate(duration)
 {
-   if (! (document.addGraph.name.value  
-      && document.addGraph.dataname1.value
-      && document.addGraph.mbean.value
-      && document.addGraph.server_id.value
-      && document.addGraph.timeframe.value ))
-   {
-      alert("Server, Name, Data Series, MBean and Timeframe are all required fields");
-      return false;
-   }
+    if (! (document.addGraph.name.value
+            && document.addGraph.dataname1.value
+            && document.addGraph.mbean.value
+            && document.addGraph.server_id.value
+            && document.addGraph.timeframe.value ))
+    {
+        alert("Server, Name, Data Series, MBean and Timeframe are all required fields");
+        return false;
+    }
    // ensure that the timeframe is at least 2*(snapshotduration)
-   if(duration * 2 > document.addGraph.timeframe.value) {
-       alert("Timeframe needs to be at least " + 2 * duration);
-       return false;
-   }
-   if (document.addGraph.operation.value == 'other')
-   {
-       if (!document.addGraph.othermath.value)
-       {
+    if (duration * 2 > document.addGraph.timeframe.value) {
+        alert("Timeframe needs to be at least " + 2 * duration);
+        return false;
+    }
+    if (document.addGraph.operation.value == 'other')
+    {
+        if (!document.addGraph.othermath.value)
+        {
             alert("If operation is other, field must contain a math operation");
             return false;
-       }
-       var mathChars= /[\+\-\*\/]/;
-       if (!document.addGraph.othermath.value.match(mathChars)) {
+        }
+        var mathChars = /[\+\-\*\/]/;
+        if (!document.addGraph.othermath.value.match(mathChars)) {
             alert("Operation must use at least one math symbol (+, -, *, /)");
             return false;
         }
         if (document.addGraph.dataname2.value != "")
         {
-            if (document.addGraph.othermath.value.length > 1) 
+            if (document.addGraph.othermath.value.length > 1)
             {
                 if (!document.addGraph.othermath.value.charAt(0).match(mathChars) || !document.addGraph.othermath.value.charAt(document.addGraph.othermath.value.length - 1).match(mathChars))
                 {
@@ -167,15 +151,15 @@
                     return false;
                 }
             }
-                if (document.addGraph.othermath.value.length == 2) 
-                {
-                    alert("Operation must create a valid formula");
-                    return false;
-                }
+            if (document.addGraph.othermath.value.length == 2)
+            {
+                alert("Operation must create a valid formula");
+                return false;
+            }
         }
         else
         {
-            if (document.addGraph.othermath.value.length > 1) 
+            if (document.addGraph.othermath.value.length > 1)
             {
                 if (!document.addGraph.othermath.value.charAt(0).match(mathChars) || document.addGraph.othermath.value.charAt(document.addGraph.othermath.value.length - 1).match(mathChars))
                 {
@@ -183,415 +167,411 @@
                     return false;
                 }
             }
-            else if (document.addGraph.othermath.value.length == 1) 
+            else if (document.addGraph.othermath.value.length == 1)
             {
                 alert("Operation must create a valid formula");
                 return false;
             }
         }
-        
+
     }
-       return;
+
 }
-function noAlpha(obj){
+function noAlpha(obj) {
     reg = /[^0-9]/g;
-    obj.value =  obj.value.replace(reg,"");
- }
- 
- function noAlphaMath(obj){
+    obj.value = obj.value.replace(reg, "");
+}
+
+function noAlphaMath(obj) {
     reg = /[^0-9,\-,\+,\*,\/,\.]/g;
-    obj.value =  obj.value.replace(reg,"");
- }
- 
- function clearList(selectbox)
+    obj.value = obj.value.replace(reg, "");
+}
+
+function clearList(selectbox)
 {
     var i;
-    for(i=selectbox.options.length-1;i>=0;i--)
+    for (i = selectbox.options.length - 1; i >= 0; i--)
     {
         selectbox.remove(i);
     }
 }
 
 
-function addOption(selectbox, value, text )
+function addOption(selectbox, value, text, test)
 {
+    //TODO why doesn't this work?
+    //    var optn = new Option(text, value, value.equals(test));
+    //    selectbox.options.add(optn);
     var optn = document.createElement("OPTION");
     optn.text = text;
     optn.value = value;
-    if (selectbox == document.addGraph.mbean)
-    {
-        if (value==mbean)
-            optn.selected = "selected";
-    }
-    else if (selectbox == document.addGraph.dataname2 && (document.addGraph.dataname2.disabled = ""))
-    {
-        if (value=="time")
-            optn.selected = "selected";
-    }
-    else if (selectbox == document.addGraph.dataname1)
-    {
-        if (value==dataname1)
-            optn.selected = "selected";
+    if (value == test) {
+        optn.selected = "selected";
     }
     selectbox.options.add(optn);
 }
- 
- 
- function updateMbeanList(){
+
+function updateMbeanList() {
     clearList(document.addGraph.mbean);
     if (document.addGraph.server_id.value)
     {
-        addOption(document.addGraph.mbean, "", "-Select MBean-");
+        addOption(document.addGraph.mbean, "", "-Select MBean-", "-");
         for (var i = 0; i < serverPrettyBeans[document.addGraph.server_id.value].length; i++)
         {
-            addOption(document.addGraph.mbean, serverBeans[document.addGraph.server_id.value][i], serverPrettyBeans[document.addGraph.server_id.value][i]);
+            addOption(document.addGraph.mbean, serverBeans[document.addGraph.server_id.value][i], serverPrettyBeans[document.addGraph.server_id.value][i], mbean);
         }
     }
     else
-        addOption(document.addGraph.mbean, "", "-Select Server First-");
+        addOption(document.addGraph.mbean, "", "-Select Server First-", "-");
     updateDatanameList();
- }
- 
-  function updateDatanameList(){
+}
+
+function updateDatanameList() {
     clearList(document.addGraph.dataname1);
     if (document.addGraph.mbean.value)
     {
-        addOption(document.addGraph.dataname1, "", "-Select Data Name-");
-        for (var i = 0; i < serverBeanStatAttributes[document.addGraph.server_id.value][document.addGraph.mbean.selectedIndex-1].length; i++)
+        addOption(document.addGraph.dataname1, "", "-Select Data Name-", "-");
+        for (var i = 0; i < serverBeanStatAttributes[document.addGraph.server_id.value][document.addGraph.mbean.selectedIndex - 1].length; i++)
         {
-            addOption(document.addGraph.dataname1, serverBeanStatAttributes[document.addGraph.server_id.value][document.addGraph.mbean.selectedIndex-1][i], serverBeanStatAttributes[document.addGraph.server_id.value][document.addGraph.mbean.selectedIndex-1][i]);
+            addOption(document.addGraph.dataname1, serverBeanStatAttributes[document.addGraph.server_id.value][document.addGraph.mbean.selectedIndex - 1][i], serverBeanStatAttributes[document.addGraph.server_id.value][document.addGraph.mbean.selectedIndex - 1][i], dataname1);
         }
     }
     else
-        addOption(document.addGraph.dataname1, "", "-Select MBean First-");
+        addOption(document.addGraph.dataname1, "", "-Select MBean First-", "-");
     updateDataname2List();
- }
- 
-   function updateDataname2List(){
+}
+
+function updateDataname2List() {
     clearList(document.addGraph.dataname2);
     if (document.addGraph.mbean.value)
     {
-        if (document.addGraph.operation.value=="other")
-            addOption(document.addGraph.dataname2, "", "none");
-        addOption(document.addGraph.dataname2, "time", "Time");
-        for (var i = 0; i < serverBeanStatAttributes[document.addGraph.server_id.value][document.addGraph.mbean.selectedIndex-1].length; i++)
+        if (document.addGraph.operation.value == "other")
+            addOption(document.addGraph.dataname2, "", "none", "-");
+        addOption(document.addGraph.dataname2, "time", "Time", "time");
+        for (var i = 0; i < serverBeanStatAttributes[document.addGraph.server_id.value][document.addGraph.mbean.selectedIndex - 1].length; i++)
         {
-            addOption(document.addGraph.dataname2, serverBeanStatAttributes[document.addGraph.server_id.value][document.addGraph.mbean.selectedIndex-1][i], serverBeanStatAttributes[document.addGraph.server_id.value][document.addGraph.mbean.selectedIndex-1][i]);
+            addOption(document.addGraph.dataname2, serverBeanStatAttributes[document.addGraph.server_id.value][document.addGraph.mbean.selectedIndex - 1][i], serverBeanStatAttributes[document.addGraph.server_id.value][document.addGraph.mbean.selectedIndex - 1][i], "time");
         }
     }
     else
-        addOption(document.addGraph.dataname2, "", "-Select MBean First-");
-        
-     if (document.addGraph.operation.value=="")
-     {
-        document.addGraph.data2operation.selectedIndex=0;
-        document.addGraph.dataname2.selectedIndex=0;
-        document.addGraph.data2operation.disabled="disabled";
-        document.addGraph.dataname2.disabled="disabled";
-     }
- }
- 
-   function checkOtherMath(){
-    if (document.addGraph.operation.value=="other")
+        addOption(document.addGraph.dataname2, "", "-Select MBean First-", "-");
+
+    if (document.addGraph.operation.value == "")
+    {
+        document.addGraph.data2operation.selectedIndex = 0;
+        document.addGraph.dataname2.selectedIndex = 0;
+        document.addGraph.data2operation.disabled = "disabled";
+        document.addGraph.dataname2.disabled = "disabled";
+    }
+}
+
+function checkOtherMath() {
+    if (document.addGraph.operation.value == "other")
+    {
+        document.addGraph.othermath.style.display = '';
+    }
+    else
+        document.addGraph.othermath.style.display = 'none';
+    if (document.addGraph.operation.value == "")
     {
-        document.addGraph.othermath.style.display='';
+        document.addGraph.data2operation.selectedIndex = 0;
+        document.addGraph.dataname2.selectedIndex = 0;
+        document.addGraph.data2operation.disabled = "disabled";
+        document.addGraph.dataname2.disabled = "disabled";
     }
     else
-        document.addGraph.othermath.style.display='none';
-   if (document.addGraph.operation.value=="")
-   {
-        document.addGraph.data2operation.selectedIndex=0;
-        document.addGraph.dataname2.selectedIndex=0;
-        document.addGraph.data2operation.disabled="disabled";
-        document.addGraph.dataname2.disabled="disabled";
-   }
-   else
-   {
-       document.addGraph.dataname2.disabled="";
-       document.addGraph.data2operation.disabled="";
-       updateDataname2List();
-       checkNoData2();
-   }
-
- }
- 
- function checkNoData2()
- {
+    {
+        document.addGraph.dataname2.disabled = "";
+        document.addGraph.data2operation.disabled = "";
+        updateDataname2List();
+        checkNoData2();
+    }
+
+}
+
+function checkNoData2()
+{
     if (document.addGraph.dataname2.value == "")
     {
         document.addGraph.data2operation.selectedIndex = 0;
-        document.addGraph.data2operation.disabled="disabled";
+        document.addGraph.data2operation.disabled = "disabled";
     }
     else
     {
-        document.addGraph.data2operation.disabled="";
+        document.addGraph.data2operation.disabled = "";
     }
- }
- 
- function getObject(obj) {
-  var theObj;
-  if(document.all) {
-    if(typeof obj=="string") {
-      return document.all(obj);
-    } else {
-      return obj.style;
-    }
-  }
-  if(document.getElementById) {
-    if(typeof obj=="string") {
-      return document.getElementById(obj);
-    } else {
-      return obj.style;
+}
+
+function getObject(obj) {
+    if (document.all) {
+        if (typeof obj == "string") {
+            return document.all(obj);
+        } else {
+            return obj.style;
+        }
+    }
+    if (document.getElementById) {
+        if (typeof obj == "string") {
+            return document.getElementById(obj);
+        } else {
+            return obj.style;
+        }
     }
-  }
-  return null;
+    return null;
 }
- 
-    function updateFormula()
+
+function updateFormula()
+{
+    var exitObj = getObject('formulaData1operation');
+    if (document.addGraph.dataname1.value)
     {
-        var exitObj=getObject('formulaData1operation');
-        if (document.addGraph.dataname1.value)
+        if (document.addGraph.data1operation.value == 'D')
+            exitObj.innerHTML = "(Delta)";
+        else
+            exitObj.innerHTML = "";
+        exitObj = getObject('formulaDataname1');
+        exitObj.innerHTML = document.addGraph.dataname1.value;
+        if (document.addGraph.operation.value)
         {
-            if (document.addGraph.data1operation.value == 'D')
-                exitObj.innerHTML = "(Delta)";
-            else
-                exitObj.innerHTML = "";
-            exitObj=getObject('formulaDataname1');
-            exitObj.innerHTML = document.addGraph.dataname1.value;
-            if (document.addGraph.operation.value)
+            if (document.addGraph.operation.value == "other")
             {
-                if (document.addGraph.operation.value == "other")
-                {
-                    exitObj=getObject('formulaOperation');
-                    exitObj.innerHTML = document.addGraph.othermath.value;
-                }
-                else
-                {
-                    exitObj=getObject('formulaOperation');
-                    exitObj.innerHTML = document.addGraph.operation.value;
-                }
-                exitObj=getObject('formulaData2operation');
-                if (document.addGraph.data2operation.value == 'D')
-                    exitObj.innerHTML = "(Delta)";
-                else
-                    exitObj.innerHTML = "";
-                exitObj=getObject('formulaDataname2');
-                exitObj.innerHTML = document.addGraph.dataname2.value;
+                exitObj = getObject('formulaOperation');
+                exitObj.innerHTML = document.addGraph.othermath.value;
             }
             else
             {
-                exitObj=getObject('formulaOperation');
-                exitObj.innerHTML = "";
-                exitObj=getObject('formulaData2operation');
-                exitObj.innerHTML = "";
-                exitObj=getObject('formulaDataname2');
-                exitObj.innerHTML = "";
+                exitObj = getObject('formulaOperation');
+                exitObj.innerHTML = document.addGraph.operation.value;
             }
-            
+            exitObj = getObject('formulaData2operation');
+            if (document.addGraph.data2operation.value == 'D')
+                exitObj.innerHTML = "(Delta)";
+            else
+                exitObj.innerHTML = "";
+            exitObj = getObject('formulaDataname2');
+            exitObj.innerHTML = document.addGraph.dataname2.value;
         }
         else
         {
-            exitObj=getObject('formulaData1operation');
+            exitObj = getObject('formulaOperation');
             exitObj.innerHTML = "";
-            exitObj=getObject('formulaDataname1');
+            exitObj = getObject('formulaData2operation');
             exitObj.innerHTML = "";
-            exitObj=getObject('formulaOperation');
-            exitObj.innerHTML = "";
-            exitObj=getObject('formulaData2operation');
-            exitObj.innerHTML = "";
-            exitObj=getObject('formulaDataname2');
+            exitObj = getObject('formulaDataname2');
             exitObj.innerHTML = "";
         }
+
     }
+    else
+    {
+        exitObj = getObject('formulaData1operation');
+        exitObj.innerHTML = "";
+        exitObj = getObject('formulaDataname1');
+        exitObj.innerHTML = "";
+        exitObj = getObject('formulaOperation');
+        exitObj.innerHTML = "";
+        exitObj = getObject('formulaData2operation');
+        exitObj.innerHTML = "";
+        exitObj = getObject('formulaDataname2');
+        exitObj.innerHTML = "";
+    }
+}
 
 //-->
 </script>
 <!-- </head> -->
 <%
-if (!message.equals("")) {
+    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(<%=snapshotDuration/1000/60%>);"
-			name="addGraph" method="POST"
-			action="<portlet:actionURL portletMode="edit"><portlet:param name="action" value="saveAddGraph"/></portlet:actionURL>">
-		<table cellpadding="1" cellspacing="1">
-			<tr>
-				<td><label for="<portlet:namespace/>server_id">Server</label>:</td>
-				<td>&nbsp;</td>
-				<td align="right"><select name="server_id" id="<portlet:namespace/>server_id"
-					onChange="updateMbeanList(); updateFormula();">
-					<option value="">-Select Server-</option>
-				</select> <script type='text/javascript'>
-    <% 
-    for (int i = 1; i < serverIds.size()+1; i++)
-    {
-    %>
-        document.addGraph.server_id.options[<%=i%>]=new Option("<%=serverNames.get(i-1)%>", "<%=serverIds.get(i-1)%>", <%if (server_id.equals(serverIds.get(i-1))){%>true<%}else{%>false<%}%>);
-    <%
-    }%>
-    </script></td>
-				<td></td>
-			</tr>
-			<tr>
-				<td><label for="<portlet:namespace/>name">Name</label>:</td>
-				<td>&nbsp;</td>
-				<td align="right"><input type="text" name="name" id="<portlet:namespace/>name" value=""></td>
-				<td></td>
-			</tr>
-			<tr>
-				<td><label for="<portlet:namespace/>description">Description:</label></td>
-				<td>&nbsp;</td>
-				<td align="right"><textarea rows="5" cols="50"
-					name="description" id="<portlet:namespace/>description"></textarea></td>
-				<td></td>
-			</tr>
-			<tr>
-				<td><label for="<portlet:namespace/>xlabel">X Axis label</label>:</td>
-				<td>&nbsp;</td>
-				<td align="right"><input type="text" name="xlabel" id="<portlet:namespace/>xlabel" value="" /></td>
-				<td></td>
-			</tr>
-			<tr>
-				<td><label for="<portlet:namespace/>ylabel">Y Axis label</label>:</td>
-				<td>&nbsp;</td>
-				<td align="right"><input type="text" name="ylabel" id="<portlet:namespace/>ylabel" value="" /></td>
-				<td></td>
-			</tr>
-			<tr>
-				<td><label for="<portlet:namespace/>timeframe">Timeframe</label>:</td>
-				<td>&nbsp;</td>
-				<td align="right"><input type="text" width="5" size="4" id="<portlet:namespace/>timeframe"
-					name="timeframe" onKeyUp='noAlpha(this)' onKeyPress='noAlpha(this)'
-					value="60" /></td>
-				<td>minutes</td>
-			</tr>
-			<tr>
-				<td><label for="<portlet:namespace/>mbean">Mbean</label>:</td>
-				<td>&nbsp;</td>
-				<td align="right"><select name="mbean" id="<portlet:namespace/>mbean"
-					onChange="updateDatanameList(); updateFormula();">
-					<option value="">-Select Server First-</option>
-				</select></td>
-				<td></td>
-			</tr>
-			<tr>
-				<td><label for="<portlet:namespace/>dataname1">Data series</label>:</td>
-				<td>&nbsp;</td>
-				<td align="right"><select name="data1operation" title="data operation"
-					onchange="updateFormula();">
-					<option value="A" selected="selected">As-is</option>
-					<option value="D">Change (Delta) in</option>
-				</select> <select name="dataname1" id="<portlet:namespace/>dataname1" onchange="updateFormula();">
-					<option value="">-Select MBean First-</option>
-				</select></td>
-				<td></td>
-			</tr>
-			<tr>
-				<td><label for="<portlet:namespace/>operation">Math operation</label>:</td>
-				<td>&nbsp;</td>
-				<td align="right"><select name="operation" id="<portlet:namespace/>operation"
-					onChange="checkOtherMath(); updateFormula();">
-					<option value="" selected="selected">none</option>
-					<option value="+">+</option>
-					<option value="-">-</option>
-					<option value="*">*</option>
-					<option value="/">/</option>
-					<option value="other">Other</option>
-				</select></td>
-				<td><input type="text" style="display: none;" width="6"
-					size="8" name="othermath" title="Other match operation"
-					onKeyUp='noAlphaMath(this); updateFormula();'
-					onKeyPress='noAlphaMath(this); updateFormula();' value="" /></td>
-			</tr>
-			<tr>
-				<td><label for="<portlet:namespace/>dataname2">Data series 2</label>:</td>
-				<td>&nbsp;</td>
-				<td align="right"><select name="data2operation" title="data operation"
-					disabled="disabled" onchange="updateFormula();">
-					<option value="A" selected="selected">As-is</option>
-					<option value="D">Change (Delta) in</option>
-				</select> <select name="dataname2" id="<portlet:namespace/>dataname2" disabled="disabled"
-					onchange="updateFormula(); checkNoData2();">
-					<option value="">-Select Operation First-</option>
-				</select> <script type='text/javascript'>
-        updateMbeanList();
-      </script></td>
-				<td></td>
-			</tr>
-			<tr>
-				<td></td>
-				<td>&nbsp;</td>
-				<td align="right"><input type="checkbox" name="showArchive" id="<portlet:namespace/>showArchive"><label for="<portlet:namespace/>showArchive">Show
-				Archived</label></input></td>
-				<td></td>
-			</tr>
-			<tr>
-				<td>Graphing:</td>
-				<td colspan="2"><strong><span
-					id="formulaData1operation"></span> <span id="formulaDataname1"></span>
-				<span id="formulaOperation"></span> <span id="formulaData2operation"></span>
-				<span id="formulaDataname2"></span></strong></td>
-			</tr>
-			<tr>
-				<td colspan="3"><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>
-		<script type='text/javascript'>
-        updateFormula();
-        checkNoData2();
-      </script></td>
+<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(<%=snapshotDuration/1000/60%>);"
+      name="addGraph" method="POST"
+      action="<portlet:actionURL portletMode="edit"><portlet:param name="action" value="saveAddGraph"/></portlet:actionURL>">
+<table cellpadding="1" cellspacing="1">
+<tr>
+    <td><label for="<portlet:namespace/>server_id">Server</label>:</td>
+    <td>&nbsp;</td>
+    <td align="right"><select name="server_id" id="<portlet:namespace/>server_id"
+                              onChange="updateMbeanList(); updateFormula();">
+        <option value="">-Select Server-</option>
+    </select>
+        <script type='text/javascript'>
+            <%
+            for (int i = 1; i < serverIds.size()+1; i++)
+            {
+            %>
+            document.addGraph.server_id.options[<%=i%>] = new Option("<%=serverNames.get(i-1)%>", "<%=serverIds.get(i-1)%>", <%if (server_id.equals(serverIds.get(i-1))){%>true<%}else{%>false<%}%>);
+            <%
+            }%>
+        </script>
+    </td>
+    <td></td>
+</tr>
+<tr>
+    <td><label for="<portlet:namespace/>name">Name</label>:</td>
+    <td>&nbsp;</td>
+    <td align="right"><input type="text" name="name" id="<portlet:namespace/>name" value=""></td>
+    <td></td>
+</tr>
+<tr>
+    <td><label for="<portlet:namespace/>description">Description:</label></td>
+    <td>&nbsp;</td>
+    <td align="right"><textarea rows="5" cols="50"
+                                name="description" id="<portlet:namespace/>description"></textarea></td>
+    <td></td>
+</tr>
+<tr>
+    <td><label for="<portlet:namespace/>xlabel">X Axis label</label>:</td>
+    <td>&nbsp;</td>
+    <td align="right"><input type="text" name="xlabel" id="<portlet:namespace/>xlabel" value=""/></td>
+    <td></td>
+</tr>
+<tr>
+    <td><label for="<portlet:namespace/>ylabel">Y Axis label</label>:</td>
+    <td>&nbsp;</td>
+    <td align="right"><input type="text" name="ylabel" id="<portlet:namespace/>ylabel" value=""/></td>
+    <td></td>
+</tr>
+<tr>
+    <td><label for="<portlet:namespace/>timeframe">Timeframe</label>:</td>
+    <td>&nbsp;</td>
+    <td align="right"><input type="text" width="5" size="4" id="<portlet:namespace/>timeframe"
+                             name="timeframe" onKeyUp='noAlpha(this)' onKeyPress='noAlpha(this)'
+                             value="60"/></td>
+    <td>minutes</td>
+</tr>
+<tr>
+    <td><label for="<portlet:namespace/>mbean">Mbean</label>:</td>
+    <td>&nbsp;</td>
+    <td align="right"><select name="mbean" id="<portlet:namespace/>mbean"
+                              onChange="updateDatanameList(); updateFormula();">
+        <option value="">-Select Server First-</option>
+    </select></td>
+    <td></td>
+</tr>
+<tr>
+    <td><label for="<portlet:namespace/>dataname1">Data series</label>:</td>
+    <td>&nbsp;</td>
+    <td align="right"><select name="data1operation" title="data operation"
+                              onchange="updateFormula();">
+        <option value="A" selected="selected">As-is</option>
+        <option value="D">Change (Delta) in</option>
+    </select> <select name="dataname1" id="<portlet:namespace/>dataname1" onchange="updateFormula();">
+        <option value="">-Select MBean First-</option>
+    </select></td>
+    <td></td>
+</tr>
+<tr>
+    <td><label for="<portlet:namespace/>operation">Math operation</label>:</td>
+    <td>&nbsp;</td>
+    <td align="right"><select name="operation" id="<portlet:namespace/>operation"
+                              onChange="checkOtherMath(); updateFormula();">
+        <option value="" selected="selected">none</option>
+        <option value="+">+</option>
+        <option value="-">-</option>
+        <option value="*">*</option>
+        <option value="/">/</option>
+        <option value="other">Other</option>
+    </select></td>
+    <td><input type="text" style="display: none;" width="6"
+               size="8" name="othermath" title="Other match operation"
+               onKeyUp='noAlphaMath(this); updateFormula();'
+               onKeyPress='noAlphaMath(this); updateFormula();' value=""/></td>
+</tr>
+<tr>
+    <td><label for="<portlet:namespace/>dataname2">Data series 2</label>:</td>
+    <td>&nbsp;</td>
+    <td align="right"><select name="data2operation" title="data operation"
+                              disabled="disabled" onchange="updateFormula();">
+        <option value="A" selected="selected">As-is</option>
+        <option value="D">Change (Delta) in</option>
+    </select> <select name="dataname2" id="<portlet:namespace/>dataname2" disabled="disabled"
+                      onchange="updateFormula(); checkNoData2();">
+        <option value="">-Select Operation First-</option>
+    </select>
+        <script type='text/javascript'>
+            updateMbeanList();
+        </script>
+    </td>
+    <td></td>
+</tr>
+<tr>
+    <td></td>
+    <td>&nbsp;</td>
+    <td align="right"><input type="checkbox" name="showArchive" id="<portlet:namespace/>showArchive"><label for="<portlet:namespace/>showArchive">Show
+        Archived</label></td>
+    <td></td>
+</tr>
+<tr>
+    <td>Graphing:</td>
+    <td colspan="2"><strong><span
+            id="formulaData1operation"></span> <span id="formulaDataname1"></span>
+        <span id="formulaOperation"></span> <span id="formulaData2operation"></span>
+        <span id="formulaDataname2"></span></strong></td>
+</tr>
+<tr>
+    <td colspan="3"><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>
+<script type='text/javascript'>
+    updateFormula();
+    checkNoData2();
+</script>
+</td>
 
-		<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
 
-		<!-- Geronimo Links -->
-		<td valign="top">
+<!-- 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">Navigation</font></td>
-			</tr>
-			<tr>
-				<td bgcolor="#FFFFFF" nowrap>&nbsp;<br />
-				<ul>
-					<li><a
-						href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showHome" /></portlet:actionURL>">Home</a></li>
-					<li><a
-						href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showAllViews" /></portlet:actionURL>">Views</a></li>
-					<li><a
-						href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showAllServers" /></portlet:actionURL>">Servers</a></li>
-					<li><a
-						href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showAllGraphs" /></portlet:actionURL>">Graphs</a></li>
-				</ul>
-				&nbsp;<br />
-				</td>
-			</tr>
-		</table>
+    <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">Navigation</font></td>
+        </tr>
+        <tr>
+            <td bgcolor="#FFFFFF" nowrap>&nbsp;<br/>
+                <ul>
+                    <li><a
+                            href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showHome" /></portlet:actionURL>">Home</a></li>
+                    <li><a
+                            href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showAllViews" /></portlet:actionURL>">Views</a></li>
+                    <li><a
+                            href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showAllServers" /></portlet:actionURL>">Servers</a></li>
+                    <li><a
+                            href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showAllGraphs" /></portlet:actionURL>">Graphs</a></li>
+                </ul>
+                &nbsp;<br/>
+            </td>
+        </tr>
+    </table>
 
-		</td>
-	</tr>
+</td>
+</tr>
 </table>
 
 

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddServer.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddServer.jsp?rev=720024&r1=720023&r2=720024&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddServer.jsp (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddServer.jsp Sun Nov 23 10:32:00 2008
@@ -16,7 +16,6 @@
 --%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
-<%@ page import="java.lang.String" %>
 <%@ page import="org.apache.geronimo.monitoring.console.Constants" %>
 <portlet:defineObjects/>
 
@@ -38,22 +37,21 @@
 if(password == null)    password = "";
 if(password2 == null)   password2 = "";
 if(protocol == null)    protocol = "";
-if(protocol.equals("1"))    
+if(protocol.equals("EJB"))
 {
     if(port == null)        port = "4201";
 }
-else if(protocol.equals("2"))
+else if(protocol.equals("JMX"))
 {
     if(port == null)        port = "1099";
 }
 else
 {
-    protocol = "1";
+    protocol = "EJB";
     if(port == null)        port = "4201";
 }
 
 %>
-<!-- <head> -->
 
     <style type='text/css'>
     </style>
@@ -103,7 +101,7 @@
  {
  %>
 <div align="left" style="width: 500px">
-<%=message %></b><br>
+<%=message %><br>
 </div>
 <%} %>
 <table>
@@ -134,8 +132,8 @@
       <td>Protocol</td>
       <td>&nbsp;</td>
       <td align="right">
-      	<input type="radio" name="protocol" id="<portlet:namespace/>protocol1" onchange='setPort()' value="1" <%if (protocol.equals("1")){ %>checked="checked"<%} %>><label for="<portlet:namespace/>protocol1">EJB</label> 
-      	<input type="radio" name="protocol" id="<portlet:namespace/>protocol2" onchange='setPort()' value="2" <%if (protocol.equals("2")){ %>checked="checked"<%} %>><label for="<portlet:namespace/>protocol2">JMX</label></td>
+      	<input type="radio" name="protocol" id="<portlet:namespace/>protocol1" onchange='setPort()' value="EJB" <%if (protocol.equals("EJB")){ %>checked="checked"<%} %>><label for="<portlet:namespace/>protocol1">EJB</label>
+      	<input type="radio" name="protocol" id="<portlet:namespace/>protocol2" onchange='setPort()' value="JMX" <%if (protocol.equals("JMX")){ %>checked="checked"<%} %>><label for="<portlet:namespace/>protocol2">JMX</label></td>
       <td></td>
     </tr>
     <tr>
@@ -174,10 +172,8 @@
   </table>
   
 
-            </p>
 
-        </td>
-     
+
          <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
 
         <!-- Geronimo Links -->

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddView.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddView.jsp?rev=720024&r1=720023&r2=720024&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddView.jsp (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddView.jsp Sun Nov 23 10:32:00 2008
@@ -16,21 +16,10 @@
 --%>
 <%@ 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.monitoring.console.StatsGraph" %>
-<%@ page import="org.apache.geronimo.monitoring.console.GraphsBuilder" %>
-<%@ page import="java.util.Set" %>
-<%@ page import="java.util.Iterator" %>
-<%@ page import="java.util.HashMap" %>
-<%@ page import="java.util.TreeMap" %>
-<%@ page import="java.util.ArrayList" %>
-<%@ 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.monitoring.console.util.DBManager" %>
+<%@ page import="java.util.List" %>
 <%@ page import="org.apache.geronimo.monitoring.console.Constants" %>
+<%@ page import="org.apache.geronimo.monitoring.console.data.Graph" %>
+<%@ page import="org.apache.geronimo.monitoring.console.data.Node" %>
 <portlet:defineObjects/>
 
 <%
@@ -105,41 +94,32 @@
       <td>Graphs:</td>
       <td>&nbsp;</td>
       <td align="right">
+          <table cellpadding="1" cellspacing="1">
+          <tr>
+          <th width="5%"></th>
+          <th>Name</th>
+          <th>Timeframe</th>
+          <th width="20%">Server</th>
+          <th>Edit</th>
+          </tr>
       <%
-      DBManager DBase = new DBManager();
-      Connection con = DBase.getConnection();
-      PreparedStatement pStmt = con.prepareStatement("SELECT * FROM graphs");
-      ResultSet rs = pStmt.executeQuery();
-       %>
-            <table cellpadding="1" cellspacing="1">
-            <tr>
-            <th width="5%"></th>
-            <th>Name</th>
-            <th>Timeframe</th>
-            <th width="20%">Server</th>
-            <th>Edit</th>
-            </tr>
-      <%
-          while (rs.next())
-          {
-              pStmt = con.prepareStatement("SELECT name FROM servers WHERE server_id="+rs.getString("server_id"));
-              ResultSet rs2 = pStmt.executeQuery();
-              if (rs2.next())
+          List<Graph> graphs = (List<Graph>) request.getAttribute("graphs");
+          for (Graph graph :graphs) {
+              Node node = graph.getNode();
+              if (node != null)
               {
       %>     
             <tr>
-            <td align="left" width="5%"><input type="checkbox" name="graph_ids" title="<%=rs2.getString("name")%>-<%=rs.getString("name") %>" value='<%=rs.getString("graph_id")%>'></td>
-            <td align="left"><a href="javascript: void(0)" onClick="openNewWindow('/monitoring/monitoringPopUpGraph.jsp?graph_id=<%=rs.getString("graph_id")%>','graph','width=800,height=300','title=<%=rs.getString("name") %>')"><%=rs.getString("name") %></a></td>
-            <td align="left"><%=rs.getString("timeframe")%> min.</td>
-            <td align="left"><a href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showServer" /><portlet:param name="server_id" value='<%=rs.getString("server_id")%>' /></portlet:actionURL>"><%=rs2.getString("name")%></a></td>
-            <td align="center"><a href="<portlet:actionURL portletMode="edit"><portlet:param name="action" value="showEditGraph" /><portlet:param name="graph_id" value='<%=rs.getString("graph_id")%>' /></portlet:actionURL>"><img border=0 src="/monitoring/images/edit-b.png" alt="edit"></a></td>
+            <td align="left" width="5%"><input type="checkbox" name="graph_ids" title="<%=node.getName()%>-<%=graph.getGraphName1()%>" value='<%=graph.getIdString()%>'></td>
+            <td align="left"><a href="javascript: void(0)" onClick="openNewWindow('/monitoring/popUpGraph?graph_id=<%=graph.getIdString()%>','graph','width=800,height=300','title=<%=graph.getGraphName1()%>')"><%=graph.getGraphName1()%></a></td>
+            <td align="left"><%=graph.getTimeFrame()%> min.</td>
+            <td align="left"><a href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showServer" /><portlet:param name="server_id" value='<%=node.getName()%>' /></portlet:actionURL>"><%=node.getName()%></a></td>
+            <td align="center"><a href="<portlet:actionURL portletMode="edit"><portlet:param name="action" value="showEditGraph" /><portlet:param name="graph_id" value='<%=graph.getIdString()%>' /></portlet:actionURL>"><img border=0 src="/monitoring/images/edit-b.png" alt="edit"></a></td>
             </tr>
       <%
 
               }
-              rs2.close();
           }
-      rs.close();
       %>
             </table>
 </td>
@@ -153,8 +133,6 @@
   </table>
   </form>
 
-            </p>
-
         </td>
      
          <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp?rev=720024&r1=720023&r2=720024&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp Sun Nov 23 10:32:00 2008
@@ -16,94 +16,54 @@
 --%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
-<%@ page import="java.util.Set" %>
+<%@ page import="java.util.ArrayList" %>
 <%@ page import="java.util.Iterator" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Set" %>
 <%@ page import="java.util.TreeMap" %>
-<%@ page import="java.util.ArrayList" %>
-<%@ page import="java.lang.String" %>
-<%@ page import="java.sql.Connection" %>
-<%@ page import="java.sql.PreparedStatement" %>
-<%@ page import="java.sql.ResultSet" %>
-<%@ page import="org.apache.geronimo.monitoring.console.util.DBManager" %>
 <%@ page import="org.apache.geronimo.monitoring.console.MRCConnector" %>
+<%@ page import="org.apache.geronimo.monitoring.console.data.Graph" %>
+<%@ page import="org.apache.geronimo.monitoring.console.data.Node" %>
 <portlet:defineObjects/>
 
 <%
 
-String graph_id = (String) request.getAttribute("graph_id");
-String message = (String) request.getAttribute("message");
-
-DBManager DBase = new DBManager();
-Connection con = DBase.getConnection();
-
-
-if (message == null)
-    message = new String("");
+    String message = (String) request.getAttribute("message");
+    if (message == null)
+        message = "";
+    Graph graph = (Graph) request.getAttribute("graph");
+    List<Node> nodes = (List<Node>) request.getAttribute("nodes");
 
-
-PreparedStatement pStmt = con.prepareStatement("SELECT * FROM graphs WHERE graph_id="+graph_id);
-ResultSet rs = pStmt.executeQuery();
-
-if (rs.next())
+if (graph != null)
 {    
-    String server_id = rs.getString("server_id");
-    String name = rs.getString("name");
-    Integer enabled = rs.getInt("enabled");
-    String description = rs.getString("description");
-    Integer timeframe = rs.getInt("timeframe");
-    String mbean = rs.getString("mbean");
-    String data1operation = rs.getString("data1operation");
-    String dataname1 = rs.getString("dataname1");
-    String operation = rs.getString("operation");
-    String data2operation = rs.getString("data2operation");
-    String dataname2 = rs.getString("dataname2");
-    String xlabel = rs.getString("xlabel");
-    String ylabel = rs.getString("ylabel");
-    String warninglevel1 = rs.getString("warninglevel1");
-    String warninglevel2 = rs.getString("warninglevel2");
-    String color = rs.getString("color");
-    String added = rs.getString("added").substring(0,16);
-    String modified = rs.getString("modified").substring(0,16);
-    String last_seen = rs.getString("last_seen").substring(0,16);
-    boolean archive = rs.getInt("archive") == 1 ? true : false;
-    rs.close();
-
-    pStmt = con.prepareStatement("SELECT * FROM servers WHERE enabled=1");
-    rs = pStmt.executeQuery();
-
-    MRCConnector mrc = null;
+    String server_id = graph.getNode().getName();
     Long snapshotDuration = null;
 
     ArrayList<String> serverIds = new ArrayList<String>();
     ArrayList<String> serverNames = new ArrayList<String>();
 %>
 <script type = "text/javascript">
-var serverBeans = new Array();
-var serverPrettyBeans = new Array();
-var serverBeanStatAttributes = new Array();
+var serverBeans = new Object();
+var serverPrettyBeans = new Object();
+var serverBeanStatAttributes = new Object();
 var server_id = "<%=server_id%>";
-var mbean = "<%=mbean%>";
-var dataname1 = "<%=dataname1%>";
-var dataname2 = "<%=dataname2%>";
+var mbean = "<%=graph.getMBeanName()%>";
+var dataname1 = "<%=graph.getDataName1()%>";
+var dataname2 = "<%=graph.getDataName2()%>";
 
 <%
-while (rs.next())
-{
-    TreeMap <String,String> trackedBeansMap = null;
+for (Node node: nodes) {
+    TreeMap <String,String> trackedBeansMap  ;
     try {
-        mrc = new MRCConnector(           rs.getString("ip"), 
-                                                    rs.getString("username"), 
-                                                    rs.getString("password"),
-                                                    rs.getInt("port"),
-                                                    rs.getInt("protocol"));
+        MRCConnector mrc = new MRCConnector(node);
         trackedBeansMap = mrc.getTrackedBeansMap();;
-        serverIds.add(rs.getString("server_id"));
-        serverNames.add(rs.getString("name") +" - "+rs.getString("ip"));
+        serverIds.add(node.getName());
+        serverNames.add(node.getName());
         snapshotDuration = mrc.getSnapshotDuration();
         %>
-        serverBeans[<%=rs.getString("server_id")%>] = new Array();
-        serverPrettyBeans[<%=rs.getString("server_id")%>] = new Array();
-        serverBeanStatAttributes[<%=rs.getString("server_id")%>] = new Array();
+        serverBeans["<%=node.getName()%>"] = new Array();
+        serverPrettyBeans["<%=node.getName()%>"] = new Array();
+        serverBeanStatAttributes["<%=node.getName()%>"] = new Array();
         <%
         int i = 0;
         for (Iterator <String> it = trackedBeansMap.keySet().iterator(); it.hasNext();)
@@ -111,15 +71,15 @@
                 String prettyBean = it.next().toString();
                  Set<String> statAttributes = mrc.getStatAttributesOnMBean(trackedBeansMap.get(prettyBean));
             %>
-                serverBeans[<%=rs.getString("server_id")%>][<%=i%>]="<%=trackedBeansMap.get(prettyBean)%>";
-                serverPrettyBeans[<%=rs.getString("server_id")%>][<%=i%>]="<%=prettyBean%>";
-                serverBeanStatAttributes[<%=rs.getString("server_id")%>][<%=i%>] = new Array();
+                serverBeans["<%=node.getName()%>"][<%=i%>]="<%=trackedBeansMap.get(prettyBean)%>";
+                serverPrettyBeans["<%=node.getName()%>"][<%=i%>]="<%=prettyBean%>";
+                serverBeanStatAttributes["<%=node.getName()%>"][<%=i%>] = new Array();
                 <%
                 int j = 0;
                 for (Iterator <String> itt = statAttributes.iterator(); itt.hasNext();)
                 {
                     %>
-                    serverBeanStatAttributes[<%=rs.getString("server_id")%>][<%=i%>][<%=j%>]="<%=itt.next().toString()%>";
+                    serverBeanStatAttributes["<%=node.getName()%>"][<%=i%>][<%=j%>]="<%=itt.next().toString()%>";
                     <%
                     j++;
                 }
@@ -215,7 +175,6 @@
         }
         
     }
-    return;
 }
 function noAlpha(obj){
     reg = /[^0-9]/g;
@@ -356,7 +315,6 @@
     }
  }
  function getObject(obj) {
-  var theObj;
   if(document.all) {
     if(typeof obj=="string") {
       return document.all(obj);
@@ -449,30 +407,30 @@
         <td width="90%" align="left" valign="top">
             <p>
             <font face="Verdana" size="+1">
-            Editing: <%=name%>
+            Editing: <%=graph.getGraphName1()%>
             </font>
             </p>         
             <p>
    <form onsubmit="return validate(<%=snapshotDuration/1000/60%>);" name="editGraph" method="POST" action="<portlet:actionURL portletMode="edit"><portlet:param name="action" value="saveEditGraph"/></portlet:actionURL>">
    <table cellpadding="1" cellspacing="1">
-      <tr>
-      <td>Added:</td>
-      <td>&nbsp;</td>
-      <td align="right"><%=added%></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Last Modified:</td>
-      <td>&nbsp;</td>
-      <td align="right"><%=modified%></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Last Seen:</td>
-      <td>&nbsp;</td>
-      <td align="right"><%=last_seen%></td>
-      <td></td>
-    </tr>
+      <%--<tr>--%>
+      <%--<td>Added:</td>--%>
+      <%--<td>&nbsp;</td>--%>
+      <%--<td align="right"><%=added%></td>--%>
+      <%--<td></td>--%>
+    <%--</tr>--%>
+    <%--<tr>--%>
+      <%--<td>Last Modified:</td>--%>
+      <%--<td>&nbsp;</td>--%>
+      <%--<td align="right"><%=modified%></td>--%>
+      <%--<td></td>--%>
+    <%--</tr>--%>
+    <%--<tr>--%>
+      <%--<td>Last Seen:</td>--%>
+      <%--<td>&nbsp;</td>--%>
+      <%--<td align="right"><%=last_seen%></td>--%>
+      <%--<td></td>--%>
+    <%--</tr>--%>
    <tr>
       <td><label for="<portlet:namespace/>server_id">Server</label>:</td>
       <td>&nbsp;</td>
@@ -495,31 +453,31 @@
     <tr>
       <td><label for="<portlet:namespace/>name">Name</label>:</td>
       <td>&nbsp;</td>
-      <td align="right"><input type="text" name="name" id="<portlet:namespace/>name" value="<%=name%>"></td>
+      <td align="right"><input type="text" name="name" id="<portlet:namespace/>name" value="<%=graph.getGraphName1()%>"></td>
       <td></td>
     </tr>
     <tr>
       <td><label for="<portlet:namespace/>description">Description</label>:</td>
       <td>&nbsp;</td>
-      <td align="right"><textarea rows="5" cols="50" name="description" id="<portlet:namespace/>description"><%=description%></textarea></td>
+      <td align="right"><textarea rows="5" cols="50" name="description" id="<portlet:namespace/>description"><%=graph.getDescription()%></textarea></td>
       <td></td>
     </tr>
     <tr>
       <td><label for="<portlet:namespace/>xlabel">X Axis label</label>:</td>
       <td>&nbsp;</td>
-      <td align="right"><input type="text" name="xlabel" id="<portlet:namespace/>xlabel" value="<%=xlabel%>"/></td>
+      <td align="right"><input type="text" name="xlabel" id="<portlet:namespace/>xlabel" value="<%=graph.getXlabel()%>"/></td>
       <td></td>
     </tr>
     <tr>
       <td><label for="<portlet:namespace/>ylabel">Y Axis label</label>:</td>
       <td>&nbsp;</td>
-      <td align="right"><input type="text" name="ylabel" id="<portlet:namespace/>ylabel" value="<%=ylabel%>"/></td>
+      <td align="right"><input type="text" name="ylabel" id="<portlet:namespace/>ylabel" value="<%=graph.getYlabel()%>"/></td>
       <td></td>
     </tr>
     <tr>
         <td><label for="<portlet:namespace/>timeframe">Timeframe</label>:</td>
         <td>&nbsp;</td>
-        <td align="right"><input type="text" width="5" size="4" name="timeframe" id="<portlet:namespace/>timeframe" onKeyUp='noAlpha(this)' onKeyPress='noAlpha(this)' value="<%=timeframe%>"/></td>
+        <td align="right"><input type="text" width="5" size="4" name="timeframe" id="<portlet:namespace/>timeframe" onKeyUp='noAlpha(this)' onKeyPress='noAlpha(this)' value="<%=graph.getTimeFrame()%>"/></td>
         <td> minutes</td>
       </tr>
     <tr>
@@ -537,8 +495,8 @@
       <td>&nbsp;</td>
       <td align="right">
       <select name="data1operation" title="data operation" onchange="updateFormula();">
-        <option value="A" <%if (data1operation.equals("A")){  %>selected="selected"<%} %>>As-is</option>
-        <option value="D" <%if (data1operation.equals("D")){  %>selected="selected"<%} %>>Change (Delta) in</option>
+        <option value="A" <%if (graph.getData1operation()=='A'){  %>selected="selected"<%} %>>As-is</option>
+        <option value="D" <%if (graph.getData1operation()=='D'){  %>selected="selected"<%} %>>Change (Delta) in</option>
       </select><label for="<portlet:namespace/>dataname1">name</label>
       <select name="dataname1" id="<portlet:namespace/>dataname1" onchange="updateFormula();">
         <option value="">-Select MBean First-</option>
@@ -551,25 +509,25 @@
       <td>&nbsp;</td>
         <td align="right">
       <select name="operation" id="<portlet:namespace/>operation" onChange="checkOtherMath(); updateFormula();">
-        <option value="" <%if (operation.equals("null") || operation.equals("") || operation == null){  %>selected="selected"<%} %>>none</option>
-        <option value="+" <%if (operation.equals("+")){  %>selected="selected"<%} %>>+</option>
-        <option value="-" <%if (operation.equals("-")){  %>selected="selected"<%} %>>-</option>
-        <option value="*" <%if (operation.equals("*")){  %>selected="selected"<%} %>>*</option>
-        <option value="/" <%if (operation.equals("/")){  %>selected="selected"<%} %>>/</option>
-        <option value="other" <%if (!operation.equals("null") && !operation.equals("+") && !operation.equals("-") && !operation.equals("*") && !operation.equals("/") && !operation.equals("") && operation != null){  %>selected="selected"<%} %>>Other</option>
+        <option value="" <%if (graph.getOperation().equals("null") || graph.getOperation().equals("") || graph.getOperation() == null){  %>selected="selected"<%} %>>none</option>
+        <option value="+" <%if (graph.getOperation().equals("+")){  %>selected="selected"<%} %>>+</option>
+        <option value="-" <%if (graph.getOperation().equals("-")){  %>selected="selected"<%} %>>-</option>
+        <option value="*" <%if (graph.getOperation().equals("*")){  %>selected="selected"<%} %>>*</option>
+        <option value="/" <%if (graph.getOperation().equals("/")){  %>selected="selected"<%} %>>/</option>
+        <option value="other" <%if (!graph.getOperation().equals("null") && !graph.getOperation().equals("+") && !graph.getOperation().equals("-") && !graph.getOperation().equals("*") && !graph.getOperation().equals("/") && !graph.getOperation().equals("") && graph.getOperation() != null){  %>selected="selected"<%} %>>Other</option>
       </select>
       </td>
-      <td><input type="text" <%if (!operation.equals("null") && !operation.equals("+") && !operation.equals("-") && !operation.equals("*") && !operation.equals("/") && !operation.equals("") && operation != null){  %><%} else {%>style="display: none;"<%}%> width="6" size="8" name="othermath" title="other operation" onKeyUp='noAlphaMath(this); updateFormula();' onKeyPress='noAlphaMath(this); updateFormula();' value="<%=operation %>"/></td>
+      <td><input type="text" <%if (!graph.getOperation().equals("null") && !graph.getOperation().equals("+") && !graph.getOperation().equals("-") && !graph.getOperation().equals("*") && !graph.getOperation().equals("/") && !graph.getOperation().equals("") && graph.getOperation() != null){  %><%} else {%>style="display: none;"<%}%> width="6" size="8" name="othermath" title="other operation" onKeyUp='noAlphaMath(this); updateFormula();' onKeyPress='noAlphaMath(this); updateFormula();' value="<%=graph.getOperation() %>"/></td>
     </tr>
     <tr>
       <td>Data series 2:</td>
       <td>&nbsp;</td>
       <td align="right">
-      <select name="data2operation" title="data operation" <%if (operation.equals("null") || operation.equals("") || operation == null){  %>disabled="disabled"<%} %> onchange="updateFormula();">
-        <option value="A" <%if (data2operation.equals("A")){  %>selected="selected"<%} %>>As-is</option>
-        <option value="D" <%if (data2operation.equals("D")){  %>selected="selected"<%} %>>Change (Delta) in</option>
+      <select name="data2operation" title="data operation" <%if (graph.getOperation().equals("null") || graph.getOperation().equals("") || graph.getOperation() == null){  %>disabled="disabled"<%} %> onchange="updateFormula();">
+        <option value="A" <%if (graph.getData2operation()=='A'){  %>selected="selected"<%} %>>As-is</option>
+        <option value="D" <%if (graph.getData2operation()=='D'){  %>selected="selected"<%} %>>Change (Delta) in</option>
       </select><label for="<portlet:namespace/>dataname2">name</label>
-      <select name="dataname2" id="<portlet:namespace/>dataname2" <%if (operation.equals("null") || operation.equals("") || operation == null){  %>disabled="disabled"<%} %> onchange=" checkNoData2(); updateFormula();">
+      <select name="dataname2" id="<portlet:namespace/>dataname2" <%if (graph.getOperation().equals("null") || graph.getOperation().equals("") || graph.getOperation() == null){  %>disabled="disabled"<%} %> onchange=" checkNoData2(); updateFormula();">
         <option value="">-Select Operation First-</option>
       </select>
       <script type='text/javascript'>
@@ -582,10 +540,10 @@
         <td></td>
         <td></td>
         <td>
-            <% if(archive) { %>
-                <input type="checkbox" name="showArchive" id="<portlet:namespace/>showArchive" checked><label for="<portlet:namespace/>showArchive">Show Archive</label></input>
+            <% if(graph.isShowArchive()) { %>
+                <input type="checkbox" name="showArchive" id="<portlet:namespace/>showArchive" checked><label for="<portlet:namespace/>showArchive">Show Archive</label>
             <% } else { %>
-                <input type="checkbox" name="showArchive" id="<portlet:namespace/>showArchive"><label for="<portlet:namespace/>showArchive">Show Archive</label></input>
+                <input type="checkbox" name="showArchive" id="<portlet:namespace/>showArchive"><label for="<portlet:namespace/>showArchive">Show Archive</label>
             <% } %>
         </td>
         <td></td>
@@ -599,9 +557,8 @@
       <td></td>
     </tr>
   </table>
-  <input name="graph_id" type="hidden" value="<%=graph_id%>">
+  <input name="graph_id" type="hidden" value="<%=graph.getIdString()%>">
   </form>
-      </p>
       <script type='text/javascript'>
         updateFormula();
         checkNoData2();
@@ -643,7 +600,7 @@
                     <td bgcolor="#FFFFFF" nowrap>
                         &nbsp;<br />
                         <ul>
-                            <li><a href="<portlet:actionURL portletMode="edit"><portlet:param name="action" value="deleteGraph" /><portlet:param name="graph_id" value="<%=graph_id%>" /></portlet:actionURL>">Delete this graph</a></li>
+                            <li><a href="<portlet:actionURL portletMode="edit"><portlet:param name="action" value="deleteGraph" /><portlet:param name="graph_id" value="<%=graph.getIdString()%>" /></portlet:actionURL>">Delete this graph</a></li>
                         </ul>
                         &nbsp;<br />
                     </td>   
@@ -654,10 +611,8 @@
     </tr>
 </table>
 <%
-con.close();
-}
-    else
-    {%>
+} else {
+%>
 <table>
     <tr>
         <!-- Body -->



Mime
View raw message