Package org.knime.core.webui.node
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
Manages data service instances created by
DataServiceProvider-implementations.- Author:
- Martin Horn, KNIME GmbH, Konstanz, Germany
-
Constructor Summary
ConstructorsConstructorDescriptionDataServiceManager(Function<N, DataServiceProvider> getDataServiceProvider) DataServiceManager(Function<N, DataServiceProvider> getDataServiceProvider, boolean shouldCleanUpDataServicesOnNodeStateChange) -
Method Summary
Modifier and TypeMethodDescriptionvoidcallApplyDataService(N nodeWrapper, String request) Helper to call theApplyDataService.callInitialDataService(N nodeWrapper) Helper to call theInitialDataService.callRpcDataService(N nodeWrapper, String request) Helper to call theRpcDataService.voiddeactivateDataServices(N nodeWrapper) Callsdeactivateon a data service if there is a data service instance available for the given node (wrapper).<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.
-
Constructor Details
-
DataServiceManager
- Parameters:
getDataServiceProvider- function that returns theDataServiceProvider-instance for the given node wrapper
-
DataServiceManager
public DataServiceManager(Function<N, DataServiceProvider> getDataServiceProvider, boolean shouldCleanUpDataServicesOnNodeStateChange) - Parameters:
getDataServiceProvider- function that returns theDataServiceProvider-instance for the given node wrappershouldCleanUpDataServicesOnNodeStateChange-
-
-
Method Details
-
getDataServiceOfType
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 fordataServiceClass- A type (or sub-type) ofInitialDataService,RpcDataServiceorApplyDataService.- Returns:
- the data service instance or an empty optional if no data service is available
-
callInitialDataService
Helper to call theInitialDataService.- 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
Helper to call theRpcDataService.- Parameters:
nodeWrapper- the node to call the data service forrequest- the data service request- Returns:
- the data service response
- Throws:
IllegalStateException- if there is no text data service
-
callApplyDataService
Helper to call theApplyDataService.- Parameters:
nodeWrapper- the node to call the data service forrequest- the data service request representing the data to apply- Throws:
IOException- if applying the data failedIllegalStateException- if there is no text apply data service
-
deactivateDataServices
Callsdeactivateon a data service if there is a data service instance available for the given node (wrapper).- Parameters:
nodeWrapper-
-