});
}
private void loadSecurityConfig() {
ModelNode operation = new ModelNode();
operation.get(ADDRESS).set(Baseadress.get());
operation.get(ADDRESS).add("subsystem", "messaging");
operation.get(ADDRESS).add("hornetq-server", getCurrentServer());
operation.get(OP).set(READ_CHILDREN_RESOURCES_OPERATION);
operation.get(CHILD_TYPE).set("security-setting");
operation.get(RECURSIVE).set(true);
final EntityAdapter<SecurityPattern> adapter =
new EntityAdapter<SecurityPattern>(
SecurityPattern.class, metaData
);
dispatcher.execute(new DMRAction(operation), new SimpleCallback<DMRResponse>() {
@Override
public void onSuccess(DMRResponse result) {
ModelNode response = result.get();
List<Property> patterns = response.get(RESULT).asPropertyList();
List<SecurityPattern> payload = new LinkedList<SecurityPattern>();
for(Property pattern : patterns)
{
String patternName = pattern.getName();
ModelNode patternValue = pattern.getValue().asObject();
if(patternValue.hasDefined("role"))
{
List<Property> roles = patternValue.get("role").asPropertyList();
for(Property role : roles)
{
String roleName = role.getName();
ModelNode roleValue = role.getValue().asObject();
SecurityPattern securityPattern = adapter.fromDMR(roleValue);
securityPattern.setPattern(patternName);
securityPattern.setRole(roleName);
payload.add(securityPattern);