* @param config Configuration to return
* @param groupDefinition Definition of this group
* @throws Exception If anything goes wrong
*/
private void loadHandleGroup(Configuration config, PropertyGroupDefinition groupDefinition) throws Exception {
Operation operation = null;
String groupName = groupDefinition.getName();
if (groupName.startsWith("attribute:")) {
String attr = groupName.substring("attribute:".length());
operation = new ReadAttribute(address, attr);
} else if (groupName.startsWith("children:")) {
String type = groupName.substring("children:".length());
if (type.contains(":")) {
// If the third part ends with a ?, we fill this config prop with the resource name from the path
String tmp = type.substring(type.indexOf(":") + 1);
if (tmp.endsWith("+-")) {
nameFromPathProperty = tmp.substring(0, tmp.length() - 2);
}
// We need the type for reading
type = type.substring(0, type.indexOf(":"));
}
operation = new ReadChildrenResources(address, type);
operation.addAdditionalProperty("recursive", "true");
} else if (groupName.startsWith("child:")) {
String subPath = groupName.substring("child:".length());
if (!subPath.contains("="))
throw new IllegalArgumentException("subPath of 'child:' expression has no =");
if (subPath.contains(":")) {
subPath = subPath.substring(0,subPath.indexOf(':'));
}
boolean includeRuntime=false;
if (subPath.endsWith("*")) {
subPath = subPath.substring(0,subPath.length()-1);
includeRuntime=true;
}
Address address1 = new Address(address);
address1.addSegment(subPath);
operation = new ReadResource(address1);
if (includeRuntime)
((ReadResource)operation).includeRuntime(true);
} else {//no special handling of <c:groups> details required.
//Just assume normal group operations aggregation semantics, so retrieve entries and load.
Operation op = new ReadResource(address);
List<PropertyDefinition> listedDefs = configurationDefinition.getPropertiesInGroup(groupName);
loadHandleProperties(config, listedDefs, op);
return;
}
List<PropertyDefinition> listedDefs = configurationDefinition.getPropertiesInGroup(groupName);