From 43e1b76083c945f04d4eeb827d0b9d9cf7f15263 Mon Sep 17 00:00:00 2001 From: Alex Rudyy Date: Fri, 17 May 2013 15:26:04 +0000 Subject: 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 --- .../server/management/plugin/HttpManagement.java | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'qpid/java/broker-plugins/management-http') 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 attributes) + { + Map convertedAttributes = MapValueConverter.convert(attributes, ATTRIBUTE_TYPES); + validateAttributes(convertedAttributes); + + super.changeAttributes(convertedAttributes); + } + + private void validateAttributes(Map 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"); + } + } + } + } -- cgit v1.2.1