{
initParameterTypes = unadvisedMethod.getParameterTypes();
initParameterValues = statefulInvocation.getArguments();
}
RemoteBinding binding = null;
RemoteBindings bindings = (RemoteBindings) resolveAnnotation(RemoteBindings.class);
if (bindings != null)
binding = bindings.value()[0];
else
binding = (RemoteBinding) resolveAnnotation(RemoteBinding.class);
StatefulContainerInvocation newStatefulInvocation = buildNewInvocation(
info, statefulInvocation, initParameterTypes,
initParameterValues);
StatefulRemoteProxyFactory factory = new StatefulRemoteProxyFactory(this, binding);
factory.init();
Object proxy = null;
if (newStatefulInvocation.getId() != null)
proxy = factory.createProxy(newStatefulInvocation.getId());
else
proxy = factory.createProxy();
InvocationResponse response = marshallResponse(statefulInvocation, proxy, newStatefulInvocation.getResponseContextInfo());
if (newStatefulInvocation.getId() != null)
response.addAttachment(StatefulConstants.NEW_ID,
newStatefulInvocation.getId());
return response;
}
else if (unadvisedMethod.getName().equals("remove"))
{
StatefulHandleImpl handle = (StatefulHandleImpl) statefulInvocation
.getArguments()[0];
destroySession(handle.id);
InvocationResponse response = new InvocationResponse(null);
response.setContextInfo(statefulInvocation.getResponseContextInfo());
return response;
}
else if (unadvisedMethod.getName().equals("getEJBMetaData"))
{
Class remote = null;
Class home = null;
Class pkClass = Object.class;
HomeHandleImpl homeHandle = null;
Remote remoteAnnotation = (Remote) resolveAnnotation(Remote.class);
if (remoteAnnotation != null)
remote = remoteAnnotation.value()[0];
RemoteHome homeAnnotation = (RemoteHome) resolveAnnotation(RemoteHome.class);
if (homeAnnotation != null)
home = homeAnnotation.value();
RemoteBinding remoteBindingAnnotation = (RemoteBinding) resolveAnnotation(RemoteBinding.class);
if (remoteBindingAnnotation != null)
homeHandle = new HomeHandleImpl(remoteBindingAnnotation
.jndiBinding());
EJBMetaDataImpl metadata = new EJBMetaDataImpl(remote, home, pkClass,
true, false, homeHandle);
InvocationResponse response = marshallResponse(statefulInvocation, metadata, null);
return response;
}
else if (unadvisedMethod.getName().equals("getHomeHandle"))
{
HomeHandleImpl homeHandle = null;
RemoteBinding remoteBindingAnnotation = (RemoteBinding) resolveAnnotation(RemoteBinding.class);
if (remoteBindingAnnotation != null)
homeHandle = new HomeHandleImpl(remoteBindingAnnotation
.jndiBinding());
InvocationResponse response = marshallResponse(statefulInvocation, homeHandle, null);
return response;