/** * Creates the operation to add a resource. * * @param address the address of the operation to add. * @param properties the properties to set for the resource. * @return the operation. */ private ModelNode buildAddOperation( final ModelNode address, final Map<String, String> properties) { final ModelNode op = ServerOperations.createAddOperation(address); for (Map.Entry<String, String> prop : properties.entrySet()) { final String[] props = prop.getKey().split(","); if (props.length == 0) { throw new RuntimeException("Invalid property " + prop); } ModelNode node = op; for (int i = 0; i < props.length - 1; ++i) { node = node.get(props[i]); } final String value = prop.getValue() == null ? "" : prop.getValue(); if (value.startsWith("!!")) { handleDmrString(node, props[props.length - 1], value); } else { node.get(props[props.length - 1]).set(value); } } return op; }