// Add the metric to the dynamic-load-provider.
final ModelNode metric = new ModelNode();
List<Property> list = operation.asPropertyList();
Iterator<Property> it = list.iterator();
while (it.hasNext()) {
Property prop = it.next();
if (prop.getName().equals("property")) {
String properties = prop.getValue().asString();
ModelNode props = ModelNode.fromString(properties);
metric.get("property").set(props);
} else if (prop.getName().equals("class")) {
metric.get(prop.getName()).set(prop.getValue().asString());
}
}
if (!metric.get("class").isDefined()) {
throw new OperationFailedException(
new ModelNode().set(MESSAGES.classAttributeRequired("add-custom-metric")));