Package org.apache.geronimo.web25.deployment

Examples of org.apache.geronimo.web25.deployment.DefaultWebAppInfoFactory


            String messageDestinationName = messageDestination.getMessageDestinationName();
            if (mergeContext.containsAttribute(createMessageDestinationConfiguredInWebXMLKey(messageDestination.getMessageDestinationName()))) {
                continue;
            }
            if (mergeContext.containsAttribute(createMessageDestinationConfiguredInWebFragmentXMLKey(messageDestinationName))) {
                MergeItem mergeItem = (MergeItem) mergeContext.getAttribute(createMessageDestinationConfiguredInWebFragmentXMLKey(messageDestinationName));
                throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateJNDIRefMessage("message-destination", messageDestinationName, mergeItem.getBelongedURL(), mergeContext.getCurrentJarUrl()));
            } else {
                 webApp.getMessageDestination().add(messageDestination);
                mergeContext.setAttribute(createMessageDestinationConfiguredInWebFragmentXMLKey(messageDestinationName), new MergeItem(messageDestination, mergeContext.getCurrentJarUrl(),
                        ElementSource.WEB_FRAGMENT));
            }
        }
    }
View Full Code Here


    @Override
    public void merge(WebFragment webFragment, WebApp webApp, MergeContext mergeContext) throws DeploymentException {
        for (ResourceRef srcResourceRef : webFragment.getResourceRef()) {
            String resourceRefName = srcResourceRef.getResRefName();
            String resourceRefKey = createResourceRefKey(resourceRefName);
            MergeItem mergeItem = (MergeItem) mergeContext.getAttribute(resourceRefKey);
            if (mergeItem != null) {
                if (mergeItem.isFromWebFragment()) {
                    throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateJNDIRefMessage("resource-ref", resourceRefName, mergeItem.getBelongedURL(), mergeContext.getCurrentJarUrl()));
                } else if (mergeItem.isFromWebXml() && !isResourceRefInjectTargetsConfiguredInInitialWebXML(resourceRefName, mergeContext)) {
                    //Merge InjectTarget
                    ResourceRef resourceRef = (ResourceRef) mergeItem.getValue();
                    for (InjectionTarget injectTarget : srcResourceRef.getInjectionTarget()) {
                        String resourceRefInjectTargetKey = createResourceRefInjectTargetKey(resourceRefName, injectTarget.getInjectionTargetClass(), injectTarget
                                .getInjectionTargetName());
                        if (!mergeContext.containsAttribute(resourceRefInjectTargetKey)) {
                            resourceRef.getInjectionTarget().add(injectTarget);
                            mergeContext.setAttribute(resourceRefInjectTargetKey, Boolean.TRUE);
                        }
                    }
                }
            } else {
                webApp.getResourceRef().add(srcResourceRef);
                mergeContext.setAttribute(resourceRefKey, new MergeItem(srcResourceRef, mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
                for (InjectionTarget injectionTarget : srcResourceRef.getInjectionTarget()) {
                    mergeContext.setAttribute(createResourceRefInjectTargetKey(resourceRefName, injectionTarget.getInjectionTargetClass(), injectionTarget.getInjectionTargetName()
                            ), Boolean.TRUE);
                }
            }
View Full Code Here

    @Override
    public void preProcessWebXmlElement(WebApp webApp, MergeContext mergeContext) throws DeploymentException {
        for (ResourceRef resourceRef : webApp.getResourceRef()) {
            String resourceRefName = resourceRef.getResRefName();
            mergeContext.setAttribute(createResourceRefKey(resourceRefName), new MergeItem(resourceRef, null, ElementSource.WEB_XML));
            //Create an attribute tag to indicate whether injectTarget is configured in web.xml file
            if (!resourceRef.getInjectionTarget().isEmpty()) {
                mergeContext.setAttribute(createResourceRefInjectTargetConfiguredInWebXMLKey(resourceRefName), Boolean.TRUE);
            }
            for (InjectionTarget injectionTarget : resourceRef.getInjectionTarget()) {
View Full Code Here

    public void merge(WebFragment webFragment, WebApp webApp, MergeContext mergeContext) throws DeploymentException {
        LocaleEncodingMappingList targetLocaleEncodingMappingList = webApp.getLocaleEncodingMappingList().isEmpty() ? null: webApp.getLocaleEncodingMappingList().get(0);
        for (LocaleEncodingMappingList localeEncodingMappingList : webFragment.getLocaleEncodingMappingList()) {
            for (LocaleEncodingMapping localeEncodingMapping : localeEncodingMappingList.getLocaleEncodingMapping()) {
                String localeEncodingMappingKey = createLocaleEncodingMappingKey(localeEncodingMapping.getLocale());
                MergeItem mergeItem = (MergeItem) mergeContext.getAttribute(localeEncodingMappingKey);
                if (mergeItem != null && mergeItem.isFromWebFragment() && !mergeItem.getValue().equals(localeEncodingMapping.getEncoding())) {
                    throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateKeyValueMessage("locale-encoding-mapping", "locale", localeEncodingMapping.getLocale(), "encoding",
                            (String) mergeItem.getValue(), mergeItem.getBelongedURL(), localeEncodingMapping.getLocale(), mergeContext.getCurrentJarUrl()));
                }
                if (targetLocaleEncodingMappingList == null) {
                    targetLocaleEncodingMappingList = new LocaleEncodingMappingList();
                    webApp.getLocaleEncodingMappingList().add(targetLocaleEncodingMappingList);
                }
                targetLocaleEncodingMappingList.getLocaleEncodingMapping().add(localeEncodingMapping);
                mergeContext.setAttribute(localeEncodingMappingKey, new MergeItem(localeEncodingMapping.getEncoding(), mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
            }
        }
    }
View Full Code Here

        }
        if (targetLocaleEncodingMappingList != null) {
            webApp.getLocaleEncodingMappingList().clear();
            webApp.getLocaleEncodingMappingList().add(targetLocaleEncodingMappingList);
            for (LocaleEncodingMapping localeEncodingMapping : targetLocaleEncodingMappingList.getLocaleEncodingMapping()) {
                context.setAttribute(createLocaleEncodingMappingKey(localeEncodingMapping.getLocale()), new MergeItem(localeEncodingMapping.getEncoding(), null, ElementSource.WEB_XML));
            }
        }
    }
View Full Code Here

    @Override
    public void merge(WebFragment webFragment, WebApp webApp, MergeContext mergeContext) throws DeploymentException {
        for (PersistenceContextRef srcPersistenceContextRef : webFragment.getPersistenceContextRef()) {
            String persistenceContextRefName = srcPersistenceContextRef.getPersistenceContextRefName();
            String persistenceContextRefKey = createPersistenceContextRefKey(persistenceContextRefName);
            MergeItem mergeItem = (MergeItem) mergeContext.getAttribute(persistenceContextRefKey);
            if (mergeItem != null) {
                if (mergeItem.isFromWebFragment()) {
                    throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateJNDIRefMessage("persistence-context-ref", persistenceContextRefName, mergeItem.getBelongedURL(), mergeContext.getCurrentJarUrl()));
                } else if (mergeItem.isFromWebXml() && !isPersistenceContextRefInjectTargetsConfiguredInInitialWebXML(persistenceContextRefName, mergeContext)) {
                    //Merge InjectTarget
                    PersistenceContextRef persistenceContextRef = (PersistenceContextRef) mergeItem.getValue();
                    for (InjectionTarget injectTarget : srcPersistenceContextRef.getInjectionTarget()) {
                        String persistenceContextRefInjectTargetKey = createPersistenceContextRefInjectTargetKey(persistenceContextRefName, injectTarget.getInjectionTargetClass(), injectTarget
                                .getInjectionTargetName());
                        if (!mergeContext.containsAttribute(persistenceContextRefInjectTargetKey)) {
                            persistenceContextRef.getInjectionTarget().add(injectTarget);
                            mergeContext.setAttribute(persistenceContextRefInjectTargetKey, Boolean.TRUE);
                        }
                    }
                }
            } else {
                webApp.getPersistenceContextRef().add(srcPersistenceContextRef);
                mergeContext.setAttribute(persistenceContextRefKey, new MergeItem(srcPersistenceContextRef, mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
                for (InjectionTarget injectionTarget : srcPersistenceContextRef.getInjectionTarget()) {
                    mergeContext.setAttribute(createPersistenceContextRefInjectTargetKey(persistenceContextRefName, injectionTarget.getInjectionTargetClass(), injectionTarget.getInjectionTargetName()
                            ), Boolean.TRUE);
                }
            }
View Full Code Here

    @Override
    public void preProcessWebXmlElement(WebApp webApp, MergeContext mergeContext) throws DeploymentException {
        for (PersistenceContextRef persistenceContextRef : webApp.getPersistenceContextRef()) {
            String persistenceContextRefName = persistenceContextRef.getPersistenceContextRefName();
            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.getInjectionTarget().isEmpty()) {
                mergeContext.setAttribute(createPersistenceContextRefInjectTargetConfiguredInWebXMLKey(persistenceContextRefName), Boolean.TRUE);
            }
            for (InjectionTarget injectionTarget : persistenceContextRef.getInjectionTarget()) {
View Full Code Here

public class ErrorPageMergeHandler implements WebFragmentMergeHandler<WebFragment, WebApp> {

    @Override
    public void merge(WebFragment webFragment, WebApp webApp, MergeContext mergeContext) throws DeploymentException {
        for (ErrorPage errorPage : webFragment.getErrorPage()) {
            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())) {
                    boolean isErrorCodeConfigured = errorPage.getErrorCode() != null;
                    throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateKeyValueMessage("error-page",
                            isErrorCodeConfigured ? "error-code" : "exception-type",
                            isErrorCodeConfigured ? "" + errorPage.getErrorCode() : errorPage.getExceptionType(),
                            "location",
                            (String) mergeItem.getValue(), mergeItem.getBelongedURL(),
                            errorPage.getLocation(),
                            mergeContext.getCurrentJarUrl()));
                }
            } else {
                webApp.getErrorPage().add(errorPage);
                mergeContext.setAttribute(createErrorPageKey(errorPage), new MergeItem(errorPage.getLocation(), mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
            }
        }
    }
View Full Code Here

    }

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

        if (webApp.getJspConfig().size() > 1) {
            throw new DeploymentException(WebDeploymentMessageUtils.createMultipleConfigurationWebAppErrorMessage("jsp-config"));
        }
        JspConfig jspConfig = webApp.getJspConfig().get(0);
        for (Taglib taglib : jspConfig.getTaglib()) {
            context.setAttribute(createTaglibKey(taglib), new MergeItem(taglib.getTaglibLocation(), null, ElementSource.WEB_XML));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.web25.deployment.DefaultWebAppInfoFactory

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.