try {
log.debug("processResource(): Does not exist in DD: " + resourceName);
// Doesn't exist in deployment descriptor -- add new
ResourceRefType resourceRef = annotatedApp.addNewResourceRef();
//------------------------------------------------------------------------------
// <resource-ref> required elements:
//------------------------------------------------------------------------------
// resource-ref-name
JndiNameType resourceRefName = resourceRef.addNewResRefName();
resourceRefName.setStringValue(resourceName);
if (!resourceType.equals("")) {
// resource-ref-type
FullyQualifiedClassType qualifiedClass = resourceRef.addNewResType();
qualifiedClass.setStringValue(resourceType);
}
if (method != null || field != null) {
// injectionTarget
InjectionTargetType injectionTarget = resourceRef.addNewInjectionTarget();
configureInjectionTarget(injectionTarget, method, field);
}
//------------------------------------------------------------------------------
// <resource-ref> optional elements:
//------------------------------------------------------------------------------
// description
String descriptionAnnotation = annotation.description();
if (!descriptionAnnotation.equals("")) {
DescriptionType description = resourceRef.addNewDescription();
description.setStringValue(descriptionAnnotation);
}
// authentication
if (annotation.authenticationType() == Resource.AuthenticationType.CONTAINER) {
ResAuthType resAuth = resourceRef.addNewResAuth();
resAuth.setStringValue("Container");
} else if (annotation.authenticationType() == Resource.AuthenticationType.APPLICATION) {
ResAuthType resAuth = resourceRef.addNewResAuth();
resAuth.setStringValue("Application");
}
// sharing scope
ResSharingScopeType resScope = resourceRef.addNewResSharingScope();
resScope.setStringValue(annotation.shareable() ? "Shareable" : "Unshareable");
// mappedName
String mappdedNameAnnotation = annotation.mappedName();
if (!mappdedNameAnnotation.equals("")) {
XsdStringType mappedName = resourceRef.addNewMappedName();
mappedName.setStringValue(mappdedNameAnnotation);
}
// lookup
String lookup = annotation.lookup();
if (!lookup.equals("")) {
XsdStringType lookupName = resourceRef.addNewLookupName();
lookupName.setStringValue(lookup);
}
}
catch (Exception anyException) {
log.debug("ResourceRefBuilder: Exception caught while processing <resource-ref>");