{
String match = getAttributeValue(node, "match");
NodeList children = node.getChildNodes();
AddressSettings addressSettings = new AddressSettings();
Pair<String, AddressSettings> setting = new Pair<String, AddressSettings>(match, addressSettings);
for (int i = 0; i < children.getLength(); i++)
{
final Node child = children.item(i);
final String name = child.getNodeName();
if (DEAD_LETTER_ADDRESS_NODE_NAME.equalsIgnoreCase(name))
{
SimpleString queueName = new SimpleString(getTrimmedTextContent(child));
addressSettings.setDeadLetterAddress(queueName);
}
else if (EXPIRY_ADDRESS_NODE_NAME.equalsIgnoreCase(name))
{
SimpleString queueName = new SimpleString(getTrimmedTextContent(child));
addressSettings.setExpiryAddress(queueName);
}
else if (EXPIRY_DELAY_NODE_NAME.equalsIgnoreCase(name))
{
addressSettings.setExpiryDelay(XMLUtil.parseLong(child));
}
else if (REDELIVERY_DELAY_NODE_NAME.equalsIgnoreCase(name))
{
addressSettings.setRedeliveryDelay(XMLUtil.parseLong(child));
}
else if (REDELIVERY_DELAY_MULTIPLIER_NODE_NAME.equalsIgnoreCase(name))
{
addressSettings.setRedeliveryMultiplier(XMLUtil.parseDouble(child));
}
else if (MAX_REDELIVERY_DELAY_NODE_NAME.equalsIgnoreCase(name))
{
addressSettings.setMaxRedeliveryDelay(XMLUtil.parseLong(child));
}
else if (MAX_SIZE_BYTES_NODE_NAME.equalsIgnoreCase(name))
{
addressSettings.setMaxSizeBytes(XMLUtil.parseLong(child));
}
else if (PAGE_SIZE_BYTES_NODE_NAME.equalsIgnoreCase(name))
{
addressSettings.setPageSizeBytes(XMLUtil.parseLong(child));
}
else if (PAGE_MAX_CACHE_SIZE_NODE_NAME.equalsIgnoreCase(name))
{
addressSettings.setPageCacheMaxSize(XMLUtil.parseInt(child));
}
else if (MESSAGE_COUNTER_HISTORY_DAY_LIMIT_NODE_NAME.equalsIgnoreCase(name))
{
addressSettings.setMessageCounterHistoryDayLimit(XMLUtil.parseInt(child));
}
else if (ADDRESS_FULL_MESSAGE_POLICY_NODE_NAME.equalsIgnoreCase(name))
{
String value = getTrimmedTextContent(child);
Validators.ADDRESS_FULL_MESSAGE_POLICY_TYPE.validate(ADDRESS_FULL_MESSAGE_POLICY_NODE_NAME,
value);
AddressFullMessagePolicy policy = Enum.valueOf(AddressFullMessagePolicy.class, value);
addressSettings.setAddressFullMessagePolicy(policy);
}
else if (LVQ_NODE_NAME.equalsIgnoreCase(name))
{
addressSettings.setLastValueQueue(XMLUtil.parseBoolean(child));
}
else if (MAX_DELIVERY_ATTEMPTS.equalsIgnoreCase(name))
{
addressSettings.setMaxDeliveryAttempts(XMLUtil.parseInt(child));
}
else if (REDISTRIBUTION_DELAY_NODE_NAME.equalsIgnoreCase(name))
{
addressSettings.setRedistributionDelay(XMLUtil.parseLong(child));
}
else if (SEND_TO_DLA_ON_NO_ROUTE.equalsIgnoreCase(name))
{
addressSettings.setSendToDLAOnNoRoute(XMLUtil.parseBoolean(child));
}
}
return setting;
}