Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.MessageDestinationRef


            String name = entry.getKey();
            if (lookupJndiContextMap(module, name) != null) {
                // some other builder handled this entry already
                continue;
            }
            MessageDestinationRef messageDestinationRef = entry.getValue();
            String linkName = getStringValue(messageDestinationRef.getMessageDestinationLink());
            //TODO figure out something better to do here!
            if (linkName == null) {
                linkName = name;
            }
            String type = getStringValue(messageDestinationRef.getMessageDestinationType());
            type = inferAndCheckType(module, bundle, messageDestinationRef.getInjectionTarget(), name, type);

            GerMessageDestinationType destination = getMessageDestination(linkName, messageDestinations);

            Object value = null;
            if (destination == null) {
                String lookupName = getStringValue(messageDestinationRef.getLookupName());
                if (lookupName != null) {
                    if (lookupName.equals(getJndiName(name))) {
                        throw new DeploymentException("message-destination-ref lookup name refers to itself");
                    }
                    value = new JndiReference(lookupName);
                }
            }

            if (value == null) {
                value = buildMessageReference(module, linkName, type, destination);
            }

            if (value != null) {
                put(name, value, ReferenceType.RESOURCE_ENV, module.getJndiContext(), messageDestinationRef.getInjectionTarget(), sharedContext);
            }
        }

    }
View Full Code Here


            String resourceType = getResourceType(annotation, method, field);

            String jndiName = getJndiName(resourceName);

            //If it already exists in xml as a message-destination-ref or resource-env-ref, we are done.
            MessageDestinationRef messageDestinationRef = annotatedApp.getMessageDestinationRefMap().get(jndiName);
            if (messageDestinationRef != null) {
                if (method != null || field != null) {
                    Set<InjectionTarget> targets = messageDestinationRef.getInjectionTarget();
                    if (!hasTarget(method, field, targets)) {
                        messageDestinationRef.getInjectionTarget().add(configureInjectionTarget(method, field));
                    }
                }
                return true;
            }
View Full Code Here

            }
            annotatedApp.getResourceEnvRef().add(resourceEnvRef);
        }

        private void addMethodDestinationRef(JndiConsumer annotatedApp, String resourceName, String resourceType, Method method, Field field, Resource annotation) {
            MessageDestinationRef messageDestinationRef = new MessageDestinationRef();

            //------------------------------------------------------------------------------
            // <message-destination-ref> required elements:
            //------------------------------------------------------------------------------

            // message-destination-ref-name
            messageDestinationRef.setMessageDestinationRefName(resourceName);

            if (!resourceType.isEmpty()) {
                // message-destination-ref-type
                messageDestinationRef.setMessageDestinationType(resourceType);
            }
            if (method != null || field != null) {
                // injectionTarget
                messageDestinationRef.getInjectionTarget().add(configureInjectionTarget(method, field));
            }

            //------------------------------------------------------------------------------
            // <message-destination-ref> optional elements:
            //------------------------------------------------------------------------------

            // description
            String descriptionAnnotation = annotation.description();
            if (!descriptionAnnotation.isEmpty()) {
                messageDestinationRef.setDescriptions(new Text[]{new Text(null, descriptionAnnotation)});
            }

            // mappedName
            String mappdedNameAnnotation = annotation.mappedName();
            if (!mappdedNameAnnotation.isEmpty()) {
                messageDestinationRef.setMappedName(mappdedNameAnnotation);
            }

            // lookup
            String lookup = annotation.lookup();
            if (!lookup.isEmpty()) {
                messageDestinationRef.setLookupName(lookup);
            }
            annotatedApp.getMessageDestinationRef().add(messageDestinationRef);
        }
View Full Code Here

            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
                    MessageDestinationRef messageDestinationRef = (MessageDestinationRef) mergeItem.getValue();
                    for (InjectionTarget injectTarget : srcMessageDestinationRef.getInjectionTarget()) {
                        String messageDestinationRefInjectTargetKey = createMessageDestinationRefInjectTargetKey(messageDestinationRefName, injectTarget.getInjectionTargetClass(), injectTarget
                                .getInjectionTargetName());
                        if (!mergeContext.containsAttribute(messageDestinationRefInjectTargetKey)) {
                            messageDestinationRef.getInjectionTarget().add(injectTarget);
                            mergeContext.setAttribute(messageDestinationRefInjectTargetKey, Boolean.TRUE);
                        }
                    }
                }
            } else {
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.MessageDestinationRef

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.