You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ec...@apache.org on 2008/01/28 11:34:25 UTC
svn commit: r615847 - in /geronimo/server/trunk/plugins/monitoring:
mconsole-ear/src/main/resources/
mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/
mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/util/
mconsole-war...
Author: ecraig
Date: Mon Jan 28 02:34:23 2008
New Revision: 615847
URL: http://svn.apache.org/viewvc?rev=615847&view=rev
Log:
GERONIMO-3730
monitoring plugin to support jmx connections in mconsole
Implemented UI elements to select connection method
Renamed current mrcconnector class to mrcconnectorejb, in order to add mrcconnectorjmx
added protocol field to database schema
added checks for connection type in monitoring portlet
Added:
geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnectorEJB.java
- copied, changed from r615733, geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java
Removed:
geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java
Modified:
geronimo/server/trunk/plugins/monitoring/mconsole-ear/src/main/resources/MonitoringClientDB.sql
geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java
geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java
geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/util/DBManager.java
geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddServer.jsp
geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp
geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp
geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp
geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
Modified: geronimo/server/trunk/plugins/monitoring/mconsole-ear/src/main/resources/MonitoringClientDB.sql
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-ear/src/main/resources/MonitoringClientDB.sql?rev=615847&r1=615846&r2=615847&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-ear/src/main/resources/MonitoringClientDB.sql (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-ear/src/main/resources/MonitoringClientDB.sql Mon Jan 28 02:34:23 2008
@@ -3,6 +3,8 @@
* enabled Enable/disable this server - defaults to 1
* name Name for this server - alphanum
* ip IP address of this server
+ * port Port number to connect on
+ * protocol Protocol to use, 1 for ejb, 2 for jmx
* username username to use for connecting
* password password to use for connecting
* added Timestamp when this server was added
@@ -14,6 +16,8 @@
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: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java?rev=615847&r1=615846&r2=615847&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java Mon Jan 28 02:34:23 2008
@@ -35,7 +35,7 @@
private String ip = new String();
private int timeFrame;
private int snapCount;
- private MRCConnector mrc = new MRCConnector();
+ private MRCConnectorEJB mrc = new MRCConnectorEJB();
private Connection con;
// constructor
@@ -80,7 +80,7 @@
String username = rsServer.getString("username");
String password = rsServer.getString("password");
int port = rsServer.getInt("port");
- // close the connection before calling the MRCConnector because
+ // close the connection before calling the MRCConnectorEJB because
// it opens another
// connection to the db to update the SERVERS.last_seen
// attribute
@@ -89,7 +89,7 @@
} catch (Exception e) {
throw e;
}
- mrc = new MRCConnector(ip, username, password, port);
+ mrc = new MRCConnectorEJB(ip, username, password, port);
snapCount = timeFrame
/ java.lang.Integer
Copied: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnectorEJB.java (from r615733, geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnectorEJB.java?p2=geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnectorEJB.java&p1=geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java&r1=615733&r2=615847&rev=615847&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnectorEJB.java Mon Jan 28 02:34:23 2008
@@ -37,11 +37,11 @@
import org.apache.geronimo.util.EncryptionManager;
-public class MRCConnector {
+public class MRCConnectorEJB {
private MasterRemoteControlRemote mrc = null;
- MRCConnector() {
+ MRCConnectorEJB() {
}
@@ -55,7 +55,7 @@
* @throws Exception -
* If the connection to mrc-server fails
*/
- public MRCConnector(String ip, String userName, String password, int port)
+ public MRCConnectorEJB(String ip, String userName, String password, int port)
throws Exception {
// decrypt the password
password = (String) EncryptionManager.decrypt(password);
Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java?rev=615847&r1=615846&r2=615847&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java Mon Jan 28 02:34:23 2008
@@ -202,9 +202,9 @@
String username = actionRequest.getParameter("username");
String password = actionRequest.getParameter("password");
String password2 = actionRequest.getParameter("password2");
- String strPort = actionRequest.getParameter("port");
- int port = Integer.parseInt(strPort);
- String message = testConnection(name, ip, username, password, port);
+ Integer port = Integer.parseInt(actionRequest.getParameter("port"));
+ Integer protocol = Integer.parseInt(actionRequest.getParameter("protocol"));
+ String message = testConnection(name, ip, username, password, port, protocol);
actionResponse.setRenderParameter("message", message);
actionResponse.setRenderParameter("name", name);
actionResponse.setRenderParameter("username", username);
@@ -212,6 +212,7 @@
actionResponse.setRenderParameter("password", password);
actionResponse.setRenderParameter("password2", password2);
actionResponse.setRenderParameter("port", "" + port);
+ actionResponse.setRenderParameter("protocol", "" + protocol);
} else if (action.equals("testEditServerConnection")) {
String name = actionRequest.getParameter("name");
String ip = actionRequest.getParameter("ip");
@@ -221,9 +222,9 @@
String server_id = actionRequest.getParameter("server_id");
String snapshot = actionRequest.getParameter("snapshot");
String retention = actionRequest.getParameter("retention");
- String strPort = actionRequest.getParameter("port");
- int port = Integer.parseInt(strPort);
- String message = testConnection(name, ip, username, password, port);
+ Integer port = Integer.parseInt(actionRequest.getParameter("port"));
+ Integer protocol = Integer.parseInt(actionRequest.getParameter("protocol"));
+ String message = testConnection(name, ip, username, password, port, protocol);
actionResponse.setRenderParameter("message", message);
actionResponse.setRenderParameter("name", name);
actionResponse.setRenderParameter("username", username);
@@ -234,13 +235,22 @@
actionResponse.setRenderParameter("server_id", server_id);
actionResponse.setRenderParameter("retention", retention);
actionResponse.setRenderParameter("port", "" + port);
+ actionResponse.setRenderParameter("protocol", "" + protocol);
}
}
private String testConnection(String name, String ip, String username,
- String password, int port) {
+ String password, int port, int protocol) {
try {
- MRCConnector mrc = new MRCConnector(ip, username, password, port);
+ if (protocol == 1)
+ {
+ MRCConnectorEJB mrc = new MRCConnectorEJB(ip, username, password, port);
+ }
+ else if (protocol == 2)
+ {
+ System.out.println("");
+ //TODO: JMX Stuff here
+ }
return "<font color=\"green\"><strong><li>Connection was successfully established.</li></strong></font>";
} catch (Exception e) {
return "<font color=\"red\"><strong><li>Failed to create a connection to server.</li></strong></font>";
@@ -596,8 +606,8 @@
String username = actionRequest.getParameter("username");
String snapshot = actionRequest.getParameter("snapshot");
String retention = actionRequest.getParameter("retention");
- String strPort = actionRequest.getParameter("port");
- int port = Integer.parseInt(strPort);
+ Integer port = Integer.parseInt(actionRequest.getParameter("port"));
+ Integer protocol = Integer.parseInt(actionRequest.getParameter("protocol"));
// encrypt the password
if (password != null && !password.equals("")) {
password = EncryptionManager.encrypt(password);
@@ -614,7 +624,7 @@
+ "', username='"
+ username
+ "', modified=CURRENT_TIMESTAMP, last_seen=CURRENT_TIMESTAMP, "
- + "port=" + port + " WHERE server_id="
+ + "port=" + port + ",protocol="+protocol+" WHERE server_id="
+ server_id);
pStmt.executeUpdate();
// when user did not specify the password, just grab it from the
@@ -645,7 +655,8 @@
+ username
+ "', password='"
+ password
- + "', modified=CURRENT_TIMESTAMP, last_seen=CURRENT_TIMESTAMP WHERE server_id="
+ + "', modified=CURRENT_TIMESTAMP, last_seen=CURRENT_TIMESTAMP, "
+ + "port=" + port + ",protocol="+protocol+" WHERE server_id="
+ server_id);
pStmt.executeUpdate();
}
@@ -654,10 +665,17 @@
if (snapshot == null || retention == null) {
// do not update if we do not know
} else {
- (new MRCConnector(ip, username, password, port))
+ if (protocol == 1)
+ {
+ (new MRCConnectorEJB(ip, username, password, port))
.setSnapshotDuration(Long.parseLong(snapshot) * 1000 * 60);
- (new MRCConnector(ip, username, password, port))
+ (new MRCConnectorEJB(ip, username, password, port))
.setSnapshotRetention(Integer.parseInt(retention));
+ }
+ else if (protocol == 2)
+ {
+ //TODO: JMX Here
+ }
}
// set success message
actionResponse
@@ -677,6 +695,7 @@
Connection con = DBase.getConnection();
String name = actionRequest.getParameter("name");
String ip = actionRequest.getParameter("ip");
+ int protocol = Integer.parseInt(actionRequest.getParameter("protocol"));
int port = Integer.parseInt(actionRequest.getParameter("port"));
String password = actionRequest.getParameter("password");
String username = actionRequest.getParameter("username");
@@ -686,7 +705,7 @@
}
try {
PreparedStatement pStmt = con
- .prepareStatement("INSERT INTO servers (name, ip, username, password, modified, last_seen, added, port) VALUES ('"
+ .prepareStatement("INSERT INTO servers (name, ip, username, password, modified, last_seen, added, port, protocol) VALUES ('"
+ name
+ "','"
+ ip
@@ -695,7 +714,9 @@
+ "','"
+ password
+ "',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,"
- + port + ")");
+ + port
+ + ","
+ + protocol + ")");
pStmt.executeUpdate();
actionResponse.setRenderParameter("message",
"<font color=\"green\"><strong><li>Server " + name + " at "
@@ -965,12 +986,13 @@
private String startTrackingMbean(String server_id, String mbean) {
PreparedStatement pStmt = null;
ResultSet rs = null;
- MRCConnector mrc = null;
+ MRCConnectorEJB mrc = null;
DBManager DBase = new DBManager();
Connection con = DBase.getConnection();
String server_ip = null;
String username = null;
String password = null;
+ int protocol = 0;
int port = -1;
// fetch server information
try {
@@ -987,6 +1009,7 @@
password = rs.getString("password");
username = rs.getString("username");
port = rs.getInt("port");
+ protocol = rs.getInt("protocol");
} catch (SQLException e) {
return "<font color=\"red\"><strong><li>DATABASE ERROR: "
+ e.getMessage() + "</li></strong></font>";
@@ -994,7 +1017,15 @@
// attempt to connect to the mrc server
try {
con.close();
- mrc = new MRCConnector(server_ip, username, password, port);
+ if (protocol == 1)
+ {
+ mrc = new MRCConnectorEJB(server_ip, username, password, port);
+ }
+ else if (protocol == 2)
+ {
+ System.out.println("");
+ //TODO: JMX Stuff here
+ }
} catch (Exception e) {
return "<font color=\"red\"><strong><li>MRC ERROR: Unable to connect to server "
+ server_ip
@@ -1026,13 +1057,14 @@
private String stopTrackingMbean(String server_id, String mbean) {
PreparedStatement pStmt = null;
ResultSet rs = null;
- MRCConnector mrc = null;
+ MRCConnectorEJB mrc = null;
DBManager DBase = new DBManager();
Connection con = DBase.getConnection();
String server_ip = null;
String username = null;
String password = null;
int port = -1;
+ int protocol = 0;
// fetch server's information
try {
pStmt = con
@@ -1048,6 +1080,7 @@
password = rs.getString("password");
username = rs.getString("username");
port = rs.getInt("port");
+ protocol = rs.getInt("protocol");
} catch (SQLException e) {
return "<font color=\"red\"><strong><li>DATABASE ERROR: "
+ e.getMessage() + "</li></strong></font>";
@@ -1055,8 +1088,16 @@
// attempt to connect to the mrc-server
try {
con.close();
- mrc = new MRCConnector(server_ip, username, password, port);
- } catch (Exception e) {
+ if (protocol == 1)
+ {
+ mrc = new MRCConnectorEJB(server_ip, username, password, port);
+ }
+ else if (protocol == 2)
+ {
+ System.out.println("");
+ //TODO: JMX Stuff here
+ }
+ } catch (Exception e) {
return "<font color=\"red\"><strong><li>MRC ERROR: Unable to connect to server "
+ server_ip
+ ": "
@@ -1088,13 +1129,14 @@
private String stopThread(String server_id) {
PreparedStatement pStmt = null;
ResultSet rs = null;
- MRCConnector mrc = null;
+ MRCConnectorEJB mrc = null;
DBManager DBase = new DBManager();
Connection con = DBase.getConnection();
String server_ip = null;
String username = null;
String password = null;
int port = -1;
+ int protocol = 0;
// fetch the server's information
try {
pStmt = con
@@ -1110,6 +1152,7 @@
password = rs.getString("password");
username = rs.getString("username");
port = rs.getInt("port");
+ protocol = rs.getInt("protocol");
} catch (SQLException e) {
return "<font color=\"red\"><strong><li>DATABASE ERROR: "
+ e.getMessage() + "</li></strong></font>";
@@ -1117,7 +1160,15 @@
// attempt to connect to the mrc-server
try {
con.close();
- mrc = new MRCConnector(server_ip, username, password, port);
+ if (protocol == 1)
+ {
+ mrc = new MRCConnectorEJB(server_ip, username, password, port);
+ }
+ else if (protocol == 2)
+ {
+ System.out.println("");
+ //TODO: JMX Stuff here
+ }
} catch (Exception e) {
return "<font color=\"red\"><strong><li>MRC ERROR: Unable to connect to server "
+ server_ip
@@ -1147,13 +1198,14 @@
private String startThread(String server_id, Long snapshotDuration) {
PreparedStatement pStmt = null;
ResultSet rs = null;
- MRCConnector mrc = null;
+ MRCConnectorEJB mrc = null;
DBManager DBase = new DBManager();
Connection con = DBase.getConnection();
String server_ip = null;
String username = null;
String password = null;
int port = -1;
+ int protocol = 0;
// fetch the server's information
try {
pStmt = con
@@ -1169,6 +1221,7 @@
password = rs.getString("password");
username = rs.getString("username");
port = rs.getInt("port");
+ protocol = rs.getInt("protocol");
} catch (SQLException e) {
return "<font color=\"red\"><strong><li>DATABASE ERROR: "
+ e.getMessage() + "</li></strong></font>";
@@ -1176,7 +1229,15 @@
// attempt to connect to the mrc-server
try {
con.close();
- mrc = new MRCConnector(server_ip, username, password, port);
+ if (protocol == 1)
+ {
+ mrc = new MRCConnectorEJB(server_ip, username, password, port);
+ }
+ else if (protocol == 2)
+ {
+ System.out.println("");
+ //TODO: JMX Stuff here
+ }
} catch (Exception e) {
return "<font color=\"red\"><strong><li>MRC ERROR: Unable to connect to server "
+ server_ip
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=615847&r1=615846&r2=615847&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 Mon Jan 28 02:34:23 2008
@@ -113,7 +113,8 @@
+ "enabled SMALLINT DEFAULT 1 NOT NULL,"
+ "name VARCHAR(128) DEFAULT NULL,"
+ "ip VARCHAR(128) UNIQUE NOT NULL,"
- + "port INT 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: 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=615847&r1=615846&r2=615847&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 Mon Jan 28 02:34:23 2008
@@ -30,7 +30,7 @@
<%@ page import="java.sql.ResultSet"%>
<%@ page import="java.sql.SQLException"%>
<%@ page import="org.apache.geronimo.monitoring.console.util.*"%>
-<%@ page import="org.apache.geronimo.monitoring.console.MRCConnector"%>
+<%@ page import="org.apache.geronimo.monitoring.console.MRCConnectorEJB"%>
<portlet:defineObjects />
<%
@@ -45,7 +45,7 @@
PreparedStatement pStmt = con
.prepareStatement("SELECT * FROM servers WHERE enabled=1");
ResultSet rs = pStmt.executeQuery();
- MRCConnector mrc = null;
+ MRCConnectorEJB mrc = null;
ArrayList<String> serverIds = new ArrayList<String>();
ArrayList<String> serverNames = new ArrayList<String>();
Long snapshotDuration = 5L;
@@ -73,7 +73,7 @@
{
TreeMap <String,String> trackedBeansMap = null;
try {
- mrc = new MRCConnector( rs.getString("ip"),
+ mrc = new MRCConnectorEJB( rs.getString("ip"),
rs.getString("username"),
rs.getString("password"),
rs.getInt("port"));
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=615847&r1=615846&r2=615847&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 Mon Jan 28 02:34:23 2008
@@ -40,6 +40,7 @@
String password = (String) request.getAttribute("password");
String password2 = (String) request.getAttribute("password2");
String port = (String) request.getAttribute("port");
+String protocol = (String) request.getAttribute("protocol");
if(message == null) message = "";
if(name == null) name = "";
@@ -47,7 +48,21 @@
if(username == null) username = "";
if(password == null) password = "";
if(password2 == null) password2 = "";
-if(port == null) port = "4201";
+if(protocol == null) protocol = "";
+if(protocol.equals("1"))
+{
+ if(port == null) port = "4201";
+}
+else if(protocol.equals("2"))
+{
+ if(port == null) port = "1099";
+}
+else
+{
+ protocol = "1";
+ if(port == null) port = "4201";
+}
+
%>
<!-- <head> -->
@@ -70,7 +85,7 @@
&& document.addServer.password.value
&& document.addServer.port.value ))
{
- alert("Name, Address, Port, Username, and Password are all required fields");
+ alert("Name, Address, Protocol, Port, Username, and Password are all required fields");
return false;
}
if (document.addServer.password.value != document.addServer.password2.value)
@@ -119,6 +134,12 @@
<td>IP/Hostname:</td>
<td> </td>
<td align="right"><input type="text" name="ip" value="<%=ip%>"/></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>Protocol</td>
+ <td> </td>
+ <td align="right"><input type="radio" name="protocol" value="1" <%if (protocol.equals("1")){ %>checked="checked"<%} %>>EJB <input type="radio" name="protocol" value="2" <%if (protocol.equals("2")){ %>checked="checked"<%} %>>JMX</td>
<td></td>
</tr>
<tr>
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=615847&r1=615846&r2=615847&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 Mon Jan 28 02:34:23 2008
@@ -30,7 +30,7 @@
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="org.apache.geronimo.monitoring.console.util.*" %>
-<%@ page import="org.apache.geronimo.monitoring.console.MRCConnector" %>
+<%@ page import="org.apache.geronimo.monitoring.console.MRCConnectorEJB" %>
<portlet:defineObjects/>
<%
@@ -76,7 +76,7 @@
pStmt = con.prepareStatement("SELECT * FROM servers WHERE enabled=1");
rs = pStmt.executeQuery();
- MRCConnector mrc = null;
+ MRCConnectorEJB mrc = null;
Long snapshotDuration = null;
ArrayList<String> serverIds = new ArrayList<String>();
@@ -96,7 +96,7 @@
{
TreeMap <String,String> trackedBeansMap = null;
try {
- mrc = new MRCConnector( rs.getString("ip"),
+ mrc = new MRCConnectorEJB( rs.getString("ip"),
rs.getString("username"),
rs.getString("password"),
rs.getInt("port"));
Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp?rev=615847&r1=615846&r2=615847&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp Mon Jan 28 02:34:23 2008
@@ -31,7 +31,7 @@
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="org.apache.geronimo.monitoring.console.util.*" %>
-<%@ page import="org.apache.geronimo.monitoring.console.MRCConnector" %>
+<%@ page import="org.apache.geronimo.monitoring.console.MRCConnectorEJB" %>
<%@ page import="org.apache.geronimo.util.EncryptionManager" %>
<portlet:defineObjects/>
@@ -49,6 +49,7 @@
String snapshot = (String) request.getAttribute("snapshot");
String retention = (String) request.getAttribute("retention");
String port = (String)request.getAttribute("port");
+String protocol = (String) request.getAttribute("protocol");
if(message == null) message = "";
if(name == null) name = "";
if(ip == null) ip = "";
@@ -57,14 +58,27 @@
if(password2 == null) password2 = "";
if(snapshot == null) snapshot = "";
if(retention == null) retention = "";
-if(port == null) port = "";
+if(protocol == null) protocol = "";
+if(protocol.equals("1"))
+{
+ if(port == null) port = "4201";
+}
+else if(protocol.equals("2"))
+{
+ if(port == null) port = "1099";
+}
+else
+{
+ protocol = "1";
+ if(port == null) port = "4201";
+}
DBManager DBase = new DBManager();
Connection con = DBase.getConnection();
PreparedStatement pStmt = con.prepareStatement("SELECT * FROM servers WHERE server_id="+server_id);
ResultSet rs = pStmt.executeQuery();
-MRCConnector mrc = null;
+MRCConnectorEJB mrc = null;
boolean isOnline = true;
String added = "";
String modified = "";
@@ -80,6 +94,7 @@
username = rs.getString("username");
ip = rs.getString("ip");
port = rs.getString("port");
+ protocol = rs.getString("protocol");
dbPassword = (String)EncryptionManager.decrypt(rs.getString("password"));
}
added = rs.getString("added");
@@ -87,14 +102,14 @@
last_seen = rs.getString("last_seen");
enabled = rs.getInt("enabled") == 1 ? true : false;
try {
- // close connection before using the MRCConnector
+ // close connection before using the MRCConnectorEJB
con.close();
- mrc = new MRCConnector(ip, username, password, Integer.parseInt(port));
+ mrc = new MRCConnectorEJB(ip, username, password, Integer.parseInt(port));
} catch (Exception e) {
// the password supplied by the user doesn't work
try {
if(retention.equals("") || snapshot.equals("")) {
- mrc = new MRCConnector(ip, username, dbPassword, Integer.parseInt(port));
+ mrc = new MRCConnectorEJB(ip, username, dbPassword, Integer.parseInt(port));
// get the snapshot on the first call or any subsequent valid connections
snapshot = snapshot == "" ? "" + mrc.getSnapshotDuration() / 1000 / 60 : snapshot;
// get the retention on the first call or any subsequent valid connection
@@ -125,9 +140,9 @@
&& document.editServer.ip.value
&& document.editServer.username.value
&& document.editServer.snapshot.value
- && document.editServer.port.value))
+ && document.editServer.port.value ))
{
- alert("Name, Address, Port, Username, and Snapshot Duration are all required fields.");
+ alert("Name, Address, Protocol, Port, Username, and Snapshot Duration are all required fields.");
return false;
}
if (document.editServer.password.value != document.editServer.password2.value)
@@ -143,9 +158,10 @@
&& document.editServer.ip.value
&& document.editServer.username.value
&& document.editServer.snapshot.value
- && document.editServer.password.value ))
+ && document.editServer.password.value
+ && document.editServer.port.value ))
{
- alert("Name, Address, Username, and Snapshot Duration are all required fields.");
+ alert("Name, Address, Protocol, Port, Username, and Snapshot Duration are all required fields.");
return false;
}
if (document.editServer.password.value != document.editServer.password2.value)
@@ -213,6 +229,12 @@
<td>IP/Hostname:</td>
<td> </td>
<td align="right"><input type="text" name="ip" value=<%= "\"" + ip + "\"" %>/></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>Protocol</td>
+ <td> </td>
+ <td align="right"><input type="radio" name="protocol" value="1" <%if (protocol.equals("1")){ %>checked="checked"<%} %>>EJB <input type="radio" name="protocol" value="2" <%if (protocol.equals("1")){ %>checked="checked"<%} %>>JMX</td>
<td></td>
</tr>
<tr>
Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp?rev=615847&r1=615846&r2=615847&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp Mon Jan 28 02:34:23 2008
@@ -23,7 +23,7 @@
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.SQLException" %>
-<%@ page import="org.apache.geronimo.monitoring.console.MRCConnector" %>
+<%@ page import="org.apache.geronimo.monitoring.console.MRCConnectorEJB" %>
<%@ page import="org.apache.geronimo.monitoring.console.util.*" %>
<portlet:defineObjects/>
<%
@@ -126,11 +126,11 @@
String name = serverInfos.get(i).name;
boolean online = false;
boolean collecting = false;
- MRCConnector mrc = null;
+ MRCConnectorEJB mrc = null;
Long snapshotDuration = new Long(0);
if (enabled) {
try {
- mrc = new MRCConnector(ip, username, password, port);
+ mrc = new MRCConnectorEJB(ip, username, password, port);
online = true;
} catch (Exception e) {
online = false;
Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp?rev=615847&r1=615846&r2=615847&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp Mon Jan 28 02:34:23 2008
@@ -22,7 +22,7 @@
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.SQLException" %>
-<%@ page import="org.apache.geronimo.monitoring.console.MRCConnector" %>
+<%@ page import="org.apache.geronimo.monitoring.console.MRCConnectorEJB" %>
<%@ page import="org.apache.geronimo.monitoring.console.util.*" %>
<portlet:defineObjects/>
<%
@@ -91,11 +91,11 @@
String name = serverInfos.get(i).name;
boolean online = false;
boolean collecting = false;
- MRCConnector mrc = null;
+ MRCConnectorEJB mrc = null;
Long snapshotDuration = new Long(0);
if (enabled) {
try {
- mrc = new MRCConnector(ip, username, password, port);
+ mrc = new MRCConnectorEJB(ip, username, password, port);
online = true;
} catch (Exception e) {
online = false;
Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp?rev=615847&r1=615846&r2=615847&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp Mon Jan 28 02:34:23 2008
@@ -32,7 +32,7 @@
<%@ page import="java.sql.SQLException" %>
<%@ page import="java.sql.Timestamp" %>
<%@ page import="org.apache.geronimo.monitoring.console.util.*" %>
-<%@ page import="org.apache.geronimo.monitoring.console.MRCConnector" %>
+<%@ page import="org.apache.geronimo.monitoring.console.MRCConnectorEJB" %>
<portlet:defineObjects/>
<%
@@ -43,7 +43,7 @@
DBManager DBase = new DBManager();
Connection con = DBase.getConnection();
-MRCConnector mrc = null;
+MRCConnectorEJB mrc = null;
boolean isOnline = true;
boolean collecting = false;
@@ -71,7 +71,7 @@
long retention = -1;
rs.close();
try {
- mrc = new MRCConnector(ip, username, password, port);
+ mrc = new MRCConnectorEJB(ip, username, password, port);
availableBeansMap = mrc.getFreeStatisticsProviderBeanNamesMap();
retention = mrc.getSnapshotRetention();
trackedBeansMap = mrc.getTrackedBeansMap();