if (declaredEjbLocalRefs.contains(refName)) {
continue;
}
// create the ejb-ref
EjbLocalRef ref = new EjbLocalRef();
// ejb-ref-name
ref.setEjbRefName(refName);
jndiConsumer.getEjbLocalRef().add(ref);
// ejb-ref-type
String refType = getStringValue(xmlbeansRef.getEjbRefType());
if ("SESSION".equalsIgnoreCase(refType)) {
ref.setEjbRefType(org.apache.openejb.jee.EjbRefType.SESSION);
} else if ("ENTITY".equalsIgnoreCase(refType)) {
ref.setEjbRefType(org.apache.openejb.jee.EjbRefType.ENTITY);
}
// home
ref.setLocalHome(getStringValue(xmlbeansRef.getLocalHome()));
// remote
ref.setLocal(getStringValue(xmlbeansRef.getLocal()));
// ejb-link
ref.setEjbLink(getStringValue(xmlbeansRef.getEjbLink()));
// mapped-name
ref.setMappedName(getStringValue(xmlbeansRef.getMappedName()));
// handle external refs
GerEjbLocalRefType ejbLocalRefType = localRefMap.get(ref.getEjbRefName());
if (ejbLocalRefType != null && ejbLocalRefType.getPattern() != null) {
// external ear ref
// set mapped name to the deploymentId of the external ref
GerPatternType pattern = ejbLocalRefType.getPattern();
String module = pattern.getModule();
if (module == null) {
module = pattern.getArtifactId();
}
String ejbName = pattern.getName();
String deploymentId = module.trim() + "/" + ejbName;
ref.setMappedName(deploymentId.trim());
}
// openejb handling of injection-targets
if (xmlbeansRef.getInjectionTargetArray() != null) {
for (InjectionTargetType injectionTargetType : xmlbeansRef.getInjectionTargetArray()) {
InjectionTarget injectionTarget = new InjectionTarget();
injectionTarget.setInjectionTargetClass(getStringValue(injectionTargetType.getInjectionTargetClass()));
injectionTarget.setInjectionTargetName(getStringValue(injectionTargetType.getInjectionTargetName()));
ref.getInjectionTarget().add(injectionTarget);
}
}
//geronimo's handling of injection-target
addInjections(refName, xmlbeansRef.getInjectionTargetArray(), componentContext);
}