private void validateAttributes(Map<String, Object> convertedAttributes)
{
if (convertedAttributes.containsKey(MODEL_VERSION) && !Model.MODEL_VERSION.equals(convertedAttributes.get(MODEL_VERSION)))
{
throw new IllegalConfigurationException("Cannot change the model version");
}
if (convertedAttributes.containsKey(STORE_VERSION)
&& !new Integer(_brokerStore.getVersion()).equals(convertedAttributes.get(STORE_VERSION)))
{
throw new IllegalConfigurationException("Cannot change the store version");
}
String defaultVirtualHost = (String) convertedAttributes.get(DEFAULT_VIRTUAL_HOST);
if (defaultVirtualHost != null)
{
VirtualHost foundHost = findVirtualHostByName(defaultVirtualHost);
if (foundHost == null)
{
throw new IllegalConfigurationException("Virtual host with name " + defaultVirtualHost
+ " cannot be set as a default as it does not exist");
}
}
Long queueFlowControlSize = (Long) convertedAttributes.get(QUEUE_FLOW_CONTROL_SIZE_BYTES);
Long queueFlowControlResumeSize = (Long) convertedAttributes.get(QUEUE_FLOW_CONTROL_RESUME_SIZE_BYTES);
if (queueFlowControlSize != null || queueFlowControlResumeSize != null )
{
if (queueFlowControlSize == null)
{
queueFlowControlSize = (Long)getAttribute(QUEUE_FLOW_CONTROL_SIZE_BYTES);
}
if (queueFlowControlResumeSize == null)
{
queueFlowControlResumeSize = (Long)getAttribute(QUEUE_FLOW_CONTROL_RESUME_SIZE_BYTES);
}
if (queueFlowControlResumeSize > queueFlowControlSize)
{
throw new IllegalConfigurationException("Flow resume size can't be greater than flow control size");
}
}
for (String attributeName : POSITIVE_NUMERIC_ATTRIBUTES)
{
Number value = (Number) convertedAttributes.get(attributeName);
if (value != null && value.longValue() < 0)
{
throw new IllegalConfigurationException("Only positive integer value can be specified for the attribute "
+ attributeName);
}
}
}