// openejb handling of injection-targets
if (spec_ejbRef.getInjectionTarget() != null) {
List<InjectionTarget> injectionTargetsToAdd=new ArrayList<InjectionTarget>();
for (InjectionTarget injectionTargetType : spec_ejbRef.getInjectionTarget()) {
InjectionTarget newInjectionTarget = new InjectionTarget();
newInjectionTarget.setInjectionTargetClass(getStringValue(injectionTargetType
.getInjectionTargetClass()));
newInjectionTarget.setInjectionTargetName(getStringValue(injectionTargetType
.getInjectionTargetName()));
injectionTargetsToAdd.add(newInjectionTarget);
}
spec_ejbRef.getInjectionTarget().addAll(injectionTargetsToAdd);
}
// TODO: geronimo's handling of injection-target
// addInjections(refName, spec_ejbRef.getInjectionTarget(), NamingBuilder.INJECTION_KEY.get(sharedContext));
}
}
for (EjbLocalRef localRefFromSpecDD : jndiConsumer.getEjbLocalRef()) {
String refName = getStringValue(localRefFromSpecDD.getEjbRefName());
// skip corba refs
GerEjbLocalRefType ejbLocalRefType = localRefMap.get(refName);
// merge info in alt-DD to spec DD.
if (ejbLocalRefType != null) {
// ejb-ref-name
localRefFromSpecDD.setEjbRefName(refName);
// ejb-ref-type
String refType = getStringValue(localRefFromSpecDD.getType());
if ("SESSION".equalsIgnoreCase(refType)) {
localRefFromSpecDD.setEjbRefType(org.apache.openejb.jee.EjbRefType.SESSION);
} else if ("ENTITY".equalsIgnoreCase(refType)) {
localRefFromSpecDD.setEjbRefType(org.apache.openejb.jee.EjbRefType.ENTITY);
}
// home
localRefFromSpecDD.setLocalHome(getStringValue(localRefFromSpecDD.getLocalHome()));
// remote
localRefFromSpecDD.setLocal(getStringValue(localRefFromSpecDD.getLocal()));
// ejb-link
localRefFromSpecDD.setEjbLink(getStringValue(localRefFromSpecDD.getEjbLink()));
// mapped-name
localRefFromSpecDD.setMappedName(getStringValue(localRefFromSpecDD.getMappedName()));
// handle external refs
if (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;
localRefFromSpecDD.setMappedName(deploymentId.trim());
}
// openejb handling of injection-targets
if (localRefFromSpecDD.getInjectionTarget() != null) {
List<InjectionTarget> injectionTargetsToAdd=new ArrayList<InjectionTarget>();
for (InjectionTarget injectionTargetType : localRefFromSpecDD.getInjectionTarget()) {
InjectionTarget injectionTarget = new InjectionTarget();
injectionTarget.setInjectionTargetClass(getStringValue(injectionTargetType
.getInjectionTargetClass()));
injectionTarget.setInjectionTargetName(getStringValue(injectionTargetType
.getInjectionTargetName()));
injectionTargetsToAdd.add(injectionTarget);
}
localRefFromSpecDD.getInjectionTarget().addAll(injectionTargetsToAdd);