}
Javascript js;
if (portalName == null)
{
js = Javascript.create(new ResourceId(ResourceScope.SHARED, LEGACY_JAVA_SCRIPT), js_module, js_path, contextPath, priority);
}
else
{
js = Javascript.create(new ResourceId(ResourceScope.PORTAL, portalName), js_module, 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;
Element resourceElt = XMLTools.getUniqueChild(element, MODULE_TAG, false);
if (resourceElt != null)
{
fetchMode = FetchMode.ON_LOAD;
}
else
{
resourceElt = XMLTools.getUniqueChild(element, SCRIPTS_TAG, false);
fetchMode = FetchMode.IMMEDIATE;
}
if (resourceElt != null)
{
ScriptResourceDescriptor desc = scripts.get(id);
if (desc == null)
{
scripts.put(id, desc = new ScriptResourceDescriptor(id, fetchMode));
}
else
{
desc.fetchMode = fetchMode;
}
parseDesc(resourceElt, 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 = MODULE_TAG.equals(element.getTagName()) ? FetchMode.ON_LOAD : FetchMode.IMMEDIATE;
ScriptResourceDescriptor desc = scripts.get(id);
if (desc == null)
{
scripts.put(id, desc = new ScriptResourceDescriptor(id, fetchMode));