diff --git a/eventmesh-admin/.gitignore b/eventmesh-admin/.gitignore deleted file mode 100644 index 63d2f1a0c7..0000000000 --- a/eventmesh-admin/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -.gradle -build/ -!gradle/wrapper/gradle-wrapper.jar -!**/src/main/**/build/ -!**/src/test/**/build/ - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache -bin/ -!**/src/main/**/bin/ -!**/src/test/**/bin/ - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr -out/ -!**/src/main/**/out/ -!**/src/test/**/out/ - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ - -### VS Code ### -.vscode/ diff --git a/eventmesh-admin/README.md b/eventmesh-admin/README.md deleted file mode 100644 index aadf9b82e2..0000000000 --- a/eventmesh-admin/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Getting Started - -## Build on source code - -``` -cd eventmesh-console -./gradlew clean bootJar -``` - -``` -java -jar build/libs/eventmesh-console-0.0.1-SNAPSHOT.jar -``` - -## Build and Run with Docker - -``` -cd eventmesh-console -./gradlew clean bootJar -docker build -t yourname/eventmesh-console -f docker/Dockerfile . -``` - -``` -docker run -d --name eventmesh-console -p 8080:8080 yourname/eventmesh-console -``` \ No newline at end of file diff --git a/eventmesh-admin/build.gradle b/eventmesh-admin/build.gradle deleted file mode 100644 index 5b676ab663..0000000000 --- a/eventmesh-admin/build.gradle +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -plugins { - id 'java' - id 'idea' - id 'org.springframework.boot' version '2.7.15' - id 'io.spring.dependency-management' version '1.0.15.RELEASE' -} - -group = 'org.apache.eventmesh' -version = '0.0.1-SNAPSHOT' - -java { - sourceCompatibility = '1.8' -} - -configurations { - compileOnly { - extendsFrom annotationProcessor - } -} - -repositories { - mavenCentral() - maven { url 'https://maven.aliyun.com/repository/public/' } -} - -ext { - // utility - commonsLang3Version = '3.13.0' - guavaVersion = '32.1.2-jre' // not used for now - fastjsonVersion = '2.0.40' - // swagger - springdocVersion = '1.7.0' - // unit test - mockitoVersion = '5.5.0' - // meta - nacosVersion = '2.2.4' -} - -dependencies { - // versions managed by spring.dependency-management - implementation 'org.springframework.boot:spring-boot-starter-web' - compileOnly 'org.projectlombok:lombok' - developmentOnly 'org.springframework.boot:spring-boot-devtools' - annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' - annotationProcessor 'org.projectlombok:lombok' - testImplementation 'org.springframework.boot:spring-boot-starter-test' - - // utility - implementation "org.apache.commons:commons-lang3:${commonsLang3Version}" - implementation("com.alibaba.fastjson2:fastjson2:${fastjsonVersion}") - // swagger - implementation "org.springdoc:springdoc-openapi-ui:${springdocVersion}" - implementation "org.springdoc:springdoc-openapi-javadoc:${springdocVersion}" - annotationProcessor 'com.github.therapi:therapi-runtime-javadoc-scribe:0.15.0' - // unit test - testImplementation("org.mockito:mockito-core:${mockitoVersion}") - // meta - implementation("com.alibaba.nacos:nacos-client:${nacosVersion}") -} diff --git a/eventmesh-admin/docker/Dockerfile b/eventmesh-admin/docker/Dockerfile deleted file mode 100644 index a59c68f600..0000000000 --- a/eventmesh-admin/docker/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -# -# 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. -# - -FROM openjdk:8-jre-alpine -VOLUME /tmp -COPY build/libs/eventmesh-admin-*.jar eventmesh-admin.jar -ENV JAVA_OPTS="" -ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /eventmesh-admin.jar"] diff --git a/eventmesh-admin/docs/UserGuide_CN.md b/eventmesh-admin/docs/UserGuide_CN.md deleted file mode 100644 index 0ffdd02fcb..0000000000 --- a/eventmesh-admin/docs/UserGuide_CN.md +++ /dev/null @@ -1 +0,0 @@ -// TODO \ No newline at end of file diff --git a/eventmesh-admin/docs/UserGuide_EN.md b/eventmesh-admin/docs/UserGuide_EN.md deleted file mode 100644 index 0ffdd02fcb..0000000000 --- a/eventmesh-admin/docs/UserGuide_EN.md +++ /dev/null @@ -1 +0,0 @@ -// TODO \ No newline at end of file diff --git a/eventmesh-admin/gradle/wrapper/gradle-wrapper.jar b/eventmesh-admin/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 033e24c4cd..0000000000 Binary files a/eventmesh-admin/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/eventmesh-admin/gradle/wrapper/gradle-wrapper.properties b/eventmesh-admin/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 2b303b2bb5..0000000000 --- a/eventmesh-admin/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# 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. -# - -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/eventmesh-admin/gradlew b/eventmesh-admin/gradlew deleted file mode 100644 index fcb6fca147..0000000000 --- a/eventmesh-admin/gradlew +++ /dev/null @@ -1,248 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# 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 -# -# https://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. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -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 - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/eventmesh-admin/gradlew.bat b/eventmesh-admin/gradlew.bat deleted file mode 100644 index 93e3f59f13..0000000000 --- a/eventmesh-admin/gradlew.bat +++ /dev/null @@ -1,92 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/eventmesh-admin/settings.gradle b/eventmesh-admin/settings.gradle deleted file mode 100644 index 5c6d89a336..0000000000 --- a/eventmesh-admin/settings.gradle +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ - -rootProject.name = 'eventmesh-admin' diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/EventMeshAdminApplication.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/EventMeshAdminApplication.java deleted file mode 100644 index af67076178..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/EventMeshAdminApplication.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.eventmesh.admin; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class EventMeshAdminApplication { - - public static void main(String[] args) { - SpringApplication.run(EventMeshAdminApplication.class, args); - } - -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/AdminProperties.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/AdminProperties.java deleted file mode 100644 index bb4e01eb65..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/AdminProperties.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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.eventmesh.admin.config; - -import org.apache.eventmesh.admin.constant.ConfigConst; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -import lombok.Data; - -@Data -@Component -@ConfigurationProperties(prefix = ConfigConst.ADMIN_PROPS_PREFIX) -public class AdminProperties { - - private MetaProperties meta = new MetaProperties(); - - private ConfigProperties config = new ConfigProperties(); - - @Data - public static class MetaProperties { - - private String type = ConfigConst.META_TYPE_NACOS; - - private NacosProperties nacos = new NacosProperties(); - - private EtcdProperties etcd = new EtcdProperties(); - - @Data - public static class NacosProperties { - - private String addr = "127.0.0.1:8848"; - - private String namespace = ""; - - private boolean authEnabled = false; - - private String protocol = "http"; - - private String username; - - private String password; - - private String accessKey; - - private String secretKey; - - } - - @Data - public static class EtcdProperties { - - private String addr; - - } - } - - @Data - public static class ConfigProperties { - - private int timeoutMs = 5000; - - } -} \ No newline at end of file diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/MetaTypeConfig.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/MetaTypeConfig.java deleted file mode 100644 index 5f2602c6b4..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/MetaTypeConfig.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.eventmesh.admin.config; - -import static org.apache.eventmesh.admin.constant.ConfigConst.META_TYPE_ETCD; -import static org.apache.eventmesh.admin.constant.ConfigConst.META_TYPE_NACOS; - -import org.apache.eventmesh.admin.service.ConnectionService; -import org.apache.eventmesh.admin.service.SubscriptionService; -import org.apache.eventmesh.admin.service.impl.EtcdConnectionService; -import org.apache.eventmesh.admin.service.impl.EtcdSubscriptionService; -import org.apache.eventmesh.admin.service.impl.NacosConnectionService; -import org.apache.eventmesh.admin.service.impl.NacosSubscriptionService; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * Use different registry SDK depending on the configured meta type - */ -@Configuration -public class MetaTypeConfig { - - private final AdminProperties adminProperties; - - public MetaTypeConfig(AdminProperties adminProperties) { - this.adminProperties = adminProperties; - } - - @Bean - public ConnectionService connectionService() { - switch (adminProperties.getMeta().getType()) { - case META_TYPE_NACOS: - return new NacosConnectionService(adminProperties); - case META_TYPE_ETCD: - return new EtcdConnectionService(); - default: - throw new IllegalArgumentException("Unsupported eventmesh meta type: " + adminProperties.getMeta().getType()); - } - } - - @Bean - public SubscriptionService subscriptionService() { - switch (adminProperties.getMeta().getType()) { - case META_TYPE_NACOS: - return new NacosSubscriptionService(adminProperties); - case META_TYPE_ETCD: - return new EtcdSubscriptionService(); - default: - throw new IllegalArgumentException("Unsupported eventmesh meta type: " + adminProperties.getMeta().getType()); - } - } -} \ No newline at end of file diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/constant/ConfigConst.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/constant/ConfigConst.java deleted file mode 100644 index 70bf5008da..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/constant/ConfigConst.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.eventmesh.admin.constant; - -public class ConfigConst { - - // yml config - public static final String ADMIN_PROPS_PREFIX = "eventmesh"; - public static final String META_TYPE_NACOS = "nacos"; - public static final String META_TYPE_ETCD = "etcd"; - - // Open-API - public static final String HTTP_PREFIX = "http://"; - public static final String HTTPS_PREFIX = "https://"; - - // common - /** - * colon with space - */ - public static final String COLON = ": "; - -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/constant/NacosConst.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/constant/NacosConst.java deleted file mode 100644 index 1b78b87abd..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/constant/NacosConst.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.eventmesh.admin.constant; - -public class NacosConst { - - public static final String LOGIN_API = "/nacos/v1/auth/login"; - - public static final String LOGIN_REQ_USERNAME = "username"; - public static final String LOGIN_REQ_PASSWORD = "password"; - - public static final String LOGIN_RESP_TOKEN = "accessToken"; - - public static final String CONFIGS_API = "/nacos/v1/cs/configs"; - - public static final String CONFIGS_REQ_PAGE = "pageNo"; - public static final String CONFIGS_REQ_PAGE_SIZE = "pageSize"; - public static final String CONFIGS_REQ_DATAID = "dataId"; - public static final String CONFIGS_REQ_GROUP = "group"; - public static final String CONFIGS_REQ_SEARCH = "search"; - public static final String CONFIGS_REQ_TOKEN = "accessToken"; - - public static final String CONFIGS_RESP_CONTENT_LIST = "pageItems"; // json page data list field - public static final String CONFIGS_RESP_CONTENT = "content"; // json page data field - public static final String CONFIGS_RESP_PAGES = "pagesAvailable"; // json total pages field - public static final String CONFIGS_RESP_DATAID = "dataId"; - public static final String CONFIGS_RESP_GROUP = "group"; -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/controller/ConnectionController.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/controller/ConnectionController.java deleted file mode 100644 index 14df3da586..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/controller/ConnectionController.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.eventmesh.admin.controller; - -import org.apache.eventmesh.admin.service.ConnectionService; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@RestController -public class ConnectionController { - - @Autowired - public ConnectionService connectionService; - - /** - * Query Connection List - *

- * The subscription information of SourceConnector and SinkConnector reported by EventMesh Runtime to the meta, - * containing the configuration of each connection. - * - * @param page the page number - * @param size the page size - * @return A paged list of connection configuration and total number of pages - */ - @GetMapping("/connection") - public String listConnections(@RequestParam("page") Integer page, @RequestParam("size") String size) { - return null; - } - -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/controller/SubscriptionController.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/controller/SubscriptionController.java deleted file mode 100644 index 0c826731cd..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/controller/SubscriptionController.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.eventmesh.admin.controller; - -import org.apache.eventmesh.admin.dto.Result; -import org.apache.eventmesh.admin.model.SubscriptionInfo; -import org.apache.eventmesh.admin.service.SubscriptionService; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@RestController -@RequestMapping("/api/v1") -public class SubscriptionController { - - @Autowired - public SubscriptionService subscriptionService; - - // the subscription dataId naming pattern of EventMesh clients: ip-protocol - private static final String CLIENT_DATA_ID_PATTERN = "*.*.*.*-*"; - - /** - * Retrieve the config content of a specified config. - * - * @param dataId nacos config data id (Exact Matching) - * @param group config group (Exact Matching) - * @return config content - */ - @GetMapping("/subscription") - public Result retrieveSubscription(@RequestParam("dataId") String dataId, @RequestParam("group") String group) { - return Result.success(subscriptionService.retrieveConfig(dataId, group)); - } - - /** - * Retrieve a list of configs. - * - * @param page page number - * @param size page size - * @param dataId nacos config data id (Fuzzy Matching) - * @param group config group (Fuzzy Matching) - * @return config properties and base64 encoded config content - */ - @GetMapping("/subscriptions") - public Result> listSubscriptions( - @RequestParam(name = "page", defaultValue = "1") Integer page, - @RequestParam(name = "size", defaultValue = "10") Integer size, - @RequestParam(name = "dataId", defaultValue = CLIENT_DATA_ID_PATTERN) String dataId, - @RequestParam(name = "group", defaultValue = "") String group) { - return Result.success(subscriptionService.retrieveConfigs(page, size, dataId, group)); - } - -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/dto/Result.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/dto/Result.java deleted file mode 100644 index 1fe2f09fc9..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/dto/Result.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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.eventmesh.admin.dto; - -import static org.apache.eventmesh.admin.enums.Status.SUCCESS; - -import org.apache.eventmesh.admin.enums.Status; -import org.apache.eventmesh.admin.exception.BaseException; - -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * A RESTful response DTO. - */ - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class Result { - - private T data; - - private Integer pages; - - private StatusMessage message; - - public Result(StatusMessage statusMessage) { - this.message = statusMessage; - } - - public Result(T data, Integer pages) { - this.data = data; - this.pages = pages; - } - - /** - * The request is valid and the result is wrapped in {@link Result}. - */ - public static Result success() { - return new Result<>(new StatusMessage(SUCCESS)); - } - - public static Result success(Result result) { - result.setMessage(new StatusMessage(SUCCESS)); - return result; - } - - public static Result success(T data) { - return new Result<>(data, null, new StatusMessage(SUCCESS)); - } - - /** - * The request is valid and the result is returned in {@link ResponseEntity}. - * Logic issues should use 422 Unprocessable Entity instead of 200 OK. - */ - public static ResponseEntity> ok() { - return ResponseEntity.ok(new Result<>(new StatusMessage(SUCCESS))); - } - - public static ResponseEntity> ok(Result result) { - result.setMessage(new StatusMessage(SUCCESS)); - return ResponseEntity.ok(result); - } - - /** - * The request is invalid. - */ - public static ResponseEntity> badRequest(String message) { - return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(new Result<>(new StatusMessage(message))); - } - - /** - * The request is valid but cannot be processed due to business logic issues. - */ - public static ResponseEntity> unprocessable(String message) { - return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(new Result<>(new StatusMessage(message))); - } - - /** - * Uncaught exception happened in EventMeshAdmin application. - */ - public static ResponseEntity> internalError(String message) { - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new Result<>(new StatusMessage(message))); - } - - /** - * Upstream service unavailable such as Meta. - */ - public static ResponseEntity> badGateway(String message) { - return ResponseEntity.status(HttpStatus.BAD_GATEWAY).body(new Result<>(new StatusMessage(message))); - } - - @Data - public static class StatusMessage { - - private String status; - - private String category; - - private String desc; - - public StatusMessage(BaseException e) { - this.status = e.getStatus().name(); - this.category = e.getStatus().getCategory().name(); - this.desc = e.getMessage(); - } - - /** - * Only recommended for returning successful results, - * the stack trace cannot be displayed when returning unsuccessful results. - */ - public StatusMessage(Status status) { - this.status = status.name(); - this.category = status.getCategory().name(); - this.desc = status.getDesc(); // no stack trace - } - - public StatusMessage(String desc) { - this.desc = desc; - } - } -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/enums/Status.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/enums/Status.java deleted file mode 100644 index e5039468cb..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/enums/Status.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.eventmesh.admin.enums; - -import static org.apache.eventmesh.admin.constant.ConfigConst.COLON; - -import org.springframework.http.HttpStatus; - -import lombok.Getter; - -/** - * An enumeration class that conforms to the RESTful specifications and custom error reporting requirements. - *

- */ - -@Getter -public enum Status { - - SUCCESS(HttpStatus.OK, Category.SUCCESS, "Operation success."), - - NACOS_SDK_CONFIG_ERR(HttpStatus.INTERNAL_SERVER_ERROR, Category.SDK_CONFIG_ERR, - "Failed to create Nacos ConfigService. Please check EventMeshAdmin application configuration."), - - NACOS_GET_CONFIGS_ERR(HttpStatus.BAD_GATEWAY, Category.META_COM_ERR, "Failed to retrieve Nacos config(s)."), - - NACOS_EMPTY_RESP_ERR(HttpStatus.BAD_GATEWAY, Category.META_COM_ERR, "No result returned by Nacos. Please check Nacos."), - - NACOS_LOGIN_ERR(HttpStatus.UNAUTHORIZED, Category.META_COM_ERR, "Nacos login failed."), - - NACOS_LOGIN_EMPTY_RESP_ERR(HttpStatus.BAD_GATEWAY, Category.META_COM_ERR, "Nacos didn't return accessToken. Please check Nacos status."), - ; - - // error code - private final HttpStatus code; - - // error type - private final Category category; - - // error message - private final String desc; - - Status(HttpStatus code, Category category, String desc) { - this.code = code; - this.category = category; - this.desc = desc; - } - - @Override - public String toString() { - return name() + " of " + category + COLON + desc; - } - - @Getter - public enum Category { - - SUCCESS("Successfully received and processed"), - - SDK_CONFIG_ERR("The Meta SDK config in EventMeshAdmin application.yml error"), - - META_COM_ERR("Network communication to Meta error"), - ; - - /** - * Helpful for understanding and not used for now - */ - private final String desc; - - Category(String desc) { - this.desc = desc; - } - } -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/BaseException.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/BaseException.java deleted file mode 100644 index dfaee05550..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/BaseException.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.eventmesh.admin.exception; - -import static org.apache.eventmesh.admin.constant.ConfigConst.COLON; - -import org.apache.eventmesh.admin.enums.Status; -import org.apache.eventmesh.admin.util.ExceptionUtil; - -import lombok.Getter; - -/** - * Exceptions in EventMeshAdmin application - */ - -@Getter -public class BaseException extends RuntimeException { - - private static final long serialVersionUID = 3509261993355721168L; - - private Status status; - - public BaseException(String message) { - super(message); - } - - /** - * Customized error reporting using enums and exceptions - */ - public BaseException(Status status, Throwable cause) { - super(ExceptionUtil.trimDesc(status.getDesc()) + COLON + cause.getMessage(), cause); - this.status = status; - } - - public BaseException(Status status) { - super(status.getDesc()); - this.status = status; - } -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/EventMeshAdminException.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/EventMeshAdminException.java deleted file mode 100644 index 00feec5dbf..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/EventMeshAdminException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.eventmesh.admin.exception; - -import org.apache.eventmesh.admin.enums.Status; - -/** - * EventMeshAdmin Application side exception - */ - -public class EventMeshAdminException extends BaseException { - - private static final long serialVersionUID = 2002022502005456586L; - - public EventMeshAdminException(String message) { - super(message); - } - - /** - * Customized error reporting using enums and exceptions - */ - public EventMeshAdminException(Status status, Throwable cause) { - super(status, cause); - } -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/EventMeshException.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/EventMeshException.java deleted file mode 100644 index 224d4e939d..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/EventMeshException.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.eventmesh.admin.exception; - -/** - * EventMesh Runtime side exception - */ - -public class EventMeshException extends BaseException { - - private static final long serialVersionUID = 5648256502005456586L; - - public EventMeshException(String message) { - super(message); - } -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/GlobalExceptionHandler.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/GlobalExceptionHandler.java deleted file mode 100644 index 814fe0f6bd..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/GlobalExceptionHandler.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.eventmesh.admin.exception; - -import org.apache.eventmesh.admin.dto.Result; -import org.apache.eventmesh.admin.dto.Result.StatusMessage; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.RestControllerAdvice; - -import lombok.extern.slf4j.Slf4j; - -/** - * This class, in conjunction with {@linkplain org.apache.eventmesh.admin.enums.Status Status} and {@link BaseException}, - * collectively implements customized error reporting. - */ - -@Slf4j -@RestControllerAdvice -public class GlobalExceptionHandler { - - @ExceptionHandler(BaseException.class) - public ResponseEntity> baseHandler(BaseException e, HttpServletRequest request) { - String uri = request.getRequestURI(); - log.error("RESTful API {} service error occurred, name: {}, category: {}", - uri, e.getStatus().name(), e.getStatus().getCategory().name(), e); - return ResponseEntity.status(e.getStatus().getCode()).body(new Result<>(new StatusMessage(e))); - } - - @ExceptionHandler(RuntimeException.class) - public ResponseEntity> runtimeHandler(RuntimeException e, HttpServletRequest request) { - String uri = request.getRequestURI(); - log.error("RESTful API {} runtime error occurred.", uri, e); - return Result.internalError(e.getMessage()); - } - - @ExceptionHandler(Exception.class) - public ResponseEntity> exceptionHandler(Exception e, HttpServletRequest request) { - String uri = request.getRequestURI(); - log.error("RESTful API {} unknown error occurred.", uri, e); - return Result.internalError(e.getMessage()); - } - -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/MetaException.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/MetaException.java deleted file mode 100644 index 2028eae387..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/MetaException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.eventmesh.admin.exception; - -import org.apache.eventmesh.admin.enums.Status; - -/** - * Meta side exception with EventMeshAdmin Application - */ - -public class MetaException extends BaseException { - - private static final long serialVersionUID = 6246145526338359773L; - - public MetaException(String message) { - super(message); - } - - /** - * Customized error reporting using enums and exceptions - */ - public MetaException(Status status, Throwable cause) { - super(status, cause); - } - - public MetaException(Status status) { - super(status); - } -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/model/ConnectionInfo.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/model/ConnectionInfo.java deleted file mode 100644 index 1e24280675..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/model/ConnectionInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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.eventmesh.admin.model; - -public class ConnectionInfo { - -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/model/SubscriptionInfo.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/model/SubscriptionInfo.java deleted file mode 100644 index 1ad722cd0f..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/model/SubscriptionInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.eventmesh.admin.model; - -import lombok.Builder; -import lombok.Data; - -@Data -@Builder -public class SubscriptionInfo { - - // client name - private String clientName; - - // group name - private String group; - - // config content - private String subscription; -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/ConnectionService.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/ConnectionService.java deleted file mode 100644 index a61c9cd6e8..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/ConnectionService.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.eventmesh.admin.service; - -/** - * "Connection" refers to the subscription relationship between connectors. - * It focuses on the configuration deployed on the source and sink connectors themselves, - * reported by the connector. - */ -public interface ConnectionService { - -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/SubscriptionService.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/SubscriptionService.java deleted file mode 100644 index 9eae5c8275..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/SubscriptionService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.eventmesh.admin.service; - -import org.apache.eventmesh.admin.dto.Result; -import org.apache.eventmesh.admin.model.SubscriptionInfo; - -import java.util.List; - -/** - * "Subscription" refers to the traditional MQ producer-consumer topic subscription relationship, - * emphasizing the subscription relationship between EventMesh clients (including SDK and connectors) and topics, - * reported by the EventMesh runtime. - */ -public interface SubscriptionService { - - String retrieveConfig(String dataId, String group); - - Result> retrieveConfigs(Integer page, Integer size, String dataId, String group); -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/EtcdConnectionService.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/EtcdConnectionService.java deleted file mode 100644 index 00bb767f42..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/EtcdConnectionService.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.eventmesh.admin.service.impl; - -import org.apache.eventmesh.admin.service.ConnectionService; - -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class EtcdConnectionService implements ConnectionService { - -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/EtcdSubscriptionService.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/EtcdSubscriptionService.java deleted file mode 100644 index b05026f999..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/EtcdSubscriptionService.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.eventmesh.admin.service.impl; - -import org.apache.eventmesh.admin.dto.Result; -import org.apache.eventmesh.admin.model.SubscriptionInfo; -import org.apache.eventmesh.admin.service.SubscriptionService; - -import java.util.List; - -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class EtcdSubscriptionService implements SubscriptionService { - - @Override - public String retrieveConfig(String dataId, String group) { - return null; - } - - @Override - public Result> retrieveConfigs(Integer page, Integer size, String dataId, String group) { - return null; - } -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/NacosConnectionService.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/NacosConnectionService.java deleted file mode 100644 index 0d231b73cd..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/NacosConnectionService.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.eventmesh.admin.service.impl; - -import org.apache.eventmesh.admin.config.AdminProperties; -import org.apache.eventmesh.admin.service.ConnectionService; - -import java.util.Properties; - -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class NacosConnectionService implements ConnectionService { - - Properties properties = new Properties(); - - public NacosConnectionService(AdminProperties adminProperties) { - properties.setProperty("serverAddr", adminProperties.getMeta().getNacos().getAddr()); - properties.setProperty("username", adminProperties.getMeta().getNacos().getUsername()); - properties.setProperty("password", adminProperties.getMeta().getNacos().getPassword()); - properties.setProperty("namespace", adminProperties.getMeta().getNacos().getNamespace()); - properties.setProperty("timeoutMs", String.valueOf(adminProperties.getConfig().getTimeoutMs())); - } - -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/NacosSubscriptionService.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/NacosSubscriptionService.java deleted file mode 100644 index 282dab135b..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/NacosSubscriptionService.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * 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.eventmesh.admin.service.impl; - -import static org.apache.eventmesh.admin.enums.Status.NACOS_EMPTY_RESP_ERR; -import static org.apache.eventmesh.admin.enums.Status.NACOS_GET_CONFIGS_ERR; -import static org.apache.eventmesh.admin.enums.Status.NACOS_LOGIN_EMPTY_RESP_ERR; -import static org.apache.eventmesh.admin.enums.Status.NACOS_LOGIN_ERR; -import static org.apache.eventmesh.admin.enums.Status.NACOS_SDK_CONFIG_ERR; - -import org.apache.eventmesh.admin.config.AdminProperties; -import org.apache.eventmesh.admin.constant.ConfigConst; -import org.apache.eventmesh.admin.constant.NacosConst; -import org.apache.eventmesh.admin.dto.Result; -import org.apache.eventmesh.admin.exception.EventMeshAdminException; -import org.apache.eventmesh.admin.exception.MetaException; -import org.apache.eventmesh.admin.model.SubscriptionInfo; -import org.apache.eventmesh.admin.service.SubscriptionService; - -import java.util.ArrayList; -import java.util.Base64; -import java.util.Collections; -import java.util.List; -import java.util.Properties; - -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.util.UriComponentsBuilder; - -import com.alibaba.fastjson2.JSON; -import com.alibaba.fastjson2.JSONObject; -import com.alibaba.nacos.api.NacosFactory; -import com.alibaba.nacos.api.PropertyKeyConst; -import com.alibaba.nacos.api.config.ConfigService; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class NacosSubscriptionService implements SubscriptionService { - - AdminProperties adminProperties; - - Properties nacosProps = new Properties(); - - RestTemplate restTemplate = new RestTemplate(); - - private static String HTTP_PREFIX = ConfigConst.HTTP_PREFIX; - - public NacosSubscriptionService(AdminProperties adminProperties) { - this.adminProperties = adminProperties; - - nacosProps.setProperty(PropertyKeyConst.SERVER_ADDR, adminProperties.getMeta().getNacos().getAddr()); - nacosProps.setProperty(PropertyKeyConst.NAMESPACE, adminProperties.getMeta().getNacos().getNamespace()); - if (adminProperties.getMeta().getNacos().isAuthEnabled()) { - if (!adminProperties.getMeta().getNacos().getUsername().isEmpty()) { - nacosProps.setProperty(PropertyKeyConst.USERNAME, adminProperties.getMeta().getNacos().getUsername()); - } - if (!adminProperties.getMeta().getNacos().getPassword().isEmpty()) { - nacosProps.setProperty(PropertyKeyConst.PASSWORD, adminProperties.getMeta().getNacos().getPassword()); - } - if (!adminProperties.getMeta().getNacos().getAccessKey().isEmpty()) { - nacosProps.setProperty(PropertyKeyConst.ACCESS_KEY, adminProperties.getMeta().getNacos().getAccessKey()); - } - if (!adminProperties.getMeta().getNacos().getSecretKey().isEmpty()) { - nacosProps.setProperty(PropertyKeyConst.SECRET_KEY, adminProperties.getMeta().getNacos().getSecretKey()); - } - } - if (adminProperties.getMeta().getNacos().getProtocol().equalsIgnoreCase("https")) { - HTTP_PREFIX = ConfigConst.HTTPS_PREFIX; - } - } - - /** - * Retrieve a specified config with Nacos SDK. - */ - @Override - public String retrieveConfig(String dataId, String group) { - ConfigService configService; - try { - configService = NacosFactory.createConfigService(nacosProps); - } catch (Exception e) { - log.error(NACOS_SDK_CONFIG_ERR.getDesc(), e); - throw new EventMeshAdminException(NACOS_SDK_CONFIG_ERR, e); - } - try { - return configService.getConfig(dataId, group, adminProperties.getConfig().getTimeoutMs()); - } catch (Exception e) { - log.error(NACOS_GET_CONFIGS_ERR.getDesc(), e); - throw new MetaException(NACOS_GET_CONFIGS_ERR, e); - } - } - - /** - * Retrieve a list of configs with Nacos OpenAPI, because Nacos SDK doesn't support listing and fuzzy matching. - */ - @Override - public Result> retrieveConfigs(Integer page, Integer size, String dataId, String group) { - UriComponentsBuilder urlBuilder = UriComponentsBuilder - .fromHttpUrl(HTTP_PREFIX + nacosProps.getProperty(PropertyKeyConst.SERVER_ADDR) + NacosConst.CONFIGS_API) - .queryParam(NacosConst.CONFIGS_REQ_PAGE, page) - .queryParam(NacosConst.CONFIGS_REQ_PAGE_SIZE, size) - .queryParam(NacosConst.CONFIGS_REQ_DATAID, dataId) - .queryParam(NacosConst.CONFIGS_REQ_GROUP, group) - .queryParam(NacosConst.CONFIGS_REQ_SEARCH, "blur"); - - if (adminProperties.getMeta().getNacos().isAuthEnabled()) { - urlBuilder.queryParam(NacosConst.CONFIGS_REQ_TOKEN, loginGetAccessToken()); - } - - ResponseEntity response; - try { - response = restTemplate.getForEntity(urlBuilder.toUriString(), String.class); - } catch (Exception e) { - log.error(NACOS_GET_CONFIGS_ERR.getDesc(), e); - throw new MetaException(NACOS_GET_CONFIGS_ERR, e); - } - if (response.getBody() == null || response.getBody().isEmpty()) { - log.error(NACOS_EMPTY_RESP_ERR.getDesc()); - throw new MetaException(NACOS_EMPTY_RESP_ERR); - } - - JSONObject obj = JSON.parseObject(response.getBody()); - return new Result<>(toSubscriptionInfos(obj), obj.getInteger(NacosConst.CONFIGS_RESP_PAGES)); - } - - private List toSubscriptionInfos(JSONObject obj) { - List subscriptionInfos = new ArrayList<>(); - for (Object pageItem : obj.getJSONArray(NacosConst.CONFIGS_RESP_CONTENT_LIST)) { - JSONObject pageItemObj = (JSONObject) pageItem; - subscriptionInfos.add(toSubscriptionInfo(pageItemObj)); - } - return subscriptionInfos; - } - - private SubscriptionInfo toSubscriptionInfo(JSONObject obj) { - String content = obj.getString(NacosConst.CONFIGS_RESP_CONTENT); - return SubscriptionInfo.builder() - .clientName(obj.getString(NacosConst.CONFIGS_RESP_DATAID)) - .group(obj.getString(NacosConst.CONFIGS_RESP_GROUP)) - // The subscription content of Nacos config should be base64 encoded to protect special characters. - .subscription(Base64.getEncoder().encodeToString(content.getBytes())) - .build(); - } - - /** - * Login if auth enabled and return accessToken. - */ - private String loginGetAccessToken() { - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - - MultiValueMap bodyParams = new LinkedMultiValueMap<>(); - bodyParams.put(NacosConst.LOGIN_REQ_USERNAME, Collections.singletonList(nacosProps.getProperty(PropertyKeyConst.USERNAME))); - bodyParams.put(NacosConst.LOGIN_REQ_PASSWORD, Collections.singletonList(nacosProps.getProperty(PropertyKeyConst.PASSWORD))); - - String loginUrl = HTTP_PREFIX + nacosProps.getProperty(PropertyKeyConst.SERVER_ADDR) + NacosConst.LOGIN_API; - HttpEntity> loginRequest = new HttpEntity<>(bodyParams, headers); - ResponseEntity loginResponse; - try { - loginResponse = restTemplate.postForEntity(loginUrl, loginRequest, String.class); - } catch (Exception e) { - log.error(NACOS_LOGIN_ERR.getDesc(), e); - throw new MetaException(NACOS_LOGIN_ERR, e); - } - if (loginResponse.getBody() == null || loginResponse.getBody().isEmpty()) { - log.error(NACOS_LOGIN_EMPTY_RESP_ERR + " Status code: {}", loginResponse.getStatusCode()); - throw new MetaException(NACOS_LOGIN_EMPTY_RESP_ERR + " Status code: " + loginResponse.getStatusCode()); - } - return JSON.parseObject(loginResponse.getBody()).getString(NacosConst.LOGIN_RESP_TOKEN); - } -} diff --git a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/util/ExceptionUtil.java b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/util/ExceptionUtil.java deleted file mode 100644 index db82be63f7..0000000000 --- a/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/util/ExceptionUtil.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.eventmesh.admin.util; - -public class ExceptionUtil { - - /** - * Remove the last period of exception description. - */ - public static String trimDesc(String desc) { - if (desc == null) { - return ""; - } - if (desc.charAt(desc.length() - 1) == '.') { - return desc.substring(0, desc.length() - 1); - } - return desc; - } - -} diff --git a/eventmesh-admin/src/main/resources/application.yml b/eventmesh-admin/src/main/resources/application.yml deleted file mode 100644 index d55a238e7c..0000000000 --- a/eventmesh-admin/src/main/resources/application.yml +++ /dev/null @@ -1,51 +0,0 @@ -# -# 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. -# - -spring: - application: - name: eventmesh-admin - -server: - port: 8080 - servlet: - encoding: - charset: UTF-8 - enabled: true - force: true - -logging: - config: classpath:logback.xml - -eventmesh: - meta: - # registry type: nacos, etcd - type: nacos - nacos: - addr: 127.0.0.1:8848 - namespace: # namespace id, empty by default - authEnabled: false - protocol: http # http or https - username: - password: - # Alibaba Cloud MSE Nacos auth, not nacos.token.secret.key - accessKey: - secretKey: - etcd: - addr: # TODO - config: - # timeout for admin client - timeoutMs: 5000 \ No newline at end of file diff --git a/eventmesh-admin/src/main/resources/logback.xml b/eventmesh-admin/src/main/resources/logback.xml deleted file mode 100644 index 29f868bc18..0000000000 --- a/eventmesh-admin/src/main/resources/logback.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - [%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n - - - - - ${user.home}/logs/eventmesh-admin.log - true - - ${user.home}/logs/eventmesh-admin-%d{yyyy-MM-dd}.%i.log - - - 104857600 - - 10 - - - [%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n - UTF-8 - - - - - - - - - \ No newline at end of file diff --git a/eventmesh-admin/src/test/java/org/apache/eventmesh/admin/EventMeshAdminApplicationTests.java b/eventmesh-admin/src/test/java/org/apache/eventmesh/admin/EventMeshAdminApplicationTests.java deleted file mode 100644 index 3e2d7fc2aa..0000000000 --- a/eventmesh-admin/src/test/java/org/apache/eventmesh/admin/EventMeshAdminApplicationTests.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.eventmesh.admin; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class EventMeshAdminApplicationTests { - - @Test - void contextLoads() { - } - -}