You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2023/07/22 01:20:03 UTC
[camel-karavan] 01/05: karavan-infinispan #817
This is an automated email from the ASF dual-hosted git repository.
marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
commit 365e9d6ae6b22b33d852f0def0a432cc7270fe90
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Fri Jul 21 20:59:01 2023 -0400
karavan-infinispan #817
---
.../.mvn/wrapper/maven-wrapper.properties | 18 +
karavan-web/karavan-infinispan/mvnw | 308 +++++++++++++++
karavan-web/karavan-infinispan/mvnw.cmd | 205 ++++++++++
karavan-web/karavan-infinispan/pom.xml | 132 +++++++
.../karavan/infinispan/CodeReloadListener.java | 30 ++
.../karavan/infinispan/InfinispanService.java | 414 +++++++++++++++++++++
.../karavan/infinispan/model/CamelStatus.java | 81 ++++
.../camel/karavan/infinispan/model/CommitInfo.java | 53 +++
.../karavan/infinispan/model/ContainerInfo.java | 70 ++++
.../karavan/infinispan/model/ContainerStatus.java | 141 +++++++
.../karavan/infinispan/model/DeploymentStatus.java | 111 ++++++
.../karavan/infinispan/model/DevModeStatus.java | 78 ++++
.../camel/karavan/infinispan/model/GitConfig.java | 48 +++
.../camel/karavan/infinispan/model/GitRepo.java | 49 +++
.../karavan/infinispan/model/GitRepoFile.java | 37 ++
.../camel/karavan/infinispan/model/GroupedKey.java | 81 ++++
.../karavan/infinispan/model/KaravanSchema.java | 28 ++
.../karavan/infinispan/model/PipelineStatus.java | 83 +++++
.../camel/karavan/infinispan/model/Project.java | 125 +++++++
.../karavan/infinispan/model/ProjectFile.java | 71 ++++
.../karavan/infinispan/model/ServiceStatus.java | 107 ++++++
.../src/main/resources/application.properties | 14 +
.../main/resources/cache/command-cache-config.xml | 6 +
.../src/main/resources/cache/data-cache-config.xml | 6 +
.../camel/karavan/infinispan/DataGridTest.java | 74 ++++
25 files changed, 2370 insertions(+)
diff --git a/karavan-web/karavan-infinispan/.mvn/wrapper/maven-wrapper.properties b/karavan-web/karavan-infinispan/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 00000000..70f4f50f
--- /dev/null
+++ b/karavan-web/karavan-infinispan/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.8/apache-maven-3.8.8-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
diff --git a/karavan-web/karavan-infinispan/mvnw b/karavan-web/karavan-infinispan/mvnw
new file mode 100755
index 00000000..8d937f4c
--- /dev/null
+++ b/karavan-web/karavan-infinispan/mvnw
@@ -0,0 +1,308 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Apache Maven Wrapper startup batch script, version 3.2.0
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /usr/local/etc/mavenrc ] ; then
+ . /usr/local/etc/mavenrc
+ fi
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "$(uname)" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
+ else
+ JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
+ fi
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=$(java-config --jre-home)
+ fi
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
+ JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="$(which javac)"
+ if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=$(which readlink)
+ if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
+ if $darwin ; then
+ javaHome="$(dirname "\"$javaExecutable\"")"
+ javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
+ else
+ javaExecutable="$(readlink -f "\"$javaExecutable\"")"
+ fi
+ javaHome="$(dirname "\"$javaExecutable\"")"
+ javaHome=$(expr "$javaHome" : '\(.*\)/bin')
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=$(cd "$wdir/.." || exit 1; pwd)
+ fi
+ # end of workaround
+ done
+ printf '%s' "$(cd "$basedir" || exit 1; pwd)"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ # Remove \r in case we run on Windows within Git Bash
+ # and check out the repository with auto CRLF management
+ # enabled. Otherwise, we may read lines that are delimited with
+ # \r\n and produce $'-Xarg\r' rather than -Xarg due to word
+ # splitting rules.
+ tr -s '\r\n' ' ' < "$1"
+ fi
+}
+
+log() {
+ if [ "$MVNW_VERBOSE" = true ]; then
+ printf '%s\n' "$1"
+ fi
+}
+
+BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
+log "$MAVEN_PROJECTBASEDIR"
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
+if [ -r "$wrapperJarPath" ]; then
+ log "Found $wrapperJarPath"
+else
+ log "Couldn't find $wrapperJarPath, downloading it ..."
+
+ if [ -n "$MVNW_REPOURL" ]; then
+ wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
+ else
+ wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
+ fi
+ while IFS="=" read -r key value; do
+ # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
+ safeValue=$(echo "$value" | tr -d '\r')
+ case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
+ esac
+ done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
+ log "Downloading from: $wrapperUrl"
+
+ if $cygwin; then
+ wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
+ fi
+
+ if command -v wget > /dev/null; then
+ log "Found wget ... using wget"
+ [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ else
+ wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ fi
+ elif command -v curl > /dev/null; then
+ log "Found curl ... using curl"
+ [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
+ else
+ curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
+ fi
+ else
+ log "Falling back to using Java to download"
+ javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
+ javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
+ # For Cygwin, switch paths to Windows format before running javac
+ if $cygwin; then
+ javaSource=$(cygpath --path --windows "$javaSource")
+ javaClass=$(cygpath --path --windows "$javaClass")
+ fi
+ if [ -e "$javaSource" ]; then
+ if [ ! -e "$javaClass" ]; then
+ log " - Compiling MavenWrapperDownloader.java ..."
+ ("$JAVA_HOME/bin/javac" "$javaSource")
+ fi
+ if [ -e "$javaClass" ]; then
+ log " - Running MavenWrapperDownloader.java ..."
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
+ fi
+ fi
+ fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+# If specified, validate the SHA-256 sum of the Maven wrapper jar file
+wrapperSha256Sum=""
+while IFS="=" read -r key value; do
+ case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
+ esac
+done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
+if [ -n "$wrapperSha256Sum" ]; then
+ wrapperSha256Result=false
+ if command -v sha256sum > /dev/null; then
+ if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
+ wrapperSha256Result=true
+ fi
+ elif command -v shasum > /dev/null; then
+ if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
+ wrapperSha256Result=true
+ fi
+ else
+ echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
+ echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
+ exit 1
+ fi
+ if [ $wrapperSha256Result = false ]; then
+ echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
+ echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
+ echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
+ exit 1
+ fi
+fi
+
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+# shellcheck disable=SC2086 # safe args
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ $MAVEN_DEBUG_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/karavan-web/karavan-infinispan/mvnw.cmd b/karavan-web/karavan-infinispan/mvnw.cmd
new file mode 100644
index 00000000..f80fbad3
--- /dev/null
+++ b/karavan-web/karavan-infinispan/mvnw.cmd
@@ -0,0 +1,205 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Apache Maven Wrapper startup batch script, version 3.2.0
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
+
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Found %WRAPPER_JAR%
+ )
+) else (
+ if not "%MVNW_REPOURL%" == "" (
+ SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
+ )
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
+ echo Downloading from: %WRAPPER_URL%
+ )
+
+ powershell -Command "&{"^
+ "$webclient = new-object System.Net.WebClient;"^
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+ "}"^
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
+ "}"
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Finished downloading %WRAPPER_JAR%
+ )
+)
+@REM End of extension
+
+@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
+SET WRAPPER_SHA_256_SUM=""
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
+)
+IF NOT %WRAPPER_SHA_256_SUM%=="" (
+ powershell -Command "&{"^
+ "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
+ "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
+ " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
+ " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
+ " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
+ " exit 1;"^
+ "}"^
+ "}"
+ if ERRORLEVEL 1 goto error
+)
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% ^
+ %JVM_CONFIG_MAVEN_PROPS% ^
+ %MAVEN_OPTS% ^
+ %MAVEN_DEBUG_OPTS% ^
+ -classpath %WRAPPER_JAR% ^
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+ %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
+
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%
diff --git a/karavan-web/karavan-infinispan/pom.xml b/karavan-web/karavan-infinispan/pom.xml
new file mode 100644
index 00000000..3668bac4
--- /dev/null
+++ b/karavan-web/karavan-infinispan/pom.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>karavan-infinispan</artifactId>
+ <packaging>jar</packaging>
+ <parent>
+ <groupId>org.apache.camel.karavan</groupId>
+ <artifactId>karavan-web</artifactId>
+ <version>3.21.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-vertx</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-jackson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-infinispan-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>application.properties</include>
+ <include>**/**.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>target/classes/proto</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>karavan.proto</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>io.smallrye</groupId>
+ <artifactId>jandex-maven-plugin</artifactId>
+ <version>${jandex-maven-plugin-version}</version>
+ <executions>
+ <execution>
+ <id>make-index</id>
+ <goals>
+ <goal>jandex</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>${quarkus.platform.group-id}</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <version>${quarkus.platform.version}</version>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <goals>
+ <goal>build</goal>
+ <goal>generate-code</goal>
+ <goal>generate-code-tests</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${compiler-plugin.version}</version>
+ <configuration>
+ <parameters>${maven.compiler.parameters}</parameters>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire-plugin.version}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
+ <maven.home>${maven.home}</maven.home>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
+ <name>Apache Development Snapshot Repository</name>
+ <url>https://repository.apache.org/content/repositories/snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+</project>
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/CodeReloadListener.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/CodeReloadListener.java
new file mode 100644
index 00000000..8c369157
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/CodeReloadListener.java
@@ -0,0 +1,30 @@
+package org.apache.camel.karavan.infinispan;
+
+import io.vertx.core.eventbus.EventBus;
+import io.vertx.core.json.JsonObject;
+import org.apache.camel.karavan.infinispan.model.GroupedKey;
+import org.infinispan.client.hotrod.annotation.ClientCacheEntryCreated;
+import org.infinispan.client.hotrod.annotation.ClientCacheEntryModified;
+import org.infinispan.client.hotrod.annotation.ClientListener;
+import org.infinispan.client.hotrod.event.ClientCacheEntryCreatedEvent;
+import org.infinispan.client.hotrod.event.ClientCacheEntryModifiedEvent;
+
+@ClientListener
+public class CodeReloadListener {
+ private final EventBus eventBus;
+
+ public CodeReloadListener(EventBus eventBus) {
+ this.eventBus = eventBus;
+ }
+
+ @ClientCacheEntryCreated
+ public void entryCreated(ClientCacheEntryCreatedEvent<GroupedKey> event) {
+ eventBus.publish(InfinispanService.CODE_RELOAD_COMMAND_INTERNAL, JsonObject.mapFrom(event.getKey()));
+ }
+
+ @ClientCacheEntryModified
+ public void entryModified(ClientCacheEntryModifiedEvent<GroupedKey> event) {
+ eventBus.publish(InfinispanService.CODE_RELOAD_COMMAND_INTERNAL, JsonObject.mapFrom(event.getKey()));
+ }
+
+}
\ No newline at end of file
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/InfinispanService.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/InfinispanService.java
new file mode 100644
index 00000000..36a9db6e
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/InfinispanService.java
@@ -0,0 +1,414 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.karavan.infinispan;
+
+import io.quarkus.vertx.ConsumeEvent;
+import io.smallrye.mutiny.tuples.Tuple2;
+import io.vertx.core.eventbus.EventBus;
+import io.vertx.core.json.JsonObject;
+import org.apache.camel.karavan.infinispan.model.*;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+import org.infinispan.client.hotrod.RemoteCache;
+import org.infinispan.client.hotrod.RemoteCacheManager;
+import org.infinispan.client.hotrod.Search;
+import org.infinispan.client.hotrod.configuration.ClientIntelligence;
+import org.infinispan.client.hotrod.configuration.ConfigurationBuilder;
+import org.infinispan.commons.configuration.StringConfiguration;
+import org.infinispan.commons.marshall.ProtoStreamMarshaller;
+import org.infinispan.query.dsl.QueryFactory;
+import org.jboss.logging.Logger;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Default;
+import javax.inject.Inject;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.time.Instant;
+import java.util.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
+
+import static org.infinispan.query.remote.client.ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME;
+
+@Default
+@ApplicationScoped
+public class InfinispanService {
+
+ @ConfigProperty(name ="infinispan.hosts")
+ String infinispanHosts;
+ @ConfigProperty(name ="infinispan.username")
+ String infinispanUsername;
+ @ConfigProperty(name ="infinispan.password")
+ String infinispanPassword;
+
+ @Inject
+ EventBus eventBus;
+
+ private RemoteCache<GroupedKey, Project> projects;
+ private RemoteCache<GroupedKey, ProjectFile> files;
+ private RemoteCache<GroupedKey, PipelineStatus> pipelineStatuses;
+ private RemoteCache<GroupedKey, DeploymentStatus> deploymentStatuses;
+ private RemoteCache<GroupedKey, ContainerStatus> containerStatuses;
+ private RemoteCache<GroupedKey, ServiceStatus> serviceStatuses;
+ private RemoteCache<GroupedKey, CamelStatus> camelStatuses;
+ private RemoteCache<String, String> commits;
+ private RemoteCache<GroupedKey, DevModeStatus> devmodeStatuses;
+ private RemoteCache<GroupedKey, String> codeReloadCommands;
+ private RemoteCache<GroupedKey, ContainerInfo> containers;
+ private final AtomicBoolean ready = new AtomicBoolean(false);
+
+ private RemoteCacheManager cacheManager;
+
+ private static final Logger LOGGER = Logger.getLogger(InfinispanService.class.getName());
+
+ private static final String DEFAULT_ENVIRONMENT = "dev";
+
+ public static final String CODE_RELOAD_COMMAND = "CODE_RELOAD_COMMAND";
+ public static final String CODE_RELOAD_COMMAND_INTERNAL = "CODE_RELOAD_COMMAND_INTERNAL";
+
+ public void start(boolean startCodeReloadListeners) {
+ LOGGER.info("InfinispanService is starting in remote mode");
+
+ ProtoStreamMarshaller marshaller = new ProtoStreamMarshaller();
+ marshaller.register(new KaravanSchemaImpl());
+
+ ConfigurationBuilder builder = new ConfigurationBuilder();
+ builder.socketTimeout(1000)
+ .connectionTimeout(10000)
+ .addServers(infinispanHosts)
+ .security()
+ .authentication().enable()
+ .username(infinispanUsername)
+ .password(infinispanPassword)
+ .clientIntelligence(ClientIntelligence.BASIC)
+ .marshaller(marshaller);
+
+ cacheManager = new RemoteCacheManager(builder.build());
+
+ projects = getOrCreateCache(Project.CACHE, false);
+ files = getOrCreateCache(ProjectFile.CACHE, false);
+ containerStatuses = getOrCreateCache(ContainerStatus.CACHE, false);
+ pipelineStatuses = getOrCreateCache(PipelineStatus.CACHE, false);
+ deploymentStatuses = getOrCreateCache(DeploymentStatus.CACHE, false);
+ serviceStatuses = getOrCreateCache(ServiceStatus.CACHE, false);
+ camelStatuses = getOrCreateCache(CamelStatus.CACHE, false);
+ commits = getOrCreateCache("commits", false);
+ deploymentStatuses = getOrCreateCache(DeploymentStatus.CACHE, false);
+ devmodeStatuses = getOrCreateCache(DevModeStatus.CACHE, false);
+ containers = getOrCreateCache(ContainerInfo.CACHE, false);
+ codeReloadCommands = getOrCreateCache("code_reload_commands", true);
+
+ cacheManager.getCache(PROTOBUF_METADATA_CACHE_NAME).put("karavan.proto", getResourceFile("/proto/karavan.proto"));
+
+ if (startCodeReloadListeners) {
+ cacheManager.getCache("code_reload_commands").addClientListener(new CodeReloadListener(eventBus));
+ }
+
+ ready.set(true);
+ LOGGER.info("InfinispanService is started in remote mode");
+ }
+
+ private <K, V> RemoteCache<K, V> getOrCreateCache(String name, boolean command) {
+ String config = getResourceFile(command ? "/cache/command-cache-config.xml" : "/cache/data-cache-config.xml");
+ return cacheManager.administration().getOrCreateCache(name, new StringConfiguration(String.format(config, name)));
+ }
+
+ public boolean isReady() {
+ return ready.get();
+ }
+
+
+ @ConsumeEvent(value = CODE_RELOAD_COMMAND_INTERNAL, blocking = true)
+ void resendCodeReloadCommand(JsonObject message) {
+ GroupedKey key = message.mapTo(GroupedKey.class);
+ deleteCodeReloadCommand(key);
+ eventBus.publish(CODE_RELOAD_COMMAND, key.getProjectId());
+ }
+
+ public void sendCodeReloadCommand(String projectId) {
+ codeReloadCommands.put(GroupedKey.create(projectId, DEFAULT_ENVIRONMENT, UUID.randomUUID().toString()), projectId);
+ }
+
+ public void deleteCodeReloadCommand(GroupedKey key) {
+ codeReloadCommands.remove(key);
+ }
+
+ public List<Project> getProjects() {
+ return projects.values().stream().collect(Collectors.toList());
+ }
+
+ public void saveProject(Project project) {
+ GroupedKey key = GroupedKey.create(project.getProjectId(), DEFAULT_ENVIRONMENT, project.getProjectId());
+ projects.put(key, project);
+ projects.put(key, project);
+ }
+
+ public List<ProjectFile> getProjectFiles(String projectId) {
+ QueryFactory queryFactory = Search.getQueryFactory(files);
+ return queryFactory.<ProjectFile>create("FROM karavan.ProjectFile WHERE projectId = :projectId")
+ .setParameter("projectId", projectId)
+ .execute().list();
+ }
+
+ public Map<GroupedKey, ProjectFile> getProjectFilesMap(String projectId) {
+ QueryFactory queryFactory = Search.getQueryFactory(files);
+ return queryFactory.<ProjectFile>create("FROM karavan.ProjectFile WHERE projectId = :projectId")
+ .setParameter("projectId", projectId)
+ .execute().list().stream()
+ .collect(Collectors.toMap(f -> new GroupedKey(f.getProjectId(), DEFAULT_ENVIRONMENT, f.getName()), f -> f));
+ }
+
+ public ProjectFile getProjectFile(String projectId, String filename) {
+ QueryFactory queryFactory = Search.getQueryFactory(files);
+ List<ProjectFile> list = queryFactory.<ProjectFile>create("FROM karavan.ProjectFile WHERE projectId = :projectId AND name = :name")
+ .setParameter("projectId", projectId)
+ .setParameter("name", filename)
+ .execute().list();
+ return list.size() > 0 ? list.get(0) : null;
+ }
+
+ public void saveProjectFile(ProjectFile file) {
+ files.put(GroupedKey.create(file.getProjectId(), DEFAULT_ENVIRONMENT, file.getName()), file);
+ }
+
+ public void saveProjectFiles(Map<GroupedKey, ProjectFile> f) {
+ Map<GroupedKey, ProjectFile> files = new HashMap<>(f.size());
+ f.forEach((groupedKey, projectFile) -> {
+ projectFile.setLastUpdate(Instant.now().toEpochMilli());
+ });
+ files.putAll(files);
+ }
+
+ public void deleteProject(String projectId) {
+ projects.remove(GroupedKey.create(projectId, DEFAULT_ENVIRONMENT,projectId));
+ }
+
+ public void deleteProjectFile(String projectId, String filename) {
+ files.remove(GroupedKey.create(projectId, DEFAULT_ENVIRONMENT,filename));
+ }
+
+ public Project getProject(String projectId) {
+ return projects.get(GroupedKey.create(projectId, DEFAULT_ENVIRONMENT,projectId));
+ }
+
+ public PipelineStatus getPipelineStatus(String projectId, String environment) {
+ return pipelineStatuses.get(GroupedKey.create(projectId, environment, projectId));
+ }
+
+ public void savePipelineStatus(PipelineStatus status) {
+ pipelineStatuses.put(GroupedKey.create(status.getProjectId(), status.getEnv(), status.getProjectId()), status);
+ }
+
+ public void deletePipelineStatus(PipelineStatus status) {
+ pipelineStatuses.remove(GroupedKey.create(status.getProjectId(), status.getEnv(), status.getProjectId()));
+ }
+
+ public DeploymentStatus getDeploymentStatus(String projectId, String environment) {
+ return deploymentStatuses.get(GroupedKey.create(projectId, environment, projectId));
+ }
+
+ public void saveDeploymentStatus(DeploymentStatus status) {
+ deploymentStatuses.put(GroupedKey.create(status.getProjectId(), status.getEnv(), status.getProjectId()), status);
+ }
+
+ public void deleteDeploymentStatus(DeploymentStatus status) {
+ deploymentStatuses.remove(GroupedKey.create(status.getProjectId(), status.getEnv(), status.getProjectId()));
+ }
+
+ public List<DeploymentStatus> getDeploymentStatuses() {
+ return new ArrayList<>(deploymentStatuses.values());
+ }
+
+ public List<DeploymentStatus> getDeploymentStatuses(String env) {
+ QueryFactory queryFactory = Search.getQueryFactory((RemoteCache<?, ?>) deploymentStatuses);
+ return queryFactory.<DeploymentStatus>create("FROM karavan.DeploymentStatus WHERE env = :env")
+ .setParameter("env", env)
+ .execute().list();
+ }
+
+ public void saveServiceStatus(ServiceStatus status) {
+ serviceStatuses.put(GroupedKey.create(status.getProjectId(), status.getEnv(), status.getProjectId()), status);
+ }
+
+ public void deleteServiceStatus(ServiceStatus status) {
+ serviceStatuses.remove(GroupedKey.create(status.getProjectId(), status.getEnv(), status.getProjectId()));
+ }
+
+ public List<ServiceStatus> getServiceStatuses() {
+ return new ArrayList<>(serviceStatuses.values());
+ }
+
+ public List<ContainerStatus> getContainerStatuses(String projectId, String env) {
+ QueryFactory queryFactory = Search.getQueryFactory(containerStatuses);
+ return queryFactory.<ContainerStatus>create("FROM karavan.ContainerStatus WHERE projectId = :projectId AND env = :env")
+ .setParameter("projectId", projectId)
+ .setParameter("env", env)
+ .execute().list();
+ }
+
+ public ContainerStatus getDevModeContainerStatuses(String projectId, String env) {
+ QueryFactory queryFactory = Search.getQueryFactory(containerStatuses);
+ List<ContainerStatus> list = queryFactory.<ContainerStatus>create("FROM karavan.ContainerStatus WHERE projectId = :projectId AND env = :env AND type = :type")
+ .setParameter("projectId", projectId)
+ .setParameter("env", env)
+ .setParameter("type", ContainerStatus.CType.devmode)
+ .execute().list();
+ return list.size() > 0 ? list.get(0) : null;
+ }
+
+ public List<ContainerStatus> getContainerStatuses(String env) {
+ QueryFactory queryFactory = Search.getQueryFactory(containerStatuses);
+ return queryFactory.<ContainerStatus>create("FROM karavan.ContainerStatus WHERE env = :env")
+ .setParameter("env", env)
+ .execute().list();
+ }
+
+ public List<ContainerStatus> getAllContainerStatuses() {
+ return new ArrayList<>(containerStatuses.values());
+ }
+
+ public void saveContainerStatus(ContainerStatus status) {
+ containerStatuses.put(GroupedKey.create(status.getProjectId(), status.getEnv(), status.getName()), status);
+ }
+
+ public void deleteContainerStatus(ContainerStatus status) {
+ containerStatuses.remove(GroupedKey.create(status.getProjectId(), status.getEnv(), status.getName()));
+ }
+
+ public void deleteContainerStatus(String projectId, String env, String containerName) {
+ containerStatuses.remove(GroupedKey.create(projectId, env, containerName));
+ }
+
+ public CamelStatus getCamelStatus(String projectId, String env, String name) {
+ GroupedKey key = GroupedKey.create(projectId, env, name);
+ return camelStatuses.get(key);
+ }
+
+ public List<CamelStatus> getCamelStatusesByEnv(String env, CamelStatus.Name name) {
+ QueryFactory queryFactory = Search.getQueryFactory(camelStatuses);
+ return queryFactory.<CamelStatus>create("FROM karavan.CamelStatus WHERE env = :env AND name = :name")
+ .setParameter("env", env)
+ .setParameter("name", name)
+ .execute().list();
+ }
+
+ public List<CamelStatus> getCamelStatusesByProjectIdEnv(String projectId, String env) {
+ QueryFactory queryFactory = Search.getQueryFactory(camelStatuses);
+ return queryFactory.<CamelStatus>create("FROM karavan.CamelStatus WHERE projectId = :projectId AND env = :env")
+ .setParameter("projectId", projectId)
+ .setParameter("env", env)
+ .execute().list();
+ }
+
+ public void saveCamelStatus(CamelStatus status) {
+ GroupedKey key = GroupedKey.create(status.getProjectId(), status.getEnv(), status.getName().name());
+ camelStatuses.put(key, status);
+ }
+
+ public void deleteCamelStatus(String projectId, String name, String env) {
+ GroupedKey key = GroupedKey.create(projectId, env, name);
+ camelStatuses.remove(key);
+ }
+
+ public void deleteCamelStatuses(String projectId, String env) {
+ Arrays.stream(CamelStatus.Name.values()).forEach(name -> {
+ GroupedKey key = GroupedKey.create(projectId, env, name.name());
+ camelStatuses.remove(key);
+ });
+ }
+
+ public void saveCommit(String commitId, int time) {
+ commits.put(commitId, String.valueOf(time));
+ }
+
+ public void saveLastCommit(String commitId) {
+ commits.put("lastCommitId", commitId);
+ }
+
+ public Tuple2<String, Integer> getLastCommit() {
+ String lastCommitId = commits.get("lastCommitId");
+ String time = commits.get(lastCommitId);
+ return Tuple2.of(lastCommitId, Integer.parseInt(time));
+ }
+
+ public boolean hasCommit(String commitId) {
+ return commits.get(commitId) != null;
+ }
+
+ public void saveDevModeStatus(DevModeStatus status) {
+ devmodeStatuses.put(GroupedKey.create(status.getProjectId(), DEFAULT_ENVIRONMENT, status.getProjectId()), status);
+ }
+
+ public void deleteDevModeStatus(String projectId) {
+ devmodeStatuses.remove(GroupedKey.create(projectId, DEFAULT_ENVIRONMENT, projectId));
+ }
+
+ public DevModeStatus getDevModeStatus(String projectId) {
+ return devmodeStatuses.get(GroupedKey.create(projectId,DEFAULT_ENVIRONMENT, projectId));
+ }
+
+ public List<DevModeStatus> getLoadedDevModeStatuses() {
+ QueryFactory queryFactory = Search.getQueryFactory(devmodeStatuses);
+ return queryFactory.<DevModeStatus>create("FROM karavan.DevModeStatus WHERE codeLoaded = true")
+ .execute().list();
+ }
+
+ public List<DevModeStatus> getDevModeStatuses() {
+ return new ArrayList<>(devmodeStatuses.values());
+ }
+
+ public void saveContainerInfo(ContainerInfo ci) {
+ containers.put(GroupedKey.create(ci.getContainerName(), ci.getEnv() != null ? ci.getEnv() : DEFAULT_ENVIRONMENT, ci.getContainerName()), ci);
+ }
+
+ public void getContainerInfo(String name, String env) {
+ containers.get(GroupedKey.create(name, env, name));
+ }
+
+ public List<ContainerInfo> getContainerInfos(String env) {
+ QueryFactory queryFactory = Search.getQueryFactory(containers);
+ return queryFactory.<ContainerInfo>create("FROM karavan.ContainerInfo WHERE env = :env")
+ .setParameter("env", env)
+ .execute().list();
+ }
+
+ public void deleteContainerInfo(String containerName) {
+ containers.remove(GroupedKey.create(containerName, DEFAULT_ENVIRONMENT, containerName));
+ }
+
+ public void clearAllStatuses() {
+ CompletableFuture.allOf(
+ deploymentStatuses.clearAsync(),
+ containerStatuses.clearAsync(),
+ pipelineStatuses.clearAsync(),
+ camelStatuses.clearAsync(),
+ devmodeStatuses.clearAsync()
+ ).join();
+ }
+
+ private String getResourceFile(String path) {
+ try {
+ InputStream inputStream = InfinispanService.class.getResourceAsStream(path);
+ return new BufferedReader(new InputStreamReader(inputStream))
+ .lines().collect(Collectors.joining(System.getProperty("line.separator")));
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/CamelStatus.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/CamelStatus.java
new file mode 100644
index 00000000..37109261
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/CamelStatus.java
@@ -0,0 +1,81 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import org.infinispan.protostream.annotations.ProtoEnumValue;
+import org.infinispan.protostream.annotations.ProtoFactory;
+import org.infinispan.protostream.annotations.ProtoField;
+
+public class CamelStatus {
+
+ public enum Name {
+
+ @ProtoEnumValue(number = 0, name = "context") context,
+ @ProtoEnumValue (number = 1, name = "inflight") inflight,
+ @ProtoEnumValue (number = 2, name = "memory") memory,
+ @ProtoEnumValue (number = 3, name = "properties") properties,
+ @ProtoEnumValue (number = 4, name = "route") route,
+ @ProtoEnumValue (number = 5, name = "trace") trace,
+ @ProtoEnumValue (number = 6, name = "jvm") jvm,
+ @ProtoEnumValue (number = 7, name = "source") source
+ }
+
+ public static final String CACHE = "camel_statuses";
+ @ProtoField(number = 1)
+ String projectId;
+ @ProtoField(number = 2)
+ String containerName;
+ @ProtoField(number = 3)
+ Name name;
+ @ProtoField(number = 4)
+ String status;
+ @ProtoField(number = 5)
+ String env;
+
+ @ProtoFactory
+ public CamelStatus(String projectId, String containerName, Name name, String status, String env) {
+ this.projectId = projectId;
+ this.containerName = containerName;
+ this.name = name;
+ this.status = status;
+ this.env = env;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getContainerName() {
+ return containerName;
+ }
+
+ public void setContainerName(String containerName) {
+ this.containerName = containerName;
+ }
+
+ public Name getName() {
+ return name;
+ }
+
+ public void setName(Name name) {
+ this.name = name;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getEnv() {
+ return env;
+ }
+
+ public void setEnv(String env) {
+ this.env = env;
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/CommitInfo.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/CommitInfo.java
new file mode 100644
index 00000000..b7ee2075
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/CommitInfo.java
@@ -0,0 +1,53 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import java.util.List;
+
+public class CommitInfo {
+ private String commitId;
+ private Integer time;
+ private List<GitRepo> repos;
+
+ public CommitInfo(String commitId, Integer time) {
+ this.commitId = commitId;
+ this.time = time;
+ }
+
+ public CommitInfo(String commitId, Integer time, List<GitRepo> repos) {
+ this.commitId = commitId;
+ this.time = time;
+ this.repos = repos;
+ }
+
+ public String getCommitId() {
+ return commitId;
+ }
+
+ public void setCommitId(String commitId) {
+ this.commitId = commitId;
+ }
+
+ public Integer getTime() {
+ return time;
+ }
+
+ public void setTime(Integer time) {
+ this.time = time;
+ }
+
+ public List<GitRepo> getRepos() {
+ return repos;
+ }
+
+ public void setRepos(List<GitRepo> repos) {
+ this.repos = repos;
+ }
+
+ @Override
+ public String toString() {
+ return "CommitInfo{" +
+ "commitId='" + commitId + '\'' +
+ ", time=" + time +
+ ", repos=" + repos +
+ '}';
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/ContainerInfo.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/ContainerInfo.java
new file mode 100644
index 00000000..985e70b3
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/ContainerInfo.java
@@ -0,0 +1,70 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import org.infinispan.protostream.annotations.ProtoFactory;
+import org.infinispan.protostream.annotations.ProtoField;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ContainerInfo {
+ public static final String CACHE = "container_infos";
+ @ProtoField(number = 1)
+ String containerName;
+ @ProtoField(number = 2)
+ String containerId;
+ @ProtoField(number = 3)
+ String image;
+ @ProtoField(number = 4, collectionImplementation = ArrayList.class)
+ List<Integer> ports;
+ @ProtoField(number = 5)
+ String env;
+
+ @ProtoFactory
+ public ContainerInfo(String containerName, String containerId, String image, List<Integer> ports, String env) {
+ this.containerName = containerName;
+ this.containerId = containerId;
+ this.image = image;
+ this.ports = ports;
+ this.env = env;
+ }
+
+ public String getEnv() {
+ return env;
+ }
+
+ public void setEnv(String env) {
+ this.env = env;
+ }
+
+ public String getContainerName() {
+ return containerName;
+ }
+
+ public void setContainerName(String containerName) {
+ this.containerName = containerName;
+ }
+
+ public String getContainerId() {
+ return containerId;
+ }
+
+ public void setContainerId(String containerId) {
+ this.containerId = containerId;
+ }
+
+ public String getImage() {
+ return image;
+ }
+
+ public void setImage(String image) {
+ this.image = image;
+ }
+
+ public List<Integer> getPorts() {
+ return ports;
+ }
+
+ public void setPorts(List<Integer> ports) {
+ this.ports = ports;
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/ContainerStatus.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/ContainerStatus.java
new file mode 100644
index 00000000..d8a3db89
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/ContainerStatus.java
@@ -0,0 +1,141 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import org.infinispan.protostream.annotations.ProtoEnumValue;
+import org.infinispan.protostream.annotations.ProtoFactory;
+import org.infinispan.protostream.annotations.ProtoField;
+
+public class ContainerStatus {
+
+ public enum CType {
+ @ProtoEnumValue(number = 0, name = "devmode") devmode,
+ @ProtoEnumValue(number = 1, name = "devservice") devservice,
+ @ProtoEnumValue(number = 2, name = "pod") pod,
+ @ProtoEnumValue(number = 3, name = "container") container,
+ }
+
+ public static final String CACHE = "pod_statuses";
+ @ProtoField(number = 1)
+ String name;
+ @ProtoField(number = 2)
+ Boolean ready;
+ @ProtoField(number = 3)
+ String projectId;
+ @ProtoField(number = 4)
+ String env;
+ @ProtoField(number = 5)
+ Integer exposedPort;
+ @ProtoField(number = 6)
+ CType type;
+ @ProtoField(number = 7)
+ String memoryInfo;
+ @ProtoField(number = 8)
+ String cpuInfo;
+ @ProtoField(number = 9)
+ String created;
+
+ @ProtoFactory
+ public ContainerStatus(String name, Boolean ready, String projectId, String env, Integer exposedPort, CType type, String memoryInfo, String cpuInfo, String created) {
+ this.name = name;
+ this.ready = ready;
+ this.projectId = projectId;
+ this.env = env;
+ this.exposedPort = exposedPort;
+ this.type = type;
+ this.memoryInfo = memoryInfo;
+ this.cpuInfo = cpuInfo;
+ this.created = created;
+ }
+
+ public ContainerStatus(String name, Boolean ready, String projectId, String env, CType type, String memoryInfo, String cpuInfo, String created) {
+ this.name = name;
+ this.ready = ready;
+ this.projectId = projectId;
+ this.env = env;
+ this.memoryInfo = memoryInfo;
+ this.cpuInfo = cpuInfo;
+ this.created = created;
+ this.type = type;
+ }
+
+ public ContainerStatus(String name, Boolean ready, String projectId, String env, CType type, String created, Integer exposedPort) {
+ this.name = name;
+ this.ready = ready;
+ this.projectId = projectId;
+ this.env = env;
+ this.created = created;
+ this.exposedPort = exposedPort;
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Boolean getReady() {
+ return ready;
+ }
+
+ public void setReady(Boolean ready) {
+ this.ready = ready;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getEnv() {
+ return env;
+ }
+
+ public void setEnv(String env) {
+ this.env = env;
+ }
+
+ public String getMemoryInfo() {
+ return memoryInfo;
+ }
+
+ public void setMemoryInfo(String memoryInfo) {
+ this.memoryInfo = memoryInfo;
+ }
+
+ public String getCpuInfo() {
+ return cpuInfo;
+ }
+
+ public void setCpuInfo(String cpuInfo) {
+ this.cpuInfo = cpuInfo;
+ }
+
+ public String getCreated() {
+ return created;
+ }
+
+ public void setCreated(String created) {
+ this.created = created;
+ }
+
+ public Integer getExposedPort() {
+ return exposedPort;
+ }
+
+ public void setExposedPort(Integer exposedPort) {
+ this.exposedPort = exposedPort;
+ }
+
+ public CType getType() {
+ return type;
+ }
+
+ public void setType(CType type) {
+ this.type = type;
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/DeploymentStatus.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/DeploymentStatus.java
new file mode 100644
index 00000000..95e35d67
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/DeploymentStatus.java
@@ -0,0 +1,111 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import org.infinispan.protostream.annotations.ProtoFactory;
+import org.infinispan.protostream.annotations.ProtoField;
+
+public class DeploymentStatus {
+ public static final String CACHE = "deployment_statuses";
+ @ProtoField(number = 1)
+ String projectId;
+ @ProtoField(number = 2)
+ String namespace;
+ @ProtoField(number = 3)
+ String env;
+ @ProtoField(number = 4)
+ String cluster;
+ @ProtoField(number = 5)
+ String image;
+ @ProtoField(number = 6)
+ Integer replicas;
+ @ProtoField(number = 7)
+ Integer readyReplicas;
+ @ProtoField(number = 8)
+ Integer unavailableReplicas;
+
+ public DeploymentStatus(String projectId, String namespace, String cluster, String env) {
+ this.projectId = projectId;
+ this.namespace = namespace;
+ this.cluster = cluster;
+ this.env = env;
+ this.image = "";
+ this.replicas = 0;
+ this.readyReplicas = 0;
+ this.unavailableReplicas = 0;
+ }
+
+ @ProtoFactory
+ public DeploymentStatus(String projectId, String namespace, String cluster, String env, String image, Integer replicas, Integer readyReplicas, Integer unavailableReplicas) {
+ this.projectId = projectId;
+ this.namespace = namespace;
+ this.env = env;
+ this.cluster = cluster;
+ this.image = image;
+ this.replicas = replicas;
+ this.readyReplicas = readyReplicas;
+ this.unavailableReplicas = unavailableReplicas;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getEnv() {
+ return env;
+ }
+
+ public void setEnv(String env) {
+ this.env = env;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ public String getImage() {
+ return image;
+ }
+
+ public void setImage(String image) {
+ this.image = image;
+ }
+
+ public Integer getReplicas() {
+ return replicas;
+ }
+
+ public void setReplicas(Integer replicas) {
+ this.replicas = replicas;
+ }
+
+ public Integer getReadyReplicas() {
+ return readyReplicas;
+ }
+
+ public void setReadyReplicas(Integer readyReplicas) {
+ this.readyReplicas = readyReplicas;
+ }
+
+ public Integer getUnavailableReplicas() {
+ return unavailableReplicas;
+ }
+
+ public void setUnavailableReplicas(Integer unavailableReplicas) {
+ this.unavailableReplicas = unavailableReplicas;
+ }
+
+ public String getCluster() {
+ return cluster;
+ }
+
+ public void setCluster(String cluster) {
+ this.cluster = cluster;
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/DevModeStatus.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/DevModeStatus.java
new file mode 100644
index 00000000..c45208d3
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/DevModeStatus.java
@@ -0,0 +1,78 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import org.infinispan.protostream.annotations.ProtoFactory;
+import org.infinispan.protostream.annotations.ProtoField;
+
+public class DevModeStatus {
+ public static final String CACHE = "devmode_statuses";
+ @ProtoField(number = 1)
+ String projectId;
+ @ProtoField(number = 2)
+ String containerName;
+ @ProtoField(number = 3)
+ String containerId;
+ @ProtoField(number = 4)
+ Boolean codeLoaded;
+ @ProtoField(number = 5)
+ Boolean logging;
+
+ @ProtoFactory
+ public DevModeStatus(String projectId, String containerName, String containerId, Boolean codeLoaded, Boolean logging) {
+ this.projectId = projectId;
+ this.containerName = containerName;
+ this.containerId = containerId;
+ this.codeLoaded = codeLoaded;
+ this.logging = logging;
+ }
+
+ public DevModeStatus(String projectId, String containerName, String containerId, Boolean codeLoaded) {
+ this.projectId = projectId;
+ this.containerName = containerName;
+ this.containerId = containerId;
+ this.codeLoaded = codeLoaded;
+ this.logging = false;
+ }
+
+ public DevModeStatus() {
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getContainerName() {
+ return containerName;
+ }
+
+ public void setContainerName(String containerName) {
+ this.containerName = containerName;
+ }
+
+ public String getContainerId() {
+ return containerId;
+ }
+
+ public void setContainerId(String containerId) {
+ this.containerId = containerId;
+ }
+
+ public Boolean getCodeLoaded() {
+ return codeLoaded;
+ }
+
+ public void setCodeLoaded(Boolean codeLoaded) {
+ this.codeLoaded = codeLoaded;
+ }
+
+ public Boolean getLogging() {
+ return logging;
+ }
+
+ public void setLogging(Boolean logging) {
+ this.logging = logging;
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/GitConfig.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/GitConfig.java
new file mode 100644
index 00000000..285c8017
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/GitConfig.java
@@ -0,0 +1,48 @@
+package org.apache.camel.karavan.infinispan.model;
+
+public class GitConfig {
+ private String uri;
+ private String username;
+ private String password;
+ private String branch;
+
+ public GitConfig(String uri, String username, String password, String branch) {
+ this.uri = uri;
+ this.username = username;
+ this.password = password;
+ this.branch = branch;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getBranch() {
+ return branch;
+ }
+
+ public void setBranch(String branch) {
+ this.branch = branch;
+ }
+
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/GitRepo.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/GitRepo.java
new file mode 100644
index 00000000..4736814f
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/GitRepo.java
@@ -0,0 +1,49 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import java.util.List;
+
+public class GitRepo {
+ private String name;
+ private String commitId;
+ private Long lastCommitTimestamp;
+ private List<GitRepoFile> files;
+
+ public GitRepo(String name, String commitId, Long lastCommitTimestamp, List<GitRepoFile> files) {
+ this.name = name;
+ this.commitId = commitId;
+ this.lastCommitTimestamp = lastCommitTimestamp;
+ this.files = files;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCommitId() {
+ return commitId;
+ }
+
+ public void setCommitId(String commitId) {
+ this.commitId = commitId;
+ }
+
+ public Long getLastCommitTimestamp() {
+ return lastCommitTimestamp;
+ }
+
+ public void setLastCommitTimestamp(Long lastCommitTimestamp) {
+ this.lastCommitTimestamp = lastCommitTimestamp;
+ }
+
+ public List<GitRepoFile> getFiles() {
+ return files;
+ }
+
+ public void setFiles(List<GitRepoFile> files) {
+ this.files = files;
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/GitRepoFile.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/GitRepoFile.java
new file mode 100644
index 00000000..a1186efe
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/GitRepoFile.java
@@ -0,0 +1,37 @@
+package org.apache.camel.karavan.infinispan.model;
+
+public class GitRepoFile {
+ private String name;
+ private Long lastCommitTimestamp;
+ private String body;
+
+ public GitRepoFile(String name, Long lastCommitTimestamp, String body) {
+ this.name = name;
+ this.lastCommitTimestamp = lastCommitTimestamp;
+ this.body = body;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Long getLastCommitTimestamp() {
+ return lastCommitTimestamp;
+ }
+
+ public void setLastCommitTimestamp(Long lastCommitTimestamp) {
+ this.lastCommitTimestamp = lastCommitTimestamp;
+ }
+
+ public String getBody() {
+ return body;
+ }
+
+ public void setBody(String body) {
+ this.body = body;
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/GroupedKey.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/GroupedKey.java
new file mode 100644
index 00000000..e1889dd2
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/GroupedKey.java
@@ -0,0 +1,81 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import org.infinispan.protostream.annotations.ProtoFactory;
+import org.infinispan.protostream.annotations.ProtoField;
+//import org.infinispan.distribution.group.Group;
+
+
+public class GroupedKey {
+
+ @ProtoField(number = 1)
+ String projectId;
+ @ProtoField(number = 2)
+ String env;
+ @ProtoField(number = 3)
+ String key;
+
+ @ProtoFactory
+ public GroupedKey(String projectId, String env, String key) {
+ this.projectId = projectId;
+ this.env = env;
+ this.key = key;
+ }
+
+ public static GroupedKey create(String projectId, String env, String key) {
+ return new GroupedKey(projectId, env, key);
+ }
+
+ public String getEnv() {
+ return env;
+ }
+
+ public void setEnv(String env) {
+ this.env = env;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+// @Group https://github.com/quarkusio/quarkus/issues/34677
+ public String getProjectId() {
+ return projectId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ GroupedKey that = (GroupedKey) o;
+
+ if (!projectId.equals(that.projectId)) return false;
+ if (!env.equals(that.env)) return false;
+ return key.equals(that.key);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = projectId.hashCode();
+ result = 31 * result + env.hashCode();
+ result = 31 * result + key.hashCode();
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "GroupedKey{" +
+ "projectId='" + projectId + '\'' +
+ ", env='" + env + '\'' +
+ ", key='" + key + '\'' +
+ '}';
+ }
+}
\ No newline at end of file
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/KaravanSchema.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/KaravanSchema.java
new file mode 100644
index 00000000..1b2777ca
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/KaravanSchema.java
@@ -0,0 +1,28 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import org.infinispan.protostream.GeneratedSchema;
+import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
+
+@AutoProtoSchemaBuilder(
+ includeClasses = {
+ GroupedKey.class,
+ Project.class,
+ Project.Type.class,
+ ProjectFile.class,
+ PipelineStatus.class,
+ CamelStatus.class,
+ CamelStatus.Name.class,
+ DeploymentStatus.class,
+ ContainerStatus.class,
+ ContainerStatus.CType.class,
+ ServiceStatus.class,
+ DevModeStatus.class,
+ ContainerInfo.class
+ },
+ schemaFileName = "karavan.proto",
+ schemaFilePath = "proto/",
+ schemaPackageName = "karavan")
+public interface KaravanSchema extends GeneratedSchema {
+}
+
+
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/PipelineStatus.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/PipelineStatus.java
new file mode 100644
index 00000000..fd0831d0
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/PipelineStatus.java
@@ -0,0 +1,83 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import org.infinispan.protostream.annotations.ProtoFactory;
+import org.infinispan.protostream.annotations.ProtoField;
+
+public class PipelineStatus {
+ public static final String CACHE = "pipeline_statuses";
+ @ProtoField(number = 1)
+ String projectId;
+ @ProtoField(number = 2)
+ String pipelineName;
+ @ProtoField(number = 3)
+ String result;
+ @ProtoField(number = 5)
+ String startTime;
+ @ProtoField(number = 6)
+ String completionTime;
+ @ProtoField(number = 7)
+ String env;
+
+ @ProtoFactory
+ public PipelineStatus(String projectId, String pipelineName, String result, String startTime, String completionTime, String env) {
+ this.projectId = projectId;
+ this.pipelineName = pipelineName;
+ this.result = result;
+ this.startTime = startTime;
+ this.completionTime = completionTime;
+ this.env = env;
+ }
+
+ public PipelineStatus(String projectId, String env) {
+ this.projectId = projectId;
+ this.env = env;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getPipelineName() {
+ return pipelineName;
+ }
+
+ public void setPipelineName(String pipelineName) {
+ this.pipelineName = pipelineName;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+ public String getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+
+ public String getCompletionTime() {
+ return completionTime;
+ }
+
+ public void setCompletionTime(String completionTime) {
+ this.completionTime = completionTime;
+ }
+
+ public String getEnv() {
+ return env;
+ }
+
+ public void setEnv(String env) {
+ this.env = env;
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/Project.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/Project.java
new file mode 100644
index 00000000..9c31e296
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/Project.java
@@ -0,0 +1,125 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import org.infinispan.protostream.annotations.ProtoEnumValue;
+import org.infinispan.protostream.annotations.ProtoFactory;
+import org.infinispan.protostream.annotations.ProtoField;
+
+import java.time.Instant;
+
+public class Project {
+ public static final String CACHE = "projects";
+
+ public enum Type {
+
+ @ProtoEnumValue(number = 0, name = "templates") templates,
+ @ProtoEnumValue (number = 1, name = "kamelets") kamelets,
+ @ProtoEnumValue (number = 2, name = "services") services,
+ @ProtoEnumValue (number = 3, name = "pipelines") pipelines,
+ @ProtoEnumValue (number = 4, name = "normal") normal,
+ }
+
+ @ProtoField(number = 1)
+ String projectId;
+ @ProtoField(number = 2)
+ String name;
+ @ProtoField(number = 3)
+ String description;
+ @ProtoField(number = 4)
+ String runtime;
+ @ProtoField(number = 5)
+ String lastCommit;
+ @ProtoField(number = 6)
+ Long lastCommitTimestamp;
+ @ProtoField(number = 7)
+ Type type;
+
+ @ProtoFactory
+ public Project(String projectId, String name, String description, String runtime, String lastCommit, Long lastCommitTimestamp, Type type) {
+ this.projectId = projectId;
+ this.name = name;
+ this.description = description;
+ this.runtime = runtime;
+ this.lastCommit = lastCommit;
+ this.lastCommitTimestamp = lastCommitTimestamp;
+ this.type = type;
+ }
+
+ public Project(String projectId, String name, String description, String runtime, String lastCommit, Long lastCommitTimestamp) {
+ this.projectId = projectId;
+ this.name = name;
+ this.description = description;
+ this.runtime = runtime;
+ this.lastCommit = lastCommit;
+ this.lastCommitTimestamp = lastCommitTimestamp;
+ this.type = Type.normal;
+ }
+
+ public Project(String projectId, String name, String description, String runtime) {
+ this.projectId = projectId;
+ this.name = name;
+ this.description = description;
+ this.runtime = runtime;
+ this.lastCommitTimestamp = Instant.now().toEpochMilli();
+ this.type = Type.normal;
+ }
+
+ public Project() {
+ this.type = Type.normal;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getRuntime() {
+ return runtime;
+ }
+
+ public void setRuntime(String runtime) {
+ this.runtime = runtime;
+ }
+
+ public String getLastCommit() {
+ return lastCommit;
+ }
+
+ public void setLastCommit(String lastCommit) {
+ this.lastCommit = lastCommit;
+ }
+
+ public Long getLastCommitTimestamp() {
+ return lastCommitTimestamp;
+ }
+
+ public void setLastCommitTimestamp(Long lastCommitTimestamp) {
+ this.lastCommitTimestamp = lastCommitTimestamp;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(Type type) {
+ this.type = type;
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/ProjectFile.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/ProjectFile.java
new file mode 100644
index 00000000..14cc3adf
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/ProjectFile.java
@@ -0,0 +1,71 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import org.infinispan.protostream.annotations.ProtoDoc;
+import org.infinispan.protostream.annotations.ProtoFactory;
+import org.infinispan.protostream.annotations.ProtoField;
+
+public class ProjectFile {
+ public static final String CACHE = "project_files";
+ @ProtoField(number = 1)
+ String name;
+ @ProtoField(number = 2)
+ String code;
+ @ProtoField(number = 3)
+ @ProtoDoc("@Field(index=Index.YES, analyze = Analyze.YES, store = Store.NO)")
+ String projectId;
+ @ProtoField(number = 4)
+ Long lastUpdate;
+
+ @ProtoFactory
+ public ProjectFile(String name, String code, String projectId, Long lastUpdate) {
+ this.name = name;
+ this.code = code;
+ this.projectId = projectId;
+ this.lastUpdate = lastUpdate;
+ }
+
+ public ProjectFile() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public Long getLastUpdate() {
+ return lastUpdate;
+ }
+
+ public void setLastUpdate(Long lastUpdate) {
+ this.lastUpdate = lastUpdate;
+ }
+
+ @Override
+ public String toString() {
+ return "ProjectFile{" +
+ "name='" + name + '\'' +
+ ", code='" + code + '\'' +
+ ", projectId='" + projectId + '\'' +
+ ", lastUpdate=" + lastUpdate +
+ '}';
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/ServiceStatus.java b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/ServiceStatus.java
new file mode 100644
index 00000000..9ce1d073
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/java/org/apache/camel/karavan/infinispan/model/ServiceStatus.java
@@ -0,0 +1,107 @@
+package org.apache.camel.karavan.infinispan.model;
+
+import org.infinispan.protostream.annotations.ProtoFactory;
+import org.infinispan.protostream.annotations.ProtoField;
+
+public class ServiceStatus {
+ public static final String CACHE = "service_statuses";
+ @ProtoField(number = 1)
+ String projectId;
+ @ProtoField(number = 2)
+ String namespace;
+ @ProtoField(number = 3)
+ String env;
+ @ProtoField(number = 4)
+ String cluster;
+ @ProtoField(number = 5)
+ Integer port;
+ @ProtoField(number = 6)
+ Integer targetPort;
+ @ProtoField(number = 7)
+ String clusterIP;
+ @ProtoField(number = 8)
+ String type;
+
+ @ProtoFactory
+ public ServiceStatus(String projectId, String namespace, String env, String cluster, Integer port, Integer targetPort, String clusterIP, String type) {
+ this.projectId = projectId;
+ this.namespace = namespace;
+ this.env = env;
+ this.cluster = cluster;
+ this.port = port;
+ this.targetPort = targetPort;
+ this.clusterIP = clusterIP;
+ this.type = type;
+ }
+
+ public ServiceStatus(String projectId, String namespace, String cluster, String env) {
+ this.projectId = projectId;
+ this.namespace = namespace;
+ this.env = env;
+ this.cluster = cluster;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ public String getEnv() {
+ return env;
+ }
+
+ public void setEnv(String env) {
+ this.env = env;
+ }
+
+ public String getCluster() {
+ return cluster;
+ }
+
+ public void setCluster(String cluster) {
+ this.cluster = cluster;
+ }
+
+ public Integer getPort() {
+ return port;
+ }
+
+ public void setPort(Integer port) {
+ this.port = port;
+ }
+
+ public Integer getTargetPort() {
+ return targetPort;
+ }
+
+ public void setTargetPort(Integer targetPort) {
+ this.targetPort = targetPort;
+ }
+
+ public String getClusterIP() {
+ return clusterIP;
+ }
+
+ public void setClusterIP(String clusterIP) {
+ this.clusterIP = clusterIP;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+}
diff --git a/karavan-web/karavan-infinispan/src/main/resources/application.properties b/karavan-web/karavan-infinispan/src/main/resources/application.properties
new file mode 100644
index 00000000..81c48214
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/resources/application.properties
@@ -0,0 +1,14 @@
+infinispan.username=admin
+infinispan.password=password
+infinispan.hosts=localhost:11222
+
+quarkus.infinispan-client.devservices.enabled=true
+quarkus.infinispan-client.devservices.service-name=infinispan
+quarkus.infinispan-client.devservices.image-name=quay.io/infinispan/server:14.0.6.Final
+quarkus.infinispan-client.devservices.port=11222
+quarkus.infinispan-client.health.enabled=false
+
+# Infinispan client intelligence
+# Use BASIC as a Docker for Mac workaround
+quarkus.infinispan-client.client-intelligence=BASIC
+
diff --git a/karavan-web/karavan-infinispan/src/main/resources/cache/command-cache-config.xml b/karavan-web/karavan-infinispan/src/main/resources/cache/command-cache-config.xml
new file mode 100644
index 00000000..27481642
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/resources/cache/command-cache-config.xml
@@ -0,0 +1,6 @@
+<distributed-cache name="%s" mode="SYNC">
+ <encoding media-type="application/x-protostream"/>
+ <locking isolation="REPEATABLE_READ"/>
+ <groups enabled="true"/>
+ <memory max-count="100000" when-full="REMOVE"/>
+</distributed-cache>
\ No newline at end of file
diff --git a/karavan-web/karavan-infinispan/src/main/resources/cache/data-cache-config.xml b/karavan-web/karavan-infinispan/src/main/resources/cache/data-cache-config.xml
new file mode 100644
index 00000000..31f6c304
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/main/resources/cache/data-cache-config.xml
@@ -0,0 +1,6 @@
+<distributed-cache name="%s" mode="SYNC">
+ <encoding media-type="application/x-protostream"/>
+ <locking isolation="REPEATABLE_READ"/>
+ <groups enabled="true"/>
+ <memory max-count="1000000" when-full="REMOVE"/>
+</distributed-cache>
\ No newline at end of file
diff --git a/karavan-web/karavan-infinispan/src/test/java/org/apache/camel/karavan/infinispan/DataGridTest.java b/karavan-web/karavan-infinispan/src/test/java/org/apache/camel/karavan/infinispan/DataGridTest.java
new file mode 100644
index 00000000..d90d4bcc
--- /dev/null
+++ b/karavan-web/karavan-infinispan/src/test/java/org/apache/camel/karavan/infinispan/DataGridTest.java
@@ -0,0 +1,74 @@
+package org.apache.camel.karavan.infinispan;
+
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.vertx.ConsumeEvent;
+import io.vertx.core.json.JsonObject;
+import org.apache.camel.karavan.infinispan.model.CamelStatus;
+import org.apache.camel.karavan.infinispan.model.ContainerInfo;
+import org.apache.camel.karavan.infinispan.model.ProjectFile;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@QuarkusTest
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public class DataGridTest {
+
+ @Inject
+ InfinispanService infinispanService;
+
+ @BeforeAll
+ public void setup() {
+ infinispanService.start(true);
+ }
+
+ @Test
+ public void testContainersStatuses() throws InterruptedException {
+ ContainerInfo ci = new ContainerInfo("demo", "id", "image", List.of(8080, 8081, 8082), "dev");
+ infinispanService.saveContainerInfo(ci);
+ List<ContainerInfo> list = infinispanService.getContainerInfos("dev");
+ assertEquals(1, list.size());
+ }
+
+ @Test
+ public void testProjectFiles() throws InterruptedException {
+ List<ProjectFile> files = infinispanService.getProjectFiles("xxx");
+ assertEquals(0, files.size());
+ }
+
+ @Test
+ public void testCamelStatuses() throws InterruptedException {
+ CamelStatus cs = new CamelStatus("test1", "container1", CamelStatus.Name.context, "", "dev");
+ infinispanService.saveCamelStatus(cs);
+ List<CamelStatus> list = infinispanService.getCamelStatusesByEnv("dev", CamelStatus.Name.context);
+ assertEquals(1, list.size());
+ }
+
+
+ private List<String> commandsReceived = new ArrayList<>();
+ @ConsumeEvent(InfinispanService.CODE_RELOAD_COMMAND)
+ void receiveCommand(String message) {
+ System.out.println("receiveCommand " + message);
+ commandsReceived.add(message);
+ }
+
+ @Test
+ public void sendCommand() throws InterruptedException {
+ List<String> commandsSent = List.of("test1", "test2", "test3", "test1");
+
+ commandsSent.forEach(project -> infinispanService.sendCodeReloadCommand(project));
+
+ CountDownLatch latch = new CountDownLatch(4);
+ latch.await(5, TimeUnit.SECONDS);
+ assertEquals(commandsSent.size(), commandsReceived.size());
+ }
+}