summaryrefslogtreecommitdiff
path: root/qpid/java/broker-plugins
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2013-05-17 15:26:04 +0000
committerAlex Rudyy <orudyy@apache.org>2013-05-17 15:26:04 +0000
commit43e1b76083c945f04d4eeb827d0b9d9cf7f15263 (patch)
tree42d73112710946a52e3b2cec55a9f6a940330df4 /qpid/java/broker-plugins
parent47db83c40fd9730f050a78aa9bf904ba88b83c09 (diff)
downloadqpid-python-43e1b76083c945f04d4eeb827d0b9d9cf7f15263.tar.gz
QPID-4863: Validate plugin attribute changes and throw UnsupportedOperationException where attribute changes are not supported
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1483861 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins')
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java29
-rw-r--r--qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java21
2 files changed, 50 insertions, 0 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
index 43328c16bf..d41b505d23 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
@@ -436,4 +436,33 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem
return getBroker().getSubjectCreator(localAddress);
}
+ @Override
+ protected void changeAttributes(Map<String, Object> attributes)
+ {
+ Map<String, Object> convertedAttributes = MapValueConverter.convert(attributes, ATTRIBUTE_TYPES);
+ validateAttributes(convertedAttributes);
+
+ super.changeAttributes(convertedAttributes);
+ }
+
+ private void validateAttributes(Map<String, Object> convertedAttributes)
+ {
+ if(convertedAttributes.containsKey(HttpManagement.NAME))
+ {
+ String newName = (String) convertedAttributes.get(HttpManagement.NAME);
+ if(!getName().equals(newName))
+ {
+ throw new IllegalConfigurationException("Changing the name of http management plugin is not allowed");
+ }
+ }
+ if (convertedAttributes.containsKey(TIME_OUT))
+ {
+ Number value = (Number) convertedAttributes.get(TIME_OUT);
+ if (value == null || value.longValue() < 0)
+ {
+ throw new IllegalConfigurationException("Only positive integer value can be specified for the session time out attribute");
+ }
+ }
+ }
+
}
diff --git a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java
index cebfb8d9d9..f58ec2bfbd 100644
--- a/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java
+++ b/qpid/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagement.java
@@ -33,6 +33,7 @@ import java.util.UUID;
import javax.management.JMException;
import org.apache.log4j.Logger;
+import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.jmx.mbeans.LoggingManagementMBean;
import org.apache.qpid.server.jmx.mbeans.UserManagementMBean;
import org.apache.qpid.server.jmx.mbeans.ServerInformationMBean;
@@ -362,4 +363,24 @@ public class JMXManagement extends AbstractPluginAdapter implements Configuratio
return AVAILABLE_ATTRIBUTES;
}
+ @Override
+ protected void changeAttributes(Map<String, Object> attributes)
+ {
+ Map<String, Object> convertedAttributes = MapValueConverter.convert(attributes, ATTRIBUTE_TYPES);
+ validateAttributes(convertedAttributes);
+
+ super.changeAttributes(convertedAttributes);
+ }
+
+ private void validateAttributes(Map<String, Object> convertedAttributes)
+ {
+ if(convertedAttributes.containsKey(JMXManagement.NAME))
+ {
+ String newName = (String) convertedAttributes.get(JMXManagement.NAME);
+ if(!getName().equals(newName))
+ {
+ throw new IllegalConfigurationException("Changing the name of jmx management plugin is not allowed");
+ }
+ }
+ }
}