{
initParameterTypes = unadvisedMethod.getParameterTypes();
initParameterValues = statefulInvocation.getArguments();
}
RemoteBinding binding = null;
RemoteBindings bindings = this.getAnnotation(RemoteBindings.class);
if (bindings != null)
binding = bindings.value()[0];
else
binding = this.getAnnotation(RemoteBinding.class);
StatefulSessionContainerMethodInvocation newStatefulInvocation = buildNewInvocation(
info, statefulInvocation, initParameterTypes,
initParameterValues);
StatefulRemoteProxyFactory factory = new StatefulRemoteProxyFactory(this, binding);
factory.init();
Object proxy = null;
String businessInterfaceType = unadvisedMethod.getReturnType().getName();
if (newStatefulInvocation.getSessionId() != null)
proxy = factory.createProxyEjb21(newStatefulInvocation.getSessionId(), businessInterfaceType);
else
proxy = factory.createProxyEjb21(businessInterfaceType);
InvocationResponse response = marshallResponse(statefulInvocation, proxy, newStatefulInvocation.getResponseContextInfo());
if (newStatefulInvocation.getSessionId() != null)
response.addAttachment(StatefulConstants.NEW_ID,
newStatefulInvocation.getSessionId());
return response;
}
else if (unadvisedMethod.getName().equals("remove"))
{
remove(statefulInvocation.getArguments()[0]);
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;
Class<?>[] remotes = ProxyFactoryHelper.getRemoteInterfaces(this);
if (remotes != null && remotes.length > 0)
{
remote = remotes[0];
}
RemoteHome homeAnnotation = this.getAnnotation(RemoteHome.class);
if (homeAnnotation != null)
home = homeAnnotation.value();
RemoteBinding remoteBindingAnnotation = this.getAnnotation(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 = this.getAnnotation(RemoteBinding.class);
if (remoteBindingAnnotation != null)
homeHandle = new HomeHandleImpl(remoteBindingAnnotation
.jndiBinding());
InvocationResponse response = marshallResponse(statefulInvocation, homeHandle, null);
return response;