Search in sources :

Example 1 with WebModule

use of org.apache.openejb.config.WebModule in project tomee by apache.

the class MaxChildTest method app.

@Module
public AppModule app() {
    final String jarLocation = "target/" + getClass().getSimpleName();
    return new AppModule(Thread.currentThread().getContextClassLoader(), jarLocation, new Application(), true) {

        {
            getEjbModules().add(new EjbModule(new EjbJar("app"), new OpenejbJar() {

                {
                    getPojoDeployment().add(new PojoDeployment() {

                        {
                            setClassName(SimpleContractImpl.class.getName());
                            getProperties().setProperty("cxf.jaxws.properties", "cxfLargeMsgSize");
                        }
                    });
                }
            }));
            getWebModules().add(new WebModule(new WebApp().contextRoot("app").addServlet("ws", SimpleContractImpl.class.getName(), "/ws"), "app", Thread.currentThread().getContextClassLoader(), jarLocation, "app"));
            getServices().add(new Service() {

                {
                    setId("cxfLargeMsgSize");
                    setClassName(Properties.class.getName());
                    getProperties().setProperty("org.apache.cxf.stax.maxChildElements", "1");
                }
            });
        }
    };
}
Also used : AppModule(org.apache.openejb.config.AppModule) OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) EjbModule(org.apache.openejb.config.EjbModule) Service(org.apache.openejb.config.sys.Service) WebService(javax.jws.WebService) PojoDeployment(org.apache.openejb.jee.oejb3.PojoDeployment) WebModule(org.apache.openejb.config.WebModule) Application(org.apache.openejb.jee.Application) EjbJar(org.apache.openejb.jee.EjbJar) WebApp(org.apache.openejb.jee.WebApp) WebModule(org.apache.openejb.config.WebModule) EjbModule(org.apache.openejb.config.EjbModule) AppModule(org.apache.openejb.config.AppModule) Module(org.apache.openejb.testing.Module)

Example 2 with WebModule

use of org.apache.openejb.config.WebModule in project tomee by apache.

the class LoggingJAXRSWebAppModuleClassConfigurationTest method service.

@Module
public AppModule service() throws Exception {
    final WebModule war = new WebModule(getWebApp(), "/test", Thread.currentThread().getContextClassLoader(), "", "test");
    war.getRestApplications().add(LogginTestApplication.class.getName());
    final AppModule appModule = new AppModule(getEjbModule(LogginTestApplication.class.getName(), "test"), war);
    configureLoggin();
    return appModule;
}
Also used : AppModule(org.apache.openejb.config.AppModule) WebModule(org.apache.openejb.config.WebModule) WebModule(org.apache.openejb.config.WebModule) AppModule(org.apache.openejb.config.AppModule) Module(org.apache.openejb.testing.Module)

Example 3 with WebModule

use of org.apache.openejb.config.WebModule in project tomee by apache.

the class LoggingJAXRSWebAppModuleTest method service.

@Module
public AppModule service() throws Exception {
    final WebModule war = new WebModule(getWebApp(), "/test", Thread.currentThread().getContextClassLoader(), "", "test");
    war.getRestApplications().add(LogginTestApplication.class.getName());
    final AppModule appModule = new AppModule(getEjbModule("jaxrs-application", "test"), war);
    configureLoggin();
    return appModule;
}
Also used : AppModule(org.apache.openejb.config.AppModule) WebModule(org.apache.openejb.config.WebModule) WebModule(org.apache.openejb.config.WebModule) AppModule(org.apache.openejb.config.AppModule) Module(org.apache.openejb.testing.Module)

Example 4 with WebModule

use of org.apache.openejb.config.WebModule in project tomee by apache.

the class AddContainerCdiBeansExtension method addCdiExtLib.

public void addCdiExtLib(@Observes final BeforeAppInfoBuilderEvent event) {
    for (final EjbModule ejbModule : event.getAppModule().getEjbModules()) {
        if (ejbModule.getModuleId().startsWith("ear-scoped-cdi-beans")) {
            final Beans beans = ejbModule.getBeans();
            if (CompositeBeans.class.isInstance(beans)) {
                final CompositeBeans cb = CompositeBeans.class.cast(beans);
                cb.getManagedClasses().put(EXT_LIB, new ArrayList<>(BEANS));
            }
            return;
        }
    }
    // else a war
    for (final WebModule webModule : event.getAppModule().getWebModules()) {
        for (final EjbModule ejbModule : event.getAppModule().getEjbModules()) {
            if (ejbModule.getModuleId().equals(webModule.getModuleId())) {
                final Beans beans = ejbModule.getBeans();
                if (CompositeBeans.class.isInstance(beans)) {
                    final CompositeBeans cb = CompositeBeans.class.cast(beans);
                    cb.getManagedClasses().put(EXT_LIB, new ArrayList<>(BEANS));
                }
                return;
            }
        }
    }
}
Also used : CompositeBeans(org.apache.openejb.cdi.CompositeBeans) Beans(org.apache.openejb.jee.Beans) CompositeBeans(org.apache.openejb.cdi.CompositeBeans) EjbModule(org.apache.openejb.config.EjbModule) WebModule(org.apache.openejb.config.WebModule)

Example 5 with WebModule

use of org.apache.openejb.config.WebModule in project tomee by apache.

the class CheckAnnotations method validate.

@Override
public void validate(final AppModule appModule) {
    try {
        for (final EjbModule ejbModule : appModule.getEjbModules()) {
            module = ejbModule;
            findClassesAnnotatedWithWebService(ejbModule);
        }
        for (final WebModule webModule : appModule.getWebModules()) {
            module = webModule;
            findClassesAnnotatedWithWebService(webModule);
        }
    } catch (final Exception e) {
        logger.error("Error while validating @WebService annotation", e);
    }
}
Also used : EjbModule(org.apache.openejb.config.EjbModule) WebModule(org.apache.openejb.config.WebModule)

Aggregations

WebModule (org.apache.openejb.config.WebModule)18 AppModule (org.apache.openejb.config.AppModule)9 EjbModule (org.apache.openejb.config.EjbModule)9 File (java.io.File)7 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 WebApp (org.apache.openejb.jee.WebApp)5 OpenejbJar (org.apache.openejb.jee.oejb3.OpenejbJar)5 HashMap (java.util.HashMap)4 Map (java.util.Map)4 EjbJar (org.apache.openejb.jee.EjbJar)4 Module (org.apache.openejb.testing.Module)4 URL (java.net.URL)3 LinkedList (java.util.LinkedList)3 OpenEJBException (org.apache.openejb.OpenEJBException)3 OpenEJBRuntimeException (org.apache.openejb.OpenEJBRuntimeException)3 Beans (org.apache.openejb.jee.Beans)3 EnvEntry (org.apache.openejb.jee.EnvEntry)3 Arrays.asList (java.util.Arrays.asList)2 List (java.util.List)2