@Override
public Object doInvoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getDeclaringClass().equals(Connector.class)) {
return this.getClass().getMethod(method.getName(), method.getParameterTypes()).invoke(this, args);
}
TransformationHandler transformationHandler = TransformationHandler
.newTransformationHandler(transformationEngine, method, connectorInterface);
transformationHandler.getTargetMethod();
Method targetMethod = transformationHandler.getTargetMethod();
Object[] targetArgs = transformationHandler.transformArguments(args);
MethodCall methodCall = new MethodCall(targetMethod, targetArgs, metadata);
if (!registration.isRegistered()) {
if (targetMethod.getName().equals("getAliveState")) {
return AliveState.OFFLINE;
}
throw new IllegalArgumentException("not registered");
}
MethodResult callResult =
portUtil.sendMethodCallWithResult(registration.getPortId(), registration.getDestination(), methodCall);
switch (callResult.getType()) {
case Object:
Object result = callResult.getArg();
return transformationHandler.transformResult(result);
case Void:
return null;
case Exception:
throw new RuntimeException(callResult.getArg().toString());
default: