// portal-name is null
}
Javascript js;
if (portalName == null) {
js = Javascript.create(new ResourceId(ResourceScope.SHARED, LEGACY_JAVA_SCRIPT), js_path, contextPath,
priority);
} else {
js = Javascript
.create(new ResourceId(ResourceScope.PORTAL, portalName), js_path, contextPath, priority);
}
//
ScriptResourceDescriptor desc = scripts.get(js.getResource());
if (desc == null) {
scripts.put(js.getResource(),
desc = new ScriptResourceDescriptor(js.getResource(), FetchMode.IMMEDIATE));
}
desc.modules.add(js);
}
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
} else if (PORTAL_TAG.equals(element.getTagName()) || PORTLET_TAG.equals(element.getTagName())) {
String resourceName = XMLTools.asString(XMLTools.getUniqueChild(element, "name", true));
ResourceScope resourceScope;
if (PORTLET_TAG.equals(element.getTagName())) {
resourceName = contextPath.substring(1) + "/" + resourceName;
resourceScope = ResourceScope.PORTLET;
} else {
resourceScope = ResourceScope.PORTAL;
}
ResourceId id = new ResourceId(resourceScope, resourceName);
FetchMode fetchMode;
String group = null;
Element resourceElt = XMLTools.getUniqueChild(element, MODULE_TAG, false);
if (resourceElt != null) {
fetchMode = FetchMode.ON_LOAD;
if (XMLTools.getUniqueChild(resourceElt, URL_TAG, false) == null) {
group = parseGroup(resourceElt);
}
} else {
resourceElt = XMLTools.getUniqueChild(element, SCRIPTS_TAG, false);
fetchMode = FetchMode.IMMEDIATE;
}
if (resourceElt != null) {
ScriptResourceDescriptor desc = scripts.get(id);
if (desc == null) {
desc = new ScriptResourceDescriptor(id, fetchMode, parseOptString(element, AS_TAG), group);
} else {
desc.fetchMode = fetchMode;
}
parseDesc(resourceElt, desc);
scripts.put(id, desc);
}
} else if (MODULE_TAG.equals(element.getTagName()) || SCRIPTS_TAG.equals(element.getTagName())) {
String resourceName = XMLTools.asString(XMLTools.getUniqueChild(element, "name", true));
ResourceId id = new ResourceId(ResourceScope.SHARED, resourceName);
FetchMode fetchMode;
String group = null;
if (MODULE_TAG.equals(element.getTagName())) {
fetchMode = FetchMode.ON_LOAD;