AbstractNameQuery cssBean;
if (remoteRef.isSetCssLink()) {
String cssLink = remoteRef.getCssLink().trim();
cssBean = buildAbstractNameQuery(null, null, cssLink, NameFactory.CORBA_CSS, NameFactory.EJB_MODULE);
} else {
GerPatternType css = remoteRef.getCss();
cssBean = buildAbstractNameQuery(css, NameFactory.CORBA_CSS, NameFactory.EJB_MODULE, null);
}
ejbReference = refContext.getCORBARemoteRef(earContext,
cssBean,
new URI(getStringValue(remoteRef.getNsCorbaloc())),
getStringValue(remoteRef.getName()),
home);
} catch (URISyntaxException e) {
throw new DeploymentException("Could not construct CORBA NameServer URI: " + remoteRef.getNsCorbaloc(), e);
}
} else {
Artifact targetConfigId = null;
String optionalModule = moduleURI == null ? null : moduleURI.toString();
String requiredModule = null;
AbstractNameQuery containerQuery = null;
if (remoteRef != null && remoteRef.isSetEjbLink()) {
ejbLink = remoteRef.getEjbLink();
} else if (ejbRef.isSetEjbLink()) {
ejbLink = getStringValue(ejbRef.getEjbLink());
targetConfigId = ejbContext.getId();
}
if (ejbLink != null) {
String[] bits = ejbLink.split("#");
if (bits.length == 2) {
//look only in specified module.
requiredModule = bits[0];
if (moduleURI != null) {
requiredModule = moduleURI.resolve(requiredModule).getPath();
}
ejbLink = bits[1];
}
} else if (remoteRef != null) {
GerPatternType patternType = remoteRef.getPattern();
containerQuery = buildAbstractNameQuery(patternType, null, NameFactory.EJB_MODULE, null);
}
ejbReference = refContext.getEJBRemoteRef(refName, ejbContext, ejbLink, requiredModule, optionalModule, targetConfigId, containerQuery, isSession, home, remote);
}
}