private String resolveDestinationId(MessageDestinationRef ref, URI moduleUri, LinkResolver<MessageDestination> destinationResolver, Map<MessageDestination,String> destinationTypes) throws OpenEJBException { // skip destination refs without a destination link String link = ref.getMessageDestinationLink(); if (link == null || link.length() == 0) { return null; } // resolve the destination... if we don't find one it is a configuration bug MessageDestination destination = destinationResolver.resolveLink(link, moduleUri); if (destination == null) { throw new OpenEJBException("Message destination " + link + " for message-destination-ref " + ref.getMessageDestinationRefName() + " not found"); } // remember the type of each destination so we can use it to fillin MDBs that don't declare destination type if (ref.getMessageDestinationType() != null && !destinationTypes.containsKey(destination)) { destinationTypes.put(destination, ref.getMessageDestinationType()); } // get the destinationId String destinationId = destination.getMappedName(); if (destinationId == null) destination.getMessageDestinationName(); return destinationId; }
public String getKey() { return getName(); }
public MessageDestinationRef injectionTarget(final String className, final String property) { getInjectionTarget().add(new InjectionTarget(className, property)); // TODO move this to getKey() if (this.messageDestinationRefName == null) { this.messageDestinationRefName = "java:comp/env/" + className + "/" + property; } return this; }
String mappedName = ref.getMappedName() + ""; if (mappedName.startsWith("jndi:")){ continue; String destinationId = (mappedName.length() == 0) ? ref.getName() : mappedName; destinationId = getResourceEnvId(moduleId, destinationId, ref.getType(), appResources); ref.setMappedName(destinationId);
private void addMethodDestinationRef(JndiConsumer annotatedApp, String resourceName, String resourceType, Method method, Field field, Resource annotation) { MessageDestinationRef messageDestinationRef = new MessageDestinationRef(); messageDestinationRef.setMessageDestinationRefName(resourceName); messageDestinationRef.setMessageDestinationType(resourceType); messageDestinationRef.getInjectionTarget().add(configureInjectionTarget(method, field)); messageDestinationRef.setDescriptions(new Text[]{new Text(null, descriptionAnnotation)}); messageDestinationRef.setMappedName(mappdedNameAnnotation); messageDestinationRef.setLookupName(lookup);
private List<ResourceEnvReferenceInfo> buildResourceEnvRefInfos(JndiConsumer item) { List<ResourceEnvReferenceInfo> infos = new ArrayList<ResourceEnvReferenceInfo>(); for (ResourceEnvRef res : item.getResourceEnvRef()) { ResourceEnvReferenceInfo info = new ResourceEnvReferenceInfo(); info.resourceEnvRefName = res.getResourceEnvRefName(); info.resourceEnvRefType = res.getResourceEnvRefType(); info.resourceID = res.getMappedName(); info.location = buildLocationInfo(res); info.targets.addAll(buildInjectionInfos(res)); infos.add(info); } for (MessageDestinationRef res : item.getMessageDestinationRef()) { ResourceEnvReferenceInfo info = new ResourceEnvReferenceInfo(); info.resourceEnvRefName = res.getMessageDestinationRefName(); info.resourceEnvRefType = res.getMessageDestinationType(); info.resourceID = res.getMappedName(); info.location = buildLocationInfo(res); info.targets.addAll(buildInjectionInfos(res)); infos.add(info); } return infos; }
if (ref.getMappedName() == null && ejbDeployment.getResourceLink(ref.getName()) == null) { String destinationId = resolveDestinationId(ref, moduleUri, destinationResolver, destinationTypes); if (destinationId != null) { resourceLink.setResRefName(ref.getName()); ejbDeployment.addResourceLink(resourceLink); if (destinationId != null) { ref.setMappedName(destinationId); if (destinationId != null) { ref.setMappedName(destinationId);
String linkName = getStringValue(messageDestinationRef.getMessageDestinationLink()); String type = getStringValue(messageDestinationRef.getMessageDestinationType()); type = inferAndCheckType(module, bundle, messageDestinationRef.getInjectionTarget(), name, type); String lookupName = getStringValue(messageDestinationRef.getLookupName()); if (lookupName != null) { if (lookupName.equals(getJndiName(name))) { put(name, value, ReferenceType.RESOURCE_ENV, module.getJndiContext(), messageDestinationRef.getInjectionTarget(), sharedContext);
final String refName = ref.getMessageDestinationRefName(); ref.setMappedName(MAPPED_NAME_PREFIX + refName);
final ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName()); if (resourceLink != null && resourceLink.getResId() != null /* don't overwrite with null */) { ref.setMappedName(resourceLink.getResId());
@Override public void preProcessWebXmlElement(WebApp webApp, MergeContext mergeContext) throws DeploymentException { for (MessageDestinationRef messageDestinationRef : webApp.getMessageDestinationRef()) { String messageDestinationRefName = messageDestinationRef.getMessageDestinationRefName(); 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.getInjectionTarget().isEmpty()) { mergeContext.setAttribute(createMessageDestinationRefInjectTargetConfiguredInWebXMLKey(messageDestinationRefName), Boolean.TRUE); } for (InjectionTarget injectionTarget : messageDestinationRef.getInjectionTarget()) { mergeContext.setAttribute(createMessageDestinationRefInjectTargetKey(messageDestinationRefName, injectionTarget.getInjectionTargetClass(), injectionTarget.getInjectionTargetName() ), Boolean.TRUE); } } }
@XmlTransient public String getType() { return getMessageDestinationType(); }
@XmlTransient public String getName() { return getMessageDestinationRefName(); }
ref.setMappedName(null); ref.getInjectionTarget().clear();
public void setType(final String type) { setMessageDestinationType(type); }
public void setName(String name) { setMessageDestinationRefName(name); }
if (ref.getLookupName() != null) { continue; final String mappedName = ref.getMappedName() == null ? "" : ref.getMappedName(); if (mappedName.startsWith("jndi:")) { continue; String destinationId = mappedName.length() == 0 ? ref.getName() : mappedName; destinationId = getResourceEnvId(moduleId, destinationId, ref.getType(), appResources); ref.setMappedName(destinationId);
info.referenceName = res.getMessageDestinationRefName(); info.resourceEnvRefType = res.getMessageDestinationType(); info.resourceID = res.getMappedName(); info.location = buildLocationInfo(res); info.targets.addAll(buildInjectionInfos(res));
if (ref.getMappedName() == null && ejbDeployment.getResourceLink(ref.getName()) == null) { final String destinationId = resolveDestinationId(ref, moduleUri, destinationResolver, destinationTypes); if (destinationId != null) { resourceLink.setResRefName(ref.getName()); ejbDeployment.addResourceLink(resourceLink); if (destinationId != null) { ref.setMappedName(destinationId); if (destinationId != null) { ref.setMappedName(destinationId);
String refName = ref.getMessageDestinationRefName(); ref.setMappedName(MAPPED_NAME_PREFIX + refName);