diff --git a/backend/pom.xml b/backend/pom.xml index e152cf3e..5810284f 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -85,13 +85,12 @@ jersey-common 2.26 - - io.swagger - swagger-annotations - ${io.swagger.annotations.version} - provided - - + + org.codehaus.janino + janino + 3.1.12 + + io.quarkus quarkus-flyway diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionService.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionService.java index 6541d964..36a1f824 100644 --- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionService.java +++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionService.java @@ -26,6 +26,7 @@ import ca.bc.gov.nrs.vdyp.backend.v1.api.projection.IProjectionRunner; import ca.bc.gov.nrs.vdyp.backend.v1.api.projection.ProjectionRunner; import ca.bc.gov.nrs.vdyp.backend.v1.api.projection.StubProjectionRunner; +import ca.bc.gov.nrs.vdyp.backend.v1.gen.api.ParameterNames; import ca.bc.gov.nrs.vdyp.backend.v1.gen.model.Parameters; import ca.bc.gov.nrs.vdyp.backend.v1.utils.FileHelper; import jakarta.enterprise.context.ApplicationScoped; @@ -50,9 +51,7 @@ public Response projectionHcsvPost( FileUpload layersFileStream, // SecurityContext securityContext ) { - if (trialRun == null) { - trialRun = false; - } + Response response; Map inputStreams = new HashMap<>(); @@ -62,27 +61,37 @@ public Response projectionHcsvPost( if (trialRun) { if (polyStream.available() == 0) { + polyStream.close(); polyStream = FileHelper.getStubResourceFile("VDYP7_INPUT_POLY.csv"); } if (layersStream.available() == 0) { + layersStream.close(); layersStream = FileHelper.getStubResourceFile("VDYP7_INPUT_LAYER.csv"); } } - inputStreams.put("polygon", polyStream); - inputStreams.put("layers", layersStream); + response = runProjection("hcsv", inputStreams, trialRun, parameters, securityContext); + + inputStreams.put(ParameterNames.POLYGON_INPUT_DATA, polyStream); + inputStreams.put(ParameterNames.LAYERS_INPUT_DATA, layersStream); } catch (IOException e) { String message = Exceptions.getMessage(e, "Projection, when opening input files,"); logger.error(message); - return Response.serverError().status(500).entity(message).build(); + response = Response.serverError().status(500).entity(message).build(); } finally { - logger.info(FINALIZE_SESSION_MARKER, ">projectionHcsvPost"); + for (var entry : inputStreams.entrySet()) { + try { + entry.getValue().close(); + } catch (IOException e) { + logger.warn("Unable to close {}; reason: {}", entry.getKey(), e.getMessage()); + } + } } - return runProjection("hcsv", inputStreams, trialRun, parameters, securityContext); + return response; } public Response projectionDcsvPost( @@ -103,52 +112,53 @@ private Response runProjection( String projectionType, Map inputStreams, Boolean trialRun, Parameters params, SecurityContext securityContext ) { - if (trialRun == null) { - trialRun = false; - } - String projectionId = ProjectionService.buildId(projectionType); + logger.info("runProjection {} {}", projectionType, projectionId); + + if (debugLoggingEnabled) { + MDC.remove("projectionId"); + // FileHelper.delete(debugLogPath); + } } return response; diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionEndpoint.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionEndpoint.java index ba273fef..45a54488 100644 --- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionEndpoint.java +++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionEndpoint.java @@ -6,9 +6,7 @@ import org.jboss.resteasy.reactive.multipart.FileUpload; import ca.bc.gov.nrs.vdyp.backend.v1.api.ProjectionService; -import ca.bc.gov.nrs.vdyp.backend.v1.gen.model.MessagesInner; import ca.bc.gov.nrs.vdyp.backend.v1.gen.model.Parameters; -import ca.bc.gov.nrs.vdyp.backend.v1.gen.responses.ProjectionResource; import io.quarkus.runtime.annotations.RegisterForReflection; import jakarta.inject.Inject; import jakarta.ws.rs.Consumes; diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 26662194..e3f4735e 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -3,5 +3,5 @@ mp.openapi.scan.disable=false mp.openapi.extensions.smallrye.operationIdStrategy=METHOD -quarkus.native.additional-build-args=--initialize-at-run-time=org.glassfish.jersey.server.internal.process.RequestProcessingContext,-H:+UnlockExperimentalVMOptions,-H:Log=registerResource:3 +quarkus.native.additional-build-args=--initialize-at-run-time=org.glassfish.jersey.server.internal.process.RequestProcessingContext\\,io.netty.resolver.dns.DnsServerAddressStreamProviders,-H:+UnlockExperimentalVMOptions,-H:Log=registerResource:3 quarkus.native.resources.includes=VDYP7Console-sample-files/** diff --git a/backend/src/main/resources/logback.xml b/backend/src/main/resources/logback.xml index c95d22b7..1cfab242 100644 --- a/backend/src/main/resources/logback.xml +++ b/backend/src/main/resources/logback.xml @@ -1,11 +1,5 @@ - - projectionId - not-request-specific - DENY - - - %-4relative [%thread] %-5level %logger{35} -%kvp- %msg %n + %-4relative [%thread] %-5level %logger{35}: %msg%n