use of com.sun.enterprise.deployment.archivist.ExtensionsArchivist in project Payara by payara.
the class WebArchivist method postAnnotationProcess.
@Override
protected void postAnnotationProcess(WebBundleDescriptorImpl descriptor, ReadableArchive archive) throws IOException {
super.postAnnotationProcess(descriptor, archive);
// read web-fragment.xml
List<WebFragmentDescriptor> wfList = readStandardFragments(descriptor, archive);
// extension annotation processing will be done in top level
if (isProcessAnnotation(descriptor)) {
Map<ExtensionsArchivist, RootDeploymentDescriptor> localExtensions = new HashMap<>();
for (WebFragmentDescriptor wfDesc : wfList) {
// should be overridden and be true also
if (descriptor.isFullAttribute()) {
wfDesc.setFullAttribute(String.valueOf(descriptor.isFullAttribute()));
}
super.readAnnotations(archive, wfDesc, localExtensions);
}
// scan manifest classpath
ModuleScanner scanner = getScanner();
if (scanner instanceof WarScanner) {
((WarScanner) scanner).setScanOtherLibraries(true);
readAnnotations(archive, descriptor, localExtensions, scanner);
}
}
WebFragmentDescriptor mergedWebFragment = new WebFragmentDescriptor();
mergedWebFragment.setExists(false);
for (WebFragmentDescriptor wf : wfList) {
// we have the first fragment that's contains the web-fragment.xml file
if (!mergedWebFragment.isExists() && wf.isExists()) {
mergedWebFragment.setExists(true);
mergedWebFragment.setDistributable(wf.isDistributable());
}
mergedWebFragment.addWebBundleDescriptor(wf);
}
if (!wfList.isEmpty()) {
descriptor.addWebBundleDescriptor(mergedWebFragment);
// if there any mapping stubs left, there is something invalid referenced from web.xml
for (WebComponentDescriptor desc : descriptor.getWebComponentDescriptors()) {
if (desc instanceof WebComponentDescriptorStub) {
throw new RuntimeException(String.format("There is no web component by the name of %s here.", desc.getName()));
}
}
}
// apply default from default-web.xml to web.xml
WebBundleDescriptorImpl defaultWebBundleDescriptor = getPlainDefaultWebXmlBundleDescriptor();
descriptor.addDefaultWebBundleDescriptor(defaultWebBundleDescriptor);
}
Aggregations