if(results.length > 0) {
// Needed only when there are any SecurityRealms
configMgr = ConfigurationUtil.getConfigurationManager(kernel);
}
for (int i = 0; i < results.length; i++) {
final GeronimoManagedBean managedBean = (GeronimoManagedBean) realms[i];
AbstractName abstractName = PortletManager.getNameFor(request, realms[i]);
String parent;
Configuration parentConfig = configMgr.getConfiguration(abstractName.getArtifact());
ConfigurationModuleType parentType = parentConfig.getModuleType();
if(ConfigurationModuleType.SERVICE.equals(parentType)) {
parent = null; // Server-wide
} else {
parent = abstractName.getArtifact().toString();
}
results[i] = new ExistingRealm(realms[i].getRealmName(), abstractName, managedBean.getState(), parent);
}
// Once done, release the ConfigurationManager
if(configMgr != null) {
ConfigurationUtil.releaseConfigurationManager(kernel, configMgr);
}