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");
resourceRef.setResAuth(resAuth);
} else if (annotation.authenticationType() == Resource.AuthenticationType.APPLICATION) {
ResAuthType resAuth = resourceRef.addNewResAuth();
resAuth.setStringValue("Application");
resourceRef.setResAuth(resAuth);
}
// sharing scope
ResSharingScopeType resScope = resourceRef.addNewResSharingScope();
resScope.setStringValue(annotation.shareable() ? "Shareable" : "Unshareable");
resourceRef.setResSharingScope(resScope);
// mappedName
String mappdedNameAnnotation = annotation.mappedName();
if (!mappdedNameAnnotation.equals("")) {
XsdStringType mappedName = resourceRef.addNewMappedName();
mappedName.setStringValue(mappdedNameAnnotation);
resourceRef.setMappedName(mappedName);
}
}
catch (Exception anyException) {
log.debug("ResourceRefBuilder: Exception caught while processing <resource-ref>");