Class DataServiceManager<N extends NodeWrapper>

java.lang.Object
org.knime.core.webui.node.DataServiceManager<N>
Type Parameters:
N - the node wrapper this manager operates on

public final class DataServiceManager<N extends NodeWrapper> extends Object
Manages data service instances created by DataServiceProvider-implementations.
Author:
Martin Horn, KNIME GmbH, Konstanz, Germany
  • Constructor Details

    • DataServiceManager

      public DataServiceManager(Function<N,DataServiceProvider> getDataServiceProvider)
      Parameters:
      getDataServiceProvider - function that returns the DataServiceProvider-instance for the given node wrapper
    • DataServiceManager

      public DataServiceManager(Function<N,DataServiceProvider> getDataServiceProvider, boolean shouldCleanUpDataServicesOnNodeStateChange)
      Parameters:
      getDataServiceProvider - function that returns the DataServiceProvider-instance for the given node wrapper
      shouldCleanUpDataServicesOnNodeStateChange -
  • Method Details

    • getDataServiceOfType

      public <S> Optional<S> getDataServiceOfType(N nodeWrapper, Class<S> dataServiceClass)
      Returns data service instance of the given type or an empty optional of no data service of that type is associated with the node.
      Type Parameters:
      S - the data service type being returned
      Parameters:
      nodeWrapper - node to get the data service for
      dataServiceClass - A type (or sub-type) of InitialDataService, RpcDataService or ApplyDataService.
      Returns:
      the data service instance or an empty optional if no data service is available
    • callInitialDataService

      public String callInitialDataService(N nodeWrapper)
      Helper to call the InitialDataService.
      Parameters:
      nodeWrapper - the node to call the data service for
      Returns:
      the initial data
      Throws:
      IllegalStateException - if there is not initial data service available
    • callRpcDataService

      public String callRpcDataService(N nodeWrapper, String request)
      Helper to call the RpcDataService.
      Parameters:
      nodeWrapper - the node to call the data service for
      request - the data service request
      Returns:
      the data service response
      Throws:
      IllegalStateException - if there is no text data service
    • callApplyDataService

      public void callApplyDataService(N nodeWrapper, String request) throws IOException
      Helper to call the ApplyDataService.
      Parameters:
      nodeWrapper - the node to call the data service for
      request - the data service request representing the data to apply
      Throws:
      IOException - if applying the data failed
      IllegalStateException - if there is no text apply data service
    • deactivateDataServices

      public void deactivateDataServices(N nodeWrapper)
      Calls deactivate on a data service if there is a data service instance available for the given node (wrapper).
      Parameters:
      nodeWrapper -