Skip to content

Commit

Permalink
[Improve] remove swagger dependencies. (apache#3903)
Browse files Browse the repository at this point in the history
* [Improve] remove swagger
* [Improve] openapi improvements
  • Loading branch information
wolfboys authored Jul 24, 2024
1 parent 8d9d41e commit 9f9f9c0
Show file tree
Hide file tree
Showing 87 changed files with 803 additions and 691 deletions.
18 changes: 0 additions & 18 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,6 @@ dependency:
license: Apache-2.0
- name: com.github.docker-java:docker-java-transport-httpclient5
license: Apache-2.0
- name: com.github.xiaoymin:knife4j-annotations
license: Apache-2.0
- name: com.github.xiaoymin:knife4j-core
license: Apache-2.0
- name: com.github.xiaoymin:knife4j-spring
license: Apache-2.0
- name: com.github.xiaoymin:knife4j-spring-boot-autoconfigure
license: Apache-2.0
- name: com.github.xiaoymin:knife4j-spring-ui
license: Apache-2.0
- name: io.swagger.core.v3:swagger-annotations
license: Apache-2.0
- name: io.swagger.core.v3:swagger-models
license: Apache-2.0
- name: io.swagger:swagger-annotations
license: Apache-2.0
- name: io.swagger:swagger-models
license: Apache-2.0
- name: com.google.code.gson:gson
license: Apache-2.0
- name: com.google.guava:listenablefuture
Expand Down
28 changes: 13 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ if [[ ${have_tty} -eq 1 ]]; then
GREEN=$(printf '\033[32m')
YELLOW=$(printf '\033[33m')
BLUE=$(printf '\033[34m')
BOLD=$(printf '\033[1m')
RESET=$(printf '\033[0m')
else
PRIMARY=""
RED=""
GREEN=""
YELLOW=""
BLUE=""
BOLD=""
RESET=""
fi

Expand Down Expand Up @@ -82,8 +80,8 @@ case "$(uname)" in
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
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
Expand All @@ -92,32 +90,32 @@ case "$(uname)" in
;;
esac

if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
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" ] &&
[[ -n "$JAVA_HOME" ]] &&
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
[ -n "$CLASSPATH" ] &&
[[ -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" ] &&
[[ -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
if [[ -z "$JAVA_HOME" ]]; then
javaExecutable="$(which javac)"
if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
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 [[ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]]; then
if $darwin ; then
javaHome="$(dirname "\"$javaExecutable\"")"
javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
Expand All @@ -132,7 +130,7 @@ if [ -z "$JAVA_HOME" ]; then
fi
fi

if [ -z "$JAVA_HOME" ] ; then
if [[ -z "$JAVA_HOME" ]]; then
echo "Warning: JAVA_HOME environment variable is not set."
fi

Expand Down Expand Up @@ -172,10 +170,10 @@ print_logo() {
}

build() {
if [ -x "$PRG_DIR/mvnw" ]; then
if [[ -x "$PRG_DIR/mvnw" ]]; then
echo_g "Apache StreamPark, building..."
"$PRG_DIR/mvnw" -Pshaded,webapp,dist -DskipTests clean install
if [ $? -eq 0 ]; then
if [[ $? -eq 0 ]]; then
printf '\n'
echo_g """StreamPark project build successful!
dist: $(cd "$PRG_DIR" &>/dev/null && pwd)/dist\n"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,17 @@ import java.util

class CURLBuilder(val url: String) {

private[this] val headers: util.Map[String, String] =
new util.HashMap[String, String]
private[this] val headers: util.Map[String, String] = new JavaHashMap[String, String]

private[this] val formData: util.Map[String, String] =
new util.HashMap[String, String]
private[this] val formData: util.Map[String, String] = new JavaHashMap[String, String]

def addHeader(k: String, v: String): CURLBuilder = {
this.headers.put(k, v)
this
}

def addFormData(k: String, v: String): CURLBuilder = {
this.formData.put(k, v)
def addFormData(k: String, v: java.io.Serializable): CURLBuilder = {
this.formData.put(k, v.toString)
this
}

Expand All @@ -45,7 +43,7 @@ class CURLBuilder(val url: String) {
cURL.append(String.format("'%s' \\\n", url))
headers.keySet.foreach(h => cURL.append(String.format("-H \'%s: %s\' \\\n", h, headers.get(h))))
formData.foreach(k =>
cURL.append(String.format("--data-urlencode \'%s=%s\' \\\n", k, formData.get(k))))
cURL.append(String.format("--data-urlencode \'%s=%s\' \\\n", k._1, k._2)))
cURL.append("-i")
cURL.toString
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@

package org.apache.streampark.common.util

import org.apache.streampark.common.util.Implicits._

import org.apache.commons.lang3.StringUtils

import java.lang.reflect.{Field, Modifier}
import java.lang.annotation.Annotation
import java.lang.reflect.{Field, Method, Modifier}
import java.util.Objects

import scala.util.{Failure, Success, Try}
Expand Down Expand Up @@ -53,8 +56,9 @@ object ReflectUtils extends Logger {
}

def getFieldValue(obj: Any, field: Field): Any = {
if (Objects.isNull(obj) || Objects.isNull(field)) null
else {
if (obj == null || field == null) {
null
} else {
field.setAccessible(true)
field.get(obj) match {
case Success(v) => v
Expand All @@ -69,8 +73,7 @@ object ReflectUtils extends Logger {
throw new IllegalArgumentException(
"Could not find field [" + fieldName + "] on target [" + obj + "]")
}
try
field.set(obj, value)
try field.set(obj, value)
catch {
case e: IllegalAccessException =>
logError("Failed to assign to the element.", e)
Expand All @@ -88,7 +91,7 @@ object ReflectUtils extends Logger {
makeAccessible(field)
return field
} catch {
case e: NoSuchFieldException =>
case _: NoSuchFieldException =>
}
superClass = superClass.getSuperclass
}
Expand All @@ -103,4 +106,8 @@ object ReflectUtils extends Logger {
}
}

def getMethodsByAnnotation(beanClass: Class[_], annotClazz: Class[_ <: Annotation]): JavaList[Method] = {
beanClass.getDeclaredMethods.filter(_.getDeclaredAnnotation(annotClazz) != null).toList
}

}
21 changes: 0 additions & 21 deletions streampark-console/streampark-console-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
<MaxPermGen>512m</MaxPermGen>
<CodeCacheSize>512m</CodeCacheSize>

<knife4j-openapi3.version>4.0.0</knife4j-openapi3.version>
<springdoc-openapi-ui.version>1.6.9</springdoc-openapi-ui.version>
<commons-compress.version>1.21</commons-compress.version>
<javax-mail.version>1.4.7</javax-mail.version>
<shiro.version>1.10.0</shiro.version>
Expand Down Expand Up @@ -406,25 +404,6 @@
<artifactId>jackson-module-scala_${scala.binary.version}</artifactId>
</dependency>

<!-- openapi -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc-openapi-ui.version}</version>
</dependency>

<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
<version>${knife4j-openapi3.version}</version>
<exclusions>
<exclusion>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webflux-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<!--Test dependencies start.-->
<dependency>
<groupId>org.assertj</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ case "$(uname)" in
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
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
Expand All @@ -42,8 +42,8 @@ case "$(uname)" in
;;
esac

if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
if [[ -z "$JAVA_HOME" ]]; then
if [[ -r /etc/gentoo-release ]]; then
JAVA_HOME=$(java-config --jre-home)
fi
fi
Expand All @@ -62,12 +62,12 @@ if $mingw ; then
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
fi

if [ -z "$JAVA_HOME" ]; then
if [[ -z "$JAVA_HOME" ]]; then
javaExecutable="$(which javac)"
if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
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 [[ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]]; then
if $darwin ; then
javaHome="$(dirname "\"$javaExecutable\"")"
javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
Expand All @@ -82,9 +82,9 @@ if [ -z "$JAVA_HOME" ]; then
fi
fi

if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
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
Expand All @@ -95,12 +95,12 @@ if [ -z "$JAVACMD" ] ; then
fi
fi

if [ ! -x "$JAVACMD" ] ; then
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
if [[ -z "$JAVA_HOME" ]]; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if $os400; then
# this will not work if the user belongs in secondary groups
eval
else
if [ ! -x "$PRG_DIR"/"$EXECUTABLE" ]; then
if [[ ! -x "$PRG_DIR"/"$EXECUTABLE" ]]; then
echo "Cannot find $PRG_DIR/$EXECUTABLE"
echo "The file is absent or does not have execute permission"
echo "This file is needed to run this program"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ esac
# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ] ; do
while [[ -h "$PRG" ]]; do
# shellcheck disable=SC2006
ls=`ls -ld "$PRG"`
# shellcheck disable=SC2006
Expand All @@ -52,7 +52,7 @@ if $os400; then
# this will not work if the user belongs in secondary groups
eval
else
if [ ! -x "$PRG_DIR"/"$EXECUTABLE" ]; then
if [[ ! -x "$PRG_DIR"/"$EXECUTABLE" ]]; then
echo "Cannot find $PRG_DIR/$EXECUTABLE"
echo "The file is absent or does not have execute permission"
echo "This file is needed to run this program"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ stop() {

kill -9 "$PID"

while [ $SLEEP -ge 0 ]; do
while [[ $SLEEP -ge 0 ]]; do
# shellcheck disable=SC2046
# shellcheck disable=SC2006
kill -0 "$PID" >/dev/null 2>&1
Expand Down
Loading

0 comments on commit 9f9f9c0

Please sign in to comment.