GerResourceEnvRefType[] gerResourceEnvRef,
MessageDestinationRefType[] messageDestinationRefs,
ServiceRefType[] serviceRefs,
GerServiceRefType[] gerServiceRefs,
ClassLoader cl) throws DeploymentException {
ComponentContextBuilder builder = new ComponentContextBuilder();
RefContext refContext = earContext.getRefContext();
if (userTransaction != null) {
builder.addUserTransaction(userTransaction);
}
ObjectName corbaGBean = earContext.getCORBAGBeanObjectName();
if (corbaGBean != null) {
if (corbaGBean.isPattern()) {
corbaGBean = refContext.locateUniqueName(earContext, corbaGBean);
}
builder.addORB(corbaGBean);
}
Object handleDelegateReference = earContext.getRefContext().getHandleDelegateReference();
if (handleDelegateReference != null) {
builder.addHandleDelegateReference(handleDelegateReference);
}
URI moduleURI = module.getConfigId();
addEnvEntries(envEntries, builder, cl);
if (ejbContext == null) {
ejbContext = earContext;
}
// ejb-ref
addEJBRefs(earContext, ejbContext, refContext, moduleURI, ejbRefs, mapEjbRefs(gerEjbRefs), cl, builder);
// ejb-local-ref
addEJBLocalRefs(ejbContext, refContext, moduleURI, ejbLocalRefs, mapEjbLocalRefs(gerEjbLocalRef), cl, builder);
// resource-ref
addResourceRefs(earContext, moduleURI, resourceRefs, mapResourceRefs(gerResourceRef), cl, builder);
// resource-env-ref
addResourceEnvRefs(earContext, resourceEnvRefs, mapResourceEnvRefs(gerResourceEnvRef), cl, builder);
addMessageDestinationRefs(earContext.getRefContext(), earContext, messageDestinationRefs, cl, builder);
// Map serviceRefMap = new HashMap();
// Map serviceRefCredentialsNameMap = new HashMap();
// mapServiceRefs(gerServiceRefs, serviceRefMap, serviceRefCredentialsNameMap);
Map serviceRefMap = mapServiceRefs(gerServiceRefs);
addServiceRefs(earContext, module, serviceRefs, serviceRefMap, cl, builder);
return builder.getContext();
}