if (!absoluteOrderingConfigured) {
throw new DeploymentException("Mutiple web-fragments with the same name [" + webFragmentName + "] are found in " + jarURL + " and "
+ webFragmentEntryMap.get(webFragmentName).getJarURL() + ", you might make the name unique or use absolute ordering in web.xml");
}
} else {
webFragmentEntryMap.put(webFragmentName, new WebFragmentEntry(webFragmentName, webFragmentName, webFragment, jarURL));
}
usedWebFragmentNames.add(webFragmentName);
} else {
unnamedWebFragmentMap.put(jarURL, webFragment);
}
//Add names configurations in before/after, so that we would not add an existing name for those unamed web fragment by sudden.
if (webFragment.getOrderingArray().length > 0) {
OrderingType order = webFragment.getOrderingArray()[0];
if (order.getBefore() != null) {
for (JavaIdentifierType name : order.getBefore().getNameArray()) {
usedWebFragmentNames.add(name.getStringValue());
}
}
if (order.getAfter() != null) {
for (JavaIdentifierType name : order.getAfter().getNameArray()) {
usedWebFragmentNames.add(name.getStringValue());
}
}
}
}
//Generate names for all the web fragments which are not explicitly configured
String tempNamePrefix = "geronimo-deployment";
int nameSubfix = 0;
for (String webFragmentURL : unnamedWebFragmentMap.keySet()) {
WebFragmentType webFragment = unnamedWebFragmentMap.get(webFragmentURL);
String tempWebFragmentName = tempNamePrefix + nameSubfix++;
while (usedWebFragmentNames.contains(tempWebFragmentName)) {
tempWebFragmentName = tempNamePrefix + nameSubfix++;
}
webFragmentEntryMap.put(tempWebFragmentName, new WebFragmentEntry(tempNamePrefix, null, webFragment, webFragmentURL));
}
//Order the web fragments required (<name> element is specified)
if (absoluteOrderingConfigured) {
return absoluteOrderWebFragments(earContext, module, bundle, webApp, webFragmentEntryMap);
} else {