geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r331043 - in /geronimo/trunk/applications/console-standard/src: java/org/apache/geronimo/console/infomanager/ webapp/WEB-INF/view/infomanager/
Date Sat, 05 Nov 2005 22:47:32 GMT
Author: ammulder
Date: Sat Nov  5 14:47:29 2005
New Revision: 331043

URL: http://svn.apache.org/viewcvs?rev=331043&view=rev
Log:
Show (nearly) all System properties in the console (GERONIMO-950)

Added:
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/infomanager/ShrinkingMap.java
  (with props)
Modified:
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/infomanager/JavaSystemInfoPortlet.java
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/infomanager/javaSysNormal.jsp

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/infomanager/JavaSystemInfoPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/infomanager/JavaSystemInfoPortlet.java?rev=331043&r1=331042&r2=331043&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/infomanager/JavaSystemInfoPortlet.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/infomanager/JavaSystemInfoPortlet.java
Sat Nov  5 14:47:29 2005
@@ -21,7 +21,8 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.StringTokenizer;
-import java.util.Properties;
+import java.util.Map;
+import java.util.TreeMap;
 
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
@@ -59,24 +60,48 @@
             return;
         }
 
-        Properties javaSysProps = PortletManager.getCurrentJVM(renderRequest).getSystemProperties();
+        ShrinkingMap javaSysProps = new ShrinkingMap(PortletManager.getCurrentJVM(renderRequest).getSystemProperties());
 
         renderRequest.setAttribute("javaSysProps", javaSysProps);
 
         String sep = (String) javaSysProps.get("path.separator");
 
-        String cp = (String) javaSysProps.get("sun.boot.class.path");
-        if (cp != null) {
-            renderRequest.setAttribute("bootClassPathList", split(cp, sep));
-        }
-        cp = (String) javaSysProps.get("java.library.path");
-        if (cp != null) {
-            renderRequest.setAttribute("javaLibraryPath", split(cp, sep));
-        }
-        cp = (String) javaSysProps.get("java.class.path");
-        if (cp != null) {
-            renderRequest.setAttribute("javaClassPath", split(cp, sep));
+        String test = (String) javaSysProps.get("sun.boot.class.path");
+        if (test != null) {
+            javaSysProps.put("sun.boot.class.path", split(test, sep));
         }
+        test = (String) javaSysProps.get("sun.boot.library.path");
+        if (test != null) {
+            javaSysProps.put("sun.boot.library.path", split(test, sep));
+        }
+        test = (String) javaSysProps.get("java.library.path");
+        if (test != null) {
+            javaSysProps.put("java.library.path", split(test, sep));
+        }
+        test = (String) javaSysProps.get("java.class.path");
+        if (test != null) {
+            javaSysProps.put("java.class.path", split(test, sep));
+        }
+        test = (String) javaSysProps.get("java.endorsed.dirs");
+        if (test != null) {
+            javaSysProps.put("java.endorsed.dirs", split(test, sep));
+        }
+        test = (String) javaSysProps.get("java.ext.dirs");
+        if (test != null) {
+            javaSysProps.put("java.ext.dirs", split(test, sep));
+        }
+        test = (String) javaSysProps.get("common.loader");
+        if (test != null) {
+            javaSysProps.put("common.loader", test.replace(',',' '));
+        }
+
+        // Remove a few properties for security reasons
+        javaSysProps.remove("javax.net.ssl.keyStore");
+        javaSysProps.remove("javax.net.ssl.keyStorePassword");
+        javaSysProps.remove("javax.net.ssl.trustStore");
+        javaSysProps.remove("javax.net.ssl.trustStorePassword");
+
+        javaSysProps.setShrinking(true);
 
         if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
             normalView.include(renderRequest, renderResponse);

Added: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/infomanager/ShrinkingMap.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/infomanager/ShrinkingMap.java?rev=331043&view=auto
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/infomanager/ShrinkingMap.java
(added)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/infomanager/ShrinkingMap.java
Sat Nov  5 14:47:29 2005
@@ -0,0 +1,58 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed 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.console.infomanager;
+
+import java.util.TreeMap;
+import java.util.Map;
+
+/**
+ * A Map that can remove items as they are accessed, which makes it
+ * easier to show a list of the remaining items.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ShrinkingMap extends TreeMap {
+    private boolean shrinking = false;
+
+    public ShrinkingMap() {
+    }
+
+    public ShrinkingMap(Map defaults) {
+        super(defaults);
+    }
+
+    public boolean isShrinking() {
+        return shrinking;
+    }
+
+    public void setShrinking(boolean shrinking) {
+        this.shrinking = shrinking;
+    }
+
+    public synchronized Object get(Object key) {
+        if(shrinking) {
+            return super.remove(key);
+        } else {
+            return super.get(key);
+        }
+    }
+
+    public Map getRemainingItems() {
+        shrinking = false;
+        return this;
+    }
+}

Propchange: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/infomanager/ShrinkingMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/infomanager/javaSysNormal.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/infomanager/javaSysNormal.jsp?rev=331043&r1=331042&r2=331043&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/infomanager/javaSysNormal.jsp
(original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/infomanager/javaSysNormal.jsp
Sat Nov  5 14:47:29 2005
@@ -18,7 +18,7 @@
     <td class="LightBackground">java.class.path</td>
     <td class="LightBackground">
         <table>
-        <c:forEach var="el" items="${javaClassPath}">
+        <c:forEach var="el" items="${javaSysProps['java.class.path']}">
             <tr><td class="LightBackground">${el}</td></tr>
         </c:forEach>
         </table>
@@ -30,11 +30,23 @@
   </tr>
   <tr>
     <td class="LightBackground">java.endorsed.dirs</td>
-    <td class="LightBackground">${javaSysProps['java.endorsed.dirs']}</td>
+    <td class="LightBackground">
+        <table>
+        <c:forEach var="el" items="${javaSysProps['java.endorsed.dirs']}">
+            <tr><td class="LightBackground">${el}</td></tr>
+        </c:forEach>
+        </table>
+    </td>
   </tr>
   <tr>
     <td class="MediumBackground">java.ext.dirs</td>
-    <td class="MediumBackground">${javaSysProps['java.ext.dirs']}</td>
+    <td class="MediumBackground">
+        <table>
+        <c:forEach var="el" items="${javaSysProps['java.ext.dirs']}">
+            <tr><td class="MediumBackground">${el}</td></tr>
+        </c:forEach>
+        </table>
+    </td>
   </tr>
   <tr>
     <td class="LightBackground">java.home</td>
@@ -48,7 +60,7 @@
     <td class="LightBackground">java.library.path</td>
     <td class="LightBackground">
         <table>
-        <c:forEach var="el" items="${javaLibraryPath}">
+        <c:forEach var="el" items="${javaSysProps['java.library.path']}">
             <tr><td class="LightBackground">${el}</td></tr>
         </c:forEach>
         </table>
@@ -159,10 +171,10 @@
   <tr>
     <td class="MediumBackground">sun.boot.class.path</td>
 
-    <td class="MediumBackground"><!-- ${javaSysProps['sun.boot.class.path']} -->
+    <td class="MediumBackground">
 
         <table>
-        <c:forEach var="el" items="${bootClassPathList}">
+        <c:forEach var="el" items="${javaSysProps['sun.boot.class.path']}">
             <tr><td class="MediumBackground">${el}</td></tr>
         </c:forEach>
         </table>
@@ -171,7 +183,14 @@
   </tr>
   <tr>
     <td class="LightBackground">sun.boot.library.path</td>
-    <td class="LightBackground">${javaSysProps['sun.boot.library.path']}</td>
+    <td class="LightBackground">
+        <table>
+        <c:forEach var="el" items="${javaSysProps['sun.boot.library.path']}">
+            <tr><td class="LightBackground">${el}</td></tr>
+        </c:forEach>
+        </table>
+
+    </td>
   </tr>
   <tr>
     <td class="MediumBackground">sun.cpu.endian</td>
@@ -233,28 +252,16 @@
   <tr>
     <td class="DarkBackground" width="100%" colspan="2" align="center">Etc</td>
   </tr>
-  <tr>
-    <td class="LightBackground" width="20%" nowrap>path.separator</td>
-    <td class="LightBackground" width="80%">${javaSysProps['path.separator']}</td>
-  </tr>
-  <tr>
-    <td class="MediumBackground">line.separator</td>
-    <td class="MediumBackground">${javaSysProps['line.separator']}</td>
-  </tr>
-  <tr>
-    <td class="LightBackground">awt.toolkit</td>
-    <td class="LightBackground">${javaSysProps['awt.toolkit']}</td>
+<% String background = "LightBackground"; %>
+<%  // Crappy workaround because apparently Jetty's JSTL can't call getters on a Map subclass?!?
+    // Why doesn't ${javaSysProps.remainingItems} return the results of getRemainingItems()?
+    java.util.Map map = ((org.apache.geronimo.console.infomanager.ShrinkingMap)request.getAttribute("javaSysProps")).getRemainingItems();
+    request.setAttribute("results", map); %>
+<c:forEach var="entry" items="${results}">
+  <tr>
+    <td class="<%=background%>">${entry.key}</td>
+    <td class="<%=background%>">${entry.value}</td>
+    <% background = background.equals("MediumBackground") ? "LightBackground" : "MediumBackground";
%>
   </tr>
-  <tr>
-    <td class="MediumBackground">file.encoding</td>
-    <td class="MediumBackground">${javaSysProps['file.encoding']}</td>
-  </tr>
-  <tr>
-    <td class="LightBackground">file.encoding.pkg</td>
-    <td class="LightBackground">${javaSysProps['file.encoding.pkg']}</td>
-  </tr>
-  <tr>
-    <td class="MediumBackground">file.separator</td>
-    <td class="MediumBackground">${javaSysProps['file.separator']}</td>
-  </tr>
-</table>
\ No newline at end of file
+</c:forEach>
+</table>



Mime
View raw message