Package org.knime.core.webui.data.rpc
Interface RpcClient
- All Known Subinterfaces:
RpcSingleClient<S>
- All Known Implementing Classes:
AbstractRpcClient,AbstractRpcSingleClient,JsonRpcClient,JsonRpcSingleClient
Deprecated, for removal: This API element is subject to removal in a future version.
can be removed since we don't need a java-based RpcClient anymore once the Remote Workflow Editor becomes
obsolete
An
RpcClient implementation is used by a node dialog or node view to retrieve data from its (possibly remote)
node model.- Since:
- 4.3
- Author:
- Martin Horn, KNIME GmbH, Konstanz, Germany, Carl Witt, KNIME AG, Zurich, Switzerland
-
Method Summary
Modifier and TypeMethodDescriptioncallService(Class<S> serviceInterface, String serviceName, Consumer<S> serviceConsumer) Deprecated, for removal: This API element is subject to removal in a future version.callService(Class<S> serviceInterface, Consumer<S> serviceConsumer) Deprecated, for removal: This API element is subject to removal in a future version.Similar tocallServiceWithRes(Class, Function)but for void methods.<S,R> Future<R> callServiceWithRes(Class<S> serviceInterface, String serviceName, Function<S, R> serviceEvaluator) Deprecated, for removal: This API element is subject to removal in a future version.Calls a method on the node model's data service implementation of the given interface registered under the given name and returns the result.default <S,R> Future<R> callServiceWithRes(Class<S> serviceInterface, Function<S, R> serviceEvaluator) Deprecated, for removal: This API element is subject to removal in a future version.Calls a method on the node model's data service implementation of the interface and returns the result.default <S> SgetService(Class<S> serviceInterface) Deprecated, for removal: This API element is subject to removal in a future version.Gives direct access to the service implementation.<S> SgetService(Class<S> serviceInterface, String serviceName) Deprecated, for removal: This API element is subject to removal in a future version.SeegetService(Class).booleanDeprecated, for removal: This API element is subject to removal in a future version.
-
Method Details
-
callServiceWithRes
default <S,R> Future<R> callServiceWithRes(Class<S> serviceInterface, Function<S, R> serviceEvaluator) Deprecated, for removal: This API element is subject to removal in a future version.Calls a method on the node model's data service implementation of the interface and returns the result. Assumes that the service is registered under the nameserviceInterface.getSimpleName(). Example usage:RpcClient m_rpcClient = ... Future<List<SomeType>> future = m_rpcClient.callServiceWithRes(MyService.class, service -> service.getSomeData(someParameter)); try { List<SomeType> results = future.get(3, TimeUnit.SECONDS); } catch (TimeoutException timeoutException) { ...- Type Parameters:
S- the interface type of the service to useR- the result type of the invoked method- Parameters:
serviceEvaluator- the service evaluator is given an implementation of the node model's data service. It then calls one of the methods on the node model's service interface and returns the result.serviceInterface- the interface of the service to call to- Returns:
- a
Futurecontaining the result of the invoked method.
-
callServiceWithRes
<S,R> Future<R> callServiceWithRes(Class<S> serviceInterface, String serviceName, Function<S, R> serviceEvaluator) Deprecated, for removal: This API element is subject to removal in a future version.Calls a method on the node model's data service implementation of the given interface registered under the given name and returns the result. Example usage:RpcClient m_rpcClient = ... Future<List<SomeType>> future = m_rpcClient.callServiceWithRes(MyService.class, "MyServiceInstance3", s -> s.getSomeData(someParameter)); try { List<SomeType> results = future.get(3, TimeUnit.SECONDS); } catch (TimeoutException timeoutException) { ...- Type Parameters:
S- the interface type of the service to useR- the result type of the invoked method- Parameters:
serviceInterface- the interface of the service to call toserviceName- the name under which the service interface is registered at the server, seeRpcServer.getHandler(String)serviceEvaluator- the service evaluator is given an implementation of the node model's data service. It then calls one of the methods on the node model's service interface and returns the result.- Returns:
- the result
-
callService
Deprecated, for removal: This API element is subject to removal in a future version.Similar tocallServiceWithRes(Class, Function)but for void methods. For instance:Future<Void> future = m_rpcClient.callService(nodeDataService -> nodeDataService.sendSomeData(someData));- Type Parameters:
S- the interface type of the service to use- Parameters:
serviceInterface- the interface of the service to call toserviceConsumer- used to invoke the method on the service interface- Returns:
- an empty future
-
callService
<S> Future<Void> callService(Class<S> serviceInterface, String serviceName, Consumer<S> serviceConsumer) Deprecated, for removal: This API element is subject to removal in a future version.- Type Parameters:
S- the interface type of the service to use- Parameters:
serviceInterface- the interface of the service to callserviceName- the name under which the service interface is registered at the server, seeRpcServer.getHandler(String)serviceConsumer- used to invoke the method on the service interface- Returns:
- an empty future
-
getService
Deprecated, for removal: This API element is subject to removal in a future version.Gives direct access to the service implementation. Please note that a call to the service might block for a while (in case the rpc request is send to the server). It is always advisable to run service calls in an extra thread to not block the ui!- Type Parameters:
S-- Parameters:
serviceInterface- the interface to get the service implementation for- Returns:
- the service implementation
-
getService
Deprecated, for removal: This API element is subject to removal in a future version.SeegetService(Class).- Type Parameters:
S-- Parameters:
serviceInterface-serviceName-- Returns:
- the service implementation
-
isConnectedRemotely
boolean isConnectedRemotely()Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
trueif this rpc client is connected to a server, orfalseif the call are just forwarded to a local implementation.
-