From 2c6ec091f77fe0390534050cb67c9cf1d0da1390 Mon Sep 17 00:00:00 2001 From: JanardhanBS-SyncByte Date: Thu, 24 Sep 2026 11:11:25 +0530 Subject: [PATCH 01/10] issue-1633 spring boot changes Signed-off-by: JanardhanBS-SyncByte --- kernel-bio-converter/AGENTS.md | 36 ++ kernel-bio-converter/Dockerfile | 102 ++--- kernel-bio-converter/pom.xml | 375 +++++++++++------ kernel-bio-converter/run-local.bat | 394 ++++++++++++++++++ kernel-bio-converter/run-local.sh | 367 ++++++++++++++++ kernel-bio-converter/run_local.bat | 1 - .../KernelBioConverterApplication.java | 64 ++- .../controller/ConvertController.java | 2 +- .../bio/converter/dto/ConvertRequestDto.java | 32 +- .../exception/ConversionExceptionAdvice.java | 118 ++++-- .../service/impl/ConverterServiceImpl.java | 88 +++- .../src/main/resources/application.properties | 12 +- .../src/main/resources/bootstrap.properties | 2 + .../KernelBioConverterApplicationTest.java | 15 +- .../bio/converter/TestBootApplication.java | 71 ++-- .../controller/ConvertControllerTest.java | 6 +- .../TestSecurityConfig.java | 95 +---- .../resources/application-test.properties | 11 +- .../src/test/resources/bootstrap.properties | 2 + 19 files changed, 1413 insertions(+), 380 deletions(-) create mode 100644 kernel-bio-converter/AGENTS.md create mode 100644 kernel-bio-converter/run-local.bat create mode 100644 kernel-bio-converter/run-local.sh delete mode 100644 kernel-bio-converter/run_local.bat rename kernel-bio-converter/src/test/java/io/mosip/kernel/bio/{converter/config => testsupport}/TestSecurityConfig.java (58%) diff --git a/kernel-bio-converter/AGENTS.md b/kernel-bio-converter/AGENTS.md new file mode 100644 index 0000000..5f17a6d --- /dev/null +++ b/kernel-bio-converter/AGENTS.md @@ -0,0 +1,36 @@ +# Maven module (`kernel-bio-converter/`) + +JDK 21, Spring Boot **4.1.1**, Spring Cloud **2025.1.3**. Single module: fat JAR (service) + `-lib` classifier (embeddable). Versions pinned in this `pom.xml` — **no kernel-bom**. + +| Artifact | Role | +|----------|------| +| fat JAR | Runnable service (`spring-boot` repackage, ZIP layout) | +| `-lib` | `constant/`, `dto/`, `exception/`, `service/**` only | + +**Build:** `mvn clean install "-Dgpg.skip=true"` · tests: `mvn test "-Dgpg.skip=true"` · one class: `mvn test -Dtest=ConverterServiceImplTest "-Dgpg.skip=true"` + +Prereqs (install locally for SNAPSHOTs): `commons/kernel` → `kernel-core` / `kernel-auth-adapter` **1.4.1-SNAPSHOT**; `bio-utils` → `biometrics-util` **1.4.1-SNAPSHOT**. + +Pipeline: `ConvertController` → `IConverterApi` → `ConverterServiceImpl` → `FingerDecoder` / `FaceDecoder` / `IrisDecoder` (`biometrics-util`). + +| Source | Target | +|--------|--------| +| `ISO19794_4_2011` finger | `IMAGE/JPEG`, `IMAGE/PNG`, `ISO19794_4_2011/{JPEG,PNG}` | +| `ISO19794_5_2011` face | `IMAGE/JPEG`, `IMAGE/PNG`, `ISO19794_5_2011/{JPEG,PNG}` | +| `ISO19794_6_2011` iris | `IMAGE/PNG`, `ISO19794_6_2011/PNG` (JPEG variant disabled) | + +Errors: `ConversionException` → `MOS-CNV-001`…`012`, `MOS-CNV-500`. Swagger: `/v1/converter-service/swagger-ui/index.html`. + +## Rules + +- Pin MOSIP deps to **1.4.1-SNAPSHOT**. Do not import `kernel-bom`. +- Jackson versions live in `` (`jackson-annotations.version`, `jackson-core.version`, `jackson-databind.version` = **2.21.4**). +- Use `spring-boot-jackson2` (Jackson 2) — not Boot 4’s Jackson 3 default. +- Local run: `run-local.bat` / `run-local.sh` (`init` · `start` · `smoke` · `stop` · `test` · `all` · `docker`; env: `PORT`, `SPRING_PROFILES_ACTIVE`, `SPRING_CLOUD_CONFIG_*`, `loader_path_env`). +- Surefire keeps `--add-opens*` / `--enable-preview` — do not remove. +- JaCoCo excludes `constant/`, `config/`, `dto/`, `exception/`, `*Application`; gate ≥95% instruction/line. +- Auth: exclude adapter `SecurityConfig` via `@ComponentScan` REGEX filter; local `SecurityConfig` permits all. +- `-lib` consumers depend with `lib` — never put the fat JAR on a library classpath. +- Do not scan broad `io.mosip.kernel` / `io.mosip.*` — only `io.mosip.kernel.bio.converter` + auth-adapter basepackage. +- Keep JavaDoc on public classes, fields, and methods when adding or changing APIs. + diff --git a/kernel-bio-converter/Dockerfile b/kernel-bio-converter/Dockerfile index bfb0792..c41538e 100644 --- a/kernel-bio-converter/Dockerfile +++ b/kernel-bio-converter/Dockerfile @@ -1,89 +1,57 @@ FROM mosipid/openjdk-21-jre:21.0.4 -# label to be assigned along with Docker build [Mandatory] + ARG SOURCE ARG COMMIT_HASH ARG COMMIT_ID ARG BUILD_TIME -LABEL source=${SOURCE} -LABEL commit_hash=${COMMIT_HASH} -LABEL commit_id=${COMMIT_ID} -LABEL build_time=${BUILD_TIME} - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG spring_config_label +LABEL source=${SOURCE} \ + commit_hash=${COMMIT_HASH} \ + commit_id=${COMMIT_ID} \ + build_time=${BUILD_TIME} -# can be passed during Docker build as build time environment for spring profiles active -ARG active_profile - -# can be passed during Docker build as build time environment for config server URL +ARG spring_config_label=master +ARG active_profile=default ARG spring_config_url - -# can be passed during Docker build as build time environment for glowroot -ARG is_glowroot - -# can be passed during Docker build as build time environment for artifactory URL -ARG artifactory_url - -# environment variable to pass active profile such as DEV, QA etc at docker runtime -ENV active_profile_env=${active_profile} - -# environment variable to pass github branch to pickup configuration from, at docker runtime -ENV spring_config_label_env=${spring_config_label} - -# environment variable to pass spring configuration url, at docker runtime -ENV spring_config_url_env=${spring_config_url} - -# environment variable to pass glowroot, at docker runtime -ENV is_glowroot_env=${is_glowroot} - -# environment variable to pass artifactory url, at docker runtime -ENV artifactory_url_env=${artifactory_url} - -# environment variable to pass iam_adapter url, at docker runtime -ENV iam_adapter_url_env=${iam_adapter_url} - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_group=mosip - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_uid=1001 - -# can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_gid=1001 -# set working directory for the user -WORKDIR /home/${container_user} -ENV work_dir=/home/${container_user} -ARG loader_path=${work_dir}/additional_jars/ -ENV loader_path_env=${loader_path} -ARG logging_level_root=INFO -ENV logging_level_root_env=${logging_level_root} +ENV active_profile_env=${active_profile} \ + spring_config_label_env=${spring_config_label} \ + spring_config_url_env=${spring_config_url} \ + work_dir=/home/${container_user} \ + loader_path_env=/home/${container_user}/additional_jars/ -# set working directory for the user -WORKDIR /home/${container_user} -ENV work_dir=/home/${container_user} -ARG loader_path=${work_dir}/additional_jars/ -ENV loader_path_env=${loader_path} -ARG logging_level_root=INFO -ENV logging_level_root_env=${logging_level_root} +WORKDIR ${work_dir} -# install packages and create user RUN apt-get update && \ apt-get install -y --no-install-recommends sudo && \ groupadd -g ${container_user_gid} ${container_user_group} && \ useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} && \ - mkdir -p /home/${container_user} ${loader_path} -ENV loader_path_env=${loader_path} -COPY ./target/kernel-bio-converter-*.jar kernel-bio-converter.jar - -# change permissions of file inside working dir -RUN chown -R ${container_user}:${container_user} /home/${container_user} + mkdir -p ${work_dir}/additional_jars && \ + rm -rf /var/lib/apt/lists/* + +COPY ./target/kernel-bio-converter-*.jar ${work_dir}/kernel-bio-converter.jar +# Prefer fat JAR only (exclude -lib / -sources / -javadoc if COPY matched multiple) +RUN set -eux; \ + cd ${work_dir}; \ + for f in kernel-bio-converter-*.jar; do \ + case "$f" in \ + *-lib.jar|*-sources.jar|*-javadoc.jar) rm -f "$f" ;; \ + *) mv -f "$f" kernel-bio-converter.jar ;; \ + esac; \ + done; \ + chown -R ${container_user}:${container_user} ${work_dir} -# select container user for all tasks USER ${container_user_uid}:${container_user_gid} EXPOSE 8079 -CMD java -XX:-UseG1GC -XX:-UseParallelGC -XX:-UseShenandoahGC -XX:+ExplicitGCInvokesConcurrent -XX:+UseZGC -XX:+ZGenerational -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCompressedOops -XX:MaxGCPauseMillis=200 -Dfile.encoding=UTF-8 -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" --add-modules=ALL-SYSTEM --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.stream=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.time.LocalDate=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED --add-opens java.base/jdk.internal.reflect.DirectMethodHandleAccessor=ALL-UNNAMED -jar kernel-bio-converter.jar +# JVM GC / --add-opens flags: use run-local.bat / run-local.sh for local IDE runs. +# Shell form so ${..._env} expands at container start. +CMD java -Dfile.encoding=UTF-8 \ + -Dloader.path="${loader_path_env}" \ + -Dspring.cloud.config.label="${spring_config_label_env}" \ + -Dspring.profiles.active="${active_profile_env}" \ + -Dspring.cloud.config.uri="${spring_config_url_env}" \ + -jar kernel-bio-converter.jar diff --git a/kernel-bio-converter/pom.xml b/kernel-bio-converter/pom.xml index 0403427..51f053a 100644 --- a/kernel-bio-converter/pom.xml +++ b/kernel-bio-converter/pom.xml @@ -3,11 +3,25 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 4.1.1 + + + io.mosip.kernel kernel-bio-converter - 1.4.0-SNAPSHOT + 1.4.1-SNAPSHOT kernel-bio-converter - kernel-bio-converter + + MOSIP biometric ISO↔image converter service and embeddable library. + Fat JAR: runnable Spring Boot service (POST /v1/converter-service/convert). + Classifier lib: constant/, dto/, exception/, service/** for embedding in other MOSIP modules. + JDK 21, Spring Boot 4.1.1, no kernel-bom. Depends on kernel-core / kernel-auth-adapter / + biometrics-util 1.4.1-SNAPSHOT. + https://github.com/mosip/converters @@ -34,106 +48,172 @@ - UTF-8 + 21 + UTF-8 + + + false - - ${java.version} - ${java.version} - 3.11.0 - 3.0.2 - 3.1.0 - 3.2.0 - 2.3 - 0.8.11 - 3.1.1 - 3.3.1 - 3.2.0 - 3.2.3 - 3.0.2 - 3.1.0 - 2.22.0 - 0.7.0 - 3.2.3 - 3.7.0.1746 - - - 3.0.1 - - - 2.5.0 - - - 2.5 + + 2025.1.3 + 3.1.1 - - 4.2 - 1.3.0 - 2.0.2 - 2.14.0 - 3.9.13 + + 3.16.0 + 3.5.1 + 3.6.0 + 0.8.15 + 5.8.0.7211 + 3.12.0 + 3.1.4 + 3.4.0 + 3.2.8 + 4.9.10 + 0.11.0 - **/dto/**,**/constant/**,**/config/**,**/httpfilter/**,**/cache/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/request/**,**/spi/**,**/proxy/**,**/AuditManagerBootApplication.java - **/dto/**,**/constant/**,**/config/**,**/httpfilter/**,**/cache/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/request/**,**/spi/**,**/proxy/**,**/AuditManagerBootApplication.java - **/dto/**,**/entity/**,**/config/** - - 1.3.1-rc.1 - 1.3.1-rc.1 + **/dto/**,**/constant/**,**/config/**,**/httpfilter/**,**/cache/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/request/**,**/spi/**,**/proxy/**,**/KernelBioConverterApplication.java + **/dto/**,**/constant/**,**/config/**,**/httpfilter/**,**/cache/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/request/**,**/spi/**,**/proxy/**,**/KernelBioConverterApplication.java + **/dto/**,**/entity/**,**/config/** - 1.3.1 - 1.3.1-rc.1 - 1.3.1 - + + + 1.4.1-SNAPSHOT + 1.4.1-SNAPSHOT + 1.4.1-SNAPSHOT + + 4.2 + 1.4.0 + 2.1.2 + + + 2.21 + 2.21.4 + 2.21.4 + + 0.95 + - io.mosip.kernel - kernel-bom - ${kernel.bom.version} + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} pom import + + + + io.mosip.kernel + kernel-core + ${kernel.core.version} + + + io.mosip.kernel + kernel-auth-adapter + ${kernel.auth.adapter.version} + + + io.mosip.biometric.util + biometrics-util + ${mosip.biometrics.util.version} + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + ${springdoc.openapi.version} + + + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-annotations.version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson-core.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind.version} + + - org.springframework.security - spring-security-web + ch.qos.logback + logback-classic - org.springframework.security - spring-security-core + ch.qos.logback + logback-core - org.springframework.security - spring-security-config + org.springframework.boot + spring-boot + + + org.springframework + spring-core + org.springframework.boot spring-boot-starter-web - org.springframework.security - spring-security-test + org.springframework.boot + spring-boot-starter-validation + + + org.springframework.boot + spring-boot-jackson2 + + + com.fasterxml.jackson.module + jackson-module-afterburner + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + + org.springframework.boot spring-boot-starter-security - io.mosip.kernel - kernel-logger-logback - ${kernel.logger.logback.version} + org.springframework.security + spring-security-test + test - org.springdoc - springdoc-openapi-starter-webmvc-ui - ${springdoc.openapi.starter.webmvc.ui.version} + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.cloud + spring-cloud-starter-bootstrap org.springframework.boot @@ -141,48 +221,50 @@ provided - org.springframework.cloud - spring-cloud-starter-config + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-starter-webmvc-test + test + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui org.projectlombok lombok provided + + jakarta.servlet + jakarta.servlet-api + + + io.mosip.kernel kernel-core - ${kernel.core.version} + + + io.mosip.kernel + kernel-auth-adapter - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.core - jackson-annotations - - - com.fasterxml.jackson.core - jackson-dataformat-xml - - - com.fasterxml.jackson.core - jackson-core + org.springframework.boot + spring-boot-starter io.mosip.biometric.util biometrics-util - ${mosip.biometrics.util.version} - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - - + org.imgscalr imgscalr-lib @@ -194,27 +276,10 @@ ${jai.imageio.jpeg2000.version} - jakarta.servlet - jakarta.servlet-api - - - org.junit.vintage - junit-vintage-engine - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - - - io.mosip.kernel - kernel-auth-adapter - ${kernel.auth.adapter.version} + com.github.mhshams + jnbis + ${github.mhshams.jnbis.version} - - io.vertx - vertx-core - ${vertx.version} - @@ -233,7 +298,7 @@ org.apache.maven.plugins maven-compiler-plugin - ${maven.compiler.version} + ${maven.compiler.plugin.version} ${java.version} @@ -267,7 +332,7 @@ org.apache.maven.plugins maven-javadoc-plugin - ${maven.javadoc.plugin.version} + ${maven.javadoc.version} attach-javadocs @@ -287,18 +352,20 @@ ${skipTests} false + + + io.mosip.kernel:kernel-auth-adapter + - ${argLine} + @{argLine} --add-modules=ALL-SYSTEM --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.stream=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.time.LocalDate=ALL-UNNAMED - --add-opens - java.base/java.time.LocalDateTime=ALL-UNNAMED - --add-opens - java.base/java.time.LocalDateTime.date=ALL-UNNAMED + --add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED + --add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED --enable-preview @@ -306,7 +373,7 @@ org.jacoco jacoco-maven-plugin - ${jacoco.maven.plugin.version} + ${maven.jacoco.version} **/constant/** @@ -329,6 +396,32 @@ report + + jacoco-check + verify + + check + + + + + BUNDLE + + + INSTRUCTION + COVEREDRATIO + ${jacoco.coverage.ratio} + + + LINE + COVEREDRATIO + ${jacoco.coverage.ratio} + + + + + + @@ -353,7 +446,7 @@ ^git.commit.id.(abbrev|full)$ full - ${project.basedir}/.git + ${project.basedir}/../.git @@ -376,21 +469,33 @@ + org.springframework.boot spring-boot-maven-plugin - ${spring.boot.maven.plugin.version} - true + ZIP + build-info build-info + + + + repackage + repackage + false @@ -399,25 +504,52 @@ maven-jar-plugin ${maven.jar.plugin.version} + + + + + ${project.artifactId} + ${project.version} + MOSIP + MOSIP kernel-bio-converter (thin / classes JAR) + io.mosip + + + + + lib-jar package jar + lib + + + ${project.artifactId}-lib + ${project.version} + MOSIP + Embeddable bio-converter library (IConverterApi + DTOs) + io.mosip + + **/constant/* **/dto/* **/exception/* **/service/** - lib - @@ -468,4 +600,3 @@ - diff --git a/kernel-bio-converter/run-local.bat b/kernel-bio-converter/run-local.bat new file mode 100644 index 0000000..959ab76 --- /dev/null +++ b/kernel-bio-converter/run-local.bat @@ -0,0 +1,394 @@ +@echo off +setlocal EnableExtensions EnableDelayedExpansion +REM Standalone Windows cmd runner for kernel-bio-converter (no .ps1). +REM Linux / macOS / Git Bash: use run-local.sh +REM +REM run-local.bat init | start | smoke | stop | test | all | docker +REM Optional: SPRING_CLOUD_CONFIG_URI SPRING_CLOUD_CONFIG_LABEL PORT JDK_JAVA_OPTIONS +REM loader_path_env SPRING_PROFILES_ACTIVE IMAGE + +set "MODULE_DIR=%~dp0" +if "%MODULE_DIR:~-1%"=="\" set "MODULE_DIR=%MODULE_DIR:~0,-1%" + +set "LOCAL_DIR=%MODULE_DIR%\.local" +set "LOG_DIR=%LOCAL_DIR%\logs" +set "PID_DIR=%LOCAL_DIR%\pids" +set "PID_FILE=%PID_DIR%\converter-service.pid" +set "LOG_FILE=%LOG_DIR%\converter-service.log" +set "ERR_FILE=%LOG_DIR%\converter-service.err.log" +set "MODULE=kernel-bio-converter" + +if not defined PORT set "PORT=8079" +if not defined SPRING_PROFILES_ACTIVE set "SPRING_PROFILES_ACTIVE=default" +if not defined IMAGE set "IMAGE=kernel-bio-converter" +if not defined loader_path_env set "loader_path_env=." +set "CONTEXT=/v1/converter-service" +set "BASE=http://127.0.0.1:%PORT%%CONTEXT%" + +set "CMD=%~1" +if "%CMD%"=="" goto :usage +if /I "%CMD%"=="-h" goto :usage +if /I "%CMD%"=="--help" goto :usage +if /I "%CMD%"=="help" goto :usage +if /I "%CMD%"=="init" goto :init +if /I "%CMD%"=="test" goto :test +if /I "%CMD%"=="start" goto :start +if /I "%CMD%"=="stop" goto :stop +if /I "%CMD%"=="smoke" goto :smoke +if /I "%CMD%"=="all" goto :all +if /I "%CMD%"=="docker" goto :docker + +echo error: unknown command '%CMD%' +goto :usage + +:usage +echo Local kernel-bio-converter ^(%SPRING_PROFILES_ACTIVE% profile, :%PORT% %CONTEXT%^) +echo. +echo run-local.bat init package this module +echo run-local.bat start run and wait until Spring Boot is ready +echo run-local.bat smoke GET %CONTEXT%/actuator/health +echo run-local.bat stop +echo run-local.bat test Maven tests +echo run-local.bat all init + test + start + smoke +echo run-local.bat docker package, docker build, run +echo. +echo Port: %PORT% ^(override with set PORT=...^) +echo Optional: SPRING_CLOUD_CONFIG_URI SPRING_CLOUD_CONFIG_LABEL JDK_JAVA_OPTIONS IMAGE loader_path_env +echo. +call :print_endpoints +exit /b 1 + +:port_in_use +netstat -ano | findstr /R /C:":%PORT% .*LISTENING" >nul 2>&1 +exit /b %ERRORLEVEL% + +:pid_on_port +set "PORT_PID=" +for /f "tokens=5" %%P in ('netstat -ano ^| findstr /R /C:":%PORT% .*LISTENING"') do set "PORT_PID=%%P" +exit /b 0 + +:ensure_dirs +if not exist "%LOG_DIR%" mkdir "%LOG_DIR%" +if not exist "%PID_DIR%" mkdir "%PID_DIR%" +exit /b 0 + +:check_prereqs +where java >nul 2>&1 +if errorlevel 1 ( + echo error: java is required on PATH + exit /b 1 +) +where mvn >nul 2>&1 +if errorlevel 1 ( + echo error: mvn is required on PATH + exit /b 1 +) +exit /b 0 + +:print_endpoints +echo. +echo converter profile=%SPRING_PROFILES_ACTIVE% port=%PORT% context=%CONTEXT% +echo health %BASE%/actuator/health +echo swagger %BASE%/swagger-ui/index.html +echo swagger-ui %BASE%/swagger-ui.html +echo openapi %BASE%/v3/api-docs +echo convert POST %BASE%/convert +echo. +exit /b 0 + +:find_jar +set "BOOT_JAR=" +for %%F in ("%MODULE_DIR%\target\%MODULE%-*.jar") do ( + set "CAND=%%~nxF" + echo !CAND! | findstr /I /C:".original" /C:"-lib" /C:"sources" /C:"javadoc" >nul + if errorlevel 1 ( + set "BOOT_JAR=%%~fF" + goto :find_jar_done + ) +) +:find_jar_done +if not defined BOOT_JAR ( + echo error: no boot jar in target. Run: %~nx0 init + exit /b 1 +) +for %%S in ("!BOOT_JAR!") do if %%~zS LSS 1048576 ( + echo error: !BOOT_JAR! is not the Boot ZIP ^(no Main-Class^). Run: %~nx0 init + exit /b 1 +) +exit /b 0 + +:is_running +if not exist "%PID_FILE%" exit /b 1 +set /p CHECK_PID=<"%PID_FILE%" +if not defined CHECK_PID exit /b 1 +tasklist /FI "PID eq !CHECK_PID!" 2>nul | findstr /I "!CHECK_PID!" >nul +if errorlevel 1 exit /b 1 +exit /b 0 + +:init +call :check_prereqs +if errorlevel 1 exit /b 1 +echo ==^> packaging %MODULE% ^(skip tests^) +set "SAVED_PROFILE=%SPRING_PROFILES_ACTIVE%" +set "SPRING_PROFILES_ACTIVE=" +pushd "%MODULE_DIR%" +call mvn clean package -DskipTests "-Dgpg.skip=true" "-Dmaven.javadoc.skip=true" +set "RC=%ERRORLEVEL%" +popd +set "SPRING_PROFILES_ACTIVE=%SAVED_PROFILE%" +if not "%RC%"=="0" exit /b %RC% +echo init complete +exit /b 0 + +:test +call :check_prereqs +if errorlevel 1 exit /b 1 +echo ==^> maven tests +set "SAVED_PROFILE=%SPRING_PROFILES_ACTIVE%" +set "SPRING_PROFILES_ACTIVE=" +pushd "%MODULE_DIR%" +call mvn test "-Dgpg.skip=true" "-Dmaven.javadoc.skip=true" +set "RC=%ERRORLEVEL%" +popd +set "SPRING_PROFILES_ACTIVE=%SAVED_PROFILE%" +exit /b %RC% + +:start +echo. +echo ==^> run-local start +call :ensure_dirs +call :check_prereqs +if errorlevel 1 exit /b 1 +call :is_running +if not errorlevel 1 ( + set /p OLD_PID=<"%PID_FILE%" + echo converter-service already running ^(pid !OLD_PID!^) on port %PORT% + call :print_endpoints + exit /b 0 +) +call :port_in_use +if not errorlevel 1 ( + call :pid_on_port + echo converter-service already listening on port %PORT% ^(pid !PORT_PID!^) + if defined PORT_PID > "%PID_FILE%" echo !PORT_PID! + call :print_endpoints + exit /b 0 +) +if exist "%PID_FILE%" del /q "%PID_FILE%" >nul 2>&1 +if exist "%LOG_FILE%" del /q "%LOG_FILE%" >nul 2>&1 +if exist "%ERR_FILE%" del /q "%ERR_FILE%" >nul 2>&1 + +call :find_jar +if errorlevel 1 exit /b 1 + +echo ==^> starting converter-service from %BOOT_JAR% +echo profile=%SPRING_PROFILES_ACTIVE% +echo port=%PORT% +echo context=%CONTEXT% +echo loader.path=%loader_path_env% + +if defined SPRING_CLOUD_CONFIG_URI echo config.uri=%SPRING_CLOUD_CONFIG_URI% +if defined SPRING_CLOUD_CONFIG_LABEL echo config.label=%SPRING_CLOUD_CONFIG_LABEL% +call :print_endpoints + +set "LAUNCH_PS1=%LOCAL_DIR%\launch-converter-service.ps1" +> "%LAUNCH_PS1%" echo $ErrorActionPreference = 'Stop' +>> "%LAUNCH_PS1%" echo $argList = New-Object System.Collections.Generic.List[string] +>> "%LAUNCH_PS1%" echo $argList.Add^('-XX:-UseG1GC'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-XX:-UseParallelGC'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-XX:-UseShenandoahGC'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-XX:+ExplicitGCInvokesConcurrent'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-XX:+UseZGC'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-XX:+ZGenerational'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-XX:+UnlockExperimentalVMOptions'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-XX:+UseStringDeduplication'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-XX:+HeapDumpOnOutOfMemoryError'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-XX:+UseCompressedOops'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-XX:MaxGCPauseMillis=200'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-Dfile.encoding=UTF-8'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-Dloader.path=%loader_path_env%'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-Dspring.profiles.active=%SPRING_PROFILES_ACTIVE%'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-Dserver.port=%PORT%'^) +if defined SPRING_CLOUD_CONFIG_URI >> "%LAUNCH_PS1%" echo $argList.Add^('-Dspring.cloud.config.uri=%SPRING_CLOUD_CONFIG_URI%'^) +if defined SPRING_CLOUD_CONFIG_LABEL >> "%LAUNCH_PS1%" echo $argList.Add^('-Dspring.cloud.config.label=%SPRING_CLOUD_CONFIG_LABEL%'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('--add-modules=ALL-SYSTEM'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('--add-opens'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('java.xml/jdk.xml.internal=ALL-UNNAMED'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('--add-opens'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('java.base/java.lang.reflect=ALL-UNNAMED'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('--add-opens'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('java.base/java.lang.stream=ALL-UNNAMED'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('--add-opens'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('java.base/java.time=ALL-UNNAMED'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('--add-opens'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('java.base/java.time.LocalDate=ALL-UNNAMED'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('--add-opens'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('java.base/java.time.LocalDateTime=ALL-UNNAMED'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('--add-opens'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('java.base/java.time.LocalDateTime.date=ALL-UNNAMED'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('--add-opens'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('java.base/jdk.internal.reflect.DirectMethodHandleAccessor=ALL-UNNAMED'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('--enable-preview'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('-jar'^) +>> "%LAUNCH_PS1%" echo $argList.Add^('%BOOT_JAR%'^) +>> "%LAUNCH_PS1%" echo $p = Start-Process -FilePath 'java' -ArgumentList $argList.ToArray^(^) -WorkingDirectory '%MODULE_DIR%' -RedirectStandardOutput '%LOG_FILE%' -RedirectStandardError '%ERR_FILE%' -WindowStyle Hidden -PassThru +>> "%LAUNCH_PS1%" echo Set-Content -LiteralPath '%PID_FILE%' -Value $p.Id -Encoding ascii +powershell -NoProfile -ExecutionPolicy Bypass -File "%LAUNCH_PS1%" +if errorlevel 1 ( + echo error: failed to start java process + exit /b 1 +) + +echo ==^> waiting for Spring Boot startup on port %PORT% ^(up to 90s^) ... +call :wait_ready 90 +if errorlevel 1 exit /b 1 + +if exist "%PID_FILE%" ( + set /p STARTED_PID=<"%PID_FILE%" + echo pid !STARTED_PID! log %LOG_FILE% +) else ( + call :pid_on_port + if defined PORT_PID ( + > "%PID_FILE%" echo !PORT_PID! + echo pid !PORT_PID! log %LOG_FILE% + ) else ( + echo warn: ready but PID for port %PORT% not resolved + ) +) +echo. +echo converter-service ready +echo port %PORT% +call :print_endpoints +exit /b 0 + +:wait_ready +set /a WAIT_MAX=%~1 +if "!WAIT_MAX!"=="" set /a WAIT_MAX=90 +set /a WAIT_ELAPSED=0 +:wait_ready_loop +if !WAIT_ELAPSED! GEQ !WAIT_MAX! goto :wait_ready_fail + +call :port_in_use +if not errorlevel 1 ( + if exist "%LOG_FILE%" ( + findstr /C:"Started KernelBioConverterApplication" "%LOG_FILE%" >nul 2>&1 + if not errorlevel 1 exit /b 0 + ) +) + +if exist "%LOG_FILE%" ( + findstr /C:"APPLICATION FAILED TO START" /C:"Port %PORT% was already in use" "%LOG_FILE%" >nul 2>&1 + if not errorlevel 1 ( + echo error: startup failed. See %LOG_FILE% + type "%LOG_FILE%" + exit /b 1 + ) +) + +echo ... still starting ^(!WAIT_ELAPSED!s / !WAIT_MAX!s^) +ping -n 3 127.0.0.1 >nul +set /a WAIT_ELAPSED+=2 +goto :wait_ready_loop + +:wait_ready_fail +echo error: Spring Boot did not become ready within !WAIT_MAX!s on port %PORT% +if exist "%LOG_FILE%" type "%LOG_FILE%" +if exist "%ERR_FILE%" type "%ERR_FILE%" +exit /b 1 + +:stop +call :ensure_dirs +set "STOP_PID=" +if exist "%PID_FILE%" set /p STOP_PID=<"%PID_FILE%" +if not defined STOP_PID ( + call :pid_on_port + set "STOP_PID=!PORT_PID!" +) +if not defined STOP_PID ( + echo converter-service is not running + exit /b 0 +) +echo ==^> stopping converter-service ^(%STOP_PID%^) on port %PORT% +taskkill /PID %STOP_PID% /T /F >nul 2>&1 +del /q "%PID_FILE%" >nul 2>&1 +echo stopped. +exit /b 0 + +:http_ok +set "HTTP_CODE=000" +set "HTTP_URL=%~1" +set "HTTP_CODE_FILE=%LOCAL_DIR%\http-code.txt" +curl.exe -sS -o NUL -w "%%{http_code}" --connect-timeout 2 --max-time 3 "%HTTP_URL%" > "%HTTP_CODE_FILE%" 2>nul +if exist "%HTTP_CODE_FILE%" ( + for /f "usebackq delims=" %%C in ("%HTTP_CODE_FILE%") do set "HTTP_CODE=%%C" + del /q "%HTTP_CODE_FILE%" >nul 2>&1 +) +if not defined HTTP_CODE set "HTTP_CODE=000" +if "!HTTP_CODE!"=="" set "HTTP_CODE=000" +exit /b 0 + +:smoke +call :ensure_dirs +echo ==^> waiting for converter-service ^(up to 60s^) +set /a ELAPSED=0 +:smoke_loop +if %ELAPSED% GEQ 60 goto :smoke_fail +if exist "%PID_FILE%" ( + call :is_running + if errorlevel 1 ( + echo error: process exited. See %LOG_FILE% + if exist "%LOG_FILE%" type "%LOG_FILE%" + if exist "%ERR_FILE%" type "%ERR_FILE%" + exit /b 1 + ) +) +call :http_ok "%BASE%/actuator/health" +if "%HTTP_CODE%"=="200" goto :smoke_ok +ping -n 3 127.0.0.1 >nul +set /a ELAPSED+=2 +goto :smoke_loop + +:smoke_ok +echo healthy %BASE%/actuator/health +call :http_ok "%BASE%/swagger-ui/index.html" +echo swagger %BASE%/swagger-ui/index.html HTTP %HTTP_CODE% +if not "%HTTP_CODE%"=="200" ( + echo error: swagger not healthy + exit /b 1 +) +echo smoke ok +call :print_endpoints +exit /b 0 + +:smoke_fail +echo error: not healthy. See %LOG_FILE% +if exist "%LOG_FILE%" type "%LOG_FILE%" +if exist "%ERR_FILE%" type "%ERR_FILE%" +exit /b 1 + +:all +echo ==^> all: init + test + start + smoke +call :init +if errorlevel 1 exit /b 1 +call :test +if errorlevel 1 exit /b 1 +call :start +if errorlevel 1 exit /b 1 +call :smoke +exit /b %ERRORLEVEL% + +:docker +call :init +if errorlevel 1 exit /b 1 +where docker >nul 2>&1 +if errorlevel 1 ( + echo error: docker is required on PATH + exit /b 1 +) +docker rm -f kernel-bio-converter >nul 2>&1 +echo ==^> docker build %IMAGE% +docker build -t %IMAGE% "%MODULE_DIR%" +if errorlevel 1 exit /b 1 +call :print_endpoints +docker run --rm -p %PORT%:8079 --name kernel-bio-converter -e active_profile_env=%SPRING_PROFILES_ACTIVE% -e spring_config_url_env=%SPRING_CLOUD_CONFIG_URI% -e spring_config_label_env=%SPRING_CLOUD_CONFIG_LABEL% -e JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% %IMAGE% +exit /b %ERRORLEVEL% diff --git a/kernel-bio-converter/run-local.sh b/kernel-bio-converter/run-local.sh new file mode 100644 index 0000000..61df8f5 --- /dev/null +++ b/kernel-bio-converter/run-local.sh @@ -0,0 +1,367 @@ +#!/usr/bin/env bash +# kernel-bio-converter local runner — Linux, macOS, Windows Git Bash/MSYS. +# Windows cmd: use run-local.bat (standalone). +# +# ./run-local.sh init | start | smoke | stop | test | all | docker +# Optional: SPRING_CLOUD_CONFIG_URI SPRING_CLOUD_CONFIG_LABEL PORT JDK_JAVA_OPTIONS +# loader_path_env SPRING_PROFILES_ACTIVE IMAGE +set -euo pipefail + +MODULE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +LOCAL_DIR="${MODULE_DIR}/.local" +LOG_DIR="${LOCAL_DIR}/logs" +PID_DIR="${LOCAL_DIR}/pids" +PORT="${PORT:-8079}" +PID_FILE="${PID_DIR}/converter-service.pid" +LOG_FILE="${LOG_DIR}/converter-service.log" +MODULE="kernel-bio-converter" +PROFILE="${SPRING_PROFILES_ACTIVE:-default}" +CONFIG_URI="${SPRING_CLOUD_CONFIG_URI:-}" +CONFIG_LABEL="${SPRING_CLOUD_CONFIG_LABEL:-}" +LOADER_PATH="${loader_path_env:-.}" +IMAGE="${IMAGE:-kernel-bio-converter}" +CONTEXT="/v1/converter-service" +BASE="http://127.0.0.1:${PORT}${CONTEXT}" +UNAME_S="$(uname -s 2>/dev/null || echo unknown)" + +MVN_SKIP=( + "-DskipTests" + "-Dgpg.skip=true" + "-Dmaven.javadoc.skip=true" +) + +usage() { + cat </dev/null 2>&1 || { + echo "error: '$1' is required on PATH" >&2 + exit 1 + } +} + +ensure_dirs() { + mkdir -p "$LOG_DIR" "$PID_DIR" +} + +print_endpoints() { + echo + echo "converter profile=${PROFILE} port=${PORT} context=${CONTEXT}" + echo " health ${BASE}/actuator/health" + echo " swagger ${BASE}/swagger-ui/index.html" + echo " swagger-ui ${BASE}/swagger-ui.html" + echo " openapi ${BASE}/v3/api-docs" + echo " convert POST ${BASE}/convert" + echo +} + +check_prereqs() { + need_cmd java + need_cmd mvn + echo "os: ${UNAME_S}" + local ver + ver="$(java -version 2>&1 | head -n 1 || true)" + echo "java: $ver" + if ! echo "$ver" | grep -E '"21[\. "]' >/dev/null 2>&1; then + echo "warn: JDK 21 is required. Continuing anyway." >&2 + fi +} + +mvn_mod() { + ( + cd "$MODULE_DIR" + unset SPRING_PROFILES_ACTIVE || true + mvn "$@" + ) +} + +find_boot_jar() { + local target="${MODULE_DIR}/target" + local jar + if [[ ! -d "$target" ]]; then + echo "error: not packaged. Run: $0 init" >&2 + exit 1 + fi + for jar in "$target"/${MODULE}-*.jar; do + [[ -f "$jar" ]] || continue + case "$jar" in + *.original|*-lib.jar|*sources*|*javadoc*) continue ;; + esac + if [[ "$(wc -c < "$jar")" -lt 1048576 ]]; then + echo "error: ${jar} is not the Boot ZIP (no Main-Class). Run: $0 init" >&2 + exit 1 + fi + echo "$jar" + return 0 + done + echo "error: no boot jar in ${target}. Run: $0 init" >&2 + exit 1 +} + +is_running() { + [[ -f "$PID_FILE" ]] || return 1 + kill -0 "$(cat "$PID_FILE")" 2>/dev/null +} + +cmd_init() { + check_prereqs + echo "==> packaging ${MODULE} (skip tests)" + mvn_mod clean package "${MVN_SKIP[@]}" + echo "init complete" +} + +cmd_test() { + check_prereqs + echo "==> maven tests" + mvn_mod test "-Dgpg.skip=true" "-Dmaven.javadoc.skip=true" +} + +cmd_start() { + echo + echo "==> run-local start" + ensure_dirs + check_prereqs + if is_running; then + echo "converter-service already running (pid $(cat "$PID_FILE")) on port ${PORT}" + print_endpoints + return 0 + fi + rm -f "$LOG_FILE" + local jar + jar="$(find_boot_jar)" + echo "==> starting converter-service from $(basename "$jar")" + echo " profile=${PROFILE}" + echo " port=${PORT}" + echo " context=${CONTEXT}" + echo " loader.path=${LOADER_PATH}" + if [[ -n "${CONFIG_URI}" ]]; then + echo " config.uri=${CONFIG_URI}" + fi + if [[ -n "${CONFIG_LABEL}" ]]; then + echo " config.label=${CONFIG_LABEL}" + fi + print_endpoints + + local java_args=( + "-XX:-UseG1GC" + "-XX:-UseParallelGC" + "-XX:-UseShenandoahGC" + "-XX:+ExplicitGCInvokesConcurrent" + "-XX:+UseZGC" + "-XX:+ZGenerational" + "-XX:+UnlockExperimentalVMOptions" + "-XX:+UseStringDeduplication" + "-XX:+HeapDumpOnOutOfMemoryError" + "-XX:+UseCompressedOops" + "-XX:MaxGCPauseMillis=200" + "-Dfile.encoding=UTF-8" + "-Dloader.path=${LOADER_PATH}" + "-Dspring.profiles.active=${PROFILE}" + "-Dserver.port=${PORT}" + ) + if [[ -n "${CONFIG_URI}" ]]; then + java_args+=("-Dspring.cloud.config.uri=${CONFIG_URI}") + fi + if [[ -n "${CONFIG_LABEL}" ]]; then + java_args+=("-Dspring.cloud.config.label=${CONFIG_LABEL}") + fi + java_args+=( + "--add-modules=ALL-SYSTEM" + "--add-opens" "java.xml/jdk.xml.internal=ALL-UNNAMED" + "--add-opens" "java.base/java.lang.reflect=ALL-UNNAMED" + "--add-opens" "java.base/java.lang.stream=ALL-UNNAMED" + "--add-opens" "java.base/java.time=ALL-UNNAMED" + "--add-opens" "java.base/java.time.LocalDate=ALL-UNNAMED" + "--add-opens" "java.base/java.time.LocalDateTime=ALL-UNNAMED" + "--add-opens" "java.base/java.time.LocalDateTime.date=ALL-UNNAMED" + "--add-opens" "java.base/jdk.internal.reflect.DirectMethodHandleAccessor=ALL-UNNAMED" + "--enable-preview" + -jar "$jar" + ) + nohup java "${java_args[@]}" >"$LOG_FILE" 2>&1 & + echo $! >"$PID_FILE" + echo "pid $(cat "$PID_FILE") log ${LOG_FILE}" + echo "==> waiting for Spring Boot startup on port ${PORT} (up to 90s) ..." + wait_ready 90 + echo + echo "converter-service ready" + echo " port ${PORT}" + print_endpoints +} + +wait_ready() { + local timeout="${1:-90}" + local elapsed=0 + local code + while [[ "$elapsed" -lt "$timeout" ]]; do + if ! is_running; then + echo "error: process exited during startup. See ${LOG_FILE}" >&2 + tail -n 80 "$LOG_FILE" >&2 || true + return 1 + fi + if grep -q "Started KernelBioConverterApplication" "$LOG_FILE" 2>/dev/null; then + code="$(http_ok "${BASE}/actuator/health")" + if [[ "$code" == "200" ]]; then + return 0 + fi + fi + code="$(http_ok "${BASE}/actuator/health")" + if [[ "$code" == "200" ]]; then + return 0 + fi + if grep -q "APPLICATION FAILED TO START\|Port ${PORT} was already in use" "$LOG_FILE" 2>/dev/null; then + echo "error: startup failed. See ${LOG_FILE}" >&2 + tail -n 80 "$LOG_FILE" >&2 || true + return 1 + fi + echo " ... still starting (${elapsed}s / ${timeout}s)" + sleep 2 + elapsed=$((elapsed + 2)) + done + echo "error: Spring Boot did not become ready within ${timeout}s on port ${PORT}" >&2 + tail -n 80 "$LOG_FILE" >&2 || true + return 1 +} + +http_ok() { + local url="$1" + local code + if command -v curl >/dev/null 2>&1; then + code="$(curl -sS -o /dev/null -w "%{http_code}" --connect-timeout 2 --max-time 3 "$url" 2>/dev/null || true)" + [[ -n "$code" ]] || code="000" + printf '%s' "$code" + return 0 + fi + if command -v python3 >/dev/null 2>&1; then + python3 -c 'import sys,urllib.request +try: + urllib.request.urlopen(sys.argv[1], timeout=3) + print("200") +except Exception: + print("000")' "$url" + return 0 + fi + echo "error: install curl or python3 for smoke checks" >&2 + printf '%s' "000" +} + +cmd_stop() { + ensure_dirs + if ! is_running; then + rm -f "$PID_FILE" + echo "converter-service is not running" + return 0 + fi + local pid + pid="$(cat "$PID_FILE")" + echo "==> stopping converter-service (${pid}) on port ${PORT}" + kill "$pid" 2>/dev/null || true + local i + for i in 1 2 3 4 5 6 7 8 9 10; do + kill -0 "$pid" 2>/dev/null || break + sleep 1 + done + if kill -0 "$pid" 2>/dev/null; then + kill -9 "$pid" 2>/dev/null || true + fi + rm -f "$PID_FILE" + echo "stopped." +} + +cmd_smoke() { + ensure_dirs + local timeout="${1:-60}" + local elapsed=0 + echo "==> waiting for converter-service (up to ${timeout}s)" + while [[ "$elapsed" -lt "$timeout" ]]; do + if [[ -f "$PID_FILE" ]] && ! is_running; then + echo "error: process exited. See ${LOG_FILE}" >&2 + tail -n 40 "$LOG_FILE" >&2 || true + return 1 + fi + local code + code="$(http_ok "${BASE}/actuator/health")" + if [[ "$code" == "200" ]]; then + echo "healthy ${BASE}/actuator/health" + code="$(http_ok "${BASE}/swagger-ui/index.html")" + echo "swagger ${BASE}/swagger-ui/index.html HTTP ${code}" + if [[ "$code" != "200" ]]; then + echo "error: swagger not healthy" >&2 + return 1 + fi + echo "smoke ok" + print_endpoints + return 0 + fi + sleep 2 + elapsed=$((elapsed + 2)) + done + echo "error: not healthy. See ${LOG_FILE}" >&2 + tail -n 80 "$LOG_FILE" >&2 || true + return 1 +} + +cmd_all() { + echo "==> all: init + test + start + smoke" + cmd_init + cmd_test + cmd_start + cmd_smoke +} + +docker_host_args() { + case "$UNAME_S" in + Linux*) echo --add-host=host.docker.internal:host-gateway ;; + esac +} + +cmd_docker() { + cmd_init + need_cmd docker + docker rm -f kernel-bio-converter >/dev/null 2>&1 || true + echo "==> docker build ${IMAGE}" + docker build -t "${IMAGE}" "${MODULE_DIR}" + print_endpoints + # shellcheck disable=SC2046 + exec docker run --rm -p "${PORT}:8079" --name kernel-bio-converter \ + $(docker_host_args) \ + -e "active_profile_env=${PROFILE}" \ + -e "spring_config_url_env=${CONFIG_URI}" \ + -e "spring_config_label_env=${CONFIG_LABEL}" \ + -e "JDK_JAVA_OPTIONS=${JDK_JAVA_OPTIONS:-}" \ + "${IMAGE}" +} + +main() { + local cmd="${1:-}" + shift || true + case "$cmd" in + -h|--help|help) usage 0 ;; + init) cmd_init ;; + test) cmd_test ;; + start) cmd_start ;; + stop) cmd_stop ;; + smoke) cmd_smoke "${1:-60}" ;; + all) cmd_all ;; + docker) cmd_docker ;; + "") usage 1 ;; + *) echo "error: unknown command '$cmd'" >&2; usage 1 ;; + esac +} + +main "$@" diff --git a/kernel-bio-converter/run_local.bat b/kernel-bio-converter/run_local.bat deleted file mode 100644 index 458d37a..0000000 --- a/kernel-bio-converter/run_local.bat +++ /dev/null @@ -1 +0,0 @@ -java -Dloader.path=";" --add-modules=ALL-SYSTEM --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.stream=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.time.LocalDate=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED --add-opens java.base/jdk.internal.reflect.DirectMethodHandleAccessor=ALL-UNNAMED -jar target/kernel-bio-converter-1.4.0-SNAPSHOT.jar diff --git a/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/KernelBioConverterApplication.java b/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/KernelBioConverterApplication.java index 18610e0..87e6917 100644 --- a/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/KernelBioConverterApplication.java +++ b/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/KernelBioConverterApplication.java @@ -3,43 +3,67 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; /** * The entry point for the Kernel Bio Converter Application. - * + * *

- * This class configures and launches the Spring Boot application. It excludes - * the {@link DataSourceAutoConfiguration} class from auto-configuration since - * the application does not require a datasource configuration. The - * {@code scanBasePackages} attribute in {@link SpringBootApplication} - * annotation is used to define the base packages to scan for Spring components. + * Scan is declared only on {@link ComponentScan} so the auth-adapter + * {@code SecurityConfig} exclude filter applies. {@code kernel-core} brings + * JDBC/JPA onto the classpath; this service does not use a database, so + * DataSource / Hibernate / Data JPA auto-config are excluded. Unused + * kernel-core generators/validators are also listed in + * {@link EnableAutoConfiguration#excludeName()}. *

- * - * @see SpringApplication - * @see SpringBootApplication - * @see EnableAutoConfiguration - * @see DataSourceAutoConfiguration - * + * * @author Janardhan B S * @since 1.0.0 */ -@SpringBootApplication(scanBasePackages = { "${mosip.auth.adapter.impl.basepackage}, io.mosip.kernel.bio.*" }) -@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class }) +@SpringBootApplication +@EnableAutoConfiguration(excludeName = { + "org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration", + "org.springframework.boot.jdbc.autoconfigure.DataSourceInitializationAutoConfiguration", + "org.springframework.boot.hibernate.autoconfigure.HibernateJpaAutoConfiguration", + "org.springframework.boot.data.jpa.autoconfigure.DataJpaRepositoriesAutoConfiguration", + "io.mosip.kernel.idgenerator.vid.impl.VidGeneratorImpl", + "io.mosip.kernel.idgenerator.vid.util.VidFilterUtils", + "io.mosip.kernel.idgenerator.tokenid.impl.TokenIdGeneratorImpl", + "io.mosip.kernel.idgenerator.machineid.impl.MachineIdGeneratorImpl", + "io.mosip.kernel.idgenerator.regcenterid.impl.RegistrationCenterIdGeneratorImpl", + "io.mosip.kernel.idgenerator.mispid.impl.MispIdGeneratorImpl", + "io.mosip.kernel.licensekeygenerator.misp.impl.MISPLicenseKeyGeneratorImpl", + "io.mosip.kernel.licensekeygenerator.misp.util.MISPLicenseKeyGeneratorUtil", + "io.mosip.kernel.idgenerator.rid.impl.RidGeneratorImpl", + "io.mosip.kernel.idvalidator.prid.impl.PridValidatorImpl", + "io.mosip.kernel.idvalidator.rid.impl.RidValidatorImpl", + "io.mosip.kernel.idvalidator.uin.impl.UinValidatorImpl", + "io.mosip.kernel.idvalidator.vid.impl.VidValidatorImpl", + "io.mosip.kernel.idvalidator.mispid.impl.MispIdValidatorImpl", + "io.mosip.kernel.templatemanager.velocity.builder.TemplateManagerBuilderImpl", + "io.mosip.kernel.pdfgenerator.impl.PDFGeneratorImpl", + "io.mosip.kernel.qrcode.generator.zxing.QrcodeGeneratorImpl", + "io.mosip.kernel.transliteration.icu4j.impl.TransliterationImpl", + "io.mosip.kernel.applicanttype.api.impl.ApplicantTypeImpl", + "io.mosip.kernel.idobjectvalidator.config.IdObjectValidatorConfig", + "io.mosip.kernel.websub.api.config.IntentVerificationConfig", + "io.mosip.kernel.websub.api.config.WebSubClientConfig", + "io.mosip.kernel.websub.api.config.publisher.WebSubPublisherClientConfig", + "io.mosip.kernel.websub.api.config.publisher.RestTemplateHelper" +}) @ComponentScan( - basePackages = "io.mosip.kernel", - excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {io.mosip.kernel.auth.defaultadapter.config.SecurityConfig.class}) - ) + basePackages = { "${mosip.auth.adapter.impl.basepackage}", "io.mosip.kernel.bio.converter" }, + excludeFilters = @ComponentScan.Filter(type = FilterType.REGEX, + pattern = "io\\.mosip\\.kernel\\.auth\\.defaultadapter\\.config\\.SecurityConfig")) public class KernelBioConverterApplication { /** * The main method which serves as the entry point for the Spring Boot * application. - * + * * @param args command-line arguments (not used). */ public static void main(String[] args) { SpringApplication.run(KernelBioConverterApplication.class, args); } -} \ No newline at end of file +} diff --git a/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/controller/ConvertController.java b/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/controller/ConvertController.java index 3cfb7ca..5dd0239 100644 --- a/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/controller/ConvertController.java +++ b/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/controller/ConvertController.java @@ -2,7 +2,7 @@ import java.util.Map; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; diff --git a/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/dto/ConvertRequestDto.java b/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/dto/ConvertRequestDto.java index c3c2d84..10bbe71 100644 --- a/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/dto/ConvertRequestDto.java +++ b/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/dto/ConvertRequestDto.java @@ -3,10 +3,10 @@ import java.util.Map; import java.util.Objects; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.Data; import lombok.ToString; @@ -77,10 +77,22 @@ public class ConvertRequestDto { @SuppressWarnings({ "java:S1104" }) public Map targetParameters; + /** + * No-arg constructor for Jackson / Spring binding. + */ public ConvertRequestDto() { super(); } + /** + * Full constructor for programmatic request creation. + * + * @param values modality key → Base64 URL-encoded ISO blob + * @param sourceFormat source format code (e.g. {@code ISO19794_4_2011}) + * @param targetFormat target format code (e.g. {@code IMAGE/JPEG}) + * @param sourceParameters optional source hints + * @param targetParameters optional target hints + */ public ConvertRequestDto( @NotNull(message = "Values code can not be null") @Size(min = 1, message = "Minimum one entry required") Map values, @NotNull(message = "SourceFormat code can not be null") @NotBlank(message = "SourceFormat code can not be blank") @NotEmpty(message = "SourceFormat code can not be empty") String sourceFormat, @@ -94,6 +106,9 @@ public ConvertRequestDto( this.targetParameters = targetParameters; } + /** + * {@inheritDoc} + */ @Override public boolean equals(Object o) { if (this == o) @@ -107,11 +122,20 @@ public boolean equals(Object o) { && Objects.equals(targetParameters, that.targetParameters); } + /** + * {@inheritDoc} + */ @Override public int hashCode() { return Objects.hash(values, sourceFormat, targetFormat, sourceParameters, targetParameters); } + /** + * Lombok-style equality helper used by generated {@code equals} patterns. + * + * @param other candidate object + * @return {@code true} if {@code other} is a {@link ConvertRequestDto} + */ public boolean canEqual(Object other) { return other instanceof ConvertRequestDto; } diff --git a/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/exception/ConversionExceptionAdvice.java b/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/exception/ConversionExceptionAdvice.java index 1f4d73c..2c4ed34 100644 --- a/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/exception/ConversionExceptionAdvice.java +++ b/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/exception/ConversionExceptionAdvice.java @@ -1,7 +1,5 @@ package io.mosip.kernel.bio.converter.exception; -import java.io.IOException; - import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; @@ -10,6 +8,8 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; +import org.springframework.validation.FieldError; +import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.util.ContentCachingRequestWrapper; @@ -23,40 +23,32 @@ import io.mosip.kernel.core.util.EmptyCheckUtils; /** - * ConversionExceptionAdvice handles exceptions and builds the response wrapper - * around service errors, providing a {@link ResponseEntity} with appropriate - * error details. - * + * Global {@link RestControllerAdvice} that maps conversion and validation + * failures into MOSIP {@link ResponseWrapper}{@ containing {@link ServiceError} + * entries (HTTP 500, matching existing converter-service contract). + * *

- * This advice is responsible for capturing various exceptions, including - * generic {@link Exception}, {@link RuntimeException}, and custom - * {@link ConversionException}, and returning a standardized error response. + * Bean-validation failures on the convert request are remapped to + * {@code MOS-CNV-*} codes via {@link #mapValidationErrors(MethodArgumentNotValidException)}. + * Domain failures thrown as {@link ConversionException} keep their error code; + * unexpected exceptions become {@code MOS-CNV-500}. *

- * - * @see io.mosip.kernel.bio.converter.exception.ConversionException - * @see org.springframework.web.bind.annotation.ExceptionHandler - * @see org.springframework.web.bind.annotation.RestControllerAdvice - * + * * @author Janardhan B S * @since 1.0.0 */ - @RestControllerAdvice public class ConversionExceptionAdvice { - /** - * Logger instance for logging error details. - */ + /** SLF4J logger for validation and conversion failure diagnostics. */ private static final Logger logger = LoggerFactory.getLogger(ConversionExceptionAdvice.class); - /** - * ObjectMapper instance for JSON parsing. - */ + /** Jackson mapper used to copy {@code id}/{@code version} from the cached request body. */ private ObjectMapper objectMapper; /** - * Constructor for ConversionExceptionAdvice. + * Creates advice with the application {@link ObjectMapper}. * - * @param objectMapper the {@link ObjectMapper} to use for JSON parsing. + * @param objectMapper Jackson 2 mapper (from {@code spring-boot-jackson2}) */ @Autowired public ConversionExceptionAdvice(ObjectMapper objectMapper) { @@ -64,12 +56,34 @@ public ConversionExceptionAdvice(ObjectMapper objectMapper) { } /** - * Handles exceptions and builds the response with error details. + * Handles {@link MethodArgumentNotValidException} from {@code @Valid} on the convert API. + * + * @param request HTTP request (preferably a {@link ContentCachingRequestWrapper}) + * @param e binding / constraint violations + * @return envelope with a single {@link ServiceError} and HTTP 500 + * @throws Exception if the cached request body cannot be parsed + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + public ResponseEntity> handleValidation(HttpServletRequest request, + MethodArgumentNotValidException e) throws Exception { + ResponseWrapper responseWrapper = setErrors(request); + ConverterErrorCode code = mapValidationErrors(e); + FieldError fieldError = e.getBindingResult().getFieldError(); + String message = fieldError != null ? fieldError.getDefaultMessage() : code.getErrorMessage(); + responseWrapper.getErrors().add(new ServiceError(code.getErrorCode(), message)); + logger.error("Validation failure: {} ", e.getMessage()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).contentType(MediaType.APPLICATION_JSON) + .body(responseWrapper); + } + + /** + * Catch-all handler for {@link ConversionException}, {@link RuntimeException}, and other + * {@link Exception} types thrown from controllers or filters. * - * @param request the {@link HttpServletRequest} object. - * @param e the {@link Exception} thrown. - * @return a {@link ResponseEntity} containing the error details. - * @throws IOException if there is an error reading the request body. + * @param request HTTP request used to populate envelope metadata + * @param e the thrown exception + * @return envelope with {@link ServiceError} and HTTP 500 + * @throws Exception if the cached request body cannot be parsed */ @ExceptionHandler(value = { Exception.class, RuntimeException.class, ConversionException.class }) public ResponseEntity> defaultServiceErrorHandler(HttpServletRequest request, @@ -90,11 +104,49 @@ public ResponseEntity> defaultServiceErrorHandler( } /** - * Sets the error details in the {@link ResponseWrapper} from the request. + * Maps field-level validation failures to the closest {@link ConverterErrorCode}. + * + * @param e Spring validation exception + * @return matching converter error code (defaults to invalid request) + */ + private static ConverterErrorCode mapValidationErrors(MethodArgumentNotValidException e) { + boolean source = false; + boolean target = false; + boolean values = false; + for (FieldError err : e.getBindingResult().getFieldErrors()) { + String simple = err.getField().contains(".") + ? err.getField().substring(err.getField().lastIndexOf('.') + 1) + : err.getField(); + switch (simple) { + case "sourceFormat" -> source = true; + case "targetFormat" -> target = true; + case "values" -> values = true; + default -> { + } + } + } + if (source && target) { + return ConverterErrorCode.INPUT_SOURCE_EXCEPTION; + } + if (source) { + return ConverterErrorCode.INVALID_SOURCE_EXCEPTION; + } + if (target) { + return ConverterErrorCode.INVALID_TARGET_EXCEPTION; + } + if (values) { + return ConverterErrorCode.INVALID_REQUEST_EXCEPTION; + } + return ConverterErrorCode.INVALID_REQUEST_EXCEPTION; + } + + /** + * Builds an empty {@link ResponseWrapper} and copies {@code id} / {@code version} + * from the JSON request body when available. * - * @param httpServletRequest the {@link HttpServletRequest} object. - * @return a {@link ResponseWrapper} with the error details. - * @throws IOException if there is an error reading the request body. + * @param httpServletRequest inbound request + * @return response wrapper with optional metadata populated + * @throws Exception if JSON parsing fails */ public ResponseWrapper setErrors(HttpServletRequest httpServletRequest) throws Exception { ResponseWrapper responseWrapper = new ResponseWrapper<>(); @@ -110,4 +162,4 @@ public ResponseWrapper setErrors(HttpServletRequest httpServletReq responseWrapper.setVersion(reqNode.path("version").asText()); return responseWrapper; } -} \ No newline at end of file +} diff --git a/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/service/impl/ConverterServiceImpl.java b/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/service/impl/ConverterServiceImpl.java index 7be2d01..e4067a2 100644 --- a/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/service/impl/ConverterServiceImpl.java +++ b/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/service/impl/ConverterServiceImpl.java @@ -30,15 +30,32 @@ import io.mosip.kernel.bio.converter.service.IConverterApi; /** - * This class implements handling conversion of ISO format to JPEG or PNG Image - * format - * + * Service implementation that converts ISO/IEC 19794 biometric records + * (finger, face, iris) into JPEG/PNG image bytes (URL-safe Base64), or + * re-wraps into supported ISO target formats via {@code biometrics-util}. + * + *

+ * Entry point: {@link #convert(Map, String, String, Map, Map)}. Per-modality + * helpers decode Base64, parse the BDIR, decompress JP2000/WSQ, and re-encode. + *

+ * * @author Janardhan B S * @since 1.0.0 - * */ @Service public class ConverterServiceImpl implements IConverterApi { + /** + * Converts each Base64 URL-encoded ISO blob in {@code values} from + * {@code sourceFormat} to {@code targetFormat}. + * + * @param values identifier → Base64 URL-encoded ISO BDB + * @param sourceFormat e.g. {@code ISO19794_4_2011} + * @param targetFormat e.g. {@code IMAGE/JPEG} + * @param sourceParameters optional source hints (unused / ignored if unknown) + * @param targetParameters optional target hints (unused / ignored if unknown) + * @return map of the same keys → Base64 URL-encoded converted payloads + * @throws ConversionException when input is empty, formats are invalid, or decode fails + */ @Override public Map convert(Map values, String sourceFormat, String targetFormat, Map sourceParameters, Map targetParameters) throws ConversionException { @@ -80,6 +97,17 @@ public Map convert(Map values, String sourceForm return targetValues; } + /** + * Decodes a finger ISO19794-4 payload and re-encodes the embedded image to + * {@code targetCode} (JPEG or PNG). + * + * @param sourceCode resolved source format enum + * @param isoData Base64 URL-encoded finger ISO blob + * @param targetCode resolved target image format + * @param targetParameters optional target parameters (currently unused) + * @return Base64 URL-encoded image bytes + * @throws ConversionException on Base64, ISO structure, or compression failures + */ @SuppressWarnings({ "java:S1172", "java:S6208" }) public String convertFingerIsoToImageType(SourceFormatCode sourceCode, String isoData, TargetFormatCode targetCode, Map targetParameters) throws ConversionException { @@ -114,6 +142,14 @@ public String convertFingerIsoToImageType(SourceFormatCode sourceCode, String is return CommonUtil.encodeToURLSafeBase64(outImageData); } + /** + * Decompresses finger image bytes for the given ISO compression type. + * + * @param imageData raw image payload from the finger BDIR + * @param compressionType {@link FingerImageCompressionType} constant + * @return decoded {@link BufferedImage} + * @throws ConversionException if compression is unsupported or bytes cannot be read + */ public BufferedImage decodeFingerImage(byte[] imageData, int compressionType) throws ConversionException { try { switch (compressionType) { @@ -134,6 +170,16 @@ public BufferedImage decodeFingerImage(byte[] imageData, int compressionType) th } } + /** + * Decodes a face ISO19794-5 payload and re-encodes to {@code targetCode}. + * + * @param sourceCode resolved source format enum + * @param isoData Base64 URL-encoded face ISO blob + * @param targetCode resolved target image format + * @param targetParameters optional target parameters (currently unused) + * @return Base64 URL-encoded image bytes + * @throws ConversionException on Base64, ISO structure, or compression failures + */ @SuppressWarnings({ "java:S1172" }) public String convertFaceIsoToImageType(SourceFormatCode sourceCode, String isoData, TargetFormatCode targetCode, Map targetParameters) throws ConversionException { @@ -167,6 +213,14 @@ public String convertFaceIsoToImageType(SourceFormatCode sourceCode, String isoD return CommonUtil.encodeToURLSafeBase64(outImageData); } + /** + * Decompresses face image bytes (JPEG2000 lossy/lossless only). + * + * @param imageData raw image payload from the face BDIR + * @param imageDataType {@link ImageDataType} constant + * @return decoded {@link BufferedImage} + * @throws ConversionException if type is unsupported or bytes cannot be read + */ public BufferedImage decodeFaceImage(byte[] imageData, int imageDataType) throws ConversionException { try { if (imageDataType == ImageDataType.JPEG2000_LOSSY || imageDataType == ImageDataType.JPEG2000_LOSS_LESS) { @@ -181,6 +235,16 @@ public BufferedImage decodeFaceImage(byte[] imageData, int imageDataType) throws } } + /** + * Decodes an iris ISO19794-6 payload and re-encodes to {@code targetCode}. + * + * @param sourceCode resolved source format enum + * @param isoData Base64 URL-encoded iris ISO blob + * @param targetCode resolved target image format + * @param targetParameters optional target parameters (currently unused) + * @return Base64 URL-encoded image bytes + * @throws ConversionException on Base64, ISO structure, or compression failures + */ @SuppressWarnings({ "java:S1172" }) public String convertIrisIsoToImageType(SourceFormatCode sourceCode, String isoData, TargetFormatCode targetCode, Map targetParameters) throws ConversionException { @@ -214,6 +278,14 @@ public String convertIrisIsoToImageType(SourceFormatCode sourceCode, String isoD return CommonUtil.encodeToURLSafeBase64(outImageData); } + /** + * Decompresses iris image bytes ({@link ImageFormat#MONO_JPEG2000} only). + * + * @param imageData raw image payload from the iris BDIR + * @param imageFormat {@link ImageFormat} constant + * @return decoded {@link BufferedImage} + * @throws ConversionException if format is unsupported or bytes cannot be read + */ public BufferedImage decodeIrisImage(byte[] imageData, int imageFormat) throws ConversionException { try { if (imageFormat == ImageFormat.MONO_JPEG2000) { @@ -228,6 +300,14 @@ public BufferedImage decodeIrisImage(byte[] imageData, int imageFormat) throws C } } + /** + * Encodes a {@link BufferedImage} to JPEG or PNG bytes for the given target. + * + * @param targetCode image target enum ({@code IMAGE_JPEG} or {@code IMAGE_PNG}) + * @param outImage decoded biometric image + * @return encoded image bytes + * @throws ConversionException if {@code targetCode} is not a plain image format + */ public byte[] convertBufferedImageToBytes(TargetFormatCode targetCode, BufferedImage outImage) { switch (targetCode) { case IMAGE_JPEG: diff --git a/kernel-bio-converter/src/main/resources/application.properties b/kernel-bio-converter/src/main/resources/application.properties index ad90292..7da31fa 100644 --- a/kernel-bio-converter/src/main/resources/application.properties +++ b/kernel-bio-converter/src/main/resources/application.properties @@ -2,4 +2,14 @@ mosip.auth.adapter.impl.basepackage=io.mosip.kernel.auth.defaultadapter mosip.kernel.auth.appids.realm.map={prereg:'preregistration',ida:'mosip',registrationclient:'mosip',regproc:'mosip',partner:'mosip',resident:'mosip'} auth.server.admin.issuer.uri=https://dev2.mosip.net/keycloak/auth/realms/ -auth.server.admin.allowed.audience=mosip-regproc-client,mosip-partner-client,mosip-crereq-client,mosip-creser-client \ No newline at end of file +auth.server.admin.allowed.audience=mosip-regproc-client,mosip-partner-client,mosip-crereq-client,mosip-creser-client + +spring.config.import=optional:configserver: +# Keep Ant-style /** mid-path patterns used by MOSIP auth exclude lists (Boot 4 default is PathPattern). +spring.mvc.pathmatch.matching-strategy=ant_path_matcher +# Converter has no DB; kernel-core still pulls spring-boot-starter-data-jpa onto the classpath. +spring.autoconfigure.exclude=\ +org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration,\ +org.springframework.boot.jdbc.autoconfigure.DataSourceInitializationAutoConfiguration,\ +org.springframework.boot.hibernate.autoconfigure.HibernateJpaAutoConfiguration,\ +org.springframework.boot.data.jpa.autoconfigure.DataJpaRepositoriesAutoConfiguration diff --git a/kernel-bio-converter/src/main/resources/bootstrap.properties b/kernel-bio-converter/src/main/resources/bootstrap.properties index 5d87a83..0f16968 100644 --- a/kernel-bio-converter/src/main/resources/bootstrap.properties +++ b/kernel-bio-converter/src/main/resources/bootstrap.properties @@ -1,6 +1,8 @@ spring.cloud.config.name=converter spring.application.name=converter-service spring.profiles.default=default +spring.cloud.config.enabled=true +spring.config.import=optional:configserver: management.endpoint.health.show-details=always management.endpoints.web.exposure.include=info,health,refresh diff --git a/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/KernelBioConverterApplicationTest.java b/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/KernelBioConverterApplicationTest.java index a52e910..226c79f 100644 --- a/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/KernelBioConverterApplicationTest.java +++ b/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/KernelBioConverterApplicationTest.java @@ -3,16 +3,11 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - @SpringBootTest(classes = KernelBioConverterApplication.class) class KernelBioConverterApplicationTest { - /** - * Test if the Spring Boot application context loads without any exceptions. - */ - @Test - void contextLoads() { - assertDoesNotThrow(() -> KernelBioConverterApplication.main(new String[] {})); - } -} \ No newline at end of file + @Test + void contextLoads() { + // SpringBootTest loads the context; failure would fail this test. + } +} diff --git a/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/TestBootApplication.java b/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/TestBootApplication.java index 62c3b4f..2507019 100644 --- a/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/TestBootApplication.java +++ b/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/TestBootApplication.java @@ -1,52 +1,71 @@ package io.mosip.kernel.bio.converter; import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; import org.springframework.context.annotation.Import; import org.springframework.scheduling.annotation.EnableAsync; -import io.mosip.kernel.bio.converter.config.TestSecurityConfig; +import io.mosip.kernel.bio.testsupport.TestSecurityConfig; /** * Main Spring Boot application class for testing purposes. - * + * *

- * This class initializes a Spring Boot application with specific - * configurations: + * Mirrors production {@link KernelBioConverterApplication} exclusions so tests + * do not require a JDBC DataSource (kernel-core pulls JPA onto the classpath). *

- *
    - *
  • It scans packages defined by "${mosip.auth.adapter.impl.basepackage}" and - * "io.mosip.kernel.bio.*".
  • - *
  • Excludes DataSourceAutoConfiguration to avoid automatic datasource - * configuration.
  • - *
  • Enables asynchronous execution of methods annotated with @Async.
  • - *
  • Imports additional security configuration from - * {@link TestSecurityConfig}.
  • - *
- * + * * @author Janardhan B S * @since 1.0.0 */ -@SpringBootApplication(scanBasePackages = { - "${mosip.auth.adapter.impl.basepackage}, io.mosip.kernel.bio.*" }, exclude = { - DataSourceAutoConfiguration.class }) +@SpringBootApplication +@EnableAutoConfiguration(excludeName = { + "org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration", + "org.springframework.boot.jdbc.autoconfigure.DataSourceInitializationAutoConfiguration", + "org.springframework.boot.hibernate.autoconfigure.HibernateJpaAutoConfiguration", + "org.springframework.boot.data.jpa.autoconfigure.DataJpaRepositoriesAutoConfiguration", + "io.mosip.kernel.idgenerator.vid.impl.VidGeneratorImpl", + "io.mosip.kernel.idgenerator.vid.util.VidFilterUtils", + "io.mosip.kernel.idgenerator.tokenid.impl.TokenIdGeneratorImpl", + "io.mosip.kernel.idgenerator.machineid.impl.MachineIdGeneratorImpl", + "io.mosip.kernel.idgenerator.regcenterid.impl.RegistrationCenterIdGeneratorImpl", + "io.mosip.kernel.idgenerator.mispid.impl.MispIdGeneratorImpl", + "io.mosip.kernel.licensekeygenerator.misp.impl.MISPLicenseKeyGeneratorImpl", + "io.mosip.kernel.licensekeygenerator.misp.util.MISPLicenseKeyGeneratorUtil", + "io.mosip.kernel.idgenerator.rid.impl.RidGeneratorImpl", + "io.mosip.kernel.idvalidator.prid.impl.PridValidatorImpl", + "io.mosip.kernel.idvalidator.rid.impl.RidValidatorImpl", + "io.mosip.kernel.idvalidator.uin.impl.UinValidatorImpl", + "io.mosip.kernel.idvalidator.vid.impl.VidValidatorImpl", + "io.mosip.kernel.idvalidator.mispid.impl.MispIdValidatorImpl", + "io.mosip.kernel.templatemanager.velocity.builder.TemplateManagerBuilderImpl", + "io.mosip.kernel.pdfgenerator.impl.PDFGeneratorImpl", + "io.mosip.kernel.qrcode.generator.zxing.QrcodeGeneratorImpl", + "io.mosip.kernel.transliteration.icu4j.impl.TransliterationImpl", + "io.mosip.kernel.applicanttype.api.impl.ApplicantTypeImpl", + "io.mosip.kernel.idobjectvalidator.config.IdObjectValidatorConfig", + "io.mosip.kernel.websub.api.config.IntentVerificationConfig", + "io.mosip.kernel.websub.api.config.WebSubClientConfig", + "io.mosip.kernel.websub.api.config.publisher.WebSubPublisherClientConfig", + "io.mosip.kernel.websub.api.config.publisher.RestTemplateHelper" +}) @EnableAsync -@Import(io.mosip.kernel.bio.converter.config.TestSecurityConfig.class) +@Import(TestSecurityConfig.class) @ComponentScan( - basePackages = "io.mosip.kernel", - excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {io.mosip.kernel.auth.defaultadapter.config.SecurityConfig.class}) - ) + basePackages = { "${mosip.auth.adapter.impl.basepackage}", "io.mosip.kernel.bio.converter" }, + excludeFilters = @ComponentScan.Filter(type = FilterType.REGEX, + pattern = "io\\.mosip\\.kernel\\.auth\\.defaultadapter\\.config\\.SecurityConfig")) public class TestBootApplication { /** - * Main method to start the Spring Boot application. - * - * @param args command line arguments passed to the application. + * Boots the test application context. + * + * @param args command-line arguments (unused) */ public static void main(String[] args) { SpringApplication.run(TestBootApplication.class, args); } -} \ No newline at end of file +} diff --git a/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/controller/ConvertControllerTest.java b/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/controller/ConvertControllerTest.java index 9e92397..840d5da 100644 --- a/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/controller/ConvertControllerTest.java +++ b/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/controller/ConvertControllerTest.java @@ -16,7 +16,7 @@ import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.security.test.context.support.WithMockUser; @@ -90,7 +90,7 @@ public void t001ConvertTest() throws Exception { .checkResponse( mockMvc.perform(post("/convert").contentType(MediaType.APPLICATION_JSON) .content(mapper.writeValueAsString(convertRequestDto))).andReturn(), - 500, null, "MOS-CNV-500"); + 500, null, "MOS-CNV-001"); } /** @@ -111,7 +111,7 @@ public void t002ConvertTest() throws Exception { .checkResponse( mockMvc.perform(post("/convert").contentType(MediaType.APPLICATION_JSON) .content(mapper.writeValueAsString(convertRequestDto))).andReturn(), - 500, null, "MOS-CNV-500"); + 500, null, "MOS-CNV-002"); } /** diff --git a/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/config/TestSecurityConfig.java b/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/testsupport/TestSecurityConfig.java similarity index 58% rename from kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/config/TestSecurityConfig.java rename to kernel-bio-converter/src/test/java/io/mosip/kernel/bio/testsupport/TestSecurityConfig.java index 6ac2ac8..1d7ecc5 100644 --- a/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/config/TestSecurityConfig.java +++ b/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/testsupport/TestSecurityConfig.java @@ -1,4 +1,4 @@ -package io.mosip.kernel.bio.converter.config; +package io.mosip.kernel.bio.testsupport; import java.util.ArrayList; import java.util.Arrays; @@ -7,8 +7,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer; @@ -30,30 +28,9 @@ import com.fasterxml.jackson.module.afterburner.AfterburnerModule; /** - * Configuration class for setting up security, CORS, and MVC configurations. - * - *

- * This class provides various beans and configurations for: - *

- *
    - *
  • HttpFirewall customization to prevent security threats.
  • - *
  • Web security customization for allowing certain endpoints.
  • - *
  • CORS configuration allowing all origins, methods, and headers.
  • - *
  • AuthenticationManager setup for authentication handling.
  • - *
  • In-memory user details service for authentication purposes.
  • - *
  • AfterburnerModule setup for optimizing JSON serialization.
  • - *
  • Password encoder for encoding user passwords securely.
  • - *
- * - *

- * It also includes specific configurations for Spring Security, CORS, and - * method security. - *

- * - * @author Janardhan B S - * @since 1.0.0 + * Test-only security wiring. Lives outside {@code io.mosip.kernel.bio.converter} + * so production {@code @ComponentScan} does not pick it up. */ - @Configuration @EnableWebSecurity @EnableWebMvc @@ -61,50 +38,27 @@ @Order(2) public class TestSecurityConfig { - /** - * Customizes the HttpFirewall to use DefaultHttpFirewall. - * - * @return DefaultHttpFirewall instance - */ @Bean public HttpFirewall defaultHttpFirewall() { return new DefaultHttpFirewall(); } - /** - * Customizes web security to ignore specific endpoints and use default - * HttpFirewall. - * - * @return WebSecurityCustomizer instance - */ @Bean public WebSecurityCustomizer webSecurityCustomizer() { return web -> web.ignoring().requestMatchers(allowedEndPoints()).and().httpFirewall(defaultHttpFirewall()); } - /** - * Defines allowed endpoints for HTTP requests. - * - * @return Array of allowed endpoint patterns - */ + /** PathPattern-safe patterns (Boot 4 — no multiple {@code **} in one path). */ private String[] allowedEndPoints() { - return new String[] { "/assets/**", "/icons/**", "/screenshots/**", "/favicon**", "/**/favicon**", "/css/**", - "/js/**", "/*/error**", "/*/webjars/**", "/*/v2/api-docs", "/*/configuration/ui", - "/*/configuration/security", "/*/swagger-resources/**", "/*/swagger-ui.html", "/**/authenticate/**" }; + return new String[] { "/assets/**", "/icons/**", "/screenshots/**", "/favicon.ico", "/css/**", "/js/**", + "/error", "/error/**", "/webjars/**", "/v2/api-docs", "/v3/api-docs", "/v3/api-docs/**", + "/swagger-resources/**", "/swagger-ui/**", "/swagger-ui.html", "/authenticate/**" }; } - /** - * Configures CORS support for all origins, methods, and headers. - * - * @return CorsConfigurationSource instance - */ @Bean public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); configuration.setAllowedOrigins(Arrays.asList("*")); - /* - * or simply "*" - */ configuration.setAllowedMethods(Arrays.asList("*", "POST", "PUT", "GET", "OPTIONS", "DELETE", "PATCH")); configuration.setAllowedHeaders(Arrays.asList("*")); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); @@ -112,24 +66,6 @@ public CorsConfigurationSource corsConfigurationSource() { return source; } - /** - * Configures the AuthenticationManager bean. - * - * @param authenticationConfiguration AuthenticationConfiguration instance - * @return AuthenticationManager instance - * @throws Exception if an error occurs while retrieving AuthenticationManager - */ - /* - * @Bean public AuthenticationManager - * authenticationManager(AuthenticationConfiguration - * authenticationConfiguration) throws Exception { return - * authenticationConfiguration.getAuthenticationManager(); } - */ - /** - * Configures an in-memory user details service with predefined users and roles. - * - * @return InMemoryUserDetailsManager instance - */ @Bean public InMemoryUserDetailsManager userDetailsService() { List users = new ArrayList<>(); @@ -146,21 +82,11 @@ public InMemoryUserDetailsManager userDetailsService() { return new InMemoryUserDetailsManager(users); } - /** - * Configures the AfterburnerModule for optimizing JSON serialization. - * - * @return AfterburnerModule instance - */ @Bean public AfterburnerModule afterburnerModule() { return new AfterburnerModule(); } - /** - * Configures CORS globally for all controllers and methods. - * - * @return WebMvcConfigurer instance - */ @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurer() { @@ -171,13 +97,8 @@ public void addCorsMappings(CorsRegistry registry) { }; } - /** - * Configures the password encoder for encoding user passwords securely. - * - * @return BCryptPasswordEncoder instance - */ @Bean public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } -} \ No newline at end of file +} diff --git a/kernel-bio-converter/src/test/resources/application-test.properties b/kernel-bio-converter/src/test/resources/application-test.properties index ad90292..9d02f09 100644 --- a/kernel-bio-converter/src/test/resources/application-test.properties +++ b/kernel-bio-converter/src/test/resources/application-test.properties @@ -2,4 +2,13 @@ mosip.auth.adapter.impl.basepackage=io.mosip.kernel.auth.defaultadapter mosip.kernel.auth.appids.realm.map={prereg:'preregistration',ida:'mosip',registrationclient:'mosip',regproc:'mosip',partner:'mosip',resident:'mosip'} auth.server.admin.issuer.uri=https://dev2.mosip.net/keycloak/auth/realms/ -auth.server.admin.allowed.audience=mosip-regproc-client,mosip-partner-client,mosip-crereq-client,mosip-creser-client \ No newline at end of file +auth.server.admin.allowed.audience=mosip-regproc-client,mosip-partner-client,mosip-crereq-client,mosip-creser-client + +spring.cloud.config.enabled=false +spring.config.import=optional:configserver: +spring.mvc.pathmatch.matching-strategy=ant_path_matcher +spring.autoconfigure.exclude=\ +org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration,\ +org.springframework.boot.jdbc.autoconfigure.DataSourceInitializationAutoConfiguration,\ +org.springframework.boot.hibernate.autoconfigure.HibernateJpaAutoConfiguration,\ +org.springframework.boot.data.jpa.autoconfigure.DataJpaRepositoriesAutoConfiguration diff --git a/kernel-bio-converter/src/test/resources/bootstrap.properties b/kernel-bio-converter/src/test/resources/bootstrap.properties index 6bf9274..73dbc59 100644 --- a/kernel-bio-converter/src/test/resources/bootstrap.properties +++ b/kernel-bio-converter/src/test/resources/bootstrap.properties @@ -2,6 +2,8 @@ spring.cloud.config.name=converter spring.application.name=converter-service #spring.profiles.default=default spring.profiles.active=test +spring.cloud.config.enabled=false +spring.config.import=optional:configserver: management.endpoint.health.show-details=always management.endpoints.web.exposure.include=info,health,refresh From 050ce130f41b3c53746c934fa5aa2e68d0e11858 Mon Sep 17 00:00:00 2001 From: JanardhanBS-SyncByte Date: Thu, 24 Sep 2026 11:17:04 +0530 Subject: [PATCH 02/10] issue-1633 spring boot changes Signed-off-by: JanardhanBS-SyncByte --- kernel-bio-converter/pom.xml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/kernel-bio-converter/pom.xml b/kernel-bio-converter/pom.xml index 51f053a..6c7fb15 100644 --- a/kernel-bio-converter/pom.xml +++ b/kernel-bio-converter/pom.xml @@ -66,10 +66,10 @@ 0.8.15 5.8.0.7211 3.12.0 - 3.1.4 + 3.2.0 3.4.0 3.2.8 - 4.9.10 + 9.0.2 0.11.0 @@ -83,15 +83,16 @@ 1.4.1-SNAPSHOT 1.4.1-SNAPSHOT - + 4.2 1.4.0 2.1.2 - 2.21 - 2.21.4 - 2.21.4 + 2.22.3 + 2.22 + 2.22.3 + 2.22.3 0.95
From 6529081c79aac4ebb05ab09614a23bc073f430d5 Mon Sep 17 00:00:00 2001 From: JanardhanBS-SyncByte Date: Thu, 24 Sep 2026 11:21:18 +0530 Subject: [PATCH 03/10] issue-1633 spring boot changes Signed-off-by: JanardhanBS-SyncByte --- kernel-bio-converter/AGENTS.md | 46 +++++++++++++--------------------- kernel-bio-converter/pom.xml | 29 ++++++++++++++------- 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/kernel-bio-converter/AGENTS.md b/kernel-bio-converter/AGENTS.md index 5f17a6d..b27ccdd 100644 --- a/kernel-bio-converter/AGENTS.md +++ b/kernel-bio-converter/AGENTS.md @@ -1,36 +1,24 @@ -# Maven module (`kernel-bio-converter/`) +# kernel-bio-converter/ -JDK 21, Spring Boot **4.1.1**, Spring Cloud **2025.1.3**. Single module: fat JAR (service) + `-lib` classifier (embeddable). Versions pinned in this `pom.xml` — **no kernel-bom**. +``` +src/main/java/.../bio/converter/ +├── KernelBioConverterApplication # exclude DS/JPA + adapter SecurityConfig +├── controller/ConvertController # POST /convert +├── service/IConverterApi → impl/ConverterServiceImpl +├── dto/ · constant/ · exception/ · config/ +└── resources/ bootstrap + application (no DB) -| Artifact | Role | -|----------|------| -| fat JAR | Runnable service (`spring-boot` repackage, ZIP layout) | -| `-lib` | `constant/`, `dto/`, `exception/`, `service/**` only | +artifacts/ +├── *.jar # fat Boot ZIP +└── *-lib.jar # constant|dto|exception|service/** -**Build:** `mvn clean install "-Dgpg.skip=true"` · tests: `mvn test "-Dgpg.skip=true"` · one class: `mvn test -Dtest=ConverterServiceImplTest "-Dgpg.skip=true"` +run-local.bat|sh → init|start|smoke|stop|test|all|docker # :8079 /v1/converter-service +``` -Prereqs (install locally for SNAPSHOTs): `commons/kernel` → `kernel-core` / `kernel-auth-adapter` **1.4.1-SNAPSHOT**; `bio-utils` → `biometrics-util` **1.4.1-SNAPSHOT**. +**Pins:** Boot**4.1.1** · Cloud**2025.1.3** · springdoc**3.1.1** · `jackson2.bom`**2.22.3** · MOSIP**1.4.1-SNAPSHOT** (`kernel-core`·`auth-adapter`·`biometrics-util`) -Pipeline: `ConvertController` → `IConverterApi` → `ConverterServiceImpl` → `FingerDecoder` / `FaceDecoder` / `IrisDecoder` (`biometrics-util`). +**Flow:** Controller → ServiceImpl → Finger/Face/IrisDecoder (`biometrics-util`) · errors `MOS-CNV-001…012|500` -| Source | Target | -|--------|--------| -| `ISO19794_4_2011` finger | `IMAGE/JPEG`, `IMAGE/PNG`, `ISO19794_4_2011/{JPEG,PNG}` | -| `ISO19794_5_2011` face | `IMAGE/JPEG`, `IMAGE/PNG`, `ISO19794_5_2011/{JPEG,PNG}` | -| `ISO19794_6_2011` iris | `IMAGE/PNG`, `ISO19794_6_2011/PNG` (JPEG variant disabled) | - -Errors: `ConversionException` → `MOS-CNV-001`…`012`, `MOS-CNV-500`. Swagger: `/v1/converter-service/swagger-ui/index.html`. - -## Rules - -- Pin MOSIP deps to **1.4.1-SNAPSHOT**. Do not import `kernel-bom`. -- Jackson versions live in `` (`jackson-annotations.version`, `jackson-core.version`, `jackson-databind.version` = **2.21.4**). -- Use `spring-boot-jackson2` (Jackson 2) — not Boot 4’s Jackson 3 default. -- Local run: `run-local.bat` / `run-local.sh` (`init` · `start` · `smoke` · `stop` · `test` · `all` · `docker`; env: `PORT`, `SPRING_PROFILES_ACTIVE`, `SPRING_CLOUD_CONFIG_*`, `loader_path_env`). -- Surefire keeps `--add-opens*` / `--enable-preview` — do not remove. -- JaCoCo excludes `constant/`, `config/`, `dto/`, `exception/`, `*Application`; gate ≥95% instruction/line. -- Auth: exclude adapter `SecurityConfig` via `@ComponentScan` REGEX filter; local `SecurityConfig` permits all. -- `-lib` consumers depend with `lib` — never put the fat JAR on a library classpath. -- Do not scan broad `io.mosip.kernel` / `io.mosip.*` — only `io.mosip.kernel.bio.converter` + auth-adapter basepackage. -- Keep JavaDoc on public classes, fields, and methods when adding or changing APIs. +**Rules:** no `kernel-bom` · `spring-boot-jackson2` · scan only `bio.converter`+adapter pkg · local `SecurityConfig` permitAll · `-lib`=`lib` · Surefire `--add-opens*`/`--enable-preview` · JaCoCo≥95% (excl constant/config/dto/exception/*Application) · JavaDoc on public API +**Build:** `mvn clean install "-Dgpg.skip=true"` diff --git a/kernel-bio-converter/pom.xml b/kernel-bio-converter/pom.xml index 6c7fb15..d44d147 100644 --- a/kernel-bio-converter/pom.xml +++ b/kernel-bio-converter/pom.xml @@ -77,24 +77,26 @@ **/dto/**,**/constant/**,**/config/**,**/httpfilter/**,**/cache/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/request/**,**/spi/**,**/proxy/**,**/KernelBioConverterApplication.java **/dto/**,**/entity/**,**/config/** - - - 1.4.1-SNAPSHOT - 1.4.1-SNAPSHOT - 1.4.1-SNAPSHOT - + 4.2 1.4.0 2.1.2 + - 2.22.3 + 2.22.3 2.22 2.22.3 2.22.3 0.95 + + + + 1.4.1-SNAPSHOT + 1.4.1-SNAPSHOT + 1.4.1-SNAPSHOT @@ -108,6 +110,15 @@ import + + + com.fasterxml.jackson + jackson-bom + ${jackson2.bom.version} + pom + import + + io.mosip.kernel @@ -426,8 +437,8 @@ - pl.project13.maven - git-commit-id-plugin + io.github.git-commit-id + git-commit-id-maven-plugin ${git.commit.id.plugin.version} From b5c1c3ce8986e68d4d2a941539ff21972ee6e405 Mon Sep 17 00:00:00 2001 From: JanardhanBS-SyncByte Date: Thu, 24 Sep 2026 11:25:13 +0530 Subject: [PATCH 04/10] issue-1633 spring boot changes Signed-off-by: JanardhanBS-SyncByte --- kernel-bio-converter/Dockerfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/kernel-bio-converter/Dockerfile b/kernel-bio-converter/Dockerfile index c41538e..ab7aa70 100644 --- a/kernel-bio-converter/Dockerfile +++ b/kernel-bio-converter/Dockerfile @@ -1,5 +1,6 @@ FROM mosipid/openjdk-21-jre:21.0.4 +# Labels assigned at Docker build time [Mandatory] ARG SOURCE ARG COMMIT_HASH ARG COMMIT_ID @@ -9,22 +10,42 @@ LABEL source=${SOURCE} \ commit_id=${COMMIT_ID} \ build_time=${BUILD_TIME} +# Can be passed during Docker build as build-time environment for github branch to pick up configuration from. ARG spring_config_label=master + +# Can be passed during Docker build as build-time environment for spring profiles active. ARG active_profile=default + +# Can be passed during Docker build as build-time environment for config server URL. ARG spring_config_url + +# Can be passed during Docker build as build-time environment for container user. ARG container_user=mosip + +# Can be passed during Docker build as build-time environment for container user group. ARG container_user_group=mosip + +# Can be passed during Docker build as build-time environment for container user uid. ARG container_user_uid=1001 + +# Can be passed during Docker build as build-time environment for container user gid. ARG container_user_gid=1001 +# Environment variable to pass active profile such as DEV, QA etc at docker runtime. +# Environment variable to pass github branch to pick up configuration from, at docker runtime. +# Environment variable to pass spring configuration url, at docker runtime. +# Working directory for the container user. +# Extra jars path (loader.path) under the user home. ENV active_profile_env=${active_profile} \ spring_config_label_env=${spring_config_label} \ spring_config_url_env=${spring_config_url} \ work_dir=/home/${container_user} \ loader_path_env=/home/${container_user}/additional_jars/ +# Set working directory for the user WORKDIR ${work_dir} +# Install packages and create user RUN apt-get update && \ apt-get install -y --no-install-recommends sudo && \ groupadd -g ${container_user_gid} ${container_user_group} && \ @@ -32,8 +53,11 @@ RUN apt-get update && \ mkdir -p ${work_dir}/additional_jars && \ rm -rf /var/lib/apt/lists/* +# Copy Boot fat JAR (glob may also match -lib / -sources / -javadoc) COPY ./target/kernel-bio-converter-*.jar ${work_dir}/kernel-bio-converter.jar + # Prefer fat JAR only (exclude -lib / -sources / -javadoc if COPY matched multiple) +# Change permissions of files inside working dir RUN set -eux; \ cd ${work_dir}; \ for f in kernel-bio-converter-*.jar; do \ @@ -44,10 +68,13 @@ RUN set -eux; \ done; \ chown -R ${container_user}:${container_user} ${work_dir} +# Select container user for all tasks USER ${container_user_uid}:${container_user_gid} + EXPOSE 8079 # JVM GC / --add-opens flags: use run-local.bat / run-local.sh for local IDE runs. +# Cluster may inject JDK_JAVA_OPTIONS via Helm. Keep this CMD short. # Shell form so ${..._env} expands at container start. CMD java -Dfile.encoding=UTF-8 \ -Dloader.path="${loader_path_env}" \ From 49db7fb9ce551bb6d8621f2568d4605e4a1b7e04 Mon Sep 17 00:00:00 2001 From: JanardhanBS-SyncByte Date: Thu, 24 Sep 2026 11:25:30 +0530 Subject: [PATCH 05/10] issue-1633 spring boot changes Signed-off-by: JanardhanBS-SyncByte --- .github/workflows/push-trigger.yml | 1 + .gitignore | 3 +- AGENTS.md | 147 +----- NOTICE | 202 +++++--- README.md | 517 ++++++++++++++----- deploy/AGENTS.md | 7 + helm/AGENTS.md | 8 + licenses/Apache-2.0.txt | 202 ++++++++ licenses/BSD-3-Clause-No-Nuclear-License.txt | 15 + licenses/EDL-1.0.txt | 30 ++ licenses/EPL-2.0.txt | 277 ++++++++++ licenses/MIT.txt | 19 + licenses/MPL-2.0.txt | 374 ++++++++++++++ 13 files changed, 1446 insertions(+), 356 deletions(-) create mode 100644 deploy/AGENTS.md create mode 100644 helm/AGENTS.md create mode 100644 licenses/Apache-2.0.txt create mode 100644 licenses/BSD-3-Clause-No-Nuclear-License.txt create mode 100644 licenses/EDL-1.0.txt create mode 100644 licenses/EPL-2.0.txt create mode 100644 licenses/MIT.txt create mode 100644 licenses/MPL-2.0.txt diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index edd6261..9cd7489 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -20,6 +20,7 @@ on: - develop* - MOSIP* - release* + - issue* jobs: build-maven-kernel-bio-converter: diff --git a/.gitignore b/.gitignore index 2385bcb..8a27b65 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ */.gitignore */.project */.settings/ -*/target/ \ No newline at end of file +*/target/ +kernel-bio-converter/.local/ diff --git a/AGENTS.md b/AGENTS.md index 6f387e5..a13d4b9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,143 +1,16 @@ -# AGENTS.md +# converters -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. +ISO→JPEG/PNG. **JDK21 · Boot4.1.1 · no kernel-bom.** Load only the nested `AGENTS.md` for the folder you edit. -## Project Overview - -`kernel-bio-converter` is a MOSIP (Modular Open Source Identity Platform) Spring Boot service that converts ISO biometric data (fingerprint, face, iris) into standard image formats (JPEG/PNG). It ships as both a runnable JAR and a `-lib` classifier JAR for embedding in other MOSIP services. - -## Build & Test Commands - -All commands run from `kernel-bio-converter/` unless otherwise noted. - -**Build (skip tests and GPG signing):** -```bash -mvn install -DskipTests=true -Dgpg.skip=true -``` - -**Run all tests:** -```bash -mvn test -Dgpg.skip=true -``` - -**Run a single test class:** -```bash -mvn test -Dtest=ConverterServiceImplTest -Dgpg.skip=true ``` - -The surefire plugin passes the required JVM `--add-opens` flags automatically. The build uses `--enable-preview` (Java 21) both for compilation and test execution — do not remove these flags. - -**Run the JAR:** -```bash -java -Dloader.path=. \ - --add-modules=ALL-SYSTEM \ - --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED \ - --add-opens java.base/java.lang.reflect=ALL-UNNAMED \ - --add-opens java.base/java.time=ALL-UNNAMED \ - --enable-preview \ - -jar target/kernel-bio-converter-*.jar -``` - -**Docker build:** -```bash -docker build -t kernel-bio-converter:latest -f Dockerfile . -``` - -## Architecture - -### Dual-output build - -The Maven build produces two artifacts: -- **Fat JAR** (`spring-boot-maven-plugin` repackage) — runnable service. -- **Lib JAR** (`-lib` classifier, `maven-jar-plugin`) — includes only `constant/`, `dto/`, `exception/`, and `service/**`. This is the dependency consumed by other MOSIP modules. - -### Request / response envelope - -All HTTP interactions use MOSIP's `kernel-core` envelope types: -- Inbound: `RequestWrapper` — wraps the DTO with `id`, `version`, `requesttime`, `request`. -- Outbound: `ResponseWrapper>` — wraps the result map the same way. -- `@ResponseFilter` on `ConvertController.convert()` triggers kernel-core's response-filtering interceptor that populates the envelope metadata. - -### Conversion pipeline - -`ConvertController` → `IConverterApi` → `ConverterServiceImpl`: - -1. Decode source format string → `SourceFormatCode` enum (throws `MOS-CNV-003` if unknown). -2. Decode target format string → `TargetFormatCode` enum (throws `MOS-CNV-002` if unknown). -3. For each entry in the `values` map: - - URL-safe Base64-decode the ISO blob. - - Pass to the matching `convert*IsoToImageType()` method based on source code. - - Inside each method: decode the ISO BDIR via `mosip/biometrics-util` decoders (`FingerDecoder`, `FaceDecoder`, `IrisDecoder`). - - Decompress the embedded image (`JPEG2000` via `ImageIO`, `WSQ` via `jnbis` `WsqDecoder`). - - Re-encode to target format (`CommonUtil.convertBufferedImageToJPEGBytes` / `toPNGBytes`). - - URL-safe Base64-encode the result. -4. Return the map of `{original key → converted Base64 value}`. - -### Supported formats - -| Source (`sourceFormat`) | Description | -|---|---| -| `ISO19794_4_2011` | Finger (JP2000 lossy/lossless or WSQ) | -| `ISO19794_5_2011` | Face (JP2000 lossy/lossless only) | -| `ISO19794_6_2011` | Iris (MONO_JPEG2000 only) | - -| Target (`targetFormat`) | Description | -|---|---| -| `IMAGE/JPEG` | Plain JPEG image | -| `IMAGE/PNG` | Plain PNG image | -| `ISO19794_4_2011/JPEG`, `/PNG` | Finger ISO re-wrapped with JPEG/PNG | -| `ISO19794_5_2011/JPEG`, `/PNG` | Face ISO re-wrapped | -| `ISO19794_6_2011/PNG` | Iris ISO re-wrapped (JPEG variant intentionally disabled) | - -### Security - -`SecurityConfig` disables HTTP Basic auth and CSRF and permits all requests. Authentication is handled upstream by MOSIP's `kernel-auth-adapter` (Keycloak/token-based); the local `SecurityConfig` explicitly excludes the adapter's own `SecurityConfig` via a `@ComponentScan` filter in `KernelBioConverterApplication`. - -### Configuration - -Runtime properties are served from a Spring Cloud Config server (`mosip-config` repository). The `application.properties` in this module only contains auth-adapter bootstrap properties (`mosip.auth.adapter.impl.basepackage`, Keycloak issuer URI, allowed audience). Tests use `application-test.properties` with the same structure pointing to a dev Keycloak endpoint. - -### Error codes - -All business errors are `ConversionException(errorCode, message)` caught by `ConversionExceptionAdvice` and returned as HTTP 500 with a `ResponseWrapper`. Error code range: `MOS-CNV-001` through `MOS-CNV-012`, plus `MOS-CNV-500` for unexpected exceptions. - -### Sonar / coverage exclusions - -The `sonar` Maven profile runs SonarCloud analysis. JaCoCo and Sonar both exclude `constant/`, `config/`, `dto/`, `exception/`, and the main application class from coverage metrics. Keep this in mind when writing new code in those packages. - -## API - -**POST** `http://{host}/v1/converter-service/convert` - -Swagger UI: `http://{host}/v1/converter-service/swagger-ui/index.html` - -Example request body: -```json -{ - "id": "mosip.converter", - "version": "1.0", - "requesttime": "2024-01-01T00:00:00.000Z", - "request": { - "values": { - "Left IndexFinger": "" - }, - "sourceFormat": "ISO19794_4_2011", - "targetFormat": "IMAGE/JPEG", - "sourceParameters": {}, - "targetParameters": {} - } -} +converters/ +├── kernel-bio-converter/ # Java · run-local.* · Dockerfile +├── helm/converters/ # chart +├── deploy/ # install.sh +├── licenses/ · NOTICE · LICENSE +└── README.md # how-to (prefer over expanding this file) ``` -## Library Usage (Maven) - -```xml - - io.mosip.kernel - kernel-bio-converter - ${kernel.bioconverter.version} - lib - -``` +**Build/run:** `cd kernel-bio-converter && mvn clean install "-Dgpg.skip=true"` · `run-local.bat|sh` `init|start|smoke|stop|test|all|docker` -Call `IConverterApi.convert(values, sourceFormat, targetFormat, sourceParameters, targetParameters)` directly. \ No newline at end of file +**Rules:** one folder · Grep/Glob · skip `target/` · pins `1.4.1-SNAPSHOT` · no `kernel-bom`/`kernel-logger-logback` · Jackson2 via `jackson2.bom.version`(**2.22.3**) never Boot `jackson-bom.version` · freeze `POST /v1/converter-service/convert` + `-lib` · JaCoCo≥95% · GC flags only in `run-local.*` not Dockerfile diff --git a/NOTICE b/NOTICE index 7e77987..198c5f2 100644 --- a/NOTICE +++ b/NOTICE @@ -1,76 +1,126 @@ -MOSIP Project – Notices -Copyright © 2022 -Modular Open Source Identity Platform (MOSIP) - -This project contains third-party software components distributed under -various open-source licenses. Attribution and license information for -each included component is provided below. Full license texts are -available in the LICENSES/ directory or from each component’s official -source repository. - ---- - -Third-party attributions: - -• Spring Boot, Spring Security & Spring Cloud - (spring-boot-starter-web, spring-boot-starter-security, - configuration-processor, spring-security-core/web/config/test, - spring-cloud-starter-config, spring-boot-maven-plugin) - Licensed under the Apache License 2.0. - -• SpringDoc OpenAPI - (springdoc-openapi-starter-webmvc-ui) - Licensed under the Apache License 2.0. - -• MOSIP Kernel Libraries - (kernel-bom, kernel-core, kernel-auth-adapter, kernel-logger-logback) - Licensed under the Mozilla Public License 2.0. - -• MOSIP Biometric Utilities - (biometrics-util) - Licensed under the Mozilla Public License 2.0. - -• Jackson XML Dataformat - (jackson-dataformat-xml) - Licensed under the Apache License 2.0. - -• Jakarta Servlet API - Licensed under the Eclipse Public License 2.0. - -• Vert.x Core - (vertx-core) - Licensed under the Apache License 2.0. - -• JAI ImageIO – JPEG 2000 - (jai-imageio-jpeg2000) - Licensed under the BSD 3-Clause No-Nuclear License. - -• Imgscalr - (imgscalr-lib) - Licensed under the Apache License 2.0. - -• Lombok - (org.projectlombok:lombok) - Licensed under the MIT License. - -• JUnit Vintage Engine - Licensed under the Eclipse Public License 2.0. - -• Apache Maven Build Plugins - (maven-compiler-plugin, maven-surefire-plugin, - maven-gpg-plugin, maven-javadoc-plugin, maven-source-plugin) - Licensed under the Apache License 2.0. - -• Central Publishing Maven Plugin - Licensed under the Apache License 2.0. - -• Git Commit ID Maven Plugin - Licensed under the GNU Lesser General Public License 3.0. - ---- - -Additional open-source components may be included and are licensed under -their respective compatible open-source licenses. For complete legal -terms for each dependency, see the LICENSES/ directory or the original -source repository. - +NOTICES + +Copyright (c) MOSIP. +All rights reserved. + +This project is licensed under MPL 2.0 (see LICENSE). Third-party +versions below match kernel-bio-converter/pom.xml (checked against +Maven Central on 2026-09-24). Full license texts: licenses/. + +MOSIP open-source license matrix (compatible with MPL 2.0 / Use with MOSIP): + + License Compatible? Use with MOSIP? Comments + ------------------------------- ------------ ---------------- -------- + BSD (2-Clause, 3-Clause) Yes Yes Combine freely + MIT Yes Yes Combine freely + Apache-2.0 Yes Yes Meet attribution + MPL-2.0 Yes Yes Combine freely + ISC Yes Yes Keep ISC notice + attribution + EPL No No Incompatible with MPL + LGPLv3 Yes No May apply to combined work + GPLv2 No No No explicit MPL compatibility + GPLv3 Yes No Combined work must be GPLv3 + AGPLv3 Yes No Combined work must be AGPLv3 + Creative Commons (software) No No Not designed for software + Python-2.0 Yes Yes Keep both license notices + AFL-2.0 No No Conflicts with MPL 2.0 + AFL-2.1 Yes Yes Keep AFL notice + attribution + ODC-By-1.0 No No Database license + CDDL-1.0 Yes Yes Files retain CDDL; document split + Unicode-DFS-2016 Yes Yes Keep Unicode notice + BlueOak-1.0.0 Yes Yes Keep license text/link + OFL-1.1 Yes Yes Fonts; include OFL text + Zlib Yes Yes Include zlib license text + 0BSD Yes Yes Permissive + EDL-1.0 Yes Yes BSD-like (Jakarta Persistence) + +Dual-licensed jars: MOSIP elects an allowed option (never EPL, GPL, AGPL, or +LGPLv3 as the product license). Where only EPL OR GPL-2.0+CPE is offered +(Jakarta Servlet / Transaction APIs), those are platform/transitive deps — +document here; do not relicense MOSIP code under them. + +Pinned platform (stable; not latest milestone): + Spring Boot parent ........ 4.1.1 + Spring Cloud BOM .......... 2025.1.3 + springdoc-openapi ......... 3.1.1 + JDK ....................... 21 + +=========================== +MPL-2.0 (LICENSE / licenses/MPL-2.0.txt) +=========================== + +- This repository (io.mosip.kernel:kernel-bio-converter 1.4.1-SNAPSHOT) +- io.mosip.kernel:kernel-core 1.4.1-SNAPSHOT +- io.mosip.kernel:kernel-auth-adapter 1.4.1-SNAPSHOT +- io.mosip.biometric.util:biometrics-util 1.4.1-SNAPSHOT + +=========================== +MIT License (licenses/MIT.txt) +=========================== + +- org.projectlombok:lombok (Boot-managed) +- org.slf4j:slf4j-api (Boot-managed / transitive) + +=========================== +Apache-2.0 (licenses/Apache-2.0.txt) +=========================== + +- Spring Boot 4.1.1 / Spring Framework / Spring Security / Spring Cloud 2025.1.3 +- org.springdoc:springdoc-openapi-starter-webmvc-ui 3.1.1 +- com.fasterxml.jackson:jackson-bom 2.22.3 (property `jackson2.bom.version`; not Boot's `jackson-bom.version`) +- com.fasterxml.jackson.core:jackson-annotations 2.22 +- com.fasterxml.jackson.core:jackson-core 2.22.3 +- com.fasterxml.jackson.core:jackson-databind 2.22.3 +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml / yaml (via jackson-bom 2.22.3) +- com.fasterxml.jackson.module:jackson-module-afterburner (via jackson-bom 2.22.3) +- org.springframework.boot:spring-boot-jackson2 (Jackson 2 ObjectMapper bridge) +- com.github.mhshams:jnbis 2.1.2 +- org.imgscalr:imgscalr-lib 4.2 +- ch.qos.logback:logback-classic / logback-core (Boot-managed) +- org.apache.tomcat.embed:* (Boot-managed) +- com.zaxxer:HikariCP (Boot-managed / transitive) +- org.hibernate.orm:hibernate-core 7.x (Apache-2.0 since 7.0; transitive via kernel-core) +- Maven build plugins (compiler 3.16.0, surefire 3.6.0, jar 3.5.1, source 3.4.0, + javadoc 3.12.0, gpg 3.2.8, deploy 3.2.0, jacoco 0.8.15, + git-commit-id-maven-plugin 9.0.2, central-publishing 0.11.0, sonar 5.8.0.7211) + +=========================== +BSD-3-Clause / BSD-3-Clause-No-Nuclear (licenses/BSD-3-Clause-No-Nuclear-License.txt) +=========================== + +- com.github.jai-imageio:jai-imageio-jpeg2000 1.4.0 +- org.hamcrest:hamcrest (test scope) + +=========================== +EDL-1.0 (licenses/EDL-1.0.txt) — elect this side of dual EPL/EDL +=========================== + +- jakarta.persistence:jakarta.persistence-api (Boot / kernel-core transitive) + +=========================== +EPL-2.0 (+ optional GPL-2.0 with Classpath exception) — platform / test only +(licenses/EPL-2.0.txt) +=========================== + +MOSIP matrix: EPL and GPLv2 are not approved product licenses. These jars are +transitive / test-only from Boot and Jakarta EE; MOSIP code remains MPL-2.0. + +- jakarta.servlet:jakarta.servlet-api (EPL-2.0 OR GPL-2.0+CPE) — Boot web +- jakarta.transaction:jakarta.transaction-api (EPL-2.0 OR GPL-2.0+CPE) — transitive +- org.aspectj:aspectjweaver (EPL-2.0) — transitive via kernel-core JPA stack +- org.junit.* (EPL-2.0) — test scope only + +=========================== +Artifacts produced by this module +=========================== + +- kernel-bio-converter-${version}.jar + Fat / runnable Spring Boot service (ZIP layout). Use run-local.bat / + run-local.sh or `java -jar` with config-server env vars. + +- kernel-bio-converter-${version}-lib.jar + Embeddable library classifier: constant/, dto/, exception/, service/** + only. Maven: lib. + +- kernel-bio-converter-${version}-sources.jar / -javadoc.jar + Source and API documentation attachments for Maven Central. diff --git a/README.md b/README.md index 4efc0b8..cd85946 100644 --- a/README.md +++ b/README.md @@ -1,227 +1,460 @@ -# Converters +# MOSIP Converters + [![Maven Package upon a push](https://github.com/mosip/converters/actions/workflows/push-trigger.yml/badge.svg?branch=develop)](https://github.com/mosip/converters/actions/workflows/push-trigger.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_kernel-bio-converter&metric=alert_status&branch=develop)](https://sonarcloud.io/dashboard?id=mosip_kernel-bio-converter&branch=develop) -## Overview -The **Converters** is a MOSIP module that enables the conversion of ISO biometric and document data into standard image formats such as JPEG or PNG. The module exposes API endpoints for configuring and handling conversion operations. +ISO/IEC 19794 biometric payloads (finger, face, iris) → JPEG/PNG (and optional ISO re-wrap). +Ships as a **runnable service** and an embeddable **`-lib`** JAR. -Note: This converters module can be used both as a library and as a service. +| | | +|---|---| +| **JDK** | 21 | +| **Spring Boot** | 4.1.1 (no `kernel-bom`) | +| **Module version** | `1.4.1-SNAPSHOT` | +| **Main class** | `io.mosip.kernel.bio.converter.KernelBioConverterApplication` | +| **HTTP port / context** | `8079` / `/v1/converter-service` | +| **License** | [MPL 2.0](LICENSE) — see [NOTICE](NOTICE) | -## Features +**Quick links (after `start`):** -- Conversion of ISO biometric and document data into standard image formats (JPEG, PNG) -- Exposes API endpoints for conversion operations -- Support for multiple ISO formats (ISO19794_4_2011, ISO19794_5_2011, ISO19794_6_2011) -- Library and Service usage modes +| Purpose | URL | +|---------|-----| +| Health | http://localhost:8079/v1/converter-service/actuator/health | +| Swagger UI | http://localhost:8079/v1/converter-service/swagger-ui/index.html | +| OpenAPI | http://localhost:8079/v1/converter-service/v3/api-docs | +| Convert API | `POST` http://localhost:8079/v1/converter-service/convert | -## Services +--- -The Converters module contains the following: +## Artifacts -1. **[Converter Service](kernel-bio-converter)** (`kernel-bio-converter`) - Service for biometric data conversion. +| Artifact | Classifier | Role | +|----------|------------|------| +| `kernel-bio-converter-${version}.jar` | (none / fat) | Runnable Spring Boot service | +| `kernel-bio-converter-${version}-lib.jar` | `lib` | Embeddable API: `constant/`, `dto/`, `exception/`, `service/**` | +| `…-sources.jar` / `…-javadoc.jar` | — | Sources & JavaDoc for Central | -## Database -NA (Not applicable) +--- -## Local Setup +## Prerequisites -The project can be set up in two ways: +- **JDK 21**, **Maven 3.9+** +- **Docker** (optional — for `run-local … docker`) +- Local SNAPSHOTs (or your snapshot repo): + - `commons/kernel` → `kernel-core`, `kernel-auth-adapter` **1.4.1-SNAPSHOT** + - `bio-utils` → `biometrics-util` **1.4.1-SNAPSHOT** +- Config: [mosip-config](https://github.com/mosip/mosip-config) (optional for local demos) -1. [Local Setup (for Development or Contribution)](#local-setup-for-development-or-contribution) -2. [Local Setup with Docker (Easy Setup for Demos)](#local-setup-with-docker-easy-setup-for-demos) +--- -### Prerequisites +## Build -Before you begin, ensure you have the following installed: +```bash +cd kernel-bio-converter +mvn clean install "-Dgpg.skip=true" +``` -- **JDK**: Version 21.0.5 -- **Maven**: Version 3.9.6 +| Goal | Command | +|------|---------| +| Skip tests | `mvn clean install "-DskipTests=true" "-Dgpg.skip=true"` | +| One test class | `mvn test "-Dtest=ConverterServiceImplTest" "-Dgpg.skip=true"` | +| Coverage | `target/site/jacoco/index.html` (JaCoCo gate **≥ 95%**) | -### Runtime Dependencies +--- -Ensure the following artifacts are available in the classpath or loader path: +# Local setup -- `kernel-bio-converter.jar` +Same helper style as [`commons/kernel/kernel-auth-service`](https://github.com/mosip/commons/tree/master/kernel/kernel-auth-service): +`kernel-bio-converter/run-local.bat` (Windows cmd) and `run-local.sh` (Linux / macOS / WSL / Git Bash). -### Configuration +Working directory must be **`kernel-bio-converter/`**. Logs and PID: `.local/`. -- Converters uses configuration files from the **[mosip-config repository](https://github.com/mosip/mosip-config/tree/master)**. -- Key configuration files: - - [application-default.properties](https://github.com/mosip/mosip-config/blob/master/application-default.properties) +## Helper commands -## Installation +| Command | What it does | +|---------|----------------| +| `init` | Maven package this module (skip tests) | +| `start` | Start on port **8079**, wait until Spring Boot is ready, print Swagger/health URLs | +| `smoke` | `GET …/actuator/health` and Swagger UI | +| `stop` | Stop the process (frees the Boot ZIP for `mvn clean`) | +| `test` | Maven unit tests | +| `all` | `init` + `test` + `start` + `smoke` | +| `docker` | `init`, docker build, run | +| _(no args)_ / `help` | Usage + endpoint URLs | -### Local Setup (for Development or Contribution) +`start` uses Generational ZGC and MOSIP `--add-opens` / `--enable-preview` (see scripts). Do **not** put those long JVM flags back into the `Dockerfile`. -1. Clone the repository: +## Environment variables -```text -git clone https://github.com/mosip/converters.git -cd converters -``` +| Variable | Default | Meaning | +|----------|---------|---------| +| `PORT` | `8079` | HTTP port | +| `SPRING_PROFILES_ACTIVE` | `default` | Spring profile | +| `SPRING_CLOUD_CONFIG_URI` | _(empty)_ | Config-server URI | +| `SPRING_CLOUD_CONFIG_LABEL` | _(empty)_ | Config-server label / branch | +| `loader_path_env` | `.` | Extra JARs (`-Dloader.path`) | +| `IMAGE` | `kernel-bio-converter` | Docker image name | +| `JDK_JAVA_OPTIONS` | _(empty)_ | Extra JVM options for `docker` runs | + +--- -2. Build and install: - Navigate to the project directory: +## Windows (cmd) -```text +```bat cd kernel-bio-converter +run-local.bat init +run-local.bat start +run-local.bat smoke ``` -3. Build the project: +Override port / config server: -```text -mvn install -DskipTests=true -Dgpg.skip=true +```bat +set PORT=8079 +set SPRING_PROFILES_ACTIVE=default +set SPRING_CLOUD_CONFIG_URI=http://localhost:51000 +set SPRING_CLOUD_CONFIG_LABEL=master +set loader_path_env=. +run-local.bat start ``` -4. Run the jar locally to use the module as a service: +Stop / one-shot / Docker: -```text -java -Dloader.path=. \ ---add-modules=ALL-SYSTEM \ ---add-opens java.xml/jdk.xml.internal=ALL-UNNAMED \ ---add-opens java.base/java.lang.reflect=ALL-UNNAMED \ ---add-opens java.base/java.lang.stream=ALL-UNNAMED \ ---add-opens java.base/java.time=ALL-UNNAMED \ ---add-opens java.base/java.time.LocalDate=ALL-UNNAMED \ ---add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED \ ---add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED \ ---add-opens java.base/jdk.internal.reflect.DirectMethodHandleAccessor=ALL-UNNAMED \ --jar target/kernel-bio-converter-*.jar +```bat +run-local.bat stop +run-local.bat all +set SPRING_CLOUD_CONFIG_URI=http://host.docker.internal:51000 +run-local.bat docker ``` -5. Verify Swagger is accessible at: `http://localhost:8098/v1/converter-service/swagger-ui/index.html` +### Windows PowerShell -6. To use the jar as library configure the module as below: +```powershell +cd kernel-bio-converter +.\run-local.bat init +.\run-local.bat start +.\run-local.bat smoke +``` -```xml - - io.mosip.kernel - kernel-bio-converter - ${kernel.bioconverter.version} - lib - +```powershell +$env:PORT = "8079" +$env:SPRING_PROFILES_ACTIVE = "default" +$env:SPRING_CLOUD_CONFIG_URI = "http://localhost:51000" +$env:SPRING_CLOUD_CONFIG_LABEL = "master" +.\run-local.bat start ``` -### Local Setup with Docker (Easy Setup for Demos) +--- -1. Navigate to the service folder: +## Linux / macOS / WSL -```text +```bash cd kernel-bio-converter +chmod +x run-local.sh +./run-local.sh init +./run-local.sh start +./run-local.sh smoke ``` -2. Build the Docker image: +Override port / config server: -```text -docker build -t kernel-bio-converter:latest -f Dockerfile . +```bash +export PORT=8079 +export SPRING_PROFILES_ACTIVE=default +export SPRING_CLOUD_CONFIG_URI=http://localhost:51000 +export SPRING_CLOUD_CONFIG_LABEL=master +export loader_path_env=. +./run-local.sh start +``` + +Or one line: + +```bash +PORT=8079 SPRING_CLOUD_CONFIG_URI=http://localhost:51000 ./run-local.sh start ``` -#### Verify Installation +Stop / one-shot / Docker: + +```bash +./run-local.sh stop +./run-local.sh all +SPRING_CLOUD_CONFIG_URI=http://host.docker.internal:51000 ./run-local.sh docker +``` + +--- + +## Windows Git Bash / MSYS -Check that the container is running: +Use the shell script (not `.bat`): -```text -docker ps +```bash +cd kernel-bio-converter +chmod +x run-local.sh +./run-local.sh init +./run-local.sh start +./run-local.sh smoke +./run-local.sh stop +``` + +--- + +## Manual `java -jar` (any OS) + +Package first (`run-local … init` or `mvn package "-Dgpg.skip=true"`), then: + +**Linux / macOS / WSL / Git Bash:** + +```bash +java \ + -XX:-UseG1GC -XX:-UseParallelGC -XX:-UseShenandoahGC \ + -XX:+ExplicitGCInvokesConcurrent -XX:+UseZGC -XX:+ZGenerational \ + -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication \ + -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCompressedOops \ + -XX:MaxGCPauseMillis=200 \ + -Dfile.encoding=UTF-8 \ + -Dloader.path=. \ + -Dspring.profiles.active=default \ + -Dserver.port=8079 \ + -Dspring.cloud.config.uri=http://localhost:51000 \ + -Dspring.cloud.config.label=master \ + --add-modules=ALL-SYSTEM \ + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED \ + --add-opens java.base/java.lang.reflect=ALL-UNNAMED \ + --add-opens java.base/java.lang.stream=ALL-UNNAMED \ + --add-opens java.base/java.time=ALL-UNNAMED \ + --add-opens java.base/java.time.LocalDate=ALL-UNNAMED \ + --add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED \ + --add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED \ + --add-opens java.base/jdk.internal.reflect.DirectMethodHandleAccessor=ALL-UNNAMED \ + --enable-preview \ + -jar target/kernel-bio-converter-1.4.1-SNAPSHOT.jar +``` + +**Windows cmd:** + +```bat +java ^ + -XX:-UseG1GC -XX:-UseParallelGC -XX:-UseShenandoahGC ^ + -XX:+ExplicitGCInvokesConcurrent -XX:+UseZGC -XX:+ZGenerational ^ + -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication ^ + -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCompressedOops ^ + -XX:MaxGCPauseMillis=200 ^ + -Dfile.encoding=UTF-8 ^ + -Dloader.path=. ^ + -Dspring.profiles.active=default ^ + -Dserver.port=8079 ^ + -Dspring.cloud.config.uri=http://localhost:51000 ^ + -Dspring.cloud.config.label=master ^ + --add-modules=ALL-SYSTEM ^ + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED ^ + --add-opens java.base/java.lang.reflect=ALL-UNNAMED ^ + --add-opens java.base/java.lang.stream=ALL-UNNAMED ^ + --add-opens java.base/java.time=ALL-UNNAMED ^ + --add-opens java.base/java.time.LocalDate=ALL-UNNAMED ^ + --add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED ^ + --add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED ^ + --add-opens java.base/jdk.internal.reflect.DirectMethodHandleAccessor=ALL-UNNAMED ^ + --enable-preview ^ + -jar target\kernel-bio-converter-1.4.1-SNAPSHOT.jar ``` -## Deployment +Prefer `run-local` — it picks the fat JAR (skips `-lib` / sources / javadoc) and waits for readiness. -### Kubernetes +--- -To deploy Admin on Kubernetes cluster using Dockers refer to [Sandbox Deployment](https://docs.mosip.io/1.2.0/deploymentnew/v3-installation). +## IDE samples -## Documentation +Open the **`converters`** (or `kernel-bio-converter`) project. Working directory: **`kernel-bio-converter`**. +Main class: **`io.mosip.kernel.bio.converter.KernelBioConverterApplication`**. -### API Documentation +Recommended: run the helper from the IDE terminal / External Tools: -API endpoints and Swagger documentation are available at: `http://{host}/v1/converter-service/swagger-ui/index.html` +| OS | IDE terminal / External tool | +|----|------------------------------| +| Windows | `run-local.bat init` then `run-local.bat start` | +| Linux / macOS | `./run-local.sh init` then `./run-local.sh start` | -### Usage +### IntelliJ IDEA -**Url**: `http://{host}/v1/converter-service/convert` +1. **File → Open** → `converters` (or `kernel-bio-converter`). +2. Set Project SDK to **JDK 21**. +3. **Option A — scripts:** Terminal tab → `cd kernel-bio-converter` → `run-local.bat start` / `./run-local.sh start`. +4. **Option B — Application:** Run → Edit Configurations → **Application** + - Main class: `io.mosip.kernel.bio.converter.KernelBioConverterApplication` + - Working directory: `$MODULE_DIR$` or absolute `…/kernel-bio-converter` + - VM options: copy the `-XX:…` / `-D…` / `--add-opens…` / `--enable-preview` block from [Manual `java -jar`](#manual-java--jar-any-os) (without `-jar …`) + - Environment (optional): `SPRING_PROFILES_ACTIVE=default;PORT=8079;SPRING_CLOUD_CONFIG_URI=http://localhost:51000` -**Method**: POST +### Eclipse -**Request Structure**: +1. Import as **Existing Maven Project** → `kernel-bio-converter`. +2. Right-click `KernelBioConverterApplication` → **Run As → Java Application**. +3. **Run Configurations → Arguments → VM arguments:** paste the same VM flags as manual `java` (no `-jar`). +4. **Environment** tab: add `SPRING_PROFILES_ACTIVE`, `SPRING_CLOUD_CONFIG_URI` as needed. +5. Or use **External Tools** → Program: `run-local.bat` / `run-local.sh`, Working Directory: module folder, Arguments: `start`. + +### VS Code / Cursor + +`.vscode/launch.json` example: ```json { - "id": "sample-converter", - "version": "1.0", - "requesttime": "2022-02-22T16:46:09.499Z", - "request": { - "values": { - "Left Thumb": "", - "Right Iris": "" - }, - "sourceFormat": "string", - "targetFormat": "string", - "sourceParameters": { - "key": "value" - }, - "targetParameters": { - "key": "value" + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "KernelBioConverterApplication", + "request": "launch", + "mainClass": "io.mosip.kernel.bio.converter.KernelBioConverterApplication", + "projectName": "kernel-bio-converter", + "cwd": "${workspaceFolder}/kernel-bio-converter", + "vmArgs": "-XX:-UseG1GC -XX:-UseParallelGC -XX:-UseShenandoahGC -XX:+ExplicitGCInvokesConcurrent -XX:+UseZGC -XX:+ZGenerational -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCompressedOops -XX:MaxGCPauseMillis=200 -Dfile.encoding=UTF-8 -Dloader.path=. -Dspring.profiles.active=default -Dserver.port=8079 --add-modules=ALL-SYSTEM --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.stream=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/java.time.LocalDate=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime=ALL-UNNAMED --add-opens java.base/java.time.LocalDateTime.date=ALL-UNNAMED --add-opens java.base/jdk.internal.reflect.DirectMethodHandleAccessor=ALL-UNNAMED --enable-preview", + "env": { + "SPRING_PROFILES_ACTIVE": "default" + } } - } + ] } ``` -| **Property** | **Description** | -| ----------------------| -------------------------------------------------------------------------------- | -| values | key-value pairs, with base64 url encoded data | -| sourceFormat | Http mime types, ISO formats [ISO19794_4_2011, ISO19794_5_2011, ISO19794_6_2011] | -| sourceParameters | key-value pairs [IMAGE/JPEG, IMAGE/PNG] | -| targetFormat | Http mime types, ISO formats | -| targetParameters | key-value pairs | +Or integrated terminal: + +```bash +cd kernel-bio-converter && ./run-local.sh start # Linux / macOS / Git Bash +cd kernel-bio-converter && run-local.bat start # Windows +``` + +### NetBeans -**Response Structure**: +1. Open `kernel-bio-converter` as a Maven project. +2. Open `KernelBioConverterApplication` → **Run File**. +3. **Project Properties → Run → VM Options:** paste the same flags as manual `java`. +4. Or **Tools → External Tools** pointing at `run-local.bat` / `run-local.sh` with argument `start`. + +--- + +## Docker + +**Via helper (preferred):** + +```bat +REM Windows +set SPRING_CLOUD_CONFIG_URI=http://host.docker.internal:51000 +run-local.bat docker +``` + +```bash +# Linux / macOS / Git Bash +SPRING_CLOUD_CONFIG_URI=http://host.docker.internal:51000 ./run-local.sh docker +``` + +**Manual:** + +```bash +cd kernel-bio-converter +mvn clean package "-Dgpg.skip=true" "-DskipTests" +docker build -t kernel-bio-converter:latest -f Dockerfile . +``` + +macOS / Windows Docker Desktop: + +```bash +docker run --rm -p 8079:8079 --name kernel-bio-converter \ + -e active_profile_env=default \ + -e spring_config_url_env=http://host.docker.internal:51000 \ + -e spring_config_label_env=master \ + kernel-bio-converter:latest +``` + +Linux (reach config server on host): + +```bash +docker run --rm -p 8079:8079 --name kernel-bio-converter \ + --add-host=host.docker.internal:host-gateway \ + -e active_profile_env=default \ + -e spring_config_url_env=http://host.docker.internal:51000 \ + -e spring_config_label_env=master \ + kernel-bio-converter:latest +``` + +Local ZGC / `--add-opens` stay in **`run-local.bat` / `run-local.sh`**. The image uses a short `java -jar` entrypoint plus config env vars. + +Helm / cluster: [`deploy/`](deploy/) and [`helm/converters/`](helm/converters/). + +--- + +## Use as a library + +```xml + + io.mosip.kernel + kernel-bio-converter + ${kernel.bioconverter.version} + lib + +``` + +```java +Map out = converterApi.convert( + values, "ISO19794_4_2011", "IMAGE/JPEG", + Map.of(), Map.of()); +``` + +--- + +## API + +**`POST /v1/converter-service/convert`** ```json { - "id": "sample-converter", + "id": "mosip.converter", "version": "1.0", - "responsetime": "2022-02-22T16:46:09.513Z", - "errors": [ - { - "errorCode": "string", - "errorMessage": "string" - } - ], - "response": { - "Left Thumb": "", - "Right Iris": "" + "requesttime": "2024-01-01T00:00:00.000Z", + "request": { + "values": { "Left IndexFinger": "" }, + "sourceFormat": "ISO19794_4_2011", + "targetFormat": "IMAGE/JPEG", + "sourceParameters": {}, + "targetParameters": {} } } ``` -| **Property** | **Description** | -| :-------- | :----------------------------------------------------------------------------------------- | -| response | key-value pairs, with base64 url encoded converted data | +### Formats + +| Source | Targets | +|--------|---------| +| `ISO19794_4_2011` (finger JP2000/WSQ) | `IMAGE/JPEG`, `IMAGE/PNG`, `ISO19794_4_2011/{JPEG,PNG}` | +| `ISO19794_5_2011` (face JP2000) | `IMAGE/JPEG`, `IMAGE/PNG`, `ISO19794_5_2011/{JPEG,PNG}` | +| `ISO19794_6_2011` (iris MONO_JPEG2000) | `IMAGE/PNG`, `ISO19794_6_2011/PNG` (JPEG variant disabled) | + +### Error codes + +| Code | Meaning | +|------|---------| +| MOS-CNV-001 … MOS-CNV-012 | Validation / format / decode failures | +| MOS-CNV-500 | Unexpected technical error | + +--- +## Project layout -### Error Codes +| Path | Role | +|------|------| +| `kernel-bio-converter/` | Maven module, `run-local.bat` / `run-local.sh`, Dockerfile | +| `helm/converters/` | Helm chart | +| `deploy/` | Cluster install helpers | +| `AGENTS.md` | AI / contributor quick rules | -| **Code** | **Description** | -| :----------- | :------------------------------------------------------------------------------------------ | -| MOS-CNV-001 | Input Source Request may be null or Source Format may be null or Target Format may be null | -| MOS-CNV-002 | Invalid Request Value | -| MOS-CNV-003 | Invalid Source Value or Source Format not supported | -| MOS-CNV-004 | Invalid Target Value or Target Format not supported | -| MOS-CNV-005 | Source value can not be empty or null | -| MOS-CNV-006 | Source not valid base64urlencoded | -| MOS-CNV-007 | Could not read Source ISO Image Data | -| MOS-CNV-008 | Source not valid ISO ISO19794_4_2011 | -| MOS-CNV-009 | Source not valid ISO ISO19794_5_2011 | -| MOS-CNV-010 | Source not valid ISO ISO19794_6_2011 | -| MOS-CNV-011 | Target format not valid | -| MOS-CNV-500 | Technical Error | +--- -## Contribution & Community +## Contributing -- To learn how you can contribute code to this application, [click here](https://docs.mosip.io/1.2.0/community/code-contributions). -- If you have questions or encounter issues, visit the [MOSIP Community](https://community.mosip.io/) for support. -- For any GitHub issues: [Report here](https://github.com/mosip/converters/issues) +- Code contributions: [MOSIP docs](https://docs.mosip.io/1.2.0/community/code-contributions) +- Community: [community.mosip.io](https://community.mosip.io/) +- Issues: [github.com/mosip/converters/issues](https://github.com/mosip/converters/issues) ## License -This project is licensed under the [Mozilla Public License 2.0](LICENSE). +[Mozilla Public License 2.0](LICENSE). Third-party notices: [NOTICE](NOTICE). diff --git a/deploy/AGENTS.md b/deploy/AGENTS.md new file mode 100644 index 0000000..e2b1d83 --- /dev/null +++ b/deploy/AGENTS.md @@ -0,0 +1,7 @@ +# deploy/ + +``` +deploy/install.sh → helm/converters +``` + +**Rules:** no secrets · keep chart version aligned · no silent helm/values drift diff --git a/helm/AGENTS.md b/helm/AGENTS.md new file mode 100644 index 0000000..6fb2794 --- /dev/null +++ b/helm/AGENTS.md @@ -0,0 +1,8 @@ +# helm/ + +``` +helm/converters/ → kernel-bio-converter :8079 /v1/converter-service +deploy/ → install wrappers +``` + +**Rules:** no secrets in `values.yaml` · health path = context-path · bump `Chart.yaml`/README on publish diff --git a/licenses/Apache-2.0.txt b/licenses/Apache-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/licenses/Apache-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/licenses/BSD-3-Clause-No-Nuclear-License.txt b/licenses/BSD-3-Clause-No-Nuclear-License.txt new file mode 100644 index 0000000..07786ca --- /dev/null +++ b/licenses/BSD-3-Clause-No-Nuclear-License.txt @@ -0,0 +1,15 @@ +BSD-3-Clause-No-Nuclear-License +----------------------------------- +Copyright © 2005 Sun Microsystems, Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistribution of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + * Redistribution in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + * Neither the name of Sun Microsystems, Inc. or the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +This software is provided "AS IS," without a warranty of any kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +You acknowledge that this software is not designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear facility. diff --git a/licenses/EDL-1.0.txt b/licenses/EDL-1.0.txt new file mode 100644 index 0000000..37d5c04 --- /dev/null +++ b/licenses/EDL-1.0.txt @@ -0,0 +1,30 @@ +Eclipse Distribution License - v 1.0 + +Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + Neither the name of the Eclipse Foundation, Inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/licenses/EPL-2.0.txt b/licenses/EPL-2.0.txt new file mode 100644 index 0000000..e23ece2 --- /dev/null +++ b/licenses/EPL-2.0.txt @@ -0,0 +1,277 @@ +Eclipse Public License - v 2.0 + + THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE + PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION + OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial content + Distributed under this Agreement, and + + b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + where such changes and/or additions to the Program originate from + and are Distributed by that particular Contributor. A Contribution + "originates" from a Contributor if it was added to the Program by + such Contributor itself or anyone acting on such Contributor's behalf. + Contributions do not include changes or additions to the Program that + are not Modified Works. + +"Contributor" means any person or entity that Distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which +are necessarily infringed by the use or sale of its Contribution alone +or when combined with the Program. + +"Program" means the Contributions Distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this Agreement +or any Secondary License (as applicable), including Contributors. + +"Derivative Works" shall mean any work, whether in Source Code or other +form, that is based on (or derived from) the Program and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. + +"Modified Works" shall mean any work in Source Code or other form that +results from an addition to, deletion from, or modification of the +contents of the Program, including, for purposes of clarity any new file +in Source Code form that contains any contents of the Program. Modified +Works shall not include works that contain only declarations, +interfaces, types, classes, structures, or files of the Program solely +in each case in order to link to, bind by name, or subclass the Program +or Modified Works thereof. + +"Distribute" means the acts of a) distributing or b) making available +in any manner that enables the transfer of a copy. + +"Source Code" means the form of a Program preferred for making +modifications, including but not limited to software source code, +documentation source, and configuration files. + +"Secondary License" means either the GNU General Public License, +Version 2.0, or any later versions of that license, including any +exceptions or additional permissions as identified by the initial +Contributor. + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free copyright + license to reproduce, prepare Derivative Works of, publicly display, + publicly perform, Distribute and sublicense the Contribution of such + Contributor, if any, and such Derivative Works. + + b) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free patent + license under Licensed Patents to make, use, sell, offer to sell, + import and otherwise transfer the Contribution of such Contributor, + if any, in Source Code or other form. This patent license shall + apply to the combination of the Contribution and the Program if, at + the time the Contribution is added by the Contributor, such addition + of the Contribution causes such combination to be covered by the + Licensed Patents. The patent license shall not apply to any other + combinations which include the Contribution. No hardware per se is + licensed hereunder. + + c) Recipient understands that although each Contributor grants the + licenses to its Contributions set forth herein, no assurances are + provided by any Contributor that the Program does not infringe the + patent or other intellectual property rights of any other entity. + Each Contributor disclaims any liability to Recipient for claims + brought by any other entity based on infringement of intellectual + property rights or otherwise. As a condition to exercising the + rights and licenses granted hereunder, each Recipient hereby + assumes sole responsibility to secure any other intellectual + property rights needed, if any. For example, if a third party + patent license is required to allow Recipient to Distribute the + Program, it is Recipient's responsibility to acquire that license + before distributing the Program. + + d) Each Contributor represents that to its knowledge it has + sufficient copyright rights in its Contribution, if any, to grant + the copyright license set forth in this Agreement. + + e) Notwithstanding the terms of any Secondary License, no + Contributor makes additional grants to any Recipient (other than + those set forth in this Agreement) as a result of such Recipient's + receipt of the Program under the terms of a Secondary License + (if permitted under the terms of Section 3). + +3. REQUIREMENTS + +3.1 If a Contributor Distributes the Program in any form, then: + + a) the Program must also be made available as Source Code, in + accordance with section 3.2, and the Contributor must accompany + the Program with a statement that the Source Code for the Program + is available under this Agreement, and informs Recipients how to + obtain it in a reasonable manner on or through a medium customarily + used for software exchange; and + + b) the Contributor may Distribute the Program under a license + different than this Agreement, provided that such license: + i) effectively disclaims on behalf of all other Contributors all + warranties and conditions, express and implied, including + warranties or conditions of title and non-infringement, and + implied warranties or conditions of merchantability and fitness + for a particular purpose; + + ii) effectively excludes on behalf of all other Contributors all + liability for damages, including direct, indirect, special, + incidental and consequential damages, such as lost profits; + + iii) does not attempt to limit or alter the recipients' rights + in the Source Code under section 3.2; and + + iv) requires any subsequent distribution of the Program by any + party to be under a license that satisfies the requirements + of this section 3. + +3.2 When the Program is Distributed as Source Code: + + a) it must be made available under this Agreement, or if the + Program (i) is combined with other material in a separate file or + files made available under a Secondary License, and (ii) the initial + Contributor attached to the Source Code the notice described in + Exhibit A of this Agreement, then the Program may be made available + under the terms of such Secondary Licenses, and + + b) a copy of this Agreement must be included with each copy of + the Program. + +3.3 Contributors may not remove or alter any copyright, patent, +trademark, attribution notices, disclaimers of warranty, or limitations +of liability ("notices") contained within the Program from any copy of +the Program which they Distribute, provided that Contributors may add +their own appropriate notices. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities +with respect to end users, business partners and the like. While this +license is intended to facilitate the commercial use of the Program, +the Contributor who includes the Program in a commercial product +offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes +the Program in a commercial product offering, such Contributor +("Commercial Contributor") hereby agrees to defend and indemnify every +other Contributor ("Indemnified Contributor") against any losses, +damages and costs (collectively "Losses") arising from claims, lawsuits +and other legal actions brought by a third party against the Indemnified +Contributor to the extent caused by the acts or omissions of such +Commercial Contributor in connection with its distribution of the Program +in a commercial product offering. The obligations in this section do not +apply to any claims or Losses relating to any actual or alleged +intellectual property infringement. In order to qualify, an Indemnified +Contributor must: a) promptly notify the Commercial Contributor in +writing of such claim, and b) allow the Commercial Contributor to control, +and cooperate with the Commercial Contributor in, the defense and any +related settlement negotiations. The Indemnified Contributor may +participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those performance +claims and warranties, and if a court requires any other Contributor to +pay any damages as a result, the Commercial Contributor must pay +those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" +BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF +TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR +PURPOSE. Each Recipient is solely responsible for determining the +appropriateness of using and distributing the Program and assumes all +risks associated with its exercise of rights under this Agreement, +including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs +or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS +SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST +PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE +EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other software +or hardware) infringes such Recipient's patent(s), then such Recipient's +rights granted under Section 2(b) shall terminate as of the date such +litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign the +responsibility to serve as the Agreement Steward to a suitable separate +entity. Each new version of the Agreement will be given a distinguishing +version number. The Program (including Contributions) may always be +Distributed subject to the version of the Agreement under which it was +received. In addition, after a new version of the Agreement is published, +Contributor may elect to Distribute the Program (including its +Contributions) under the new version. + +Except as expressly stated in Sections 2(a) and 2(b) above, Recipient +receives no rights or licenses to the intellectual property of any +Contributor under this Agreement, whether expressly, by implication, +estoppel or otherwise. All rights in the Program not expressly granted +under this Agreement are reserved. Nothing in this Agreement is intended +to be enforceable by any entity that is not a Contributor or Recipient. +No third-party beneficiary rights are created under this Agreement. + +Exhibit A - Form of Secondary Licenses Notice + +"This Source Code may also be made available under the following +Secondary Licenses when the conditions for such availability set forth +in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), +version(s), and exceptions or additional permissions here}." + + Simply including a copy of this Agreement, including this Exhibit A + is not sufficient to license the Source Code under Secondary Licenses. + + If it is not possible or desirable to put the notice in a particular + file, then You may include the notice in a location (such as a LICENSE + file in a relevant directory) where a recipient would be likely to + look for such a notice. + + You may add additional accurate notices of copyright ownership. \ No newline at end of file diff --git a/licenses/MIT.txt b/licenses/MIT.txt new file mode 100644 index 0000000..e162808 --- /dev/null +++ b/licenses/MIT.txt @@ -0,0 +1,19 @@ +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/licenses/MPL-2.0.txt b/licenses/MPL-2.0.txt new file mode 100644 index 0000000..ef3e728 --- /dev/null +++ b/licenses/MPL-2.0.txt @@ -0,0 +1,374 @@ + +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + 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/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. From 443329f71809453af245dd39096eb388c0447883 Mon Sep 17 00:00:00 2001 From: JanardhanBS-SyncByte Date: Thu, 24 Sep 2026 11:28:15 +0530 Subject: [PATCH 06/10] issue-1633 spring boot changes Signed-off-by: JanardhanBS-SyncByte --- NOTICE | 2 +- kernel-bio-converter/pom.xml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NOTICE b/NOTICE index 198c5f2..83580bd 100644 --- a/NOTICE +++ b/NOTICE @@ -82,7 +82,7 @@ Apache-2.0 (licenses/Apache-2.0.txt) - org.hibernate.orm:hibernate-core 7.x (Apache-2.0 since 7.0; transitive via kernel-core) - Maven build plugins (compiler 3.16.0, surefire 3.6.0, jar 3.5.1, source 3.4.0, javadoc 3.12.0, gpg 3.2.8, deploy 3.2.0, jacoco 0.8.15, - git-commit-id-maven-plugin 9.0.2, central-publishing 0.11.0, sonar 5.8.0.7211) + git-commit-id-plugin 4.9.10 (pl.project13.maven), central-publishing 0.11.0, sonar 5.8.0.7211) =========================== BSD-3-Clause / BSD-3-Clause-No-Nuclear (licenses/BSD-3-Clause-No-Nuclear-License.txt) diff --git a/kernel-bio-converter/pom.xml b/kernel-bio-converter/pom.xml index d44d147..5dcb9b1 100644 --- a/kernel-bio-converter/pom.xml +++ b/kernel-bio-converter/pom.xml @@ -69,7 +69,7 @@ 3.2.0 3.4.0 3.2.8 - 9.0.2 + 4.9.10 0.11.0 @@ -437,8 +437,8 @@ - io.github.git-commit-id - git-commit-id-maven-plugin + pl.project13.maven + git-commit-id-plugin ${git.commit.id.plugin.version} From a4720bcf3f674c2790d0dc64376444018f51f210 Mon Sep 17 00:00:00 2001 From: JanardhanBS-SyncByte Date: Thu, 24 Sep 2026 11:37:31 +0530 Subject: [PATCH 07/10] issue-1633 spring boot changes Signed-off-by: JanardhanBS-SyncByte --- .../bio/converter/config/SwaggerConfig.java | 36 +++++++++++++++---- .../bio/converter/TestBootApplication.java | 2 +- .../config}/TestSecurityConfig.java | 5 ++- 3 files changed, 32 insertions(+), 11 deletions(-) rename kernel-bio-converter/src/test/java/io/mosip/kernel/bio/{testsupport => converter/config}/TestSecurityConfig.java (95%) diff --git a/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/config/SwaggerConfig.java b/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/config/SwaggerConfig.java index 8691fea..5e3d68f 100644 --- a/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/config/SwaggerConfig.java +++ b/kernel-bio-converter/src/main/java/io/mosip/kernel/bio/converter/config/SwaggerConfig.java @@ -9,18 +9,26 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; import io.swagger.v3.oas.models.servers.Server; /** * Configuration class for Swagger/OpenAPI documentation generation. *

- * This class defines beans to configure the OpenAPI specification based on the - * provided {@link OpenApiProperties}. It initializes an {@link OpenAPI} bean - * and a {@link GroupedOpenApi} bean to customize and group API documentation - * according to specified properties. + * Builds the Springdoc {@link OpenAPI} bean from {@link OpenApiProperties} and + * registers an Authorization apiKey so Swagger UI shows the Authorize button + * (same pattern as kernel-auth-service). + *

*/ @Configuration public class SwaggerConfig { + + /** + * Scheme name shown by Swagger UI as Authorize (IDA-style Authorization apiKey). + */ + public static final String AUTHORIZATION_SCHEME = "Authorization"; + private OpenApiProperties openApiProperties; /** @@ -37,14 +45,16 @@ public SwaggerConfig(OpenApiProperties openApiProperties) { /** * Creates an {@link OpenAPI} bean configured with title, version, description, - * and license information. + * license, servers, and Authorize apiKey. * * @return Configured {@link OpenAPI} instance representing the OpenAPI * specification */ @Bean public OpenAPI openApi() { - OpenAPI api = new OpenAPI().components(new Components()) + OpenAPI api = new OpenAPI() + .components(new Components().addSecuritySchemes(AUTHORIZATION_SCHEME, authorizationApiKey())) + .addSecurityItem(new SecurityRequirement().addList(AUTHORIZATION_SCHEME)) .info(new Info().title(openApiProperties.getInfo().getTitle()) .version(openApiProperties.getInfo().getVersion()) .description(openApiProperties.getInfo().getDescription()) @@ -56,6 +66,18 @@ public OpenAPI openApi() { return api; } + /** + * Header apiKey named {@code Authorization}, so Swagger UI shows Authorize with + * Name/In/Value (paste {@code Bearer } or the raw token as used by the + * gateway/adapter). + * + * @return the security scheme + */ + private static SecurityScheme authorizationApiKey() { + return new SecurityScheme().type(SecurityScheme.Type.APIKEY).in(SecurityScheme.In.HEADER) + .name(AUTHORIZATION_SCHEME); + } + /** * Creates a {@link GroupedOpenApi} bean to group API paths based on configured * properties. @@ -67,4 +89,4 @@ public GroupedOpenApi groupedOpenApi() { return GroupedOpenApi.builder().group(openApiProperties.getGroup().getName()) .pathsToMatch(openApiProperties.getGroup().getPaths().stream().toArray(String[]::new)).build(); } -} \ No newline at end of file +} diff --git a/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/TestBootApplication.java b/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/TestBootApplication.java index 2507019..36e076e 100644 --- a/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/TestBootApplication.java +++ b/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/TestBootApplication.java @@ -8,7 +8,7 @@ import org.springframework.context.annotation.Import; import org.springframework.scheduling.annotation.EnableAsync; -import io.mosip.kernel.bio.testsupport.TestSecurityConfig; +import io.mosip.kernel.bio.converter.config.TestSecurityConfig; /** * Main Spring Boot application class for testing purposes. diff --git a/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/testsupport/TestSecurityConfig.java b/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/config/TestSecurityConfig.java similarity index 95% rename from kernel-bio-converter/src/test/java/io/mosip/kernel/bio/testsupport/TestSecurityConfig.java rename to kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/config/TestSecurityConfig.java index 1d7ecc5..d7301ba 100644 --- a/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/testsupport/TestSecurityConfig.java +++ b/kernel-bio-converter/src/test/java/io/mosip/kernel/bio/converter/config/TestSecurityConfig.java @@ -1,4 +1,4 @@ -package io.mosip.kernel.bio.testsupport; +package io.mosip.kernel.bio.converter.config; import java.util.ArrayList; import java.util.Arrays; @@ -28,8 +28,7 @@ import com.fasterxml.jackson.module.afterburner.AfterburnerModule; /** - * Test-only security wiring. Lives outside {@code io.mosip.kernel.bio.converter} - * so production {@code @ComponentScan} does not pick it up. + * Test-only security wiring for converter integration tests. */ @Configuration @EnableWebSecurity From 572327afb5a689f019c4f6bfa431e3fc24776c30 Mon Sep 17 00:00:00 2001 From: JanardhanBS-SyncByte Date: Thu, 24 Sep 2026 12:18:57 +0530 Subject: [PATCH 08/10] issue-1633 spring boot changes Signed-off-by: JanardhanBS-SyncByte --- .github/workflows/push-trigger.yml | 2 ++ kernel-bio-converter/Dockerfile | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index 9cd7489..c39adf6 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -28,6 +28,8 @@ jobs: with: SERVICE_LOCATION: kernel-bio-converter BUILD_ARTIFACT: kernel-bio-converter + # Boot 4 ZIP layout JARs are not +x; kattu only zips -executable unless listed here. + MAVEN_NON_EXEC_ARTIFACTS: kernel-bio-converter secrets: OSSRH_USER: ${{ secrets.OSSRH_USER }} OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} diff --git a/kernel-bio-converter/Dockerfile b/kernel-bio-converter/Dockerfile index ab7aa70..7ac01d7 100644 --- a/kernel-bio-converter/Dockerfile +++ b/kernel-bio-converter/Dockerfile @@ -5,10 +5,10 @@ ARG SOURCE ARG COMMIT_HASH ARG COMMIT_ID ARG BUILD_TIME -LABEL source=${SOURCE} \ - commit_hash=${COMMIT_HASH} \ - commit_id=${COMMIT_ID} \ - build_time=${BUILD_TIME} +LABEL source=${SOURCE} +LABEL commit_hash=${COMMIT_HASH} +LABEL commit_id=${COMMIT_ID} +LABEL build_time=${BUILD_TIME} # Can be passed during Docker build as build-time environment for github branch to pick up configuration from. ARG spring_config_label=master From 2bebb67e8aa0431804c9dac468541cb7c1095d1a Mon Sep 17 00:00:00 2001 From: JanardhanBS-SyncByte Date: Thu, 24 Sep 2026 12:27:01 +0530 Subject: [PATCH 09/10] issue-1633 spring boot changes Signed-off-by: JanardhanBS-SyncByte --- kernel-bio-converter/Dockerfile | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/kernel-bio-converter/Dockerfile b/kernel-bio-converter/Dockerfile index 7ac01d7..f5dbdc0 100644 --- a/kernel-bio-converter/Dockerfile +++ b/kernel-bio-converter/Dockerfile @@ -53,19 +53,33 @@ RUN apt-get update && \ mkdir -p ${work_dir}/additional_jars && \ rm -rf /var/lib/apt/lists/* -# Copy Boot fat JAR (glob may also match -lib / -sources / -javadoc) -COPY ./target/kernel-bio-converter-*.jar ${work_dir}/kernel-bio-converter.jar +# Copy module jars into work dir (keep original names: fat, -lib, -sources, -javadoc may be present). +# Destination must end with / so Docker does not rename a single match to kernel-bio-converter.jar. +COPY ./target/kernel-bio-converter-*.jar ${work_dir}/ -# Prefer fat JAR only (exclude -lib / -sources / -javadoc if COPY matched multiple) -# Change permissions of files inside working dir +# Prefer Boot fat JAR only; drop -lib / -sources / -javadoc / .original. +# Change permissions of files inside working dir. RUN set -eux; \ cd ${work_dir}; \ + rm -f kernel-bio-converter-*-lib.jar \ + kernel-bio-converter-*-sources.jar \ + kernel-bio-converter-*-javadoc.jar \ + kernel-bio-converter-*.jar.original \ + kernel-bio-converter.jar.original 2>/dev/null || true; \ + fat=""; \ for f in kernel-bio-converter-*.jar; do \ + [ -f "$f" ] || continue; \ case "$f" in \ *-lib.jar|*-sources.jar|*-javadoc.jar) rm -f "$f" ;; \ - *) mv -f "$f" kernel-bio-converter.jar ;; \ + *) fat="$f" ;; \ esac; \ done; \ + if [ -z "$fat" ] || [ ! -f "$fat" ]; then \ + echo "error: Boot fat jar not found under ${work_dir}" >&2; \ + ls -la "${work_dir}" >&2; \ + exit 1; \ + fi; \ + mv -f "$fat" kernel-bio-converter.jar; \ chown -R ${container_user}:${container_user} ${work_dir} # Select container user for all tasks From a8637398d549b24cd27bed6526eb08a89ea25a79 Mon Sep 17 00:00:00 2001 From: JanardhanBS-SyncByte Date: Fri, 25 Sep 2026 13:15:33 +0530 Subject: [PATCH 10/10] issue-1633 service-git.prop changes Signed-off-by: JanardhanBS-SyncByte --- kernel-bio-converter/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel-bio-converter/pom.xml b/kernel-bio-converter/pom.xml index 5dcb9b1..c55a8b4 100644 --- a/kernel-bio-converter/pom.xml +++ b/kernel-bio-converter/pom.xml @@ -451,13 +451,13 @@
true - - ${project.build.outputDirectory}/service-git.properties + ${project.build.outputDirectory}/service-git.properties ^git.build.(time|version)$ ^git.commit.id.(abbrev|full)$ full + ${project.basedir}/../.git