root = "/openejb";
}
testBean.getEnvEntry().addAll(webapp.getEnvEntry());
final WebModule webModule = new WebModule(webapp, root, Thread.currentThread().getContextClassLoader(), "", root);
webModule.getAltDDs().putAll(additionalDescriptors);
webModule.getAltDDs().putAll(descriptorsToMap(method.getAnnotation(Descriptors.class)));
final EjbModule ejbModule = DeploymentLoader.addWebModule(webModule, appModule);
if (cdi) {
ejbModule.setBeans(beans(new Beans(), cdiDecorators, cdiInterceptors, cdiAlternatives));
}
final JaxrsProviders providers = method.getAnnotation(JaxrsProviders.class);
final Class<?>[] providersClasses = providers == null ? null : providers.value();
if (providers != null) {
if (classes == null) {
classes = providersClasses;
} else {
final Collection<Class<?>> newClasses = new ArrayList<>(asList(classes));
newClasses.addAll(asList(providersClasses));
classes = newClasses.toArray(new Class<?>[newClasses.size()]);
}
}
if (innerClassesAsBean) {
final Collection<Class<?>> inners = new LinkedList<Class<?>>();
for (final Class<?> clazz : testClass.getClasses()) {
final int modifiers = clazz.getModifiers();
try {
if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && clazz.getConstructor() != null) {
inners.add(clazz);
}
} catch (final NoSuchMethodException nsme) {
// no-op, skip it
}
}
if (!inners.isEmpty()) {
final Collection<Class<?>> newClasses = new ArrayList<Class<?>>(asList(classes));
newClasses.addAll(inners);
classes = newClasses.toArray(new Class<?>[newClasses.size()]);
}
}
final IAnnotationFinder finder = finderFromClasses(webModule, classes, findFiles(jarsAnnotation));
webModule.setFinder(finder);
ejbModule.setFinder(webModule.getFinder());
if (providersClasses != null) {
OpenejbJar openejbJar = ejbModule.getOpenejbJar();
if (openejbJar == null) {
openejbJar = new OpenejbJar();
ejbModule.setOpenejbJar(openejbJar);
}
final PojoDeployment pojoDeployment = new PojoDeployment();
pojoDeployment.setClassName(providers.applicationName());
pojoDeployment.getProperties().setProperty("cxf.jaxrs.providers", Join.join(",", providersClasses).replace("class ", ""));
openejbJar.getPojoDeployment().add(pojoDeployment);
}
} else if (obj instanceof WebModule) { // will add the ejbmodule too
webModulesNb++;
final WebModule webModule = (WebModule) obj;
webModule.getAltDDs().putAll(additionalDescriptors);
webModule.getAltDDs().putAll(descriptorsToMap(method.getAnnotation(Descriptors.class)));
final EjbModule ejbModule = DeploymentLoader.addWebModule(webModule, appModule);
if (cdi) {
ejbModule.setBeans(beans(new Beans(), cdiDecorators, cdiInterceptors, cdiAlternatives));
}
webModule.setFinder(finderFromClasses(webModule, classes, findFiles(jarsAnnotation)));
ejbModule.setFinder(webModule.getFinder());
} else if (obj instanceof EjbModule) {
final EjbModule ejbModule = (EjbModule) obj;
ejbModule.getAltDDs().putAll(additionalDescriptors);
ejbModule.getAltDDs().putAll(descriptorsToMap(method.getAnnotation(Descriptors.class)));