Object[] params = null;
String[] sig = null;
if(param instanceof NameBasedInvocation)
{
NameBasedInvocation nbi = (NameBasedInvocation) param;
methodName = nbi.getMethodName();
params = nbi.getParameters();
sig = nbi.getSignature();
}
else if(param instanceof InternalInvocation)
{
InternalInvocation ii = (InternalInvocation) param;
methodName = ii.getMethodName();
params = ii.getParameters();
}
else
{
log.info("Don't recognize the parameter type, so just returning it.");
return param;
}
String sessionId = invocation.getSessionId();
String subsystem = invocation.getSubsystem();
log.debug("invoke() called with method: " + methodName +
"\tsessionId: " + sessionId + "\tsubsystem:" + subsystem);
//deprecated since specific to JMX (old way of handling callbacks)
if(methodName.equals("testComplexReturn"))
{
//Need to send back complex object containing array of complext objects.
ComplexReturn ret = new ComplexReturn();
return ret;
}
if(methodName.equals("testMarshalledObject"))
{
ComplexReturn ret = new ComplexReturn();
MarshalledObject mObj = new MarshalledObject(ret);
return mObj;
}
else if(methodName.equals("test"))
{
// will cause a callback on all the listeners
log.debug("test called on server invocation handler, so should do callback.");
CallbackDispatcher callbackDispatcher = new CallbackDispatcher(invocation.getSessionId(),
invocation.getSubsystem(),
new NameBasedInvocation("handleCallback",
params,
sig));
Thread callbackThread = new Thread(callbackDispatcher);
callbackThread.start();
}