synchronized (session) {
result = (Map)session.getAttribute(PortalConstants.ATTRIBUTE_CONFIGURATION + handlerName + ':' + appName);
if (result == null) {
try {
Configuration config;
Configuration conf = this.getAuthenticationManager().getModuleConfiguration(PortalConstants.AUTHENTICATION_MODULE_NAME);
if (conf == null) {
throw new ProcessingException("portal: Configuration for application '" + appName + "' not found.");
}
result = new HashMap(10, 2);
// auth-redirect (optional)
config = conf.getChild("auth-redirect", false);
if (config != null) {
result.put(PortalConstants.CONF_AUTH_REDIRECT, config.getValue());
}
// portal-uri (required)
config = conf.getChild("portal-uri", false);
if (config == null) {
throw new ProcessingException("portal: portal-uri required for application '"+appName+"'");
}
result.put(PortalConstants.CONF_PORTAL_URI, config.getValue());
// profile-cache (optional)
config = conf.getChild("profile-cache", false);
if (config != null && config.getValueAsBoolean() == true) {
result.put(PortalConstants.CONF_PROFILE_CACHE, appName);
}
// parallel coplets
config = conf.getChild("process-coplets-parallel", false);
if (config != null) {
result.put(PortalConstants.CONF_PARALLEL_COPLETS, new Boolean(config.getValueAsBoolean(false)));
} else {
result.put(PortalConstants.CONF_PARALLEL_COPLETS, new Boolean(false));
}
// timeout
config = conf.getChild("default-coplet-timeout", false);
if (config != null) {
result.put(PortalConstants.CONF_COPLET_TIMEOUT, new Long(config.getValueAsLong(600000)));
} else {
result.put(PortalConstants.CONF_COPLET_TIMEOUT, new Long(600000));
}
// and now the profile
config = conf.getChild("profile", false);
if (config == null) throw new ProcessingException("portal: profile configuration required for application '" + appName + "'");
Configuration child;
// build resource (optional)
child = config.getChild("buildprofile", false);
if (child != null) {
result.put(PortalConstants.CONF_BUILD_RESOURCE, child.getAttribute("uri"));
}
// base resource, type is optional
child = config.getChild("layout-base", false);
if (child == null) {
throw new ProcessingException("portal: layout-base required for application '" + appName + "'");
}
result.put(PortalConstants.CONF_LAYOUTBASE_RESOURCE, child.getAttribute("uri"));
child = config.getChild("coplet-base", false);
if (child == null) {
throw new ProcessingException("portal: coplet-base required for application '" + appName + "'");
}
result.put(PortalConstants.CONF_COPLETBASE_RESOURCE, child.getAttribute("uri"));
child = config.getChild("type-base", false);
if (child != null) {
result.put(PortalConstants.CONF_TYPEBASE_RESOURCE, child.getAttribute("uri"));
}
// coplet base save (is optional)
child = config.getChild("coplet-base-save", false);
if (child != null) {
result.put(PortalConstants.CONF_COPLETBASE_SAVE_RESOURCE, child.getAttribute("uri"));
}
// global delta (load required)
child = config.getChild("global-delta-load", false);
if (child == null) {
throw new ProcessingException("portal: global-delta-load required for application '" + appName + "'");
}
result.put(PortalConstants.CONF_GLOBALDELTA_LOADRESOURCE, child.getAttribute("uri"));
child = config.getChild("global-delta-save", false);
if (child != null) {
result.put(PortalConstants.CONF_GLOBALDELTA_SAVERESOURCE, child.getAttribute("uri"));
}
child = config.getChild("global-type-delta", false);
if (child != null) {
result.put(PortalConstants.CONF_GLOBALDELTA_TYPERESOURCE, child.getAttribute("uri"));
}
// role delta (optional)
child = config.getChild("role-delta-load", false);
if (child != null) {
result.put(PortalConstants.CONF_ROLEDELTA_LOADRESOURCE, child.getAttribute("uri"));
}
child = config.getChild("role-delta-save", false);
if (child != null) {
result.put(PortalConstants.CONF_ROLEDELTA_SAVERESOURCE, child.getAttribute("uri"));
}
child = config.getChild("role-type-delta", false);
if (child != null) {
result.put(PortalConstants.CONF_ROLEDELTA_TYPERESOURCE, child.getAttribute("uri"));
}
// User delta
child = config.getChild("user-delta-load", false);
if (child != null) {
result.put(PortalConstants.CONF_USERDELTA_LOADRESOURCE, child.getAttribute("uri"));
}
child = config.getChild("user-delta-save", false);
if (child != null) {
result.put(PortalConstants.CONF_USERDELTA_SAVERESOURCE, child.getAttribute("uri"));
}
child = config.getChild("user-type-delta", false);
if (child != null) {
result.put(PortalConstants.CONF_USERDELTA_TYPERESOURCE, child.getAttribute("uri"));
}
// Personal information
child = config.getChild("user-status-load", false);
if (child != null) {
result.put(PortalConstants.CONF_STATUS_LOADRESOURCE, child.getAttribute("uri"));
}
child = config.getChild("user-status-save", false);
if (child != null) {
result.put(PortalConstants.CONF_STATUS_SAVERESOURCE, child.getAttribute("uri"));
}
// Admin Type profil
child = config.getChild("admin-type-base", false);
if (child != null) {
result.put(PortalConstants.CONF_ADMIN_TYPE_BASE, child.getAttribute("uri"));
}
// store the config in the session
session.setAttribute(PortalConstants.ATTRIBUTE_CONFIGURATION + handlerName + ':' + appName, result);
} catch (ConfigurationException conf) {