Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons;
package org.gridsuite.monitor.commons.types.messaging;

/**
* @author Antoine Bouhours <antoine.bouhours at rte-france.com>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons;
package org.gridsuite.monitor.commons.types.messaging;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.gridsuite.monitor.commons.types.processexecution.ProcessStatus;

import java.time.Instant;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons;
package org.gridsuite.monitor.commons.types.messaging;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.gridsuite.monitor.commons.types.processexecution.StepStatus;
import org.gridsuite.monitor.commons.types.result.ResultType;

import java.time.Instant;
import java.util.UUID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons;
package org.gridsuite.monitor.commons.types.messaging;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.gridsuite.monitor.commons.types.processexecution.ProcessType;
import org.gridsuite.monitor.commons.types.processconfig.ProcessConfig;
import org.gridsuite.monitor.commons.types.processconfig.SecurityAnalysisConfig;

import java.util.UUID;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons;
package org.gridsuite.monitor.commons.types.processconfig;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.gridsuite.monitor.commons.types.processexecution.ProcessType;

import java.util.List;
import java.util.UUID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons;
package org.gridsuite.monitor.commons.types.processconfig;

import org.gridsuite.monitor.commons.types.processexecution.ProcessType;

import java.util.List;
import java.util.UUID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons;
package org.gridsuite.monitor.commons.types.processexecution;

/**
* @author Antoine Bouhours <antoine.bouhours at rte-france.com>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons;
package org.gridsuite.monitor.commons.types.processexecution;

/**
* @author Antoine Bouhours <antoine.bouhours at rte-france.com>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons;
package org.gridsuite.monitor.commons.types.processexecution;

/**
* @author Antoine Bouhours <antoine.bouhours at rte-france.com>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons;
package org.gridsuite.monitor.commons.types.result;

import java.util.UUID;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons;
package org.gridsuite.monitor.commons.types.result;

/**
* @author Antoine Bouhours <antoine.bouhours at rte-france.com>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.server.services;
package org.gridsuite.monitor.server.clients;

import org.gridsuite.monitor.server.dto.ReportPage;
import org.gridsuite.monitor.server.dto.report.ReportPage;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.stereotype.Service;
Expand All @@ -18,14 +18,14 @@
* @author Franck Lecuyer <franck.lecuyer at rte-france.com>
*/
@Service
public class ReportRestService {
public class ReportRestClient {
private static final String REPORT_API_VERSION = "v1";
private static final String DELIMITER = "/";

private final RestClient restClient;

public ReportRestService(@Value("${gridsuite.services.report-server.base-uri:http://report-server/}") String reportServerBaseUri,
RestClient.Builder restClientBuilder) {
public ReportRestClient(@Value("${gridsuite.services.report-server.base-uri:http://report-server/}") String reportServerBaseUri,
RestClient.Builder restClientBuilder) {
this.restClient = restClientBuilder
.baseUrl(reportServerBaseUri + DELIMITER + REPORT_API_VERSION + DELIMITER + "reports")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.server.services;
package org.gridsuite.monitor.server.clients;

import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.*;
Expand All @@ -21,12 +21,12 @@
/**
* @author Kevin Le Saulnier <kevin.le-saulnier at rte-france.com>
*/
public class S3RestService {
public class S3RestClient {
private final S3Client s3Client;

private final String bucketName;

public S3RestService(S3Client s3Client, String bucketName) {
public S3RestClient(S3Client s3Client, String bucketName) {
this.s3Client = s3Client;
this.bucketName = bucketName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.server.services;
package org.gridsuite.monitor.server.clients;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
Expand All @@ -15,13 +15,13 @@
* @author Kevin Le Saulnier <kevin.le-saulnier at rte-france.com>
*/
@Service
public class SecurityAnalysisRestService {
public class SecurityAnalysisRestClient {
static final String SA_API_VERSION = "v1";
private static final String DELIMITER = "/";

private final RestClient restClient;

public SecurityAnalysisRestService(
public SecurityAnalysisRestClient(
RestClient.Builder restClientBuilder,
@Value("${gridsuite.services.security-analysis-server.base-uri:http://security-analysis-server/}") String securityAnalysisServerBaseUri) {
this.restClient = restClientBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.gridsuite.monitor.server.config;

import org.gridsuite.monitor.server.services.S3RestService;
import org.gridsuite.monitor.server.clients.S3RestClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
Expand All @@ -28,8 +28,8 @@ public S3Configuration(@Value("${spring.cloud.aws.bucket:ws-bucket}") String buc

@SuppressWarnings("checkstyle:MethodName")
@Bean
public S3RestService s3RestService(S3Client s3Client) {
public S3RestClient s3RestService(S3Client s3Client) {
LOGGER.info("Configuring S3Service with bucket: {}", bucketName);
return new S3RestService(s3Client, bucketName);
return new S3RestClient(s3Client, bucketName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.gridsuite.monitor.commons.ProcessExecutionStep;
import org.gridsuite.monitor.commons.ProcessType;
import org.gridsuite.monitor.server.dto.ProcessExecution;
import org.gridsuite.monitor.server.dto.ReportPage;
import org.gridsuite.monitor.server.services.MonitorService;
import org.gridsuite.monitor.commons.types.messaging.ProcessExecutionStep;
import org.gridsuite.monitor.commons.types.processexecution.ProcessType;
import org.gridsuite.monitor.server.dto.processexecution.ProcessExecution;
import org.gridsuite.monitor.server.dto.report.ReportPage;
import org.gridsuite.monitor.server.services.processexecution.ProcessExecutionService;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
Expand All @@ -33,12 +33,12 @@
@Tag(name = "Monitor server")
public class MonitorController {

private final MonitorService monitorService;
private final ProcessExecutionService processExecutionService;

public static final String HEADER_USER_ID = "userId";

public MonitorController(MonitorService monitorService) {
this.monitorService = monitorService;
public MonitorController(ProcessExecutionService processExecutionService) {
this.processExecutionService = processExecutionService;
}

@PostMapping("/execute")
Expand All @@ -50,31 +50,31 @@ public ResponseEntity<UUID> executeProcess(
@Parameter(description = "Process config uuid") @RequestParam(name = "processConfigUuid") UUID processConfigUuid,
@RequestParam(required = false, defaultValue = "false") boolean isDebug,
@RequestHeader(HEADER_USER_ID) String userId) {
Optional<UUID> executionId = monitorService.executeProcess(caseUuid, userId, processConfigUuid, isDebug);
Optional<UUID> executionId = processExecutionService.executeProcess(caseUuid, userId, processConfigUuid, isDebug);
return executionId.isPresent() ? ResponseEntity.ok(executionId.get()) : ResponseEntity.notFound().build();
}

@GetMapping("/executions/{executionId}/reports")
@Operation(summary = "Get reports for an execution")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The execution reports")})
public ResponseEntity<List<ReportPage>> getExecutionReports(@Parameter(description = "Execution UUID") @PathVariable UUID executionId) {
List<ReportPage> reports = monitorService.getReports(executionId);
List<ReportPage> reports = processExecutionService.getReports(executionId);
return ResponseEntity.ok(reports);
}

@GetMapping("/executions/{executionId}/results")
@Operation(summary = "Get results for an execution")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The execution results")})
public ResponseEntity<List<String>> getExecutionResults(@Parameter(description = "Execution UUID") @PathVariable UUID executionId) {
List<String> results = monitorService.getResults(executionId);
List<String> results = processExecutionService.getResults(executionId);
return ResponseEntity.ok(results);
}

@GetMapping("/executions")
@Operation(summary = "Get launched processes")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "The launched processes")})
public ResponseEntity<List<ProcessExecution>> getLaunchedProcesses(@Parameter(description = "Process type") @RequestParam(name = "processType") ProcessType processType) {
return ResponseEntity.ok(monitorService.getLaunchedProcesses(processType));
return ResponseEntity.ok(processExecutionService.getLaunchedProcesses(processType));
}

@GetMapping("/executions/{executionId}/step-infos")
Expand All @@ -83,7 +83,7 @@ public ResponseEntity<List<ProcessExecution>> getLaunchedProcesses(@Parameter(de
@ApiResponse(responseCode = "200", description = "The execution steps statuses"),
@ApiResponse(responseCode = "404", description = "execution id was not found")})
public ResponseEntity<List<ProcessExecutionStep>> getStepsInfos(@Parameter(description = "Execution UUID") @PathVariable UUID executionId) {
return monitorService.getStepsInfos(executionId).map(list -> ResponseEntity.ok().body(list))
return processExecutionService.getStepsInfos(executionId).map(list -> ResponseEntity.ok().body(list))
.orElseGet(() -> ResponseEntity.notFound().build());
}

Expand All @@ -93,7 +93,7 @@ public ResponseEntity<List<ProcessExecutionStep>> getStepsInfos(@Parameter(descr
@ApiResponse(responseCode = "200", description = "Debug file downloaded"),
@ApiResponse(responseCode = "404", description = "execution id was not found")})
public ResponseEntity<byte[]> getDebugInfos(@Parameter(description = "Execution UUID") @PathVariable UUID executionId) {
return monitorService.getDebugInfos(executionId)
return processExecutionService.getDebugInfos(executionId)
.map(bytes -> ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"archive.zip\"")
Expand All @@ -108,7 +108,7 @@ public ResponseEntity<byte[]> getDebugInfos(@Parameter(description = "Execution
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Execution was deleted"),
@ApiResponse(responseCode = "404", description = "Execution was not found")})
public ResponseEntity<Void> deleteExecution(@PathVariable UUID executionId) {
return monitorService.deleteExecution(executionId) ?
return processExecutionService.deleteExecution(executionId) ?
ResponseEntity.ok().build() :
ResponseEntity.notFound().build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.gridsuite.monitor.commons.PersistedProcessConfig;
import org.gridsuite.monitor.commons.ProcessConfig;
import org.gridsuite.monitor.commons.ProcessType;
import org.gridsuite.monitor.server.dto.ProcessConfigComparison;
import org.gridsuite.monitor.server.services.ProcessConfigService;
import org.gridsuite.monitor.server.dto.processconfig.PersistedProcessConfig;
import org.gridsuite.monitor.commons.types.processconfig.ProcessConfig;
import org.gridsuite.monitor.commons.types.processexecution.ProcessType;
import org.gridsuite.monitor.server.dto.processconfig.ProcessConfigComparison;
import org.gridsuite.monitor.server.services.processconfig.ProcessConfigService;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.commons;
package org.gridsuite.monitor.server.dto.processconfig;

import org.gridsuite.monitor.commons.types.processconfig.ProcessConfig;

import java.util.UUID;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.server.dto;
package org.gridsuite.monitor.server.dto.processconfig;

import io.swagger.v3.oas.annotations.media.Schema;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.monitor.server.dto;
package org.gridsuite.monitor.server.dto.processconfig;

import io.swagger.v3.oas.annotations.media.Schema;

Expand Down
Loading
Loading