qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1588586 [3/3] - in /qpid/trunk/qpid/java: broker-core/src/main/java/org/apache/qpid/server/binding/ broker-core/src/main/java/org/apache/qpid/server/exchange/ broker-core/src/main/java/org/apache/qpid/server/model/ broker-core/src/main/jav...
Date Fri, 18 Apr 2014 22:38:05 GMT
Modified: qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementFactory.java?rev=1588586&r1=1588585&r2=1588586&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementFactory.java
(original)
+++ qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementFactory.java
Fri Apr 18 22:38:03 2014
@@ -18,14 +18,13 @@
  */
 package org.apache.qpid.server.management.plugin;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.qpid.server.model.AbstractConfiguredObjectTypeFactory;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.ConfiguredObject;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
 public class HttpManagementFactory extends AbstractConfiguredObjectTypeFactory<HttpManagement>
 {
 
@@ -38,9 +37,7 @@ public class HttpManagementFactory exten
     public HttpManagement createInstance(final Map<String, Object> attributes, final
ConfiguredObject<?>... parents)
     {
         Map<String,Object> attributesWithoutId = new HashMap<String, Object>(attributes);
-        Object idObj = attributesWithoutId.remove(ConfiguredObject.ID);
-        UUID id = idObj == null ? UUID.randomUUID() : idObj instanceof UUID ? (UUID) idObj
: UUID.fromString(idObj.toString());
-        return new HttpManagement(id, getParent(Broker.class,parents), attributes);
+        return new HttpManagement(attributes, getParent(Broker.class,parents));
     }
 
 }

Modified: qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java?rev=1588586&r1=1588585&r2=1588586&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java
(original)
+++ qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java
Fri Apr 18 22:38:03 2014
@@ -31,6 +31,7 @@ import java.util.UUID;
 
 import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.test.utils.QpidTestCase;
 
 public class HttpManagementTest extends QpidTestCase
@@ -52,7 +53,8 @@ public class HttpManagementTest extends 
         attributes.put(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED, true);
         attributes.put(HttpManagement.NAME, getTestName());
         attributes.put(HttpManagement.TIME_OUT, 10000l);
-        _management = new HttpManagement(_id, _broker, attributes);
+        attributes.put(ConfiguredObject.ID, _id);
+        _management = new HttpManagement(attributes, _broker);
         _management.open();
     }
 

Modified: qpid/trunk/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementFactory.java?rev=1588586&r1=1588585&r2=1588586&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementFactory.java
(original)
+++ qpid/trunk/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementFactory.java
Fri Apr 18 22:38:03 2014
@@ -18,9 +18,7 @@
  */
 package org.apache.qpid.server.jmx;
 
-import java.util.HashMap;
 import java.util.Map;
-import java.util.UUID;
 
 import org.apache.qpid.server.model.AbstractConfiguredObjectTypeFactory;
 import org.apache.qpid.server.model.Broker;
@@ -36,9 +34,6 @@ public class JMXManagementFactory extend
     @Override
     public JMXManagementPluginImpl createInstance(final Map<String, Object> attributes,
final ConfiguredObject<?>... parents)
     {
-        Map<String,Object> attributesWithoutId = new HashMap<String, Object>(attributes);
-        Object idObj = attributesWithoutId.remove(ConfiguredObject.ID);
-        UUID id = idObj == null ? UUID.randomUUID() : idObj instanceof UUID ? (UUID) idObj
: UUID.fromString(idObj.toString());
-        return new JMXManagementPluginImpl(id, getParent(Broker.class,parents),attributes);
+        return new JMXManagementPluginImpl(attributes,getParent(Broker.class,parents));
     }
 }

Modified: qpid/trunk/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java?rev=1588586&r1=1588585&r2=1588586&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java
(original)
+++ qpid/trunk/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java
Fri Apr 18 22:38:03 2014
@@ -26,7 +26,7 @@ import java.lang.reflect.Type;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.UUID;
+import java.util.Set;
 
 import javax.management.JMException;
 
@@ -51,7 +51,6 @@ import org.apache.qpid.server.model.Stat
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.model.adapter.AbstractPluginAdapter;
 import org.apache.qpid.server.plugin.QpidServiceLoader;
-import org.apache.qpid.server.util.MapValueConverter;
 import org.apache.qpid.server.util.ServerScopedRuntimeException;
 
 public class JMXManagementPluginImpl
@@ -80,9 +79,9 @@ public class JMXManagementPluginImpl
     @ManagedAttributeField
     private boolean _usePlatformMBeanServer;
 
-    public JMXManagementPluginImpl(UUID id, Broker broker, Map<String, Object> attributes)
+    public JMXManagementPluginImpl(Map<String, Object> attributes, Broker broker)
     {
-        super(id, attributes, broker);
+        super(attributes, broker);
     }
 
     @Override
@@ -313,19 +312,12 @@ public class JMXManagementPluginImpl
     }
 
     @Override
-    protected void changeAttributes(Map<String, Object> attributes)
+    protected void validateChange(final ConfiguredObject<?> proxyForValidation, final
Set<String> changedAttributes)
     {
-        Map<String, Object> convertedAttributes = MapValueConverter.convert(attributes,
ATTRIBUTE_TYPES);
-        validateAttributes(convertedAttributes);
-
-        super.changeAttributes(convertedAttributes);
-    }
-
-    private void validateAttributes(Map<String, Object> convertedAttributes)
-    {
-        if(convertedAttributes.containsKey(JMXManagementPluginImpl.NAME))
+        super.validateChange(proxyForValidation, changedAttributes);
+        if(changedAttributes.contains(NAME))
         {
-            String newName = (String) convertedAttributes.get(JMXManagementPluginImpl.NAME);
+            String newName = proxyForValidation.getName();
             if(!getName().equals(newName))
             {
                 throw new IllegalConfigurationException("Changing the name of jmx management
plugin is not allowed");



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message