Skip to content

Commit e994b99

Browse files
author
Dennis Labordus
authored
Merge pull request #290 from com-pas/develop
New release
2 parents c4a55f6 + 62639a8 commit e994b99

File tree

29 files changed

+216
-114
lines changed

29 files changed

+216
-114
lines changed

.github/workflows/build-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
5252
- name: Build with Maven (Pull Request)
5353
if: ${{ github.event_name == 'pull_request' }}
54-
run: ./mvnw -s custom_maven_settings.xml -B -Pjvm-image clean verify
54+
run: ./mvnw -s custom_maven_settings.xml -B -Pnative-image clean verify
5555
- name: Build with Maven (Push)
5656
if: ${{ github.event_name == 'push' }}
5757
run: ./mvnw -s custom_maven_settings.xml -B clean verify

.github/workflows/release-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ jobs:
6060
env:
6161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6262
- name: Deploy with Maven to GitHub Packages and Docker Hub
63-
run: ./mvnw -B -s custom_maven_settings.xml -Pjvm-image,release clean deploy
63+
run: ./mvnw -B -s custom_maven_settings.xml -Pnative-image,release clean deploy
6464
env:
6565
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

app/pom.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ SPDX-License-Identifier: Apache-2.0
107107
<groupId>io.quarkus</groupId>
108108
<artifactId>quarkus-jdbc-postgresql</artifactId>
109109
</dependency>
110+
111+
<dependency>
112+
<groupId>org.jboss.logmanager</groupId>
113+
<artifactId>log4j2-jboss-logmanager</artifactId>
114+
</dependency>
115+
110116
<dependency>
111117
<groupId>io.quarkus</groupId>
112118
<artifactId>quarkus-container-image-docker</artifactId>
@@ -148,11 +154,6 @@ SPDX-License-Identifier: Apache-2.0
148154
<artifactId>openpojo</artifactId>
149155
<scope>test</scope>
150156
</dependency>
151-
<dependency>
152-
<groupId>org.slf4j</groupId>
153-
<artifactId>slf4j-simple</artifactId>
154-
<scope>test</scope>
155-
</dependency>
156157
</dependencies>
157158

158159
<build>

app/src/main/docker/Dockerfile-basex.jvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/app-jvm
2222
#
2323
###
24-
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
24+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-923
2525

2626
ARG JAVA_PACKAGE=java-17-openjdk-headless
2727
ARG RUN_JAVA_VERSION=1.3.8

app/src/main/docker/Dockerfile-basex.native

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# docker run -i --rm -p 8080:8080 quarkus/app
1515
#
1616
###
17-
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
17+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-923
1818
WORKDIR /work/
1919
RUN chown 1001 /work \
2020
&& chmod "g+rwX" /work \

app/src/main/docker/Dockerfile-postgresql.jvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/app-jvm
2222
#
2323
###
24-
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
24+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-923
2525

2626
ARG JAVA_PACKAGE=java-17-openjdk-headless
2727
ARG RUN_JAVA_VERSION=1.3.8

app/src/main/docker/Dockerfile-postgresql.native

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# docker run -i --rm -p 8080:8080 quarkus/app
1515
#
1616
###
17-
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
17+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-923
1818
WORKDIR /work/
1919
RUN chown 1001 /work \
2020
&& chmod "g+rwX" /work \

app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasCommonResource.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55

66
import io.quarkus.security.Authenticated;
77
import io.smallrye.mutiny.Uni;
8+
import org.apache.logging.log4j.LogManager;
9+
import org.apache.logging.log4j.Logger;
810
import org.eclipse.microprofile.jwt.JsonWebToken;
911
import org.lfenergy.compas.scl.data.rest.UserInfoProperties;
1012
import org.lfenergy.compas.scl.data.rest.v1.model.Type;
1113
import org.lfenergy.compas.scl.data.rest.v1.model.TypeListResponse;
1214
import org.lfenergy.compas.scl.data.rest.v1.model.UserInfoResponse;
1315
import org.lfenergy.compas.scl.extensions.model.SclFileType;
14-
import org.slf4j.Logger;
15-
import org.slf4j.LoggerFactory;
1616

1717
import javax.enterprise.context.RequestScoped;
1818
import javax.inject.Inject;
1919
import javax.ws.rs.GET;
20-
import javax.ws.rs.HeaderParam;
2120
import javax.ws.rs.Path;
2221
import javax.ws.rs.Produces;
2322
import javax.ws.rs.core.MediaType;
@@ -30,7 +29,7 @@
3029
@RequestScoped
3130
@Path("/common/v1/")
3231
public class CompasCommonResource {
33-
private static final Logger LOGGER = LoggerFactory.getLogger(CompasCommonResource.class);
32+
private static final Logger LOGGER = LogManager.getLogger(CompasCommonResource.class);
3433

3534
@Inject
3635
JsonWebToken jsonWebToken;
@@ -41,8 +40,8 @@ public class CompasCommonResource {
4140
@GET
4241
@Path("/type/list")
4342
@Produces(MediaType.APPLICATION_XML)
44-
public Uni<TypeListResponse> list(@HeaderParam("Authorization") String authHeader) {
45-
LOGGER.trace("Authorization Header '{}'", authHeader);
43+
public Uni<TypeListResponse> list() {
44+
LOGGER.info("Retrieving list of the types of SCL Files");
4645

4746
// Retrieve the roles the logged-in user has.
4847
var roles = jsonWebToken.getGroups();
@@ -61,9 +60,8 @@ public Uni<TypeListResponse> list(@HeaderParam("Authorization") String authHeade
6160
@GET
6261
@Path("/userinfo")
6362
@Produces(MediaType.APPLICATION_XML)
64-
public Uni<UserInfoResponse> getUserInfo(@HeaderParam("Authorization") String authHeader) {
65-
LOGGER.trace("Authorization Header '{}'", authHeader);
66-
63+
public Uni<UserInfoResponse> getUserInfo() {
64+
LOGGER.info("Retrieving user information about {}", jsonWebToken.getName());
6765
var response = new UserInfoResponse();
6866
response.setName(jsonWebToken.getClaim(userInfoProperties.name()));
6967
response.setSessionWarning(userInfoProperties.sessionWarning());

app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResource.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
import io.quarkus.security.Authenticated;
77
import io.smallrye.common.annotation.Blocking;
88
import io.smallrye.mutiny.Uni;
9+
import org.apache.logging.log4j.LogManager;
10+
import org.apache.logging.log4j.Logger;
911
import org.eclipse.microprofile.jwt.JsonWebToken;
1012
import org.lfenergy.compas.scl.data.model.Version;
1113
import org.lfenergy.compas.scl.data.rest.UserInfoProperties;
1214
import org.lfenergy.compas.scl.data.rest.v1.model.*;
1315
import org.lfenergy.compas.scl.data.service.CompasSclDataService;
1416
import org.lfenergy.compas.scl.extensions.model.SclFileType;
15-
import org.slf4j.Logger;
16-
import org.slf4j.LoggerFactory;
1717

1818
import javax.enterprise.context.RequestScoped;
1919
import javax.inject.Inject;
@@ -28,7 +28,7 @@
2828
@RequestScoped
2929
@Path("/scl/v1/{" + TYPE_PATH_PARAM + "}")
3030
public class CompasSclDataResource {
31-
private static final Logger LOGGER = LoggerFactory.getLogger(CompasSclDataResource.class);
31+
private static final Logger LOGGER = LogManager.getLogger(CompasSclDataResource.class);
3232

3333
private final CompasSclDataService compasSclDataService;
3434

@@ -49,6 +49,7 @@ public CompasSclDataResource(CompasSclDataService compasSclDataService) {
4949
@Produces(MediaType.APPLICATION_XML)
5050
public Uni<CreateResponse> create(@PathParam(TYPE_PATH_PARAM) SclFileType type,
5151
@Valid CreateRequest request) {
52+
LOGGER.info("Adding new SCL File for type {} to storage.", type);
5253
String who = jsonWebToken.getClaim(userInfoProperties.who());
5354
LOGGER.trace("Username used for Who {}", who);
5455

@@ -62,6 +63,7 @@ public Uni<CreateResponse> create(@PathParam(TYPE_PATH_PARAM) SclFileType type,
6263
@Path("/list")
6364
@Produces(MediaType.APPLICATION_XML)
6465
public Uni<ListResponse> list(@PathParam(TYPE_PATH_PARAM) SclFileType type) {
66+
LOGGER.info("Listing SCL Files for type {} from storage.", type);
6567
var response = new ListResponse();
6668
response.setItems(compasSclDataService.list(type));
6769
return Uni.createFrom().item(response);
@@ -72,6 +74,7 @@ public Uni<ListResponse> list(@PathParam(TYPE_PATH_PARAM) SclFileType type) {
7274
@Produces(MediaType.APPLICATION_XML)
7375
public Uni<VersionsResponse> listVersionsByUUID(@PathParam(TYPE_PATH_PARAM) SclFileType type,
7476
@PathParam(ID_PATH_PARAM) UUID id) {
77+
LOGGER.info("Listing versions of SCL File {} for type {} from storage.", id, type);
7578
var response = new VersionsResponse();
7679
response.setItems(compasSclDataService.listVersionsByUUID(type, id));
7780
return Uni.createFrom().item(response);
@@ -82,6 +85,7 @@ public Uni<VersionsResponse> listVersionsByUUID(@PathParam(TYPE_PATH_PARAM) SclF
8285
@Produces(MediaType.APPLICATION_XML)
8386
public Uni<GetResponse> findByUUID(@PathParam(TYPE_PATH_PARAM) SclFileType type,
8487
@PathParam(ID_PATH_PARAM) UUID id) {
88+
LOGGER.info("Retrieving latest version of SCL File {} for type {} from storage.", id, type);
8589
var response = new GetResponse();
8690
response.setSclData(compasSclDataService.findByUUID(type, id));
8791
return Uni.createFrom().item(response);
@@ -93,6 +97,7 @@ public Uni<GetResponse> findByUUID(@PathParam(TYPE_PATH_PARAM) SclFileType type,
9397
public Uni<GetResponse> findByUUIDAndVersion(@PathParam(TYPE_PATH_PARAM) SclFileType type,
9498
@PathParam(ID_PATH_PARAM) UUID id,
9599
@PathParam(VERSION_PATH_PARAM) Version version) {
100+
LOGGER.info("Retrieving version {} of SCL File {} for type {} from storage.", version, id, type);
96101
var response = new GetResponse();
97102
response.setSclData(compasSclDataService.findByUUID(type, id, version));
98103
return Uni.createFrom().item(response);
@@ -106,6 +111,7 @@ public Uni<GetResponse> findByUUIDAndVersion(@PathParam(TYPE_PATH_PARAM) SclFile
106111
public Uni<UpdateResponse> update(@PathParam(TYPE_PATH_PARAM) SclFileType type,
107112
@PathParam(ID_PATH_PARAM) UUID id,
108113
@Valid UpdateRequest request) {
114+
LOGGER.info("Updating SCL File {} for type {} to storage.", id, type);
109115
String who = jsonWebToken.getClaim(userInfoProperties.who());
110116
LOGGER.trace("Username used for Who {}", who);
111117

@@ -121,6 +127,7 @@ public Uni<UpdateResponse> update(@PathParam(TYPE_PATH_PARAM) SclFileType type,
121127
@Produces(MediaType.APPLICATION_XML)
122128
public Uni<Void> deleteAll(@PathParam(TYPE_PATH_PARAM) SclFileType type,
123129
@PathParam(ID_PATH_PARAM) UUID id) {
130+
LOGGER.info("Removing all versions of SCL File {} for type {} from storage.", id, type);
124131
compasSclDataService.delete(type, id);
125132
return Uni.createFrom().nullItem();
126133
}
@@ -132,6 +139,7 @@ public Uni<Void> deleteAll(@PathParam(TYPE_PATH_PARAM) SclFileType type,
132139
public Uni<Void> deleteVersion(@PathParam(TYPE_PATH_PARAM) SclFileType type,
133140
@PathParam(ID_PATH_PARAM) UUID id,
134141
@PathParam(VERSION_PATH_PARAM) Version version) {
142+
LOGGER.info("Removing version {} of SCL File {} for type {} from storage.", version, id, type);
135143
compasSclDataService.delete(type, id, version);
136144
return Uni.createFrom().nullItem();
137145
}

app/src/main/java/org/lfenergy/compas/scl/data/websocket/v1/CompasSclCreateServerEndpoint.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
import io.quarkus.security.Authenticated;
77
import io.vertx.mutiny.core.eventbus.EventBus;
8+
import org.apache.logging.log4j.LogManager;
9+
import org.apache.logging.log4j.Logger;
810
import org.eclipse.microprofile.jwt.JsonWebToken;
911
import org.lfenergy.compas.core.websocket.ErrorResponseEncoder;
1012
import org.lfenergy.compas.scl.data.rest.UserInfoProperties;
@@ -13,11 +15,10 @@
1315
import org.lfenergy.compas.scl.data.websocket.v1.encoder.CreateWsResponseEncoder;
1416
import org.lfenergy.compas.scl.data.websocket.v1.model.CreateWsRequest;
1517
import org.lfenergy.compas.scl.extensions.model.SclFileType;
16-
import org.slf4j.Logger;
17-
import org.slf4j.LoggerFactory;
1818

1919
import javax.enterprise.context.ApplicationScoped;
2020
import javax.inject.Inject;
21+
import javax.validation.Valid;
2122
import javax.websocket.*;
2223
import javax.websocket.server.PathParam;
2324
import javax.websocket.server.ServerEndpoint;
@@ -31,7 +32,7 @@
3132
decoders = {CreateWsRequestDecoder.class},
3233
encoders = {CreateWsResponseEncoder.class, ErrorResponseEncoder.class})
3334
public class CompasSclCreateServerEndpoint {
34-
private static final Logger LOGGER = LoggerFactory.getLogger(CompasSclCreateServerEndpoint.class);
35+
private static final Logger LOGGER = LogManager.getLogger(CompasSclCreateServerEndpoint.class);
3536

3637
private final EventBus eventBus;
3738
private final JsonWebToken jsonWebToken;
@@ -52,7 +53,9 @@ public void onOpen(Session session, @PathParam(TYPE_PATH_PARAM) String type) {
5253
}
5354

5455
@OnMessage
55-
public void onCreateMessage(Session session, CreateWsRequest request, @PathParam(TYPE_PATH_PARAM) String type) {
56+
public void onCreateMessage(Session session,
57+
@Valid CreateWsRequest request,
58+
@PathParam(TYPE_PATH_PARAM) String type) {
5659
LOGGER.info("Message (create) from session {} for type {}.", session.getId(), type);
5760

5861
String who = jsonWebToken.getClaim(userInfoProperties.who());

0 commit comments

Comments
 (0)