private static boolean removeResource(ModelControllerClient client, String type, String name) throws IOException, MgmtOperationException { ModelNode op = ModelUtil.createOpNode( "subsystem=configadmin/" + type + "=" + name, ModelDescriptionConstants.REMOVE); ModelNode result = executeOperation(client, op, false); return ModelDescriptionConstants.SUCCESS.equals( result.get(ModelDescriptionConstants.OUTCOME).asString()); }
private static boolean addOrUpdateConfiguration( ModelControllerClient client, String pid, Map<String, String> entries, String operation) throws IOException, MgmtOperationException { ModelNode op = ModelUtil.createOpNode("subsystem=configadmin/configuration=" + pid, operation); ModelNode en = new ModelNode(); for (Map.Entry<String, String> entry : entries.entrySet()) { en.get(entry.getKey()).set(entry.getValue()); } op.get("entries").set(en); ModelNode result = executeOperation(client, op, false); return ModelDescriptionConstants.SUCCESS.equals( result.get(ModelDescriptionConstants.OUTCOME).asString()); }