if (currentNodeIsModuleType) {//if is an actual Module Option Type then update attribute retrieved.
attribute = ModuleOptionsComponent.attributeMap.get(resourceType.getName());
}
//get the current attribute value
ReadAttribute op = new ReadAttribute(address, attribute);
Result result = getASConnection().execute(op);
if (result.isSuccess()) {
//populate attribute values
List<Value> currentAttributeState = new ArrayList<Value>();
currentAttributeState = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
ModuleOptionsComponent.loadModuleOptionType(attribute));
if (currentNodeIsModuleType) {//grab first available module type
Value loaded = currentAttributeState.get(0);
//populate configuration
populateCodeFlagType(configuration, attribute, loaded);
} else {//Need to locate specific module type
//locate specific node and populate the config
//Ex."login-modules:";
String moduleTypeIdentifier = attribute + ":";
int index = path.indexOf(moduleTypeIdentifier);
String loginModuleIndex = path.substring(index + moduleTypeIdentifier.length());
int lmi = Integer.valueOf(loginModuleIndex);//Ex 0,1,30
if (currentAttributeState.size() > lmi) {//then retrieve.
Value loaded = currentAttributeState.get(lmi);
//populate configuration
populateCodeFlagType(configuration, attribute, loaded);
}
}
}
//read attribute
return configuration;
}
//Module Options child, Ex. 'Login Modules (Classic', ..-Managed, .. - Profile
else if (supportsLoginModuleOptionType(grandParentType)) {
//get type and lookup supported node and type
String attribute = ModuleOptionsComponent.attributeMap.get(grandParentType.getName());
//get the current attribute value
ReadAttribute op = new ReadAttribute(address, attribute);
Result result = getASConnection().execute(op);
if (result.isSuccess()) {
//populate attribute values
List<Value> currentAttributeState = new ArrayList<Value>();
currentAttributeState = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
ModuleOptionsComponent.loadModuleOptionType(attribute));
//locate specific node and populate the config
//Ex."login-modules:";
String moduleTypeIdentifier = attribute + ":";
int index = path.indexOf(moduleTypeIdentifier);
String loginModuleIndex = path.substring(index + moduleTypeIdentifier.length());
String[] split = loginModuleIndex.split(",");
int lmi = Integer.valueOf(split[0]);//Ex 0,1,30
if (lmi < currentAttributeState.size()) {//then proceed
Value loaded = currentAttributeState.get(lmi);
//populate configuration: module-options
LinkedHashMap<String, Object> currentModuleOptions = loaded.getOptions();
//This must match exactly the mapping identifier from descriptor, otherwise loadResource fails silently.
String id = "Module Options";
PropertyMap map = new PropertyMap(id);
for (String key : currentModuleOptions.keySet()) {
PropertySimple option = new PropertySimple(key, currentModuleOptions.get(key));
map.put(option);
}
if (!currentModuleOptions.isEmpty()) {//check that keyset is non empty before adding to config.
configuration.put(map);
}
}
}
return configuration;
} else {//otherwise default subsystem discovery behavior.
ConfigurationDefinition configDef = context.getResourceType().getResourceConfigurationDefinition();
ConfigurationLoadDelegate delegate = new ConfigurationLoadDelegate(configDef, getASConnection(), address,
includeRuntime);
configuration = delegate.loadResourceConfiguration();
// Read server state
ReadAttribute op = new ReadAttribute(getAddress(), "name");
executeAndGenerateServerUpdateIfNecessary(configuration, op);
return configuration;
}
}