public void merge(MessageDestinationRef msgDestRef) throws InjectionException
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "merge", msgDestRef);

        ResourceImpl curAnnotation = (ResourceImpl) this.getAnnotation();
        String jndiName = msgDestRef.getName();
        String curJndiName = curAnnotation.name();
        String mappedName = msgDestRef.getMappedName();
        String curMappedName = curAnnotation.mappedName();
        String typeName = msgDestRef.getType();
        //The link parameter is "optional"
        String link = msgDestRef.getLink();
        String curLink = this.ivLink;
        String lookup = msgDestRef.getLookupName(); // F743-21028.4
        if (lookup != null) {
            lookup = lookup.trim();
        }

        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, "new=" + jndiName + ":" + mappedName + ":" + typeName + ":" + link + ":" + lookup);

        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, "cur=" + curJndiName + ":" + curMappedName + ":" + getInjectionClassTypeName() + ":" + curLink + ":" + ivLookup);

        //The mappedName parameter is "optional"
        if (curAnnotation.ivIsSetMappedName && mappedName != null)
        {
            if (!curMappedName.equals(mappedName))
            {
                Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
                         ivComponent,
                         ivModule,
                         ivApplication,
                         "mapped-name",
                         "message-destination-ref",
                         "message-destination-ref-name",
                         getJndiName(),
                         curMappedName,
                         mappedName); // d479669
                String exMsg = "The " + ivComponent + " bean in the " +
                               ivModule + " module of the " + ivApplication +
                               " application has conflicting configuration data in the XML" +
                               " deployment descriptor. Conflicting " + "mapped-name" +
                               " element values exist for multiple " + "message-destination-ref" +
                               " elements with the same " + "message-destination-ref-name" +
                               " element value : " +
                               getJndiName() + ". The conflicting " + "mapped-name" +
                               " element values are " + curMappedName + " and " +
                               mappedName + "."; // d479669
                throw new InjectionConfigurationException(exMsg);
            }
        }
        else if (mappedName != null && !curAnnotation.ivIsSetMappedName)
        {
            curAnnotation.ivMappedName = mappedName;
            curAnnotation.ivIsSetMappedName = true;
        }

        setXMLType(typeName,
                   "message-destination-ref",
                   "message-destination-ref-name",
                   "message-destination-type"); // F743-32443

        //The link parameter is "optional"
        if (curLink != null && link != null)
        {
            if (!curLink.equals(link))
            {
                Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
                         ivComponent,
                         ivModule,
                         ivApplication,
                         "message-destination-link",
                         "message-destination-ref",
                         "message-destination-ref-name",
                         getJndiName(),
                         curLink,
                         link); // d479669
                String exMsg = "The " + ivComponent + " bean in the " +
                               ivModule + " module of the " + ivApplication +
                               " application has conflicting configuration data in the XML" +
                               " deployment descriptor. Conflicting " + "message-destination-link" +
                               " element values exist for multiple " + "message-destination-ref" +
                               " elements with the same " + "message-destination-ref-name" + " element value : " +
                               getJndiName() + ". The conflicting " + "message-destination-link" +
                               " element values are " + curLink + " and " +
                               link + "."; // d479669
                throw new InjectionConfigurationException(exMsg);
            }
        }
        else if (link != null && curLink == null)
        {
            this.ivLink = link;
        }

        // -----------------------------------------------------------------------
        // Merge : lookup - "optional parameter                       F743-21028.4
        //
        // If present in XML, even if the empty string (""), it will override
        // any setting via annotations. An empty string would effectivly turn
        // off this setting.
        //
        // When a message-destination-ref appears multiple times in XML, an empty
        // string is considered to be a confilct with a non-empty string, since
        // both were explicitly specified.
        // -----------------------------------------------------------------------
        if (lookup != null)
        {
            if (ivLookupInXml)
            {
                if (!lookup.equals(ivLookup))
                {
                    Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
                             ivComponent,
                             ivModule,
                             ivApplication,
                             "lookup-name",
                             "message-destination-ref",
                             "message-destination-ref-name",
                             jndiName,
                             ivLookup,
                             lookup);
                    String exMsg = "The " + ivComponent + " bean in the " +
                                   ivModule + " module of the " + ivApplication +
                                   " application has conflicting configuration data in the XML" +
                                   " deployment descriptor. Conflicting " + "lookup-name" +
                                   " element values exist for multiple " +
                                   "message-destination-ref" + " elements with the same " +
                                   "message-destination-ref-name" +
                                   " element value : " + jndiName + ". The conflicting " +
                                   "lookup-name" + " element values are \"" + ivLookup +
                                   "\" and \"" + lookup + "\".";
                    throw new InjectionConfigurationException(exMsg);
                }
            }
            else
            {
                ivLookup = lookup;
                ivLookupInXml = true;
                curAnnotation.ivLookup = lookup;
                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "ivLookup = " + ivLookup);
            }
        }

        //Loop through the InjectionTargets and call addInjectionTarget.... which
        //already accounts for duplicates (in case they duplicated some between the two ref definitions.
        List<InjectionTarget> targets = msgDestRef.getInjectionTargets();
        String targetName = null;
        String targetClassName = null;

        Class<?> injectionType = getInjectionClassType();
        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, "targetType : " + injectionType);

        if (!targets.isEmpty())
        {
            for (InjectionTarget target : targets)
            {
                targetClassName = target.getInjectionTargetClassName();
                targetName = target.getInjectionTargetName();
                this.addInjectionTarget(injectionType, targetName, targetClassName);
            } //for loop
        } //targets !null

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "merge", this);
    }
public void merge ( MessageDestinationRef msgDestRef ) throws InjectionException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "merge" , msgDestRef ) ; ResourceImpl curAnnotation = ( ResourceImpl ) this . getAnnotation ( ) ; String jndiName = msgDestRef . getName ( ) ; String curJndiName = curAnnotation . name ( ) ; String mappedName = msgDestRef . getMappedName ( ) ; String curMappedName = curAnnotation . mappedName ( ) ; String typeName = msgDestRef . getType ( ) ; String link = msgDestRef . getLink ( ) ; String curLink = this . ivLink ; String lookup = msgDestRef . getLookupName ( ) ; if ( lookup != null ) { lookup = lookup . trim ( ) ; } if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "new=" + jndiName + ":" + mappedName + ":" + typeName + ":" + link + ":" + lookup ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "cur=" + curJndiName + ":" + curMappedName + ":" + getInjectionClassTypeName ( ) + ":" + curLink + ":" + ivLookup ) ; if ( curAnnotation . ivIsSetMappedName && mappedName != null ) { if ( ! curMappedName . equals ( mappedName ) ) { Tr . error ( tc , "CONFLICTING_XML_VALUES_CWNEN0052E" , ivComponent , ivModule , ivApplication , "mapped-name" , "message-destination-ref" , "message-destination-ref-name" , getJndiName ( ) , curMappedName , mappedName ) ; String exMsg = "The " + ivComponent + " bean in the " + ivModule + " module of the " + ivApplication + " application has conflicting configuration data in the XML" + " deployment descriptor. Conflicting " + "mapped-name" + " element values exist for multiple " + "message-destination-ref" + " elements with the same " + "message-destination-ref-name" + " element value : " + getJndiName ( ) + ". The conflicting " + "mapped-name" + " element values are " + curMappedName + " and " + mappedName + "." ; throw new InjectionConfigurationException ( exMsg ) ; } } else if ( mappedName != null && ! curAnnotation . ivIsSetMappedName ) { curAnnotation . ivMappedName = mappedName ; curAnnotation . ivIsSetMappedName = true ; } setXMLType ( typeName , "message-destination-ref" , "message-destination-ref-name" , "message-destination-type" ) ; if ( curLink != null && link != null ) { if ( ! curLink . equals ( link ) ) { Tr . error ( tc , "CONFLICTING_XML_VALUES_CWNEN0052E" , ivComponent , ivModule , ivApplication , "message-destination-link" , "message-destination-ref" , "message-destination-ref-name" , getJndiName ( ) , curLink , link ) ; String exMsg = "The " + ivComponent + " bean in the " + ivModule + " module of the " + ivApplication + " application has conflicting configuration data in the XML" + " deployment descriptor. Conflicting " + "message-destination-link" + " element values exist for multiple " + "message-destination-ref" + " elements with the same " + "message-destination-ref-name" + " element value : " + getJndiName ( ) + ". The conflicting " + "message-destination-link" + " element values are " + curLink + " and " + link + "." ; throw new InjectionConfigurationException ( exMsg ) ; } } else if ( link != null && curLink == null ) { this . ivLink = link ; } if ( lookup != null ) { if ( ivLookupInXml ) { if ( ! lookup . equals ( ivLookup ) ) { Tr . error ( tc , "CONFLICTING_XML_VALUES_CWNEN0052E" , ivComponent , ivModule , ivApplication , "lookup-name" , "message-destination-ref" , "message-destination-ref-name" , jndiName , ivLookup , lookup ) ; String exMsg = "The " + ivComponent + " bean in the " + ivModule + " module of the " + ivApplication + " application has conflicting configuration data in the XML" + " deployment descriptor. Conflicting " + "lookup-name" + " element values exist for multiple " + "message-destination-ref" + " elements with the same " + "message-destination-ref-name" + " element value : " + jndiName + ". The conflicting " + "lookup-name" + " element values are \"" + ivLookup + "\" and \"" + lookup + "\"." ; throw new InjectionConfigurationException ( exMsg ) ; } } else { ivLookup = lookup ; ivLookupInXml = true ; curAnnotation . ivLookup = lookup ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "ivLookup = " + ivLookup ) ; } } List < InjectionTarget > targets = msgDestRef . getInjectionTargets ( ) ; String targetName = null ; String targetClassName = null ; Class < ? > injectionType = getInjectionClassType ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "targetType : " + injectionType ) ; if ( ! targets . isEmpty ( ) ) { for ( InjectionTarget target : targets ) { targetClassName = target . getInjectionTargetClassName ( ) ; targetName = target . getInjectionTargetName ( ) ; this . addInjectionTarget ( injectionType , targetName , targetClassName ) ; } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "merge" , this ) ; }
Extract the fields from the MessageDestinationRef, and verify they match the values in the current
binding object and/or annotation exactly. If they do indeed match, add all the
InjectionTargets on the MessageDestinationRef parameter to the current binding. The code takes into
account the possibility of duplicates InjectionTargets and will only use one in case
where they duplicated between the two ref definitions.

@param msgDestRef
@throws InjectionException