Package org.apache.geronimo.web25.deployment.merge

Examples of org.apache.geronimo.web25.deployment.merge.MergeItem


    @Override
    public void preProcessWebXmlElement(WebAppType webApp, MergeContext mergeContext) throws DeploymentException {
        for (PersistenceContextRefType persistenceContextRef : webApp.getPersistenceContextRefArray()) {
            String persistenceContextRefName = persistenceContextRef.getPersistenceContextRefName().getStringValue();
            mergeContext.setAttribute(createPersistenceContextRefKey(persistenceContextRefName), new MergeItem(persistenceContextRef, null, ElementSource.WEB_XML));
            //Create an attribute tag to indicate whether injectTarget is configured in web.xml file
            if (persistenceContextRef.getInjectionTargetArray().length > 0) {
                mergeContext.setAttribute(createPersistenceContextRefInjectTargetConfiguredInWebXMLKey(persistenceContextRefName), Boolean.TRUE);
            }
            for (InjectionTargetType injectionTarget : persistenceContextRef.getInjectionTargetArray()) {
View Full Code Here


public class ErrorPageMergeHandler implements WebFragmentMergeHandler<WebFragmentType, WebAppType> {

    @Override
    public void merge(WebFragmentType webFragment, WebAppType webApp, MergeContext mergeContext) throws DeploymentException {
        for (ErrorPageType errorPage : webFragment.getErrorPageArray()) {
            MergeItem mergeItem = (MergeItem) mergeContext.getAttribute(createErrorPageKey(errorPage));
            if (mergeItem != null) {
                if (mergeItem.getSourceType().equals(ElementSource.WEB_XML)) {
                    continue;
                } else if (mergeItem.getValue().equals(errorPage.getLocation().getStringValue())) {
                    boolean isErrorCodeConfigured = errorPage.getErrorCode() != null;
                    throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateKeyValueMessage("error-page", isErrorCodeConfigured ? "error-code" : "exception-type", isErrorCodeConfigured ? errorPage
                            .getErrorCode().getStringValue() : errorPage.getExceptionType().getStringValue(), "location", (String) mergeItem.getValue(), mergeItem.getBelongedURL(), errorPage
                            .getLocation().getStringValue(), mergeContext.getCurrentJarUrl()));
                }
            } else {
                webApp.addNewErrorPage().set(errorPage);
                mergeContext.setAttribute(createErrorPageKey(errorPage), new MergeItem(errorPage.getLocation().getStringValue(), mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
            }
        }
    }
View Full Code Here

    }

    @Override
    public void preProcessWebXmlElement(WebAppType webApp, MergeContext context) throws DeploymentException {
        for (ErrorPageType errorPage : webApp.getErrorPageArray()) {
            context.setAttribute(createErrorPageKey(errorPage), new MergeItem(errorPage.getLocation().getStringValue(), null, ElementSource.WEB_XML));
        }
    }
View Full Code Here

        if (webApp.getJspConfigArray().length > 1) {
            throw new DeploymentException(WebDeploymentMessageUtils.createMultipleConfigurationWebAppErrorMessage("jsp-config"));
        }
        JspConfigType jspConfig = webApp.getJspConfigArray(0);
        for (TaglibType taglib : jspConfig.getTaglibArray()) {
            context.setAttribute(createTaglibKey(taglib), new MergeItem(taglib.getTaglibLocation().getStringValue(), null, ElementSource.WEB_XML));
        }
    }
View Full Code Here

    @Override
    public void merge(WebFragmentType webFragment, WebAppType webApp, MergeContext mergeContext) throws DeploymentException {
        for (EnvEntryType srcEnvEntry : webFragment.getEnvEntryArray()) {
            String envEntryName = srcEnvEntry.getEnvEntryName().getStringValue();
            String envEntryKey = createEnvEntryKey(envEntryName);
            MergeItem mergeItem = (MergeItem) mergeContext.getAttribute(envEntryKey);
            if (mergeItem != null) {
                if (mergeItem.isFromWebFragment()) {
                    throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateJNDIRefMessage("env-entry", envEntryName, mergeItem.getBelongedURL(), mergeContext.getCurrentJarUrl()));
                } else if (mergeItem.isFromWebXml() && !isEnvEntryInjectTargetsConfiguredInInitialWebXML(envEntryName, mergeContext)) {
                    //Merge InjectTarget
                    EnvEntryType envEntry = (EnvEntryType) mergeItem.getValue();
                    for (InjectionTargetType injectTarget : srcEnvEntry.getInjectionTargetArray()) {
                        String envEntryInjectTargetKey = createEnvEntryInjectTargetKey(envEntryName, injectTarget.getInjectionTargetClass().getStringValue(), injectTarget
                                .getInjectionTargetName().getStringValue());
                        if (!mergeContext.containsAttribute(envEntryInjectTargetKey)) {
                            envEntry.addNewInjectionTarget().set(injectTarget);
                            mergeContext.setAttribute(envEntryInjectTargetKey, Boolean.TRUE);
                        }
                    }
                }
            } else {
                EnvEntryType targetEnvEntry = (EnvEntryType) webApp.addNewEnvEntry().set(srcEnvEntry);
                mergeContext.setAttribute(envEntryKey, new MergeItem(targetEnvEntry, mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
                for (InjectionTargetType injectionTarget : targetEnvEntry.getInjectionTargetArray()) {
                    mergeContext.setAttribute(createEnvEntryInjectTargetKey(envEntryName, injectionTarget.getInjectionTargetClass().getStringValue(), injectionTarget.getInjectionTargetName()
                            .getStringValue()), Boolean.TRUE);
                }
            }
View Full Code Here

    @Override
    public void preProcessWebXmlElement(WebAppType webApp, MergeContext mergeContext) throws DeploymentException {
        for (EnvEntryType envEntry : webApp.getEnvEntryArray()) {
            String envEntryName = envEntry.getEnvEntryName().getStringValue();
            mergeContext.setAttribute(createEnvEntryKey(envEntryName), new MergeItem(envEntry, null, ElementSource.WEB_XML));
            //Create an attribute tag to indicate whether injectTarget is configured in web.xml file
            if (envEntry.getInjectionTargetArray().length > 0) {
                mergeContext.setAttribute(createEnvEntryInjectTargetConfiguredInWebXMLKey(envEntryName), Boolean.TRUE);
            }
            for (InjectionTargetType injectionTarget : envEntry.getInjectionTargetArray()) {
View Full Code Here

    @Override
    public void merge(WebFragmentType webFragment, WebAppType webApp, MergeContext mergeContext) throws DeploymentException {
        for (EjbLocalRefType srcEjbLocalRef : webFragment.getEjbLocalRefArray()) {
            String ejbLocalRefName = srcEjbLocalRef.getEjbRefName().getStringValue();
            String ejbLocalRefKey = createEjbLocalRefKey(ejbLocalRefName);
            MergeItem mergeItem = (MergeItem) mergeContext.getAttribute(ejbLocalRefKey);
            if (mergeItem != null) {
                if (mergeItem.isFromWebFragment()) {
                    throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateJNDIRefMessage("ejb-local-ref", ejbLocalRefName, mergeItem.getBelongedURL(), mergeContext.getCurrentJarUrl()));
                } else if (mergeItem.isFromWebXml() && !isEjbLocalRefInjectTargetsConfiguredInInitialWebXML(ejbLocalRefName, mergeContext)) {
                    //Merge InjectTarget
                    EjbLocalRefType ejbLocalRef = (EjbLocalRefType) mergeItem.getValue();
                    for (InjectionTargetType injectTarget : srcEjbLocalRef.getInjectionTargetArray()) {
                        String ejbLocalRefInjectTargetKey = createEjbLocalRefInjectTargetKey(ejbLocalRefName, injectTarget.getInjectionTargetClass().getStringValue(), injectTarget
                                .getInjectionTargetName().getStringValue());
                        if (!mergeContext.containsAttribute(ejbLocalRefInjectTargetKey)) {
                            ejbLocalRef.addNewInjectionTarget().set(injectTarget);
                            mergeContext.setAttribute(ejbLocalRefInjectTargetKey, Boolean.TRUE);
                        }
                    }
                }
            } else {
                EjbLocalRefType targetEjbLocalRef = (EjbLocalRefType) webApp.addNewEjbLocalRef().set(srcEjbLocalRef);
                mergeContext.setAttribute(ejbLocalRefKey, new MergeItem(targetEjbLocalRef, mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
                for (InjectionTargetType injectionTarget : targetEjbLocalRef.getInjectionTargetArray()) {
                    mergeContext.setAttribute(createEjbLocalRefInjectTargetKey(ejbLocalRefName, injectionTarget.getInjectionTargetClass().getStringValue(), injectionTarget.getInjectionTargetName()
                            .getStringValue()), Boolean.TRUE);
                }
            }
View Full Code Here

                    if (!absoluteOrderingConfigured) {
                        throw new DeploymentException("Mutiple web-fragments with the same name [" + webFragmentName + "] are found in " + jarURL + " and "
                                + webFragmentEntryMap.get(webFragmentName).getJarURL() + ", you might make the name unique or use absolute ordering in web.xml");
                    }
                } else {
                    webFragmentEntryMap.put(webFragmentName, new WebFragmentEntry(webFragmentName, webFragmentName, webFragment, jarURL));
                }
                usedWebFragmentNames.add(webFragmentName);
            } else {
                unnamedWebFragmentMap.put(jarURL, webFragment);
            }
            //Add names configurations in before/after, so that we would not add an existing name for those unamed web fragment by sudden.
            if (webFragment.getOrdering() != null) {
                Ordering order = webFragment.getOrdering();
                if (order.getBefore() != null) {
                    usedWebFragmentNames.addAll(order.getBefore().getName());
                }
                if (order.getAfter() != null) {
                    usedWebFragmentNames.addAll(order.getAfter().getName());
                }
            }
        }
        //Generate names for all the web fragments which are not explicitly configured
        String tempNamePrefix = "geronimo-deployment";
        int nameSubfix = 0;
        for (String webFragmentURL : unnamedWebFragmentMap.keySet()) {
            WebFragment webFragment = unnamedWebFragmentMap.get(webFragmentURL);
            String tempWebFragmentName = tempNamePrefix + nameSubfix++;
            while (usedWebFragmentNames.contains(tempWebFragmentName)) {
                tempWebFragmentName = tempNamePrefix + nameSubfix++;
            }
            webFragmentEntryMap.put(tempWebFragmentName, new WebFragmentEntry(tempWebFragmentName, null, webFragment, webFragmentURL));
        }
        //Order the web fragments required (<name> element is specified)
        if (absoluteOrderingConfigured) {
            return absoluteOrderWebFragments(earContext, module, bundle, webApp, webFragmentEntryMap);
        } else {
View Full Code Here

                securityHolder.setSecurity(true);

                webModuleData.setAttribute("securityHolder", securityHolder);
                //local jaspic configuration
                if (tomcatWebApp.isSetAuthentication()) {
                    AuthenticationWrapper authType = new TomcatAuthenticationWrapper(tomcatWebApp.getAuthentication());
                    configureLocalJaspicProvider(authType, contextPath, module, webModuleData);
                }

            }
View Full Code Here

        XmlBeansUtil.validateDD(xmlObject);
        return (WebAppDocument) xmlObject;
    }

    protected ComponentPermissions buildSpecSecurityConfig(WebAppType webApp) {
        SpecSecurityBuilder builder = new SpecSecurityBuilder();
        return builder.buildSpecSecurityConfig(webApp);
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.web25.deployment.merge.MergeItem

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.