}
static void addEJBLocalRefs(NamingContext ejbContext, RefContext refContext, URI moduleURI, EjbLocalRefType[] ejbLocalRefs, Map ejbLocalRefMap, ClassLoader cl, ComponentContextBuilder builder) throws DeploymentException {
J2eeContext j2eeContext = ejbContext.getJ2eeContext();
for (int i = 0; i < ejbLocalRefs.length; i++) {
EjbLocalRefType ejbLocalRef = ejbLocalRefs[i];
String ejbRefName = getStringValue(ejbLocalRef.getEjbRefName());
String local = getStringValue(ejbLocalRef.getLocal());
try {
assureEJBLocalObjectInterface(local, cl);
} catch (DeploymentException e) {
throw new DeploymentException("Error processing 'local' element for EJB Local Reference '"+ejbRefName+"' for module '"+moduleURI+"': "+e.getMessage());
}
String localHome = getStringValue(ejbLocalRef.getLocalHome());
try {
assureEJBLocalHomeInterface(localHome, cl);
} catch (DeploymentException e) {
throw new DeploymentException("Error processing 'local-home' element for EJB Local Reference '"+ejbRefName+"' for module '"+moduleURI+"': "+e.getMessage());
}
boolean isSession = "Session".equals(getStringValue(ejbLocalRef.getEjbRefType()));
String ejbLink = null;
GerEjbLocalRefType localRef = (GerEjbLocalRefType) ejbLocalRefMap.get(ejbRefName);
if (localRef != null && localRef.isSetEjbLink()) {
ejbLink = localRef.getEjbLink();
} else if (ejbLocalRef.isSetEjbLink()) {
ejbLink = getStringValue(ejbLocalRef.getEjbLink());
}
Reference ejbReference;
if (ejbLink != null) {
ejbReference = refContext.getEJBLocalRef(moduleURI, ejbLink, isSession, localHome, local, ejbContext);