use of org.apache.xbean.finder.IAnnotationFinder in project tomee by apache.
the class DeploymentLoader method addWebModule.
public static EjbModule addWebModule(final WebModule webModule, final AppModule appModule) throws OpenEJBException {
// create and add the WebModule
appModule.getWebModules().add(webModule);
if (appModule.isStandaloneModule()) {
appModule.getAdditionalLibraries().addAll(webModule.getUrls());
}
{
final Object pXml = appModule.getAltDDs().get("persistence.xml");
List<URL> persistenceXmls = pXml == null ? null : (List.class.isInstance(pXml) ? (List<URL>) pXml : new ArrayList<>(asList(URL.class.cast(pXml))));
if (persistenceXmls == null) {
persistenceXmls = new ArrayList<>();
appModule.getAltDDs().put("persistence.xml", persistenceXmls);
}
final Object o = webModule.getAltDDs().get("persistence.xml");
if (o instanceof URL) {
final URL url = (URL) o;
persistenceXmls.add(url);
}
if (o instanceof List) {
final List<URL> urls = (List<URL>) o;
persistenceXmls.addAll(urls);
}
}
// Per the Spec version of the Collapsed EAR there
// aren't individual EjbModules inside a war.
// The war itself is one big EjbModule if certain
// conditions are met. These conditions are different
// than an ear file, so the ear-style code we were previously
// using doesn't exactly work anymore.
final EjbModule webEjbModule = new EjbModule(webModule.getClassLoader(), webModule.getModuleId(), webModule.getJarLocation(), null, null);
webEjbModule.setWebapp(true);
webEjbModule.getAltDDs().putAll(webModule.getAltDDs());
appModule.getEjbModules().add(webEjbModule);
try {
// TODO: Put our scanning ehnancements back, here
fillEjbJar(webModule, webEjbModule);
if (webModule.getFinder() == null) {
if (isMetadataComplete(webModule, webEjbModule)) {
final IAnnotationFinder finder = new org.apache.xbean.finder.AnnotationFinder(new ClassesArchive());
webModule.setFinder(finder);
webEjbModule.setFinder(finder);
} else {
final IAnnotationFinder finder = FinderFactory.createFinder(webModule);
webModule.setFinder(finder);
webEjbModule.setFinder(finder);
}
} else if (webEjbModule.getFinder() == null) {
webEjbModule.setFinder(webModule.getFinder());
}
} catch (final Exception e) {
throw new OpenEJBException("Unable to create annotation scanner for web module " + webModule.getModuleId(), e);
}
addWebservices(webEjbModule);
return webEjbModule;
}
Aggregations