// The array entry types are security.realm.SecurityRealm (the subclass)
org.apache.geronimo.management.geronimo.SecurityRealm[] realms = PortletManager.getCurrentServer(request).getSecurityRealms();
ExistingRealm[] results = new ExistingRealm[realms.length];
// ConfigurationManager is used to determine if the SecurityRealm is deployed as a "SERVICE", i.e., "Server-wide"
ConfigurationManager configMgr = null;
if(results.length > 0) {
// Needed only when there are any SecurityRealms
configMgr = ConfigurationUtil.getConfigurationManager(kernel);
}
for (int i = 0; i < results.length; 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();