resourceType.endsWith("ConnectionFactory") ||
isManagedBeanReference(resourceTypeClass, annotation)) {
log.debug("processResource(): <resource-ref> found");
ResourceRef resourceRef = annotatedApp.getResourceRefMap().get(getJndiName(resourceName));
if (resourceRef == null) {
try {
log.debug("processResource(): Does not exist in DD: " + resourceName);
// Doesn't exist in deployment descriptor -- add new
resourceRef = new ResourceRef();
//------------------------------------------------------------------------------
// <resource-ref> required elements:
//------------------------------------------------------------------------------
// resource-ref-name
resourceRef.setResRefName(resourceName);
if (!resourceType.isEmpty()) {
// resource-ref-type
resourceRef.setResType(resourceType);
}
//------------------------------------------------------------------------------
// <resource-ref> optional elements:
//------------------------------------------------------------------------------
// description
String descriptionAnnotation = annotation.description();
if (!descriptionAnnotation.equals("")) {
resourceRef.setDescriptions(new Text[]{new Text(null, descriptionAnnotation)});
}
// authentication
if (annotation.authenticationType() == Resource.AuthenticationType.CONTAINER) {
resourceRef.setResAuth(ResAuth.CONTAINER);
} else if (annotation.authenticationType() == Resource.AuthenticationType.APPLICATION) {
resourceRef.setResAuth(ResAuth.APPLICATION);
}
// sharing scope
resourceRef.setResSharingScope(annotation.shareable() ? ResSharingScope.SHAREABLE : ResSharingScope.UNSHAREABLE);
// mappedName
String mappdedNameAnnotation = annotation.mappedName();
if (!mappdedNameAnnotation.equals("")) {
resourceRef.setMappedName(mappdedNameAnnotation);
}
// lookup
String lookup = annotation.lookup();
if (!lookup.equals("")) {
resourceRef.setLookupName(lookup);
}
annotatedApp.getResourceRef().add(resourceRef);
}
catch (Exception anyException) {
log.debug("ResourceRefBuilder: Exception caught while processing <resource-ref>");
}
}
if (method != null || field != null) {
Set<InjectionTarget> targets = resourceRef.getInjectionTarget();
if (!hasTarget(method, field, targets)) {
resourceRef.getInjectionTarget().add(configureInjectionTarget(method, field));
}
}
return true;
}