javaxPersistenceUnit.setName(getJndiName(javaxPersistenceUnit.getName(), fieldMetaData));
bindClassPersistenceUnit(javaxPersistenceUnit, mv);
}
// @EJB annotation
IJEjbEJB jEjb = fieldMetaData.getJEjbEJB();
if (jEjb != null) {
// validate
validateAccessFieldAnnotation(fieldMetaData);
logger.debug("Add injection for EJB on attribute {0} of class {1}", fieldMetaData.getFieldName(),
this.classAnnotationMetadata.getClassName());
// Gets the JNDI Resolver
EZBContainerJNDIResolver containerJNDIResolver = (EZBContainerJNDIResolver) this.map
.get(EZBContainerJNDIResolver.class.getName());
// ejbName ?
String beanName = jEjb.getBeanName();
// JNDI name
String jndiName = null;
// Mapped Name ? if not null, use it as JNDI name
String mappedName = jEjb.getMappedName();
if (mappedName != null && !mappedName.equals("")) {
jndiName = mappedName;
}
// JNDI name still null, ask the JNDI resolver
if (jndiName == null) {
try {
jndiName = containerJNDIResolver.getEJBJNDIUniqueName(itfName, beanName);
} catch (EZBJNDIResolverException e) {
logger.error("No jndi name found on class {0} for interface {1} and beanName {2}",
this.classAnnotationMetadata.getClassName(), itfName, beanName);
}
}
// JNDI name not null
if (jndiName != null) {
logger.debug("Result of Asking jndi name on class {0} for interface {1} and beanName {2}. Result = {3}",
this.classAnnotationMetadata.getClassName(), itfName, beanName, jndiName);
callAttributeJndi(jndiName, typeInterface, mv, fieldMetaData, this.classAnnotationMetadata
.getClassName(), REGISTRY);
callBindAttributeJndi(jEjb.getName(), jndiName, mv, fieldMetaData);
}
}