public static void sendRemoteEvent(String portId, String destination, RemoteEvent e, Map<String, String> metaData) throws PortNotAvailableException { MethodCall methodCall = new MethodCall("processRemoteEvent", new Object[]{ e }, metaData); OutgoingPortUtilService portUtilService = utilsService.getOsgiServiceProxy(OutgoingPortUtilService.class); portUtilService.sendMethodCall(portId, destination, methodCall); }
@Override public Object doInvoke(Object proxy, Method method, Object[] args) throws Throwable { List<Class<?>> paramList = Arrays.asList(method.getParameterTypes()); List<String> paramTypeNames = new ArrayList<String>(); for (Class<?> paramType : paramList) { paramTypeNames.add(paramType.getName()); } MethodCall methodCall = new MethodCall(method.getName(), args, metadata, paramTypeNames); MethodResult callResult = portUtil.sendMethodCallWithResult(portId, destination, methodCall); switch (callResult.getType()) { case Object: return callResult.getArg(); case Void: return null; case Exception: throw new RuntimeException(callResult.getArg().toString()); default: throw new IllegalStateException("Return Type has to be either Void, Object or Exception"); } }
public static void sendRemoteEvent(String portId, String destination, RemoteEvent e, Map<String, String> metaData) throws PortNotAvailableException { MethodCall methodCall = new MethodCall("processRemoteEvent", new Object[]{ e }, metaData); OutgoingPortUtilService portUtilService = utilsService.getOsgiServiceProxy(OutgoingPortUtilService.class); portUtilService.sendMethodCall(portId, destination, methodCall); }