Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.WebApp$JAXB


//        URL srcXML = classLoader.getResource("annotation/empty-web-src.xml");
//        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
//        WebAppDocument webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
//        WebAppType webApp = webAppDoc.getWebApp();
//        AnnotatedWebApp annotatedWebApp = new AnnotatedWebApp(webApp);
        WebApp webApp = load("annotation/empty-web-src.xml", WebApp.class);
        ResourceAnnotationHelper.processAnnotations(webApp, classFinder, EnvironmentEntryBuilder.EnvEntryRefProcessor.INSTANCE);
        URL expectedXML = classLoader.getResource("annotation/env-entry-expected.xml");
        XmlObject expected = XmlObject.Factory.parse(expectedXML);
//        log.debug("[@Resource <env-entry> Source XML] " + '\n' + webApp.toString() + '\n');
//        log.debug("[@Resource <env-entry> Expected XML]" + '\n' + expected.toString() + '\n');
View Full Code Here


        //use the same holder object as the web app.
        Holder holder = NamingBuilder.INJECTION_KEY.get(sharedContext);
        buildingContext.put(NamingBuilder.INJECTION_KEY, holder);

        WebApp webApp = webModule.getSpecDD();
        XmlObject geronimoWebApp = webModule.getVendorDD();

        AbstractFinder originalFinder = webModule.getClassFinder();
        ClassFinder classFinder = createOpenWebBeansClassFinder(webApp, webModule);
        webModule.setClassFinder(classFinder);
View Full Code Here

        }
        //TODO Only merge if we detect jsps???
        EnvironmentBuilder.mergeEnvironments(module.getEnvironment(), defaultEnvironment);

        WebModule webModule = (WebModule) module;
        WebApp webApp = webModule.getSpecDD();

        EARContext moduleContext = module.getEarContext();
        Map sharedContext = module.getSharedContext();

        GBeanData webAppData = (GBeanData) sharedContext.get(WebModule.WEB_APP_DATA);

        AbstractName moduleName = module.getModuleName();
        Map<EARContext.Key, Object> buildingContext = new HashMap<EARContext.Key, Object>();
        buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleName);


        //use the same holder object as the web app.
        Holder holder = NamingBuilder.INJECTION_KEY.get(sharedContext);
        buildingContext.put(NamingBuilder.INJECTION_KEY, holder);

        XmlObject jettyWebApp = webModule.getVendorDD();

        Set<String> listenerNames = new HashSet<String>();

        Map<String, Bundle> tldLocationBundleMap = getTldFiles(webApp, webModule);
        LinkedHashSet<Class<?>> classes = getListenerClasses(webApp, webModule, tldLocationBundleMap, listenerNames);
       
        AbstractFinder originalClassFinder = webModule.getClassFinder();
        ClassFinder classFinder = new ClassFinder(new ArrayList<Class<?>>(classes));
        webModule.setClassFinder(classFinder);
        namingBuilders.buildNaming(webApp, jettyWebApp, webModule, buildingContext);
        webModule.setClassFinder(originalClassFinder);

        //only try to install it if reference will work.
        //Some users (tomcat?) may have back doors into jasper that make adding this gbean unnecessary.
        GBeanInfo webAppGBeanInfo = webAppData.getGBeanInfo();
        if (webAppGBeanInfo.getReference("ContextCustomizer") != null) {
            AbstractName jspLifecycleName = moduleContext.getNaming().createChildName(moduleName, "jspLifecycleProvider", GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
            GBeanData gbeanData = new GBeanData(jspLifecycleName, JasperServletContextCustomizer.class);
            gbeanData.setAttribute("holder", holder);

            try {
                moduleContext.addGBean(gbeanData);
            } catch (GBeanAlreadyExistsException e) {
                throw new DeploymentException("Duplicate jspLifecycleProvider", e);
            }

            webAppData.setReferencePattern("ContextCustomizer", jspLifecycleName);
        }

        WebAppInfoBuilder webAppInfoBuilder = (WebAppInfoBuilder)sharedContext.get(WebModule.WEB_APP_INFO);
        if (webAppInfoBuilder != null) {
            WebAppInfo webAppInfo = webAppInfoBuilder.getWebAppInfo();
            webAppInfo.listeners.addAll(listenerNames);
            //install default jsp servlet....
            ServletInfo jspServlet = webAppInfoBuilder.copy(defaultJspServletInfo);
            List<JspConfig> jspConfigs = webApp.getJspConfig();
            List<String> jspMappings = new ArrayList<String>();
            for (JspConfig jspConfig : jspConfigs) {
                for (JspPropertyGroup propertyGroup : jspConfig.getJspPropertyGroup()) {
                    WebAppInfoBuilder.normalizeUrlPatterns(propertyGroup.getUrlPattern(), jspMappings);
                }
View Full Code Here

        URL war = classLoader.getResource("deployables/war2.war");
        assertTrue(war != null);
        JarFile dummyFile = new JarFile(new File(war.getFile()));
        JettyWebAppType GerWebAppType = builder.getJettyWebApp(null, new DeployableJarFile(dummyFile), true, null, null);
        WebApp webApp = getWebApp(dummyFile);
        String contextRoot = builder.getContextRoot(GerWebAppType, null, webApp, true, dummyFile, null);

        assertEquals("/war2", contextRoot);

    }
View Full Code Here

        URL war = classLoader.getResource("deployables/war2.war");
        assertTrue(war != null);
        JarFile dummyFile = new JarFile(new File(war.getFile()));
        JettyWebAppType GerWebAppType = builder.getJettyWebApp(null, new DeployableJarFile(dummyFile), false, "myTargetPath", null);
        WebApp webApp = getWebApp(dummyFile);
        String contextRoot = builder.getContextRoot(GerWebAppType, null, webApp, false, dummyFile, "myTargetPath");
        assertEquals("myTargetPath", contextRoot);

    }
View Full Code Here

    }

    public void testContextRootWithoutPlanButWebApp() throws Exception {

        WebApp webAppType = new WebApp();
        webAppType.setId("myId");

        URL war = classLoader.getResource("deployables/war2.war");
        assertTrue(war != null);
        JarFile dummyFile = new JarFile(new File(war.getFile()));
        JettyWebAppType GerWebAppType = builder.getJettyWebApp(null, new DeployableJarFile(dummyFile), false, "myTargetPath", webAppType);
View Full Code Here

        // Ensure annotations are processed correctly
        //-------------------------------------------------
//        URL srcXML = classLoader.getResource("annotation/empty-web-src.xml");
//        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
//        WebAppDocument webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
        WebApp webApp = load("annotation/empty-web-src.xml", WebApp.class);
        EJBAnnotationHelper.processAnnotations(webApp, classFinder);
        URL expectedXML = classLoader.getResource("annotation/ejb-expected.xml");
        XmlObject expected = XmlObject.Factory.parse(expectedXML);
//        log.debug("[@EJB Source XML] " + '\n' + webApp.toString() + '\n');
//        log.debug("[@EJB Expected XML]" + '\n' + expected.toString() + '\n');
View Full Code Here

//        URL srcXML = classLoader.getResource("annotation/handler-chain-src.xml");
//        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
//        WebAppDocument webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
//        WebAppType webApp = webAppDoc.getWebApp();
//        AnnotatedWebApp annotatedWebApp = new AnnotatedWebApp(webApp);
        WebApp webApp = load("annotation/handler-chain-src.xml", WebApp.class);
        HandlerChainAnnotationHelper.processAnnotations(webApp, classFinder);
        URL expectedXML = classLoader.getResource("annotation/handler-chain-expected.xml");
        XmlObject expected = XmlObject.Factory.parse(expectedXML);
//        log.debug("[@HandlerChain Source XML] " + '\n' + webApp.toString() + '\n');
//        log.debug("[@HandlerChain Expected XML]" + '\n' + expected.toString() + '\n');
View Full Code Here

//        URL srcXML = classLoader.getResource("annotation/empty-web-src.xml");
//        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
//        WebAppDocument webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
//        WebAppType webApp = webAppDoc.getWebApp();
//        AnnotatedWebApp annotatedWebApp = new AnnotatedWebApp(webApp);
        WebApp webApp = load("annotation/empty-web-src.xml", WebApp.class);
        PersistenceContextAnnotationHelper.processAnnotations(webApp, classFinder);
        URL expectedXML = classLoader.getResource("annotation/persistence-context-expected.xml");
        XmlObject expected = XmlObject.Factory.parse(expectedXML);
//        log.debug("[@PersistenceContext Source XML] " + '\n' + webApp.toString() + '\n');
//        log.debug("[@PersistenceContext Expected XML]" + '\n' + expected.toString() + '\n');
View Full Code Here

//        URL srcXML = classLoader.getResource("annotation/empty-web-src.xml");
//        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
//        WebAppDocument webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
//        WebAppType webApp = webAppDoc.getWebApp();
//        AnnotatedWebApp annotatedWebApp = new AnnotatedWebApp(webApp);
        WebApp webApp = load("annotation/empty-web-src.xml", WebApp.class);
        PersistenceUnitAnnotationHelper.processAnnotations(webApp, classFinder);
        URL expectedXML = classLoader.getResource("annotation/persistence-unit-expected.xml");
        XmlObject expected = XmlObject.Factory.parse(expectedXML);
//        log.debug("[@PersistenceUnit Source XML] " + '\n' + webApp.toString() + '\n');
//        log.debug("[@PersistenceUnit Expected XML]" + '\n' + expected.toString() + '\n');
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.WebApp$JAXB

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.