StatefulContainerInvocation newStatefulInvocation = buildInvocation(
info, statefulInvocation);
ProxyFactory proxyFactory = this.getProxyFactory(this.getAnnotation(RemoteBinding.class));
BaseStatefulRemoteProxyFactory statefulRemoteProxyFactory = (BaseStatefulRemoteProxyFactory) proxyFactory;
EJBObject proxy = (EJBObject) statefulRemoteProxyFactory.createProxyEjb21(newStatefulInvocation.getId(), null);
StatefulHandleRemoteImpl handle = new StatefulHandleRemoteImpl(proxy);
InvocationResponse response = marshallResponse(statefulInvocation, handle, null);
return response;
}
else if (unadvisedMethod.getName().equals("remove"))
{
try
{
destroySession(statefulInvocation.getId());
}
catch(NoSuchEJBException e)
{
if(log.isTraceEnabled())
log.trace("Throwing " + e.getClass().getName(), e);
throw new NoSuchObjectException(e.getMessage());
}
InvocationResponse response = new InvocationResponse(null);
return response;
}
else if (unadvisedMethod.getName().equals("getEJBHome"))
{
HomeHandleImpl homeHandle = null;
RemoteBinding remoteBindingAnnotation = this.getAnnotation(RemoteBinding.class);
if (remoteBindingAnnotation != null)
homeHandle = new HomeHandleImpl(ProxyFactoryHelper.getHomeJndiName(this));
EJBHome ejbHome = homeHandle.getEJBHome();
InvocationResponse response = marshallResponse(statefulInvocation, ejbHome, null);
return response;
}
else if (unadvisedMethod.getName().equals("getPrimaryKey"))
{
Object id = statefulInvocation.getId();
InvocationResponse response = marshallResponse(statefulInvocation, id, null);
return response;
}
else if (unadvisedMethod.getName().equals("isIdentical"))
{
Object id = statefulInvocation.getId();
EJBObject bean = (EJBObject) statefulInvocation.getArguments()[0];
Object primaryKey = bean.getPrimaryKey();
boolean isIdentical = id.equals(primaryKey);
InvocationResponse response = marshallResponse(statefulInvocation, isIdentical, null);
return response;