log.debug("addEJB(): <ejb-local-ref> found");
String localRefName = getName(annotation.name(), method, field);
EjbLocalRef ejbLocalRef = annotatedApp.getEjbLocalRefMap().get(getJndiName(localRefName));
if (ejbLocalRef == null) {
try {
log.debug("addEJB(): Does not exist in DD: " + localRefName);
// Doesn't exist in deployment descriptor -- add new
ejbLocalRef = new EjbLocalRef();
//------------------------------------------------------------------------------
// <ejb-local-ref> required elements:
//------------------------------------------------------------------------------
// ejb-ref-name
ejbLocalRef.setEjbRefName(localRefName);
//------------------------------------------------------------------------------
// <ejb-local-ref> optional elements:
//------------------------------------------------------------------------------
// local
if (interfce != null) {
String localAnnotation = interfce.getName();
if (!localAnnotation.isEmpty()) {
ejbLocalRef.setLocal(localAnnotation);
}
}
// ejb-link
String beanName = annotation.beanName();
if (!beanName.isEmpty()) {
ejbLocalRef.setEjbLink(beanName);
}
// mappedName
String mappdedNameAnnotation = annotation.mappedName();
if (!mappdedNameAnnotation.isEmpty()) {
ejbLocalRef.setMappedName(mappdedNameAnnotation);
}
// lookup
String lookupName = annotation.lookup();
if (!lookupName.isEmpty()) {
ejbLocalRef.setLookupName(lookupName);
}
// description
String descriptionAnnotation = annotation.description();
if (!descriptionAnnotation.isEmpty()) {
ejbLocalRef.setDescriptions(new Text[] {new Text(null, descriptionAnnotation)});
}
ejbLocalRef.setRefType(EjbReference.Type.LOCAL);
annotatedApp.getEjbLocalRef().add(ejbLocalRef);
}
catch (Exception e) {
log.debug("EJBAnnotationHelper: Exception caught while processing <ejb-local-ref>", e);
}
}
// injectionTarget
if (method != null || field != null) {
Set<InjectionTarget> targets = ejbLocalRef.getInjectionTarget();
if (!hasTarget(method, field, targets)) {
ejbLocalRef.getInjectionTarget().add(configureInjectionTarget(method, field));
}
}
} // end if local
else if (remoteFlag) { // remote