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);
}
}
}