diff --git a/.github/workflows/maven-cli.yml b/.github/workflows/maven-cli.yml index 69a1877..aa51765 100644 --- a/.github/workflows/maven-cli.yml +++ b/.github/workflows/maven-cli.yml @@ -16,11 +16,11 @@ jobs: steps: - name: checkout from git uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 + - name: Set up GraalVM 21 + uses: graalvm/setup-graalvm@v1 with: - java-version: '17' - distribution: 'temurin' + java-version: '21' + distribution: 'graalvm-community' cache: maven - name: Install gpg secret key run: | @@ -79,7 +79,7 @@ jobs: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} with: upload_url: ${{steps.create_release.outputs.upload_url}} - asset_path: 'quarkus-app/target/openepcis-event-hash-generator-service-runner.jar' + asset_path: 'quarkus/quarkus-app/target/openepcis-event-hash-generator-service-runner.jar' asset_name: 'openepcis-event-hash-generator-service-${{env.GIT_TAG_NAME}}.jar' asset_content_type: application/java-archive - name: 'Upload Release CLI Asset' @@ -139,11 +139,11 @@ jobs: username: ${{github.actor}} password: ${{secrets.GITHUB_TOKEN}} - - name: Set up JDK 17 - uses: actions/setup-java@v3 + - name: Set up GraalVM 21 + uses: graalvm/setup-graalvm@v1 with: - java-version: '17' - distribution: 'temurin' + java-version: '21' + distribution: 'graalvm-community' cache: maven - name: "Prepare Build" @@ -152,7 +152,7 @@ jobs: - name: "Build ${{matrix.platform}} native Image" run: | - mvn --no-transfer-progress --batch-mode -Pci-build package -Dnative -DskipTests -f ./quarkus-app/pom.xml \ + mvn --no-transfer-progress --batch-mode -Pci-build package -Dnative -DskipTests -f ./quarkus/quarkus-app/pom.xml \ -Dquarkus.native.container-build=true \ -Dquarkus.container-image.build=true \ -Dquarkus.container-image.name=event-hash-generator-service-native \ @@ -232,11 +232,11 @@ jobs: id: builder uses: docker/setup-buildx-action@v1 - - name: Set up JDK 17 - uses: actions/setup-java@v3 + - name: Set up GraalVM 21 + uses: graalvm/setup-graalvm@v1 with: - java-version: '17' - distribution: 'temurin' + java-version: '21' + distribution: 'graalvm-community' cache: maven - name: "Prepare Build" @@ -246,7 +246,7 @@ jobs: - name: "Build linux/amd64 Image" run: | mvn --no-transfer-progress --batch-mode \ - clean package -Pci-build -f ./quarkus-app/pom.xml \ + clean package -Pci-build -f ./quarkus/quarkus-app/pom.xml \ -Dquarkus.container-image.name=event-hash-generator-service \ -Dquarkus.container-image.build=true \ -Dquarkus.container-image.registry=ghcr.io \ @@ -258,7 +258,7 @@ jobs: - name: "Build linux/arm64 Image" run: | mvn --no-transfer-progress --batch-mode \ - clean package -Pci-build -f ./quarkus-app/pom.xml \ + clean package -Pci-build -f ./quarkus/quarkus-app/pom.xml \ -Dquarkus.container-image.name=event-hash-generator-service \ -Dquarkus.container-image.build=true \ -Dquarkus.container-image.registry=ghcr.io \ @@ -290,7 +290,7 @@ jobs: strategy: matrix: - os: ['ubuntu-latest', 'ubuntu-22.04-arm64', 'macos-latest', 'windows-latest'] + os: ['ubuntu-latest', 'ubuntu-22.04-arm64', "macos-13", 'macos-latest', 'windows-latest'] include: - os: 'ubuntu-latest' label: 'linux-amd64' @@ -298,8 +298,11 @@ jobs: - os: 'ubuntu-22.04-arm64' label: 'linux-arm64' exe: "" + - os: 'macos-13' + label: 'mac-x64' + exe: "" - os: 'macos-latest' - label: 'mac' + label: 'mac-arm' exe: "" - os: 'windows-latest' label: 'windows' @@ -330,10 +333,10 @@ jobs: run: | echo "::set-env name=UPLOAD_URL::$(cat upload_url.txt)" - - name: Set up GraalVM + - name: Set up GraalVM 21 uses: graalvm/setup-graalvm@v1 with: - java-version: '17' + java-version: '21' distribution: 'graalvm-community' native-image-job-reports: 'true' github-token: ${{ secrets.GITHUB_TOKEN }} @@ -344,7 +347,7 @@ jobs: - name: "Build Native Quarkus Executable" run: | - mvn --no-transfer-progress --batch-mode clean package -Pnative -Pci-build -DskipTests -f ./quarkus-app/pom.xml + mvn --no-transfer-progress --batch-mode clean package -Pnative -Pci-build -DskipTests -f ./quarkus/quarkus-app/pom.xml - name: 'Release Native Quarkus Executable' if: success() && contains(github.ref, 'v') @@ -355,7 +358,7 @@ jobs: with: upload_url: ${{env.UPLOAD_URL}} asset_name: 'openepcis-event-hash-generator-service-runner-${{env.GIT_TAG_NAME}}-${{matrix.label}}${{matrix.exe}}' - asset_path: 'quarkus-app/target/openepcis-event-hash-generator-service-runner${{matrix.exe}}' + asset_path: 'quarkus/quarkus-app/target/openepcis-event-hash-generator-service-runner${{matrix.exe}}' asset_content_type: application/octet-stream build-cli-native-executable: @@ -363,7 +366,7 @@ jobs: needs: [build-jar-job] strategy: matrix: - os: ['ubuntu-latest', 'ubuntu-22.04-arm64', 'macos-latest', 'windows-latest'] + os: ['ubuntu-latest', 'ubuntu-22.04-arm64', "macos-13", 'macos-latest', 'windows-latest'] include: - os: 'ubuntu-latest' label: 'linux-amd64' @@ -371,8 +374,11 @@ jobs: - os: 'ubuntu-22.04-arm64' label: 'linux-arm64' exe: "" + - os: 'macos-13' + label: 'mac-x64' + exe: "" - os: 'macos-latest' - label: 'mac' + label: 'mac-arm' exe: "" - os: 'windows-latest' label: 'windows' @@ -382,13 +388,11 @@ jobs: - name: checkout from git uses: actions/checkout@v3 - - name: Set up GraalVM + - name: Set up GraalVM 21 uses: graalvm/setup-graalvm@v1 with: - java-version: '17' + java-version: '21' distribution: 'graalvm-community' - native-image-job-reports: 'true' - github-token: ${{ secrets.GITHUB_TOKEN }} - name: 'Get Version Number' env: diff --git a/cli/pom.xml b/cli/pom.xml index 16de8eb..f6e91d9 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -94,7 +94,7 @@ - io.openepcis.epc.eventhash.main.HashGenerator + io.openepcis.eventhash.main.HashGenerator ${project.artifactId} ${project.version} ${project.artifactId} @@ -136,7 +136,7 @@ epcis-event-hash - io.openepcis.epc.eventhash.main.HashGenerator + io.openepcis.eventhash.main.HashGenerator --enable-all-security-services --enable-http diff --git a/cli/src/main/java/io/openepcis/epc/eventhash/main/HashGenerator.java b/cli/src/main/java/io/openepcis/eventhash/main/HashGenerator.java similarity index 98% rename from cli/src/main/java/io/openepcis/epc/eventhash/main/HashGenerator.java rename to cli/src/main/java/io/openepcis/eventhash/main/HashGenerator.java index 22a0980..c02f5e5 100644 --- a/cli/src/main/java/io/openepcis/epc/eventhash/main/HashGenerator.java +++ b/cli/src/main/java/io/openepcis/eventhash/main/HashGenerator.java @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.openepcis.epc.eventhash.main; +package io.openepcis.eventhash.main; -import io.openepcis.epc.eventhash.EventHashGenerator; +import io.openepcis.eventhash.EventHashGenerator; import java.io.*; -import java.time.temporal.ChronoUnit; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; diff --git a/core/src/main/java/io/openepcis/epc/eventhash/ContextNode.java b/core/src/main/java/io/openepcis/eventhash/ContextNode.java similarity index 99% rename from core/src/main/java/io/openepcis/epc/eventhash/ContextNode.java rename to core/src/main/java/io/openepcis/eventhash/ContextNode.java index 0366dad..ff9f827 100644 --- a/core/src/main/java/io/openepcis/epc/eventhash/ContextNode.java +++ b/core/src/main/java/io/openepcis/eventhash/ContextNode.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.openepcis.epc.eventhash; +package io.openepcis.eventhash; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import io.openepcis.constants.CBVVersion; import io.openepcis.constants.EPCIS; -import io.openepcis.epc.eventhash.constant.ConstantEventHashInfo; +import io.openepcis.eventhash.constant.ConstantEventHashInfo; import io.openepcis.epc.translator.util.ConverterUtil; import lombok.Getter; import lombok.NoArgsConstructor; @@ -29,7 +29,7 @@ import java.util.*; import java.util.stream.Collectors; -import static io.openepcis.epc.eventhash.constant.ConstantEventHashInfo.*; +import static io.openepcis.eventhash.constant.ConstantEventHashInfo.*; /** * This class is utilized by EventHash and SaxHandler during the parsing of XML/JSON EPCIS document diff --git a/core/src/main/java/io/openepcis/epc/eventhash/DocumentWrapperSupport.java b/core/src/main/java/io/openepcis/eventhash/DocumentWrapperSupport.java similarity index 97% rename from core/src/main/java/io/openepcis/epc/eventhash/DocumentWrapperSupport.java rename to core/src/main/java/io/openepcis/eventhash/DocumentWrapperSupport.java index 0bb36ad..11d787e 100644 --- a/core/src/main/java/io/openepcis/epc/eventhash/DocumentWrapperSupport.java +++ b/core/src/main/java/io/openepcis/eventhash/DocumentWrapperSupport.java @@ -13,14 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.openepcis.epc.eventhash; +package io.openepcis.eventhash; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.JsonNode; -import io.openepcis.epc.eventhash.exception.EventHashException; -import jakarta.inject.Inject; +import io.openepcis.eventhash.exception.EventHashException; import jakarta.inject.Singleton; import lombok.RequiredArgsConstructor; import org.eclipse.microprofile.context.ManagedExecutor; diff --git a/core/src/main/java/io/openepcis/epc/eventhash/EventHashGenerator.java b/core/src/main/java/io/openepcis/eventhash/EventHashGenerator.java similarity index 98% rename from core/src/main/java/io/openepcis/epc/eventhash/EventHashGenerator.java rename to core/src/main/java/io/openepcis/eventhash/EventHashGenerator.java index f441acf..a0bd7ea 100644 --- a/core/src/main/java/io/openepcis/epc/eventhash/EventHashGenerator.java +++ b/core/src/main/java/io/openepcis/eventhash/EventHashGenerator.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.openepcis.epc.eventhash; +package io.openepcis.eventhash; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import io.openepcis.constants.CBVVersion; import io.openepcis.constants.EPCIS; -import io.openepcis.epc.eventhash.constant.ConstantEventHashInfo; -import io.openepcis.epc.eventhash.exception.EventHashException; +import io.openepcis.eventhash.constant.ConstantEventHashInfo; +import io.openepcis.eventhash.exception.EventHashException; import io.openepcis.reactive.publisher.ObjectNodePublisher; import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.subscription.MultiEmitter; @@ -31,7 +31,6 @@ import java.util.function.Consumer; import javax.xml.parsers.SAXParserFactory; -import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; diff --git a/core/src/main/java/io/openepcis/epc/eventhash/HashIdGenerator.java b/core/src/main/java/io/openepcis/eventhash/HashIdGenerator.java similarity index 99% rename from core/src/main/java/io/openepcis/epc/eventhash/HashIdGenerator.java rename to core/src/main/java/io/openepcis/eventhash/HashIdGenerator.java index 1e5937b..aa03573 100644 --- a/core/src/main/java/io/openepcis/epc/eventhash/HashIdGenerator.java +++ b/core/src/main/java/io/openepcis/eventhash/HashIdGenerator.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.openepcis.epc.eventhash; +package io.openepcis.eventhash; import io.openepcis.constants.CBVVersion; import jakarta.xml.bind.DatatypeConverter; diff --git a/core/src/main/java/io/openepcis/epc/eventhash/HashNodeComparator.java b/core/src/main/java/io/openepcis/eventhash/HashNodeComparator.java similarity index 99% rename from core/src/main/java/io/openepcis/epc/eventhash/HashNodeComparator.java rename to core/src/main/java/io/openepcis/eventhash/HashNodeComparator.java index c79f933..83b87da 100644 --- a/core/src/main/java/io/openepcis/epc/eventhash/HashNodeComparator.java +++ b/core/src/main/java/io/openepcis/eventhash/HashNodeComparator.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.openepcis.epc.eventhash; +package io.openepcis.eventhash; import java.util.ArrayList; import java.util.Comparator; diff --git a/core/src/main/java/io/openepcis/epc/eventhash/SaxHandler.java b/core/src/main/java/io/openepcis/eventhash/SaxHandler.java similarity index 98% rename from core/src/main/java/io/openepcis/epc/eventhash/SaxHandler.java rename to core/src/main/java/io/openepcis/eventhash/SaxHandler.java index d88c5da..a09a1da 100644 --- a/core/src/main/java/io/openepcis/epc/eventhash/SaxHandler.java +++ b/core/src/main/java/io/openepcis/eventhash/SaxHandler.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.openepcis.epc.eventhash; +package io.openepcis.eventhash; import io.openepcis.constants.EPCIS; -import io.openepcis.epc.eventhash.constant.ConstantEventHashInfo; +import io.openepcis.eventhash.constant.ConstantEventHashInfo; import io.smallrye.mutiny.subscription.MultiEmitter; import java.util.ArrayDeque; import java.util.Deque; diff --git a/core/src/main/java/io/openepcis/epc/eventhash/TemplateNodeMap.java b/core/src/main/java/io/openepcis/eventhash/TemplateNodeMap.java similarity index 99% rename from core/src/main/java/io/openepcis/epc/eventhash/TemplateNodeMap.java rename to core/src/main/java/io/openepcis/eventhash/TemplateNodeMap.java index 7b96dc2..c29b2cf 100644 --- a/core/src/main/java/io/openepcis/epc/eventhash/TemplateNodeMap.java +++ b/core/src/main/java/io/openepcis/eventhash/TemplateNodeMap.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.openepcis.epc.eventhash; +package io.openepcis.eventhash; import io.openepcis.constants.EPCIS; -import io.openepcis.epc.eventhash.constant.ConstantEventHashInfo; +import io.openepcis.eventhash.constant.ConstantEventHashInfo; import java.util.*; import java.util.concurrent.atomic.AtomicReference; diff --git a/core/src/main/java/io/openepcis/epc/eventhash/constant/ConstantEventHashInfo.java b/core/src/main/java/io/openepcis/eventhash/constant/ConstantEventHashInfo.java similarity index 99% rename from core/src/main/java/io/openepcis/epc/eventhash/constant/ConstantEventHashInfo.java rename to core/src/main/java/io/openepcis/eventhash/constant/ConstantEventHashInfo.java index ad95be0..646ac71 100644 --- a/core/src/main/java/io/openepcis/epc/eventhash/constant/ConstantEventHashInfo.java +++ b/core/src/main/java/io/openepcis/eventhash/constant/ConstantEventHashInfo.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.openepcis.epc.eventhash.constant; +package io.openepcis.eventhash.constant; import static java.util.Map.entry; diff --git a/core/src/main/java/io/openepcis/epc/eventhash/exception/EventHashException.java b/core/src/main/java/io/openepcis/eventhash/exception/EventHashException.java similarity index 94% rename from core/src/main/java/io/openepcis/epc/eventhash/exception/EventHashException.java rename to core/src/main/java/io/openepcis/eventhash/exception/EventHashException.java index 634d825..3a0e0dc 100644 --- a/core/src/main/java/io/openepcis/epc/eventhash/exception/EventHashException.java +++ b/core/src/main/java/io/openepcis/eventhash/exception/EventHashException.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.openepcis.epc.eventhash.exception; +package io.openepcis.eventhash.exception; public class EventHashException extends RuntimeException { public EventHashException(String msg, Throwable parent) { diff --git a/core/src/test/java/io/openepcis/epc/eventhash/EventHashGeneratorPublisherTest.java b/core/src/test/java/io/openepcis/eventhash/EventHashGeneratorPublisherTest.java similarity index 99% rename from core/src/test/java/io/openepcis/epc/eventhash/EventHashGeneratorPublisherTest.java rename to core/src/test/java/io/openepcis/eventhash/EventHashGeneratorPublisherTest.java index c427dfb..6727a32 100644 --- a/core/src/test/java/io/openepcis/epc/eventhash/EventHashGeneratorPublisherTest.java +++ b/core/src/test/java/io/openepcis/eventhash/EventHashGeneratorPublisherTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.openepcis.epc.eventhash; +package io.openepcis.eventhash; import io.openepcis.constants.CBVVersion; import io.smallrye.mutiny.Multi; diff --git a/core/src/test/java/io/openepcis/epc/eventhash/ParallelExecutionTests.java b/core/src/test/java/io/openepcis/eventhash/ParallelExecutionTests.java similarity index 99% rename from core/src/test/java/io/openepcis/epc/eventhash/ParallelExecutionTests.java rename to core/src/test/java/io/openepcis/eventhash/ParallelExecutionTests.java index 84ad691..fe13846 100644 --- a/core/src/test/java/io/openepcis/epc/eventhash/ParallelExecutionTests.java +++ b/core/src/test/java/io/openepcis/eventhash/ParallelExecutionTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.openepcis.epc.eventhash; +package io.openepcis.eventhash; import static org.junit.Assert.assertEquals; diff --git a/pom.xml b/pom.xml index 205001c..f1810a5 100644 --- a/pom.xml +++ b/pom.xml @@ -67,17 +67,16 @@ https://github.com/openepcis/openepcis-event-hash-generator/tree/main - - 2.8.2 - - core cli restassured rest-api servlet-api + quarkus + @@ -88,6 +87,11 @@ openepcis-event-hash-generator ${project.version} + + io.openepcis.quarkus + quarkus-event-hash-generator + ${project.version} + io.openepcis openepcis-event-hash-generator-rest-api @@ -112,12 +116,34 @@ ${project.version} compile + + + io.openepcis.quarkus + quarkus-openepcis-model + ${project.version} + + + io.openepcis.quarkus + quarkus-openepcis-model-deployment + ${project.version} + + io.openepcis openepcis-test-resources ${project.version} + + io.openepcis.quarkus + quarkus-test-resources + ${project.version} + + + io.openepcis.quarkus + quarkus-test-resources-deployment + ${project.version} + diff --git a/quarkus-app/src/main/docker/Dockerfile.dev b/quarkus-app/src/main/docker/Dockerfile.dev deleted file mode 100644 index 6abad2b..0000000 --- a/quarkus-app/src/main/docker/Dockerfile.dev +++ /dev/null @@ -1,18 +0,0 @@ -FROM openjdk:17-alpine - -ENV QUARKUS_LAUNCH_DEVMODE=true \ - JAVA_ENABLE_DEBUG=true - -COPY target/quarkus-app/lib/ /deployments/lib/ -COPY target/quarkus-app/*.jar /deployments/ -COPY target/quarkus-app/app/ /deployments/app/ -COPY target/quarkus-app/quarkus/ /deployments/quarkus/ - -CMD ["java", "-jar", \ - "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" \ - "-Dquarkus.http.host=0.0.0.0", \ - "-Djava.util.logging.manager=org.jboss.logmanager.LogManager", \ - "-Dquarkus.package.type=mutable-jar", \ - "-Dquarkus.live-reload.password=123", \ - "-Dquarkus-profile=docker", \ - "/deployments/quarkus-run.jar"] \ No newline at end of file diff --git a/quarkus-app/src/main/docker/Dockerfile.jvm b/quarkus-app/src/main/docker/Dockerfile.jvm deleted file mode 100644 index 70c1619..0000000 --- a/quarkus-app/src/main/docker/Dockerfile.jvm +++ /dev/null @@ -1,55 +0,0 @@ -#### -# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode -# -# Before building the container image run: -# -# ./mvnw package -# -# Then, build the image with: -# -# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/quarkus-rest-jvm . -# -# Then run the container using: -# -# docker run -i --rm -p 8080:8080 quarkus/quarkus-rest-jvm -# -# If you want to include the debug port into your docker image -# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005 -# -# Then run the container using : -# -# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/quarkus-rest-jvm -# -### -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 - -ARG JAVA_PACKAGE=java-17-openjdk-headless -ARG RUN_JAVA_VERSION=1.3.8 -ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' -# Install java and the run-java script -# Also set up permissions for user `1001` -RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ - && microdnf update \ - && microdnf clean all \ - && mkdir /deployments \ - && chown 1001 /deployments \ - && chmod "g+rwX" /deployments \ - && chown 1001:root /deployments \ - && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ - && chown 1001 /deployments/run-java.sh \ - && chmod 540 /deployments/run-java.sh \ - && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security - -# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. -ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" -# We make four distinct layers so if there are application changes the library layers can be re-used -COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/ -COPY --chown=1001 target/quarkus-app/*.jar /deployments/ -COPY --chown=1001 target/quarkus-app/app/ /deployments/app/ -COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/ - -EXPOSE 8080 -USER 1001 - -ENTRYPOINT [ "/deployments/run-java.sh" ] - diff --git a/quarkus-app/src/main/docker/Dockerfile.legacy-jar b/quarkus-app/src/main/docker/Dockerfile.legacy-jar deleted file mode 100644 index 18c0f05..0000000 --- a/quarkus-app/src/main/docker/Dockerfile.legacy-jar +++ /dev/null @@ -1,51 +0,0 @@ -#### -# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode -# -# Before building the container image run: -# -# ./mvnw package -Dquarkus.package.type=legacy-jar -# -# Then, build the image with: -# -# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/quarkus-rest-legacy-jar . -# -# Then run the container using: -# -# docker run -i --rm -p 8080:8080 quarkus/quarkus-rest-legacy-jar -# -# If you want to include the debug port into your docker image -# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005 -# -# Then run the container using : -# -# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/quarkus-rest-legacy-jar -# -### -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 - -ARG JAVA_PACKAGE=java-17-openjdk-headless -ARG RUN_JAVA_VERSION=1.3.8 -ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' -# Install java and the run-java script -# Also set up permissions for user `1001` -RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ - && microdnf update \ - && microdnf clean all \ - && mkdir /deployments \ - && chown 1001 /deployments \ - && chmod "g+rwX" /deployments \ - && chown 1001:root /deployments \ - && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ - && chown 1001 /deployments/run-java.sh \ - && chmod 540 /deployments/run-java.sh \ - && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security - -# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. -ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" -COPY target/lib/* /deployments/lib/ -COPY target/*-runner.jar /deployments/app.jar - -EXPOSE 8080 -USER 1001 - -ENTRYPOINT [ "/deployments/run-java.sh" ] diff --git a/quarkus-app/src/main/docker/Dockerfile.native-distroless b/quarkus-app/src/main/docker/Dockerfile.native-distroless deleted file mode 100644 index 5022f37..0000000 --- a/quarkus-app/src/main/docker/Dockerfile.native-distroless +++ /dev/null @@ -1,23 +0,0 @@ -#### -# This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode -# -# Before building the container image run: -# -# ./mvnw package -Pnative -# -# Then, build the image with: -# -# docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/quarkus-rest . -# -# Then run the container using: -# -# docker run -i --rm -p 8080:8080 quarkus/quarkus-rest -# -### -FROM quay.io/quarkus/quarkus-distroless-image:1.0 -COPY target/*-runner /application - -EXPOSE 8080 -USER nonroot - -CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/quarkus/deployment/pom.xml b/quarkus/deployment/pom.xml new file mode 100644 index 0000000..b785e68 --- /dev/null +++ b/quarkus/deployment/pom.xml @@ -0,0 +1,124 @@ + + + + 4.0.0 + + io.openepcis.quarkus + quarkus-event-hash-generator-parent + 1.0.0-SNAPSHOT + ../pom.xml + + + quarkus-event-hash-generator-deployment + jar + quarkus-event-hash-generator-deployment + Quarkus Event Hash Generator Deployment + https://github.com/openepcis/openepcis-event-hash-generator + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Sven Boeckelmann + sven.boeckelmann@benelog.com + benelog GmbH & Co. KG + https://www.benelog.com + + + Aravinda Baliga B + aravinda.baliga@benelog.com + benelog GmbH & Co. KG + https://www.benelog.com + + + Shaik Dayan + dayan.shaik@benelog.com + benelog GmbH & Co. KG + https://www.benelog.com + + + + + scm:git:git://github.com/openepcis/openepcis-event-hash-generator.git + scm:git:ssh://github.com:openepcis/openepcis-event-hash-generator.git + https://github.com/openepcis/openepcis-event-hash-generator/tree/main + + + + + io.quarkus + quarkus-smallrye-health-deployment + + + + io.openepcis.quarkus + quarkus-event-hash-generator + + + io.openepcis.quarkus + quarkus-openepcis-model-deployment + + + io.openepcis.quarkus + quarkus-test-resources-deployment + + + + + + io.quarkus + quarkus-junit5-internal + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + io.quarkus + quarkus-extension-processor + ${quarkus.platform.version} + + + + + + maven-surefire-plugin + + + org.jboss.logmanager.LogManager + + + + + + + diff --git a/quarkus/deployment/src/main/java/io/openepcis/eventhash/deployment/OpenEPCISEventHashProcessor.java b/quarkus/deployment/src/main/java/io/openepcis/eventhash/deployment/OpenEPCISEventHashProcessor.java new file mode 100644 index 0000000..bc36b96 --- /dev/null +++ b/quarkus/deployment/src/main/java/io/openepcis/eventhash/deployment/OpenEPCISEventHashProcessor.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022-2024 benelog GmbH & Co. KG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.openepcis.eventhash.deployment; + +import io.openepcis.eventhash.runtime.EventHashGeneratorProducer; +import io.openepcis.eventhash.runtime.EventHashHealthCheck; +import io.openepcis.quarkus.deployment.model.OpenEPCISBuildTimeConfig; +import io.quarkus.arc.deployment.AdditionalBeanBuildItem; +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.FeatureBuildItem; +import io.quarkus.smallrye.health.deployment.spi.HealthBuildItem; + +public class OpenEPCISEventHashProcessor { + + private static final String FEATURE = "openepcis-event-hash"; + + + @BuildStep + FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } + + @BuildStep() + AdditionalBeanBuildItem buildOpenEPCISJAXBContext() { + return AdditionalBeanBuildItem.unremovableOf(EventHashGeneratorProducer.class); + } + + @BuildStep + HealthBuildItem addHealthCheck(OpenEPCISBuildTimeConfig buildTimeConfig) { + return new HealthBuildItem(EventHashHealthCheck.class.getName(), + buildTimeConfig.healthEnabled); + } + +} diff --git a/quarkus/pom.xml b/quarkus/pom.xml new file mode 100644 index 0000000..8149063 --- /dev/null +++ b/quarkus/pom.xml @@ -0,0 +1,94 @@ + + + + 4.0.0 + + io.openepcis + openepcis-event-hash-generator-build + 1.0.0-SNAPSHOT + ../pom.xml + + + io.openepcis.quarkus + quarkus-event-hash-generator-parent + pom + quarkus-event-hash-generator-parent + Quarkus Event Hash Generator Parent + https://github.com/openepcis/openepcis-event-hash-generator + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Sven Boeckelmann + sven.boeckelmann@benelog.com + benelog GmbH & Co. KG + https://www.benelog.com + + + Aravinda Baliga B + aravinda.baliga@benelog.com + benelog GmbH & Co. KG + https://www.benelog.com + + + Shaik Dayan + dayan.shaik@benelog.com + benelog GmbH & Co. KG + https://www.benelog.com + + + + + scm:git:git://github.com/openepcis/openepcis-event-hash-generator.git + scm:git:ssh://github.com:openepcis/openepcis-event-hash-generator.git + https://github.com/openepcis/openepcis-event-hash-generator/tree/main + + + + runtime + deployment + quarkus-app + + + + + + sonatype-releases + https://s01.oss.sonatype.org/content/repositories/releases + + + + sonatype-staging + https://s01.oss.sonatype.org/content/repositories/snapshots + + true + always + + + + + diff --git a/quarkus-app/README.md b/quarkus/quarkus-app/README.md similarity index 98% rename from quarkus-app/README.md rename to quarkus/quarkus-app/README.md index 14f7172..c621b33 100644 --- a/quarkus-app/README.md +++ b/quarkus/quarkus-app/README.md @@ -1,6 +1,6 @@ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -# openepcis-event-hash-generator-quarkus-app +# openepcis-event-hash-generator-app ### Introduction: This RESTful Quarkus application generates the Hash Ids for EPCIS documents in JSON/XML format using the project the openepcis-event-hash-generator (ref: https://github.com/openepcis/openepcis-event-hash-generator). By requiring only a few simple inputs, this utility simplifies it for users to produce Hash Ids for EPCIS documents. diff --git a/quarkus-app/pom.xml b/quarkus/quarkus-app/pom.xml similarity index 94% rename from quarkus-app/pom.xml rename to quarkus/quarkus-app/pom.xml index f2b44af..ffb9e97 100644 --- a/quarkus-app/pom.xml +++ b/quarkus/quarkus-app/pom.xml @@ -20,13 +20,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - io.openepcis - openepcis-event-hash-generator-build + io.openepcis.quarkus + quarkus-event-hash-generator-parent 1.0.0-SNAPSHOT + ../pom.xml - openepcis-event-hash-generator-quarkus-app - openepcis-event-hash-generator-quarkus-app + openepcis-event-hash-generator-app + openepcis-event-hash-generator-app Quarkus REST API Application to generate Hash-Ids based on XML/JSON EPCIS document provided by user. https://github.com/openepcis/openepcis-event-hash-generator @@ -64,6 +65,11 @@ io.openepcis openepcis-event-hash-generator-rest-api + + io.openepcis.quarkus + quarkus-event-hash-generator + + io.openepcis diff --git a/quarkus-app/readme-rest-swaggerui.gif b/quarkus/quarkus-app/readme-rest-swaggerui.gif similarity index 100% rename from quarkus-app/readme-rest-swaggerui.gif rename to quarkus/quarkus-app/readme-rest-swaggerui.gif diff --git a/quarkus/quarkus-app/src/main/docker/Dockerfile.jvm b/quarkus/quarkus-app/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000..cf59071 --- /dev/null +++ b/quarkus/quarkus-app/src/main/docker/Dockerfile.jvm @@ -0,0 +1,97 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/quarkus-converter-service-app-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/quarkus-converter-service-app-jvm +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/quarkus-converter-service-app-jvm +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi8/openjdk-21:1.19 + +ENV LANGUAGE='en_US:en' + + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 target/quarkus-app/*.jar /deployments/ +COPY --chown=185 target/quarkus-app/app/ /deployments/app/ +COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] + diff --git a/quarkus/quarkus-app/src/main/docker/Dockerfile.legacy-jar b/quarkus/quarkus-app/src/main/docker/Dockerfile.legacy-jar new file mode 100644 index 0000000..6c9a706 --- /dev/null +++ b/quarkus/quarkus-app/src/main/docker/Dockerfile.legacy-jar @@ -0,0 +1,93 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package -Dquarkus.package.jar.type=legacy-jar +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/quarkus-converter-service-app-legacy-jar . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/quarkus-converter-service-app-legacy-jar +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 quarkus/quarkus-converter-service-app-legacy-jar +# +# This image uses the `run-java.sh` script to run the application. +# This scripts computes the command line to execute your Java application, and +# includes memory/GC tuning. +# You can configure the behavior using the following environment properties: +# - JAVA_OPTS: JVM options passed to the `java` command (example: "-verbose:class") +# - JAVA_OPTS_APPEND: User specified Java options to be appended to generated options +# in JAVA_OPTS (example: "-Dsome.property=foo") +# - JAVA_MAX_MEM_RATIO: Is used when no `-Xmx` option is given in JAVA_OPTS. This is +# used to calculate a default maximal heap memory based on a containers restriction. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xmx` is set to a ratio +# of the container available memory as set here. The default is `50` which means 50% +# of the available memory is used as an upper boundary. You can skip this mechanism by +# setting this value to `0` in which case no `-Xmx` option is added. +# - JAVA_INITIAL_MEM_RATIO: Is used when no `-Xms` option is given in JAVA_OPTS. This +# is used to calculate a default initial heap memory based on the maximum heap memory. +# If used in a container without any memory constraints for the container then this +# option has no effect. If there is a memory constraint then `-Xms` is set to a ratio +# of the `-Xmx` memory as set here. The default is `25` which means 25% of the `-Xmx` +# is used as the initial heap size. You can skip this mechanism by setting this value +# to `0` in which case no `-Xms` option is added (example: "25") +# - JAVA_MAX_INITIAL_MEM: Is used when no `-Xms` option is given in JAVA_OPTS. +# This is used to calculate the maximum value of the initial heap memory. If used in +# a container without any memory constraints for the container then this option has +# no effect. If there is a memory constraint then `-Xms` is limited to the value set +# here. The default is 4096MB which means the calculated value of `-Xms` never will +# be greater than 4096MB. The value of this variable is expressed in MB (example: "4096") +# - JAVA_DIAGNOSTICS: Set this to get some diagnostics information to standard output +# when things are happening. This option, if set to true, will set +# `-XX:+UnlockDiagnosticVMOptions`. Disabled by default (example: "true"). +# - JAVA_DEBUG: If set remote debugging will be switched on. Disabled by default (example: +# true"). +# - JAVA_DEBUG_PORT: Port used for remote debugging. Defaults to 5005 (example: "8787"). +# - CONTAINER_CORE_LIMIT: A calculated core limit as described in +# https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt. (example: "2") +# - CONTAINER_MAX_MEMORY: Memory limit given to the container (example: "1024"). +# - GC_MIN_HEAP_FREE_RATIO: Minimum percentage of heap free after GC to avoid expansion. +# (example: "20") +# - GC_MAX_HEAP_FREE_RATIO: Maximum percentage of heap free after GC to avoid shrinking. +# (example: "40") +# - GC_TIME_RATIO: Specifies the ratio of the time spent outside the garbage collection. +# (example: "4") +# - GC_ADAPTIVE_SIZE_POLICY_WEIGHT: The weighting given to the current GC time versus +# previous GC times. (example: "90") +# - GC_METASPACE_SIZE: The initial metaspace size. (example: "20") +# - GC_MAX_METASPACE_SIZE: The maximum metaspace size. (example: "100") +# - GC_CONTAINER_OPTIONS: Specify Java GC to use. The value of this variable should +# contain the necessary JRE command-line options to specify the required GC, which +# will override the default of `-XX:+UseParallelGC` (example: -XX:+UseG1GC). +# - HTTPS_PROXY: The location of the https proxy. (example: "myuser@127.0.0.1:8080") +# - HTTP_PROXY: The location of the http proxy. (example: "myuser@127.0.0.1:8080") +# - NO_PROXY: A comma separated lists of hosts, IP addresses or domains that can be +# accessed directly. (example: "foo.example.com,bar.example.com") +# +### +FROM registry.access.redhat.com/ubi8/openjdk-21:1.19 + +ENV LANGUAGE='en_US:en' + + +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/quarkus-run.jar + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] diff --git a/quarkus-app/src/main/docker/Dockerfile.native b/quarkus/quarkus-app/src/main/docker/Dockerfile.native similarity index 59% rename from quarkus-app/src/main/docker/Dockerfile.native rename to quarkus/quarkus-app/src/main/docker/Dockerfile.native index 73f7fc1..b881f3a 100644 --- a/quarkus-app/src/main/docker/Dockerfile.native +++ b/quarkus/quarkus-app/src/main/docker/Dockerfile.native @@ -1,20 +1,20 @@ #### -# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. # # Before building the container image run: # -# ./mvnw package -Pnative +# ./mvnw package -Dnative # # Then, build the image with: # -# docker build -f src/main/docker/Dockerfile.native -t quarkus/quarkus-rest . +# docker build -f src/main/docker/Dockerfile.native -t quarkus/quarkus-converter-service-app . # # Then run the container using: # -# docker run -i --rm -p 8080:8080 quarkus/quarkus-rest +# docker run -i --rm -p 8080:8080 quarkus/quarkus-converter-service-app # ### -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9 WORKDIR /work/ RUN chown 1001 /work \ && chmod "g+rwX" /work \ @@ -24,4 +24,4 @@ COPY --chown=1001:root target/*-runner /work/application EXPOSE 8080 USER 1001 -CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/quarkus/quarkus-app/src/main/docker/Dockerfile.native-micro b/quarkus/quarkus-app/src/main/docker/Dockerfile.native-micro new file mode 100644 index 0000000..e437e23 --- /dev/null +++ b/quarkus/quarkus-app/src/main/docker/Dockerfile.native-micro @@ -0,0 +1,30 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. +# It uses a micro base image, tuned for Quarkus native executables. +# It reduces the size of the resulting container image. +# Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. +# +# Before building the container image run: +# +# ./mvnw package -Dnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/quarkus-converter-service-app . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/quarkus-converter-service-app +# +### +FROM quay.io/quarkus/quarkus-micro-image:2.0 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root target/*-runner /work/application + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/quarkus-app/src/main/java/openepcis/epc/eventhash/generator/RestApplication.java b/quarkus/quarkus-app/src/main/java/io/openepcis/eventhash/generator/RestApplication.java similarity index 77% rename from quarkus-app/src/main/java/openepcis/epc/eventhash/generator/RestApplication.java rename to quarkus/quarkus-app/src/main/java/io/openepcis/eventhash/generator/RestApplication.java index bfc984f..2794048 100644 --- a/quarkus-app/src/main/java/openepcis/epc/eventhash/generator/RestApplication.java +++ b/quarkus/quarkus-app/src/main/java/io/openepcis/eventhash/generator/RestApplication.java @@ -13,15 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package openepcis.epc.eventhash.generator; +package io.openepcis.eventhash.generator; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; -import io.openepcis.epc.eventhash.EventHashGenerator; -import io.openepcis.resources.oas.EPCISExampleOASFilter; import io.quarkus.vertx.web.Route; import io.vertx.ext.web.RoutingContext; -import jakarta.enterprise.context.RequestScoped; import jakarta.enterprise.inject.Produces; import jakarta.ws.rs.ApplicationPath; import jakarta.ws.rs.core.Application; @@ -29,7 +26,6 @@ import org.eclipse.microprofile.openapi.annotations.Operation; import org.eclipse.microprofile.openapi.annotations.info.Info; import org.eclipse.microprofile.openapi.annotations.info.License; -import org.eclipse.microprofile.openapi.annotations.media.Schema; @OpenAPIDefinition( info = @@ -42,24 +38,16 @@ @ApplicationPath("/") public class RestApplication extends Application { - private EPCISExampleOASFilter filter; - - @Produces - @RequestScoped - public EventHashGenerator createEventHashGenerator() { - return new EventHashGenerator(); - } - @Produces public JsonFactory createJsonFactory() { final ObjectMapper objectMapper = - new ObjectMapper(); // .enable(DeserializationFeature.FAIL_ON_TRAILING_TOKENS); + new ObjectMapper(); // .enable(DeserializationFeature.FAIL_ON_TRAILING_TOKENS); return new JsonFactory().setCodec(objectMapper); } @Route(methods = Route.HttpMethod.GET, path = "/") @Operation(hidden = true) - void hello(RoutingContext rc) { + void index(RoutingContext rc) { rc.redirect("/q/swagger-ui/index.html"); } } diff --git a/quarkus-app/src/main/resources/META-INF/branding/logo.png b/quarkus/quarkus-app/src/main/resources/META-INF/branding/logo.png similarity index 100% rename from quarkus-app/src/main/resources/META-INF/branding/logo.png rename to quarkus/quarkus-app/src/main/resources/META-INF/branding/logo.png diff --git a/quarkus-app/src/main/resources/application.yml b/quarkus/quarkus-app/src/main/resources/application.yml similarity index 100% rename from quarkus-app/src/main/resources/application.yml rename to quarkus/quarkus-app/src/main/resources/application.yml diff --git a/quarkus-app/src/main/resources/openepcis-banner.txt b/quarkus/quarkus-app/src/main/resources/openepcis-banner.txt similarity index 100% rename from quarkus-app/src/main/resources/openepcis-banner.txt rename to quarkus/quarkus-app/src/main/resources/openepcis-banner.txt diff --git a/quarkus-app/src/test/java/io/openecpis/epc/eventhash/generator/rest/CompareApiResultsTest.java b/quarkus/quarkus-app/src/test/java/io/openecpis/epc/eventhash/generator/rest/CompareApiResultsTest.java similarity index 98% rename from quarkus-app/src/test/java/io/openecpis/epc/eventhash/generator/rest/CompareApiResultsTest.java rename to quarkus/quarkus-app/src/test/java/io/openecpis/epc/eventhash/generator/rest/CompareApiResultsTest.java index c9062d7..cf20dfa 100644 --- a/quarkus-app/src/test/java/io/openecpis/epc/eventhash/generator/rest/CompareApiResultsTest.java +++ b/quarkus/quarkus-app/src/test/java/io/openecpis/epc/eventhash/generator/rest/CompareApiResultsTest.java @@ -32,7 +32,7 @@ import java.util.Arrays; import java.util.Objects; -import openepcis.epc.eventhash.generator.resource.EventHashGeneratorResource; +import io.openepcis.eventhash.generator.resource.EventHashGeneratorResource; import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.Test; diff --git a/quarkus-app/src/test/java/io/openecpis/epc/eventhash/generator/rest/RestEndpointTest.java b/quarkus/quarkus-app/src/test/java/io/openecpis/epc/eventhash/generator/rest/RestEndpointTest.java similarity index 98% rename from quarkus-app/src/test/java/io/openecpis/epc/eventhash/generator/rest/RestEndpointTest.java rename to quarkus/quarkus-app/src/test/java/io/openecpis/epc/eventhash/generator/rest/RestEndpointTest.java index 5ff5139..1e30c0e 100644 --- a/quarkus-app/src/test/java/io/openecpis/epc/eventhash/generator/rest/RestEndpointTest.java +++ b/quarkus/quarkus-app/src/test/java/io/openecpis/epc/eventhash/generator/rest/RestEndpointTest.java @@ -29,7 +29,7 @@ import java.nio.charset.StandardCharsets; import java.util.Objects; -import openepcis.epc.eventhash.generator.resource.EventHashGeneratorResource; +import io.openepcis.eventhash.generator.resource.EventHashGeneratorResource; import org.apache.commons.io.IOUtils; import org.jboss.resteasy.reactive.RestResponse; import org.junit.jupiter.api.Test; diff --git a/quarkus-app/src/test/resources/SensorDataExample.json b/quarkus/quarkus-app/src/test/resources/SensorDataExample.json similarity index 100% rename from quarkus-app/src/test/resources/SensorDataExample.json rename to quarkus/quarkus-app/src/test/resources/SensorDataExample.json diff --git a/quarkus/runtime/pom.xml b/quarkus/runtime/pom.xml new file mode 100644 index 0000000..0a12731 --- /dev/null +++ b/quarkus/runtime/pom.xml @@ -0,0 +1,130 @@ + + + + 4.0.0 + + io.openepcis.quarkus + quarkus-event-hash-generator-parent + 1.0.0-SNAPSHOT + ../pom.xml + + + quarkus-event-hash-generator + jar + quarkus-event-hash-generator + Quarkus Event Hash Generator + https://github.com/openepcis/openepcis-event-hash-generator + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Sven Boeckelmann + sven.boeckelmann@benelog.com + benelog GmbH & Co. KG + https://www.benelog.com + + + Aravinda Baliga B + aravinda.baliga@benelog.com + benelog GmbH & Co. KG + https://www.benelog.com + + + Shaik Dayan + dayan.shaik@benelog.com + benelog GmbH & Co. KG + https://www.benelog.com + + + + + scm:git:git://github.com/openepcis/openepcis-event-hash-generator.git + scm:git:ssh://github.com:openepcis/openepcis-event-hash-generator.git + https://github.com/openepcis/openepcis-event-hash-generator/tree/main + + + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-smallrye-health + + + + + io.openepcis.quarkus + quarkus-openepcis-model + + + io.openepcis.quarkus + quarkus-test-resources + + + io.openepcis + openepcis-event-hash-generator + + + + + + + + io.quarkus + quarkus-extension-maven-plugin + ${quarkus.platform.version} + + + compile + + extension-descriptor + + + ${project.groupId}:${project.artifactId}-deployment:${project.version} + + + + + + maven-compiler-plugin + + + + io.quarkus + quarkus-extension-processor + ${quarkus.platform.version} + + + + + + + + + diff --git a/quarkus/runtime/src/main/java/io/openepcis/eventhash/runtime/EventHashGeneratorProducer.java b/quarkus/runtime/src/main/java/io/openepcis/eventhash/runtime/EventHashGeneratorProducer.java new file mode 100644 index 0000000..d7f23bf --- /dev/null +++ b/quarkus/runtime/src/main/java/io/openepcis/eventhash/runtime/EventHashGeneratorProducer.java @@ -0,0 +1,32 @@ +/* + * Copyright 2022-2024 benelog GmbH & Co. KG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.openepcis.eventhash.runtime; + +import io.openepcis.eventhash.EventHashGenerator; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.context.RequestScoped; +import jakarta.enterprise.inject.Produces; + +@ApplicationScoped +public class EventHashGeneratorProducer { + + @Produces + @RequestScoped + public EventHashGenerator createEventHashGenerator() { + return new EventHashGenerator(); + } + +} diff --git a/quarkus/runtime/src/main/java/io/openepcis/eventhash/runtime/EventHashHealthCheck.java b/quarkus/runtime/src/main/java/io/openepcis/eventhash/runtime/EventHashHealthCheck.java new file mode 100644 index 0000000..0852a5b --- /dev/null +++ b/quarkus/runtime/src/main/java/io/openepcis/eventhash/runtime/EventHashHealthCheck.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022-2024 benelog GmbH & Co. KG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.openepcis.eventhash.runtime; + +import jakarta.enterprise.context.ApplicationScoped; +import org.eclipse.microprofile.health.HealthCheck; +import org.eclipse.microprofile.health.HealthCheckResponse; +import org.eclipse.microprofile.health.HealthCheckResponseBuilder; +import org.eclipse.microprofile.health.Readiness; + +@Readiness +@ApplicationScoped +public class EventHashHealthCheck implements HealthCheck { + + private final EventHashGeneratorProducer eventHashGeneratorProducer; + + public EventHashHealthCheck(final EventHashGeneratorProducer eventHashGeneratorProducer) { + this.eventHashGeneratorProducer = eventHashGeneratorProducer; + } + + @Override + public HealthCheckResponse call() { + HealthCheckResponseBuilder builder = HealthCheckResponse.named("OpenEPCIS Event Hash Generator health check").up(); + builder.up().withData("eventHashGeneratorProducer", eventHashGeneratorProducer.getClass().getName()); + return builder.build(); + } +} diff --git a/quarkus/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/quarkus/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000..ea01706 --- /dev/null +++ b/quarkus/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,11 @@ +--- +artifact: ${project.groupId}:${project.artifactId}:${project.version} +name: "OpenEPCIS Event Hash Generator" +metadata: + keywords: + - "epcis" + - "xml" + - "json" + categories: + - "data" + status: "stable" \ No newline at end of file diff --git a/rest-api/src/main/java/openepcis/epc/eventhash/generator/exception/JsonParseExceptionMapper.java b/rest-api/src/main/java/io/openepcis/eventhash/generator/exception/JsonParseExceptionMapper.java similarity index 96% rename from rest-api/src/main/java/openepcis/epc/eventhash/generator/exception/JsonParseExceptionMapper.java rename to rest-api/src/main/java/io/openepcis/eventhash/generator/exception/JsonParseExceptionMapper.java index b14ee3a..47afe8e 100644 --- a/rest-api/src/main/java/openepcis/epc/eventhash/generator/exception/JsonParseExceptionMapper.java +++ b/rest-api/src/main/java/io/openepcis/eventhash/generator/exception/JsonParseExceptionMapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package openepcis.epc.eventhash.generator.exception; +package io.openepcis.eventhash.generator.exception; import com.fasterxml.jackson.core.JsonParseException; import io.openepcis.model.rest.ProblemResponseBody; diff --git a/rest-api/src/main/java/openepcis/epc/eventhash/generator/exception/SaxParseExceptionMapper.java b/rest-api/src/main/java/io/openepcis/eventhash/generator/exception/SaxParseExceptionMapper.java similarity index 96% rename from rest-api/src/main/java/openepcis/epc/eventhash/generator/exception/SaxParseExceptionMapper.java rename to rest-api/src/main/java/io/openepcis/eventhash/generator/exception/SaxParseExceptionMapper.java index 743989a..f5ef379 100644 --- a/rest-api/src/main/java/openepcis/epc/eventhash/generator/exception/SaxParseExceptionMapper.java +++ b/rest-api/src/main/java/io/openepcis/eventhash/generator/exception/SaxParseExceptionMapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package openepcis.epc.eventhash.generator.exception; +package io.openepcis.eventhash.generator.exception; import io.openepcis.model.rest.ProblemResponseBody; import jakarta.ws.rs.core.Response; diff --git a/rest-api/src/main/java/openepcis/epc/eventhash/generator/resource/EventHashGeneratorResource.java b/rest-api/src/main/java/io/openepcis/eventhash/generator/resource/EventHashGeneratorResource.java similarity index 99% rename from rest-api/src/main/java/openepcis/epc/eventhash/generator/resource/EventHashGeneratorResource.java rename to rest-api/src/main/java/io/openepcis/eventhash/generator/resource/EventHashGeneratorResource.java index f9c2e68..ebc18ce 100644 --- a/rest-api/src/main/java/openepcis/epc/eventhash/generator/resource/EventHashGeneratorResource.java +++ b/rest-api/src/main/java/io/openepcis/eventhash/generator/resource/EventHashGeneratorResource.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package openepcis.epc.eventhash.generator.resource; +package io.openepcis.eventhash.generator.resource; import io.openepcis.constants.CBVVersion; -import io.openepcis.epc.eventhash.DocumentWrapperSupport; -import io.openepcis.epc.eventhash.EventHashGenerator; +import io.openepcis.eventhash.DocumentWrapperSupport; +import io.openepcis.eventhash.EventHashGenerator; import io.openepcis.model.epcis.EPCISDocument; import io.openepcis.model.epcis.EPCISEvent; import io.openepcis.model.rest.ProblemResponseBody; diff --git a/rest-api/src/test/java/openepcis/epc/eventhash/generator/resource/test/EventHashGeneratorResourceTest.java b/rest-api/src/test/java/io/openepcis/eventhash/generator/resource/test/EventHashGeneratorResourceTest.java similarity index 85% rename from rest-api/src/test/java/openepcis/epc/eventhash/generator/resource/test/EventHashGeneratorResourceTest.java rename to rest-api/src/test/java/io/openepcis/eventhash/generator/resource/test/EventHashGeneratorResourceTest.java index e6f4622..d744689 100644 --- a/rest-api/src/test/java/openepcis/epc/eventhash/generator/resource/test/EventHashGeneratorResourceTest.java +++ b/rest-api/src/test/java/io/openepcis/eventhash/generator/resource/test/EventHashGeneratorResourceTest.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package openepcis.epc.eventhash.generator.resource.test; +package io.openepcis.eventhash.generator.resource.test; import io.quarkus.test.common.http.TestHTTPEndpoint; import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; -import openepcis.epc.eventhash.generator.resource.EventHashGeneratorResource; -import openepcis.epc.eventhash.generator.test.AbstractEventHashGeneratorTest; +import io.openepcis.eventhash.generator.resource.EventHashGeneratorResource; +import io.openepcis.eventhash.generator.test.AbstractEventHashGeneratorTest; import java.net.URL; diff --git a/restassured/src/main/java/openepcis/epc/eventhash/generator/test/AbstractEventHashGeneratorTest.java b/restassured/src/main/java/io/openepcis/eventhash/generator/test/AbstractEventHashGeneratorTest.java similarity index 99% rename from restassured/src/main/java/openepcis/epc/eventhash/generator/test/AbstractEventHashGeneratorTest.java rename to restassured/src/main/java/io/openepcis/eventhash/generator/test/AbstractEventHashGeneratorTest.java index 7494891..fe84b4e 100644 --- a/restassured/src/main/java/openepcis/epc/eventhash/generator/test/AbstractEventHashGeneratorTest.java +++ b/restassured/src/main/java/io/openepcis/eventhash/generator/test/AbstractEventHashGeneratorTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package openepcis.epc.eventhash.generator.test; +package io.openepcis.eventhash.generator.test; import io.openepcis.resources.util.Commons; import io.openepcis.resources.util.ResourceFinder; diff --git a/restassured/src/main/java/openepcis/epc/eventhash/generator/test/CDITestProvider.java b/restassured/src/main/java/io/openepcis/eventhash/generator/test/CDITestProvider.java similarity index 81% rename from restassured/src/main/java/openepcis/epc/eventhash/generator/test/CDITestProvider.java rename to restassured/src/main/java/io/openepcis/eventhash/generator/test/CDITestProvider.java index aca0e02..5306743 100644 --- a/restassured/src/main/java/openepcis/epc/eventhash/generator/test/CDITestProvider.java +++ b/restassured/src/main/java/io/openepcis/eventhash/generator/test/CDITestProvider.java @@ -13,18 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package openepcis.epc.eventhash.generator.test; +package io.openepcis.eventhash.generator.test; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; -import io.openepcis.epc.eventhash.EventHashGenerator; -import io.openepcis.model.rest.ProblemResponseBody; -import io.quarkus.logging.Log; +import io.openepcis.eventhash.EventHashGenerator; import jakarta.enterprise.context.RequestScoped; import jakarta.enterprise.inject.Produces; -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBException; -import jakarta.xml.bind.Marshaller; public class CDITestProvider { final ObjectMapper objectMapper = diff --git a/servlet-api/src/main/java/openepcis/epc/eventhash/generator/servlet/EventHashGeneratorServlets.java b/servlet-api/src/main/java/io/openepcis/eventhash/generator/servlet/EventHashGeneratorServlets.java similarity index 98% rename from servlet-api/src/main/java/openepcis/epc/eventhash/generator/servlet/EventHashGeneratorServlets.java rename to servlet-api/src/main/java/io/openepcis/eventhash/generator/servlet/EventHashGeneratorServlets.java index bfc382f..087294d 100644 --- a/servlet-api/src/main/java/openepcis/epc/eventhash/generator/servlet/EventHashGeneratorServlets.java +++ b/servlet-api/src/main/java/io/openepcis/eventhash/generator/servlet/EventHashGeneratorServlets.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package openepcis.epc.eventhash.generator.servlet; +package io.openepcis.eventhash.generator.servlet; import io.openepcis.constants.CBVVersion; -import io.openepcis.epc.eventhash.DocumentWrapperSupport; -import io.openepcis.epc.eventhash.EventHashGenerator; +import io.openepcis.eventhash.DocumentWrapperSupport; +import io.openepcis.eventhash.EventHashGenerator; import io.openepcis.model.rest.servlet.ServletSupport; import jakarta.inject.Inject; import jakarta.servlet.annotation.WebServlet; diff --git a/servlet-api/src/test/java/openepcis/epc/eventhash/generator/servlet/test/EventHashGeneratorServletTest.java b/servlet-api/src/test/java/io/openepcis/eventhash/generator/servlet/test/EventHashGeneratorServletTest.java similarity index 86% rename from servlet-api/src/test/java/openepcis/epc/eventhash/generator/servlet/test/EventHashGeneratorServletTest.java rename to servlet-api/src/test/java/io/openepcis/eventhash/generator/servlet/test/EventHashGeneratorServletTest.java index 87a08a9..082e7b2 100644 --- a/servlet-api/src/test/java/openepcis/epc/eventhash/generator/servlet/test/EventHashGeneratorServletTest.java +++ b/servlet-api/src/test/java/io/openepcis/eventhash/generator/servlet/test/EventHashGeneratorServletTest.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package openepcis.epc.eventhash.generator.servlet.test; +package io.openepcis.eventhash.generator.servlet.test; +import io.openepcis.eventhash.generator.servlet.EventHashGeneratorServlets; import io.quarkus.test.common.http.TestHTTPEndpoint; import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; -import openepcis.epc.eventhash.generator.servlet.EventHashGeneratorServlets; -import openepcis.epc.eventhash.generator.test.AbstractEventHashGeneratorTest; +import io.openepcis.eventhash.generator.test.AbstractEventHashGeneratorTest; import java.net.URL;