remm 2003/12/10 16:59:07 Modified: webapps/manager/WEB-INF/classes/org/apache/catalina/manager StatusTransformer.java Log: - Add manager statistics for each context, as well as navigation links so that this is actually useful. Somehow, the links don't work with Mozilla: it must be because my HTML is very bad. IE works, though. Revision Changes Path 1.6 +87 -9 jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/StatusTransformer.java Index: StatusTransformer.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/StatusTransformer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- StatusTransformer.java 20 Oct 2003 01:44:54 -0000 1.5 +++ StatusTransformer.java 11 Dec 2003 00:59:07 -0000 1.6 @@ -233,7 +233,7 @@ int mode) throws Exception { - if (mode == 0){ + if (mode == 0) { writer.print("<h1>"); writer.print(name); writer.print("</h1>"); @@ -250,7 +250,7 @@ writer.print(" Current thread busy: "); writer.print(mBeanServer.getAttribute(tpName, "currentThreadsBusy")); - writer.print("<br/>"); + writer.print("<br>"); ObjectName grpName = null; @@ -546,11 +546,39 @@ if (mode == 0){ ObjectName queryHosts = new ObjectName("*:j2eeType=WebModule,*"); Set hostsON = mBeanServer.queryNames(queryHosts, null); + + // Navigation menu + writer.print("<h1>"); + writer.print("Application list"); + writer.print("</h1>"); + + writer.print("<p>"); + int count = 0; Iterator iterator = hostsON.iterator(); while (iterator.hasNext()) { ObjectName contextON = (ObjectName) iterator.next(); + String webModuleName = contextON.getKeyProperty("name"); + + writer.print("<a href=\"#" + (count++) + ".0\">"); + writer.print(webModuleName); + writer.print("</a>"); + if (iterator.hasNext()) { + writer.print("<br>"); + } + + } + writer.print("</p>"); + + // Webapp list + count = 0; + iterator = hostsON.iterator(); + while (iterator.hasNext()) { + ObjectName contextON = (ObjectName) iterator.next(); + writer.print("<a class=\"A.name\" name=\"#" + + (count++) + ".0\">"); writeContext(writer, contextON, mBeanServer, mode); } + } else if (mode == 1){ // for now we don't write out the Detailed state in XML } @@ -585,6 +613,17 @@ } else { return; } + + ObjectName queryManager = new ObjectName + (objectName.getDomain() + ":type=Manager,path=" + contextName + + ",host=" + hostName + ",*"); + Set managersON = mBeanServer.queryNames(queryManager, null); + ObjectName managerON = null; + Iterator iterator2 = managersON.iterator(); + while (iterator2.hasNext()) { + managerON = (ObjectName) iterator2.next(); + } + // Special case for the root context if (contextName.equals("/")) { contextName = ""; @@ -593,6 +632,7 @@ writer.print("<h1>"); writer.print(name); writer.print("</h1>"); + writer.print("</a>"); writer.print("<p>"); writer.print(" Startup time: "); @@ -601,9 +641,13 @@ writer.print(" TLD scan time: "); writer.print(formatTime(mBeanServer.getAttribute (objectName, "tldScanTime"), false)); + if (managerON != null) { + writeManager(writer, managerON, mBeanServer, mode); + } writer.print("</p>"); - - String onStr = "*:j2eeType=Servlet,WebModule=" + webModuleName + ",*"; + + String onStr = objectName.getDomain() + + ":j2eeType=Servlet,WebModule=" + webModuleName + ",*"; ObjectName servletObjectName = new ObjectName(onStr); Set set = mBeanServer.queryMBeans(servletObjectName, null); Iterator iterator = set.iterator(); @@ -611,6 +655,7 @@ ObjectInstance oi = (ObjectInstance) iterator.next(); writeWrapper(writer, oi.getObjectName(), mBeanServer, mode); } + } else if (mode == 1){ // for now we don't write out the context in XML } @@ -619,13 +664,46 @@ /** + * Write detailed information about a manager. + */ + public static void writeManager(PrintWriter writer, ObjectName objectName, + MBeanServer mBeanServer, int mode) + throws Exception { + + if (mode == 0) { + writer.print("<br>"); + writer.print(" Active sessions: "); + writer.print(mBeanServer.getAttribute + (objectName, "activeSessions")); + writer.print(" Session count: "); + writer.print(mBeanServer.getAttribute + (objectName, "sessionCounter")); + writer.print(" Max active sessions: "); + writer.print(mBeanServer.getAttribute(objectName, "maxActive")); + writer.print(" Rejected session creations: "); + writer.print(mBeanServer.getAttribute + (objectName, "rejectedSessions")); + writer.print(" Expired sessions: "); + writer.print(mBeanServer.getAttribute + (objectName, "expiredSessions")); + writer.print(" Processing time: "); + writer.print(formatTime(mBeanServer.getAttribute + (objectName, "processingTime"), false)); + } else if (mode == 1) { + // for now we don't write out the wrapper details + } + + } + + + /** * Write detailed information about a wrapper. */ public static void writeWrapper(PrintWriter writer, ObjectName objectName, MBeanServer mBeanServer, int mode) throws Exception { - if (mode == 0){ + if (mode == 0) { String servletName = objectName.getKeyProperty("name"); String[] mappings = (String[])
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]