}
private MessagingProvider parseResponse(ModelNode response) {
ModelNode model = response.get("result").asObject();
MessagingProvider provider = factory.messagingProvider().as();
provider.setName("HornetQ"); // TODO: can this be retrieved incl. version?
provider.setPersistenceEnabled(model.get("persistence-enabled").asBoolean());
// security
List<SecurityPattern> secPatterns = new ArrayList<SecurityPattern>();
if(model.hasDefined("security-setting"))
{
List<Property> secProps = model.get("security-setting").asPropertyList();
for(Property prop : secProps)
{
SecurityPattern pattern = factory.messagingSecurity().as();
pattern.setPattern(prop.getName());
Property principalProp= prop.getValue().asProperty();
pattern.setPrincipal(principalProp.getName());
ModelNode propValue = principalProp.getValue().asObject();
pattern.setSend(propValue.get("send").asBoolean());
pattern.setConsume(propValue.get("consume").asBoolean());
pattern.setManage(propValue.get("manage").asBoolean());
pattern.setCreateDurableQueue(propValue.get("createDurableQueue").asBoolean());
pattern.setDeleteDurableQueue(propValue.get("deleteDurableQueue").asBoolean());
pattern.setCreateNonDurableQueue(propValue.get("createNonDurableQueue").asBoolean());
pattern.setDeleteNonDurableQueue(propValue.get("deleteNonDurableQueue").asBoolean());
secPatterns.add(pattern);
}
}
provider.setSecurityPatterns(secPatterns);
// addressing
List<AddressingPattern> addrPatterns = new ArrayList<AddressingPattern>();
if(model.hasDefined("address-setting"))
{
List<Property> addrProps = model.get("address-setting").asPropertyList();
for(Property prop : addrProps)
{
AddressingPattern pattern = factory.messagingAddress().as();
pattern.setPattern(prop.getName());
ModelNode propValue = prop.getValue().asObject();
pattern.setDeadLetterQueue(propValue.get("dead-letter-address").asString());
pattern.setExpiryQueue(propValue.get("expiry-address").asString());
pattern.setRedeliveryDelay(propValue.get("redelivery-delay").asInt());
addrPatterns.add(pattern);
}
}
provider.setAddressPatterns(addrPatterns);
// socket binding ref
if(model.hasDefined("connector"))
{
List<Property> connectorPropList = model.get("connector").asPropertyList();
for(Property connectorProp : connectorPropList)
{
if("netty".equals(connectorProp.getName()))
{
String socketBinding = connectorProp.getValue().asObject().get("socket-binding").asString();
provider.setConnectorBinding(socketBinding);
}
}
}
if(model.hasDefined("acceptor"))
{
List<Property> acceptorPropList = model.get("acceptor").asPropertyList();
for(Property acceptorProp : acceptorPropList)
{
if("netty".equals(acceptorProp.getName()))
{
String socketBinding = acceptorProp.getValue().asObject().get("socket-binding").asString();
provider.setAcceptorBinding(socketBinding);
}
}
}
return provider;