summaryrefslogtreecommitdiff
path: root/qpid/java/broker-plugins/management-jmx
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2014-04-18 22:38:03 +0000
committerRobert Godfrey <rgodfrey@apache.org>2014-04-18 22:38:03 +0000
commit2c60d3390a322642b1dcd64f59612dc6ae1bb760 (patch)
treeced06903f8f7b138929ee97010905298251ab289 /qpid/java/broker-plugins/management-jmx
parent178745059c1265f8cae71f8b19caf448b580afb0 (diff)
downloadqpid-python-2c60d3390a322642b1dcd64f59612dc6ae1bb760.tar.gz
QPID-5578 : [Java Broker] Tidy up - minimize use of MapValueConverter, make constructors consistent across ConfiguredObjects
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1588586 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/management-jmx')
-rw-r--r--qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementFactory.java7
-rw-r--r--qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java22
2 files changed, 8 insertions, 21 deletions
diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementFactory.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementFactory.java
index 0d8b36cdd9..335e4fe50f 100644
--- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementFactory.java
+++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementFactory.java
@@ -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 extends AbstractConfiguredObjectTypeFactory<JM
@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));
}
}
diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java
index 3a04ca46fb..9ece703973 100644
--- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java
+++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagementPluginImpl.java
@@ -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.State;
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");