// Lookup the Proxy Factory in the Object Store
StatefulSessionProxyFactory proxyFactory = Ejb3RegistrarLocator.locateRegistrar().lookup(proxyFactoryKey,
StatefulSessionProxyFactory.class);
// Create a new EJB2.x Proxy
EJBObject proxy = (EJBObject)proxyFactory.createProxyEjb2x((Serializable)newStatefulInvocation.getId());
StatefulHandleRemoteImpl handle = new StatefulHandleRemoteImpl(proxy);
InvocationResponse response = marshallResponse(statefulInvocation, handle, null);
return response;
}
// SFSB remove()
else if (unadvisedMethod.getName().equals(Ejb2xMethodNames.METHOD_NAME_HOME_REMOVE))
{
try
{
// Attempt to remove the bean
destroySession(statefulInvocation.getId());
}
catch (NoSuchEJBException e)
{
String invokingClassName = method.getActualClassName();
Throwable newException = this.constructProperNoSuchEjbException(e, invokingClassName);
throw newException;
}
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;