class ComputationalServiceImpl implements ComputationalService {

	@Override
	public void updateSparkClusterConfig(UserInfo userInfo, String project, String exploratoryName, String computationalName,
										 List<ClusterConfig> config) {
		final String userName = userInfo.getName();
		final String token = userInfo.getAccessToken();
		final UserInstanceDTO userInstanceDTO = exploratoryDAO
				.fetchExploratoryFields(userName, project, exploratoryName, true);
		final UserComputationalResource compResource = userInstanceDTO
				.getResources()
				.stream()
				.filter(cr -> cr.getComputationalName().equals(computationalName) && cr.getStatus().equals(UserInstanceStatus.RUNNING.toString()))
				.findAny()
				.orElseThrow(() -> new ResourceNotFoundException(String.format(RUNNING_COMP_RES_NOT_FOUND,
						computationalName, exploratoryName)));
		EndpointDTO endpointDTO = endpointService.get(userInstanceDTO.getEndpoint());
		final ComputationalClusterConfigDTO clusterConfigDto = requestBuilder.newClusterConfigUpdate(userInfo,
				userInstanceDTO, compResource, config, endpointDTO);
		final String uuid =
				provisioningService.post(endpointDTO.getUrl() + ComputationalAPI.COMPUTATIONAL_RECONFIGURE_SPARK,
						token, clusterConfigDto, String.class);
		computationalDAO.updateComputationalFields(new ComputationalStatusDTO()
				.withProject(userInstanceDTO.getProject())
				.withComputationalName(computationalName)
				.withExploratoryName(exploratoryName)
				.withConfig(config)
				.withStatus(RECONFIGURING.toString())
				.withUser(userName));
		requestId.put(userName, uuid);

	}

	@Inject public  ComputationalServiceImpl(ProjectService projectService, ExploratoryDAO exploratoryDAO, ComputationalDAO computationalDAO,
									@Named(ServiceConsts.PROVISIONING_SERVICE_NAME) RESTService provisioningService,
									RequestBuilder requestBuilder, RequestId requestId, TagService tagService,
									EndpointService endpointService, InfrastructureTemplateService templateService);

}