use of org.apache.openejb.api.configuration.ApplicationComposer in project tomee by apache.
the class ApplicationComposerDeployer method deploy.
@Override
public AppModule deploy(final AppModule appModule) throws OpenEJBException {
if (!appModule.isStandaloneModule()) {
return appModule;
}
for (final EjbModule ejbModule : appModule.getEjbModules()) {
if (ejbModule.getFinder() == null) {
continue;
}
WebModule webModule = null;
for (final WebModule web : appModule.getWebModules()) {
if (!web.getModuleId().equals(ejbModule.getModuleId())) {
continue;
}
webModule = web;
break;
}
if (webModule == null) {
continue;
}
for (final Class<?> clazz : ejbModule.getFinder().findAnnotatedClasses(ApplicationComposer.class)) {
final ApplicationComposer applicationComposer = clazz.getAnnotation(ApplicationComposer.class);
final Descriptor descriptor = clazz.getAnnotation(Descriptor.class);
if (descriptor != null) {
configureDescriptor(appModule, descriptor);
}
final Descriptors descriptors = clazz.getAnnotation(Descriptors.class);
if (descriptors != null) {
for (final Descriptor d : descriptors.value()) {
configureDescriptor(appModule, descriptor);
}
}
final Classes classes = clazz.getAnnotation(Classes.class);
if (classes != null) {
configureClasses(webModule, ejbModule, applicationComposer, classes);
}
Object instance = null;
final AnnotationFinder finder = new AnnotationFinder(new ClassesArchive(org.apache.openejb.util.Classes.ancestors(clazz)));
for (final Method m : finder.findAnnotatedMethods(org.apache.openejb.testing.Module.class)) {
instance = configureModule(appModule, ejbModule, clazz, instance, m);
}
for (final Method m : finder.findAnnotatedMethods(Configuration.class)) {
instance = configureConfiguration(appModule, clazz, instance, m);
}
final JaxrsProviders jaxrsProviders = clazz.getAnnotation(JaxrsProviders.class);
if (jaxrsProviders != null) {
for (final Class<?> c : jaxrsProviders.value()) {
webModule.getJaxrsProviders().add(c.getName());
}
}
}
}
return appModule;
}
Aggregations