cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1356063 - in /cxf/trunk: api/src/main/java/org/apache/cxf/endpoint/ api/src/main/java/org/apache/cxf/management/ rt/core/src/main/java/org/apache/cxf/bus/ rt/core/src/main/java/org/apache/cxf/bus/managers/ rt/management/src/test/java/org/a...
Date Mon, 02 Jul 2012 03:38:15 GMT
Author: ningjiang
Date: Mon Jul  2 03:38:14 2012
New Revision: 1356063

URL: http://svn.apache.org/viewvc?rev=1356063&view=rev
Log:
CXF-4399 Added instance.id to the ObjectName

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
    cxf/trunk/api/src/main/java/org/apache/cxf/management/ManagementConstants.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/managers/WorkQueueImplMBeanWrapper.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/managers/WorkQueueManagerImplMBeanWrapper.java
    cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/jmx/BusRegistrationTest.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMUtils.java
    cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java?rev=1356063&r1=1356062&r2=1356063&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java Mon Jul  2 03:38:14
2012
@@ -107,7 +107,9 @@ public class ManagedEndpoint implements 
             endpointName = endpoint.getEndpointInfo().getName().getLocalPart();
         }
         endpointName = ObjectName.quote(endpointName);
-        buffer.append(ManagementConstants.PORT_NAME_PROP + "=" + endpointName);
+        buffer.append(ManagementConstants.PORT_NAME_PROP + "=" + endpointName + ",");
+        // Added the instance id to make the ObjectName unique
+        buffer.append(ManagementConstants.INSTANCE_ID_PROP + "=" + endpoint.hashCode());
         
         //Use default domain name of server
         return new ObjectName(buffer.toString());

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/management/ManagementConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/management/ManagementConstants.java?rev=1356063&r1=1356062&r2=1356063&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/management/ManagementConstants.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/management/ManagementConstants.java Mon Jul
 2 03:38:14 2012
@@ -29,6 +29,7 @@ public final class ManagementConstants {
     public static final String SERVICE_NAME_PROP = "service";
     public static final String OPERATION_NAME_PROP = "operation";
     public static final String PORT_NAME_PROP = "port";
+    public static final String INSTANCE_ID_PROP = "instance.id";
     
     private ManagementConstants() {
         

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java?rev=1356063&r1=1356062&r2=1356063&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/ManagedBus.java Mon Jul  2 03:38:14
2012
@@ -48,7 +48,9 @@ public class ManagedBus implements Manag
         String busId = bus.getId();
         StringBuilder buffer = new StringBuilder(ManagementConstants.DEFAULT_DOMAIN_NAME
+ ":");
         buffer.append(ManagementConstants.BUS_ID_PROP + "=" +  busId + ",");
-        buffer.append(ManagementConstants.TYPE_PROP + "="  + TYPE_VALUE);
+        buffer.append(ManagementConstants.TYPE_PROP + "="  + TYPE_VALUE + ",");
+        // Added the instance id to make the ObjectName unique
+        buffer.append(ManagementConstants.INSTANCE_ID_PROP + "=" + bus.hashCode());
         
 
         return new ObjectName(buffer.toString());

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/managers/WorkQueueImplMBeanWrapper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/managers/WorkQueueImplMBeanWrapper.java?rev=1356063&r1=1356062&r2=1356063&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/managers/WorkQueueImplMBeanWrapper.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/managers/WorkQueueImplMBeanWrapper.java
Mon Jul  2 03:38:14 2012
@@ -119,8 +119,9 @@ public class WorkQueueImplMBeanWrapper i
             //buffer.append(WorkQueueManagerImplMBeanWrapper.TYPE_VALUE + "=Shared,");
         }
         buffer.append(ManagementConstants.TYPE_PROP).append('=').append(TYPE_VALUE).append(',');
-        buffer.append(ManagementConstants.NAME_PROP).append('=').append(aWorkQueue.getName());
-
+        buffer.append(ManagementConstants.NAME_PROP).append('=').append(aWorkQueue.getName()).append(',');
+        // Added the instance id to make the ObjectName unique
+        buffer.append(ManagementConstants.INSTANCE_ID_PROP + "=" + aWorkQueue.hashCode());
         //Use default domain name of server
         return new ObjectName(buffer.toString());
     }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/managers/WorkQueueManagerImplMBeanWrapper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/managers/WorkQueueManagerImplMBeanWrapper.java?rev=1356063&r1=1356062&r2=1356063&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/managers/WorkQueueManagerImplMBeanWrapper.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/managers/WorkQueueManagerImplMBeanWrapper.java
Mon Jul  2 03:38:14 2012
@@ -55,8 +55,9 @@ public class WorkQueueManagerImplMBeanWr
         buffer.append(ManagementConstants.DEFAULT_DOMAIN_NAME).append(':');
         buffer.append(ManagementConstants.BUS_ID_PROP).append('=').append(bus.getId()).append(',');
         buffer.append("WorkQueueManager=").append(NAME_VALUE);
-        buffer.append(',').append(ManagementConstants.TYPE_PROP).append('=').append(TYPE_VALUE);
-
+        buffer.append(',').append(ManagementConstants.TYPE_PROP).append('=').append(TYPE_VALUE).append(',');
+        // Added the instance id to make the ObjectName unique
+        buffer.append(ManagementConstants.INSTANCE_ID_PROP + "=" + wqManager.hashCode());
         //Use default domain name of server
         return new ObjectName(buffer.toString());
     }

Modified: cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/jmx/BusRegistrationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/jmx/BusRegistrationTest.java?rev=1356063&r1=1356062&r2=1356063&view=diff
==============================================================================
--- cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/jmx/BusRegistrationTest.java
(original)
+++ cxf/trunk/rt/management/src/test/java/org/apache/cxf/management/jmx/BusRegistrationTest.java
Mon Jul  2 03:38:14 2012
@@ -128,14 +128,15 @@ public class BusRegistrationTest extends
         
     private static ObjectName getObjectName(Bus bus) throws JMException {
         String busId = bus.getId();
-        return getObjectName(busId);
+        return getObjectName(busId, bus);
     }
 
-    private static ObjectName getObjectName(String id) throws JMException {
+    private static ObjectName getObjectName(String id, Bus bus) throws JMException {
         StringBuilder buffer = new StringBuilder(ManagementConstants.DEFAULT_DOMAIN_NAME
+ ":");
         buffer.append(ManagementConstants.BUS_ID_PROP + "=" +  id + ",");
-        buffer.append(ManagementConstants.TYPE_PROP + "=Bus");
-        
+        buffer.append(ManagementConstants.TYPE_PROP + "=Bus,");
+        // Added the instance id to make the ObjectName unique
+        buffer.append(ManagementConstants.INSTANCE_ID_PROP + "=" + bus.hashCode());
         return new ObjectName(buffer.toString());
     }
 }

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMUtils.java?rev=1356063&r1=1356062&r2=1356063&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMUtils.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMUtils.java Mon Jul  2 03:38:14
2012
@@ -151,6 +151,8 @@ public final class RMUtils {
     public static ObjectName getManagedObjectName(RMManager manager) throws JMException {
         StringBuilder buffer = new StringBuilder();
         writeTypeProperty(buffer, manager.getBus(), "WSRM.Manager");
+        // Added the instance id to make the ObjectName unique
+        buffer.append("," + ManagementConstants.INSTANCE_ID_PROP + "=" + manager.hashCode());
         return new ObjectName(buffer.toString());
     }
     
@@ -181,6 +183,8 @@ public final class RMUtils {
         buffer.append(",");
         buffer.append(ManagementConstants.SERVICE_NAME_PROP + "=" + serviceName + ",");
         String endpointName = ObjectName.quote(ep.getEndpointInfo().getName().toString());
-        buffer.append(ManagementConstants.PORT_NAME_PROP + "=" + endpointName);
+        buffer.append(ManagementConstants.PORT_NAME_PROP + "=" + endpointName + ",");
+        // Added the instance id to make the ObjectName unique
+        buffer.append(ManagementConstants.INSTANCE_ID_PROP + "=" + ep.hashCode());
     }
 }

Modified: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java?rev=1356063&r1=1356062&r2=1356063&view=diff
==============================================================================
--- cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java
(original)
+++ cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java
Mon Jul  2 03:38:14 2012
@@ -20,6 +20,8 @@
 package org.apache.cxf.systest.ws.rm;
 
 import java.util.Date;
+import java.util.Iterator;
+import java.util.Set;
 import java.util.logging.Logger;
 
 import javax.management.MBeanServer;
@@ -35,6 +37,7 @@ import org.apache.cxf.frontend.ClientPro
 import org.apache.cxf.greeter_control.Greeter;
 import org.apache.cxf.greeter_control.GreeterService;
 import org.apache.cxf.management.InstrumentationManager;
+import org.apache.cxf.management.ManagementConstants;
 import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
 import org.apache.cxf.ws.rm.RMManager;
 import org.apache.cxf.ws.rm.RMUtils;
@@ -131,7 +134,6 @@ public class ManagedEndpointsTest extend
 
         org.apache.cxf.endpoint.Endpoint ep = ClientProxy.getClient(greeter).getEndpoint();
         String epId = RMUtils.getEndpointIdentifier(ep, clientBus);
-        
         greeter.greetMeOneWay("one"); // sent
 
         o = mbs.invoke(clientManagerName, "getEndpointIdentifiers", null, null);
@@ -141,7 +143,8 @@ public class ManagedEndpointsTest extend
         verifyArray("Expected endpoint identifier", o, new String[]{epId}, true);
         
         ObjectName clientEndpointName = RMUtils.getManagedObjectName(clientManager, ep);
-        ObjectName serverEndpointName = RMUtils.getManagedObjectName(serverManager, ep);
+        // we need to find out serverEndpointName by using the query name
+        ObjectName serverEndpointName = getEndpointName(mbs, serverManager);
         
         o = mbs.invoke(clientEndpointName, "getSourceSequenceIds", 
                        new Object[]{true}, new String[]{"boolean"});
@@ -373,4 +376,13 @@ public class ManagedEndpointsTest extend
         }
         return o;
     }
+    
+    private ObjectName getEndpointName(MBeanServer mbs, RMManager manager) throws Exception
{
+        ObjectName serviceEndpointQueryName =  new ObjectName(
+            ManagementConstants.DEFAULT_DOMAIN_NAME + ":" + ManagementConstants.BUS_ID_PROP

+            + "=" + manager.getBus().getId() + "," + ManagementConstants.TYPE_PROP + "=WSRM.Endpoint,*");
+        Set<?> s = mbs.queryNames(serviceEndpointQueryName, null);
+        Iterator<?> it = s.iterator();
+        return (ObjectName)it.next();
+    }    
 }



Mime
View raw message