Package org.apache.geronimo.web25.deployment

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


    @Override
    public void merge(WebFragment webFragment, WebApp webApp, MergeContext mergeContext) throws DeploymentException {
        for (EnvEntry srcEnvEntry : webFragment.getEnvEntry()) {
            String envEntryName = srcEnvEntry.getEnvEntryName();
            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
                    EnvEntry envEntry = (EnvEntry) mergeItem.getValue();
                    for (InjectionTarget injectTarget : srcEnvEntry.getInjectionTarget()) {
                        String envEntryInjectTargetKey = createEnvEntryInjectTargetKey(envEntryName, injectTarget.getInjectionTargetClass(), injectTarget
                                .getInjectionTargetName());
                        if (!mergeContext.containsAttribute(envEntryInjectTargetKey)) {
                            envEntry.getInjectionTarget().add(injectTarget);
                            mergeContext.setAttribute(envEntryInjectTargetKey, Boolean.TRUE);
                        }
                    }
                }
            } else {
                webApp.getEnvEntry().add(srcEnvEntry);
                mergeContext.setAttribute(envEntryKey, new MergeItem(srcEnvEntry, mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
                for (InjectionTarget injectionTarget : srcEnvEntry.getInjectionTarget()) {
                    mergeContext.setAttribute(createEnvEntryInjectTargetKey(envEntryName, injectionTarget.getInjectionTargetClass(), injectionTarget.getInjectionTargetName()
                            ), Boolean.TRUE);
                }
            }
View Full Code Here


    @Override
    public void preProcessWebXmlElement(WebApp webApp, MergeContext mergeContext) throws DeploymentException {
        for (EnvEntry envEntry : webApp.getEnvEntry()) {
            String envEntryName = envEntry.getEnvEntryName();
            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.getInjectionTarget().size() > 0) {
                mergeContext.setAttribute(createEnvEntryInjectTargetConfiguredInWebXMLKey(envEntryName), Boolean.TRUE);
            }
            for (InjectionTarget injectionTarget : envEntry.getInjectionTarget()) {
View Full Code Here

    @Override
    public void merge(FilterType srcFilter, FilterType targetFilter, MergeContext mergeContext) throws DeploymentException {
        String filterName = srcFilter.getFilterName().getStringValue();
        for (ParamValueType paramValue : srcFilter.getInitParamArray()) {
            MergeItem existedMergeItem = (MergeItem) mergeContext.getAttribute(createFilterInitParamKey(filterName, paramValue.getParamName().getStringValue()));
            if (existedMergeItem == null) {
                targetFilter.addNewInitParam().set(paramValue);
                addFilterInitParam(filterName, paramValue, ElementSource.WEB_FRAGMENT, mergeContext.getCurrentJarUrl(), mergeContext);
            } else {
                ParamValueType existedParamValue = (ParamValueType) existedMergeItem.getValue();
                switch (existedMergeItem.getSourceType()) {
                case WEB_XML:
                    continue;
                case WEB_FRAGMENT:
                    if (existedParamValue.getParamValue().getStringValue().equals(paramValue.getParamValue().getStringValue())
                            || existedMergeItem.getBelongedURL().equals(mergeContext.getCurrentJarUrl())) {
                        break;
                    } else {
                        throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateKeyValueMessage("filter " + filterName, "param-name", paramValue.getParamName().getStringValue(),
                                "param-value", existedParamValue.getParamValue().getStringValue(), existedMergeItem.getBelongedURL(), paramValue.getParamValue().getStringValue(), mergeContext
                                        .getCurrentJarUrl()));
                    }
                case ANNOTATION:
                    //Spec 8.1.n.iii Init params for servlets and filters defined via annotations, will be
                    //overridden in the descriptor if the name of the init param exactly matches
                    //the name specified via the annotation. Init params are additive between the
                    //annotations and descriptors.
                    //In my understanding, the value of init-param should be overridden even if it is merged from annotation before the current web-fragment.xml file
                    existedParamValue.getParamValue().set(paramValue.getParamValue());
                    existedMergeItem.setBelongedURL(mergeContext.getCurrentJarUrl());
                    existedMergeItem.setSourceType(ElementSource.WEB_FRAGMENT);
                }
            }
        }
    }
View Full Code Here

    public static boolean isFilterInitParamConfigured(String filterName, String paramName, MergeContext mergeContext) {
        return mergeContext.containsAttribute(createFilterInitParamKey(filterName, paramName));
    }

    public static void addFilterInitParam(String filterName, ParamValueType paramValue, ElementSource source, String relativeUrl, MergeContext mergeContext) {
        mergeContext.setAttribute(createFilterInitParamKey(filterName, paramValue.getParamName().getStringValue()), new MergeItem(paramValue, relativeUrl, source));
    }
View Full Code Here

    @Override
    public void merge(WebFragmentType webFragment, WebAppType webApp, MergeContext mergeContext) throws DeploymentException {
        for (MessageDestinationRefType srcMessageDestinationRef : webFragment.getMessageDestinationRefArray()) {
            String messageDestinationRefName = srcMessageDestinationRef.getMessageDestinationRefName().getStringValue();
            String messageDestinationRefKey = createMessageDestinationRefKey(messageDestinationRefName);
            MergeItem mergeItem = (MergeItem) mergeContext.getAttribute(messageDestinationRefKey);
            if (mergeItem != null) {
                if (mergeItem.isFromWebFragment()) {
                    throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateJNDIRefMessage("message-destination-ref", messageDestinationRefName, mergeItem.getBelongedURL(), mergeContext.getCurrentJarUrl()));
                } else if (mergeItem.isFromWebXml() && !isMessageDestinationRefInjectTargetsConfiguredInInitialWebXML(messageDestinationRefName, mergeContext)) {
                    //Merge InjectTarget
                    MessageDestinationRefType messageDestinationRef = (MessageDestinationRefType) mergeItem.getValue();
                    for (InjectionTargetType injectTarget : srcMessageDestinationRef.getInjectionTargetArray()) {
                        String messageDestinationRefInjectTargetKey = createMessageDestinationRefInjectTargetKey(messageDestinationRefName, injectTarget.getInjectionTargetClass().getStringValue(), injectTarget
                                .getInjectionTargetName().getStringValue());
                        if (!mergeContext.containsAttribute(messageDestinationRefInjectTargetKey)) {
                            messageDestinationRef.addNewInjectionTarget().set(injectTarget);
                            mergeContext.setAttribute(messageDestinationRefInjectTargetKey, Boolean.TRUE);
                        }
                    }
                }
            } else {
                MessageDestinationRefType targetMessageDestinationRef = (MessageDestinationRefType) webApp.addNewMessageDestinationRef().set(srcMessageDestinationRef);
                mergeContext.setAttribute(messageDestinationRefKey, new MergeItem(targetMessageDestinationRef, mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
                for (InjectionTargetType injectionTarget : targetMessageDestinationRef.getInjectionTargetArray()) {
                    mergeContext.setAttribute(createMessageDestinationRefInjectTargetKey(messageDestinationRefName, injectionTarget.getInjectionTargetClass().getStringValue(), injectionTarget.getInjectionTargetName()
                            .getStringValue()), Boolean.TRUE);
                }
            }
View Full Code Here

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

    @Override
    public void merge(WebFragmentType webFragment, WebAppType webApp, MergeContext mergeContext) throws DeploymentException {
        for (PersistenceUnitRefType srcPersistenceUnitRef : webFragment.getPersistenceUnitRefArray()) {
            String persistenceUnitRefName = srcPersistenceUnitRef.getPersistenceUnitRefName().getStringValue();
            String persistenceUnitRefKey = createPersistenceUnitRefKey(persistenceUnitRefName);
            MergeItem mergeItem = (MergeItem) mergeContext.getAttribute(persistenceUnitRefKey);
            if (mergeItem != null) {
                if (mergeItem.isFromWebFragment()) {
                    throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateJNDIRefMessage("persistence-unit-ref", persistenceUnitRefName, mergeItem.getBelongedURL(), mergeContext.getCurrentJarUrl()));
                } else if (mergeItem.isFromWebXml() && !isPersistenceUnitRefInjectTargetsConfiguredInInitialWebXML(persistenceUnitRefName, mergeContext)) {
                    //Merge InjectTarget
                    PersistenceUnitRefType persistenceUnitRef = (PersistenceUnitRefType) mergeItem.getValue();
                    for (InjectionTargetType injectTarget : srcPersistenceUnitRef.getInjectionTargetArray()) {
                        String persistenceUnitRefInjectTargetKey = createPersistenceUnitRefInjectTargetKey(persistenceUnitRefName, injectTarget.getInjectionTargetClass().getStringValue(), injectTarget
                                .getInjectionTargetName().getStringValue());
                        if (!mergeContext.containsAttribute(persistenceUnitRefInjectTargetKey)) {
                            persistenceUnitRef.addNewInjectionTarget().set(injectTarget);
                            mergeContext.setAttribute(persistenceUnitRefInjectTargetKey, Boolean.TRUE);
                        }
                    }
                }
            } else {
                PersistenceUnitRefType targetPersistenceUnitRef = (PersistenceUnitRefType) webApp.addNewPersistenceUnitRef().set(srcPersistenceUnitRef);
                mergeContext.setAttribute(persistenceUnitRefKey, new MergeItem(targetPersistenceUnitRef, mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
                for (InjectionTargetType injectionTarget : targetPersistenceUnitRef.getInjectionTargetArray()) {
                    mergeContext.setAttribute(createPersistenceUnitRefInjectTargetKey(persistenceUnitRefName, injectionTarget.getInjectionTargetClass().getStringValue(), injectionTarget.getInjectionTargetName()
                            .getStringValue()), Boolean.TRUE);
                }
            }
View Full Code Here

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

        for (ParamValueType paramValue : webFragment.getContextParamArray()) {
            String qualifiedContextParamName = QUALIFIED_CONTEXT_PARAM_NAME_PREFIX + paramValue.getParamName().getStringValue();
            if (mergeContext.containsAttribute(qualifiedContextParamName)) {
                continue;
            }
            MergeItem existedContextParamValue = (MergeItem) mergeContext.getAttribute(qualifiedContextParamName);
            if (existedContextParamValue == null) {
                webApp.addNewContextParam().set(paramValue);
                mergeContext.setAttribute(qualifiedContextParamName, new MergeItem(paramValue.getParamValue().getStringValue(), jarUrl, ElementSource.WEB_FRAGMENT));
            } else if (!existedContextParamValue.getValue().equals(paramValue.getParamValue().getStringValue())) {
                throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateKeyValueMessage("context-param", "param-name", paramValue.getParamName().getStringValue(), "param-value",
                        existedContextParamValue.getValue().toString(), existedContextParamValue.getBelongedURL(), paramValue.getParamValue().getStringValue(), jarUrl));
            }
        }
    }
View Full Code Here

    @Override
    public void merge(WebFragmentType webFragment, WebAppType webApp, MergeContext mergeContext) throws DeploymentException {
        for (ServiceRefType srcServiceRef : webFragment.getServiceRefArray()) {
            String serviceRefName = srcServiceRef.getServiceRefName().getStringValue();
            String serviceRefKey = createServiceRefKey(serviceRefName);
            MergeItem mergeItem = (MergeItem) mergeContext.getAttribute(serviceRefKey);
            if (mergeItem != null) {
                if (mergeItem.isFromWebFragment()) {
                    throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateJNDIRefMessage("service-ref", serviceRefName, mergeItem.getBelongedURL(), mergeContext.getCurrentJarUrl()));
                } else if (mergeItem.isFromWebXml() && !isServiceRefInjectTargetsConfiguredInInitialWebXML(serviceRefName, mergeContext)) {
                    //Merge InjectTarget
                    ServiceRefType serviceRef = (ServiceRefType) mergeItem.getValue();
                    for (InjectionTargetType injectTarget : srcServiceRef.getInjectionTargetArray()) {
                        String serviceRefInjectTargetKey = createServiceRefInjectTargetKey(serviceRefName, injectTarget.getInjectionTargetClass().getStringValue(), injectTarget
                                .getInjectionTargetName().getStringValue());
                        if (!mergeContext.containsAttribute(serviceRefInjectTargetKey)) {
                            serviceRef.addNewInjectionTarget().set(injectTarget);
                            mergeContext.setAttribute(serviceRefInjectTargetKey, Boolean.TRUE);
                        }
                    }
                }
            } else {
                ServiceRefType targetServiceRef = (ServiceRefType) webApp.addNewServiceRef().set(srcServiceRef);
                mergeContext.setAttribute(serviceRefKey, new MergeItem(targetServiceRef, mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
                for (InjectionTargetType injectionTarget : targetServiceRef.getInjectionTargetArray()) {
                    mergeContext.setAttribute(createServiceRefInjectTargetKey(serviceRefName, injectionTarget.getInjectionTargetClass().getStringValue(), injectionTarget.getInjectionTargetName()
                            .getStringValue()), Boolean.TRUE);
                }
            }
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.