geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r806547 - in /geronimo/server/branches/2.1: framework/configs/rmi-naming/src/main/plan/ framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/ testsuite/security-testsuite/test-security/src/test/java/org/apache/gero...
Date Fri, 21 Aug 2009 13:36:27 GMT
Author: kevan
Date: Fri Aug 21 13:36:27 2009
New Revision: 806547

URL: http://svn.apache.org/viewvc?rev=806547&view=rev
Log:
GERONIMO-4809 Use platform mbean server, rather than creating a geronimo unique one. Basically
a port of 4559 to branches/2.1

Modified:
    geronimo/server/branches/2.1/framework/configs/rmi-naming/src/main/plan/plan.xml
    geronimo/server/branches/2.1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/RealMBeanServerReference.java
    geronimo/server/branches/2.1/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestJMXSecurity.java
    geronimo/server/branches/2.1/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurity.java

Modified: geronimo/server/branches/2.1/framework/configs/rmi-naming/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/framework/configs/rmi-naming/src/main/plan/plan.xml?rev=806547&r1=806546&r2=806547&view=diff
==============================================================================
--- geronimo/server/branches/2.1/framework/configs/rmi-naming/src/main/plan/plan.xml (original)
+++ geronimo/server/branches/2.1/framework/configs/rmi-naming/src/main/plan/plan.xml Fri Aug
21 13:36:27 2009
@@ -43,7 +43,10 @@
         <attribute name="nameInNamespace">ger:</attribute>
     </gbean>
 
-    <gbean name="MBeanServerReference" class="org.apache.geronimo.system.jmx.RealMBeanServerReference"/>
+    <gbean name="MBeanServerReference" class="org.apache.geronimo.system.jmx.RealMBeanServerReference">
+        <attribute name="usePlatformMBeanServer">true</attribute>
+    </gbean>
+
 
     <!-- MBean server service -->
     <gbean name="MBeanServerKernelBridge" class="org.apache.geronimo.system.jmx.MBeanServerKernelBridge">

Modified: geronimo/server/branches/2.1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/RealMBeanServerReference.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/RealMBeanServerReference.java?rev=806547&r1=806546&r2=806547&view=diff
==============================================================================
--- geronimo/server/branches/2.1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/RealMBeanServerReference.java
(original)
+++ geronimo/server/branches/2.1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/RealMBeanServerReference.java
Fri Aug 21 13:36:27 2009
@@ -16,7 +16,9 @@
  */
 package org.apache.geronimo.system.jmx;
 
+import java.lang.management.ManagementFactory;
 import java.util.ArrayList;
+
 import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
 
@@ -25,24 +27,30 @@
 
 /**
  * Creates a real mbean server of finds an existing one with the specified mbeanServerId
+ *
  * @version $Rev$ $Date$
  */
 public class RealMBeanServerReference implements MBeanServerReference {
     private static final String GERONIMO_DEFAULT_DOMAIN = "geronimo";
-    
+
     private MBeanServer mbeanServer;
 
-    public RealMBeanServerReference(String mbeanServerId) throws MBeanServerNotFound {
-        ArrayList servers = MBeanServerFactory.findMBeanServer(mbeanServerId);
-        if (servers.size() == 0) {
-            mbeanServer = MBeanServerFactory.createMBeanServer(GERONIMO_DEFAULT_DOMAIN);
-        } else if (servers.size() > 1) {
-            throw new MBeanServerNotFound(servers.size() + " MBeanServers were found with
the agent id " + mbeanServerId);
+    public RealMBeanServerReference(boolean usePlatformMBeanServer,
+                                    String mbeanServerId) throws MBeanServerNotFound {
+        if (usePlatformMBeanServer) {
+            mbeanServer = ManagementFactory.getPlatformMBeanServer();
         } else {
-            mbeanServer = (MBeanServer) servers.get(0);
+            ArrayList servers = MBeanServerFactory.findMBeanServer(mbeanServerId);
+            if (servers.size() == 0) {
+                mbeanServer = MBeanServerFactory.createMBeanServer(GERONIMO_DEFAULT_DOMAIN);
+            } else if (servers.size() > 1) {
+                throw new MBeanServerNotFound(servers.size() + " MBeanServers were found
with the agent id " + mbeanServerId);
+            } else {
+                mbeanServer = (MBeanServer) servers.get(0);
+            }
         }
     }
-    
+
     /**
      * Finds an existing MBeanServer with default domain GERONIMO_DEFAULT_DOMAIN
      * or creates a new one if there isn't any.
@@ -50,14 +58,14 @@
     public RealMBeanServerReference() {
         // Find all MBeanServers
         ArrayList<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null);
-        for(MBeanServer server: servers) {
+        for (MBeanServer server : servers) {
             // Look for one with default domain GERONIMO_DEFAULT_DOMAIN
             if (GERONIMO_DEFAULT_DOMAIN.equals(server.getDefaultDomain())) {
                 mbeanServer = server;
                 break;
             }
         }
-        if(mbeanServer == null) {
+        if (mbeanServer == null) {
             // No MBeanServer with default domain GERONIMO_DEFAULT_DOMAIN exists. Create
one.
             mbeanServer = MBeanServerFactory.createMBeanServer(GERONIMO_DEFAULT_DOMAIN);
         }
@@ -66,13 +74,13 @@
     public MBeanServer getMBeanServer() {
         return mbeanServer;
     }
-
     public static final GBeanInfo GBEAN_INFO;
 
     static {
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(RealMBeanServerReference.class);
         infoFactory.addAttribute("mbeanServerId", String.class, true);
-        //infoFactory.setConstructor(new String[]{"mbeanServerId"});
+        infoFactory.addAttribute("usePlatformMBeanServer", boolean.class, true);
+        infoFactory.setConstructor(new String[]{"usePlatformMBeanServer", "mbeanServerId"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/server/branches/2.1/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestJMXSecurity.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestJMXSecurity.java?rev=806547&r1=806546&r2=806547&view=diff
==============================================================================
--- geronimo/server/branches/2.1/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestJMXSecurity.java
(original)
+++ geronimo/server/branches/2.1/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestJMXSecurity.java
Fri Aug 21 13:36:27 2009
@@ -40,7 +40,8 @@
         
         MBeanServerConnection conn = getConnection(environment);
         System.out.println(conn.getDefaultDomain());
-        assertEquals("geronimo", conn.getDefaultDomain());        
+//        assertEquals("geronimo", conn.getDefaultDomain());        
+        assertEquals("DefaultDomain", conn.getDefaultDomain());
     }
 
     @Test

Modified: geronimo/server/branches/2.1/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurity.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurity.java?rev=806547&r1=806546&r2=806547&view=diff
==============================================================================
--- geronimo/server/branches/2.1/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurity.java
(original)
+++ geronimo/server/branches/2.1/testsuite/security-testsuite/test-security/src/test/java/org/apache/geronimo/testsuite/security/TestMEJBSecurity.java
Fri Aug 21 13:36:27 2009
@@ -42,7 +42,8 @@
         
         Management mgmt = getMEJB(env);
         System.out.println(mgmt.getDefaultDomain());
-        assertEquals("geronimo", mgmt.getDefaultDomain());        
+//        assertEquals("geronimo", mgmt.getDefaultDomain());
+        assertEquals("DefaultDomain", mgmt.getDefaultDomain());        
     }
 
     @Test



Mime
View raw message