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) {
Element nativeAmdTag = XMLTools.getUniqueChild(element, NATIVE_AMD_TAG, false);
boolean isNativeAmd = nativeAmdTag != null && Boolean.parseBoolean(XMLTools.asString(nativeAmdTag, true).toLowerCase());
desc = new ScriptResourceDescriptor(id, fetchMode, parseOptString(element, AS_TAG), group, isNativeAmd);
} 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;
if (XMLTools.getUniqueChild(element, URL_TAG, false) == null) {