{
throw new RuntimeException("Could not load business local interface " + businessLocal, cnfe);
}
allLocalinterfaces.add(businessLocalIntf);
InvocationHandler invocationHandler = new SingletonBeanLocalInvocationHandler(containerRegistryKey,
businessLocal, clientInterceptors);
// time to create a proxy
Object proxy = proxyFactory.createProxy(new Class<?>[]
{businessLocalIntf}, invocationHandler);
// bind to jndi
String jndiName = jndiNameResolver.resolveJNDIName(sessionBean, businessLocal);
JNDIBinderImpl jndiBinder = new JNDIBinderImpl(jndiCtx, jndiName, proxy);
String binderMCBeanName = JNDI_BINDER_MC_BEAN_PREFIX + jndiName;
BeanMetaData jndiBinderBMD = createBeanMetaData(binderMCBeanName, jndiBinder, container);
DeploymentUnit parentUnit = unit.getParent();
parentUnit.addAttachment(BeanMetaData.class + ":" + binderMCBeanName, jndiBinderBMD);
}
List<LocalBindingMetaData> localBindings = sessionBean.getLocalBindings();
if (localBindings == null || localBindings.isEmpty())
{
InvocationHandler invocationHandler = new SingletonBeanLocalInvocationHandler(containerRegistryKey, containerGUID, clientInterceptors);
String defaultBusinessLocalJNDIName = jndiNameResolver.resolveLocalBusinessDefaultJNDIName(sessionBean);
Object proxy = proxyFactory.createProxy(allLocalinterfaces.toArray(new Class<?>[allLocalinterfaces.size()]),
invocationHandler);
JNDIBinderImpl jndiBinder = new JNDIBinderImpl(jndiCtx, defaultBusinessLocalJNDIName, proxy);
String binderMCBeanName = JNDI_BINDER_MC_BEAN_PREFIX + defaultBusinessLocalJNDIName;
BeanMetaData jndiBinderBMD = createBeanMetaData(binderMCBeanName, jndiBinder, container);
DeploymentUnit parentUnit = unit.getParent();
parentUnit.addAttachment(BeanMetaData.class + ":" + binderMCBeanName, jndiBinderBMD);
}
else
{
for (LocalBindingMetaData localBinding : localBindings)
{
String jndiName = localBinding.getJndiName();
// if not explicitly specified, then use the default jndi name
if (jndiName == null)
{
jndiName = jndiNameResolver.resolveLocalBusinessDefaultJNDIName(sessionBean);
}
InvocationHandler invocationHandler = new SingletonBeanLocalInvocationHandler(containerRegistryKey, containerGUID, clientInterceptors);
Object proxy = proxyFactory.createProxy(
allLocalinterfaces.toArray(new Class<?>[allLocalinterfaces.size()]), invocationHandler);
JNDIBinderImpl jndiBinder = new JNDIBinderImpl(jndiCtx, jndiName, proxy);
String binderMCBeanName = JNDI_BINDER_MC_BEAN_PREFIX + jndiName;
BeanMetaData jndiBinderBMD = createBeanMetaData(binderMCBeanName, jndiBinder, container);