Interface RpcClient

All Known Subinterfaces:
RpcSingleClient<S>
All Known Implementing Classes:
AbstractRpcClient, AbstractRpcSingleClient, JsonRpcClient, JsonRpcSingleClient

@Deprecated(forRemoval=true) public interface RpcClient
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 Type
    Method
    Description
    <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.
    default <S> Future<Void>
    callService(Class<S> serviceInterface, Consumer<S> serviceConsumer)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Similar to callServiceWithRes(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> S
    getService(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> S
    getService(Class<S> serviceInterface, String serviceName)
    Deprecated, for removal: This API element is subject to removal in a future version.
    boolean
    Deprecated, 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 name serviceInterface.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 use
      R - 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 Future containing 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 use
      R - the result type of the invoked method
      Parameters:
      serviceInterface - the interface of the service to call to
      serviceName - the name under which the service interface is registered at the server, see RpcServer.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

      default <S> Future<Void> callService(Class<S> serviceInterface, Consumer<S> serviceConsumer)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Similar to callServiceWithRes(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 to
      serviceConsumer - 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 call
      serviceName - the name under which the service interface is registered at the server, see RpcServer.getHandler(String)
      serviceConsumer - used to invoke the method on the service interface
      Returns:
      an empty future
    • getService

      default <S> S getService(Class<S> serviceInterface)
      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

      <S> S getService(Class<S> serviceInterface, String serviceName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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:
      true if this rpc client is connected to a server, or false if the call are just forwarded to a local implementation.