From a6382a58ffc9376c0869407a8197659d59f4835a Mon Sep 17 00:00:00 2001 From: benjobs Date: Sun, 27 Jun 2021 18:44:33 +0800 Subject: [PATCH 1/2] streamx 1.0.0 release --- streamx-common/pom.xml | 33 +- .../{AssertUtil.scala => AssertUtils.scala} | 2 +- .../streamx/common/util/DateUtils.scala | 22 +- .../common/util/FlinkClientUtils.scala | 62 ++++ .../streamx/common}/util/FlinkUtils.scala | 4 +- .../streamx/common/util/HadoopUtils.scala | 4 +- .../base/config/P6spySqlFormatConfig.java | 4 +- .../CommonUtil.java => util/CommonUtils.java} | 36 ++- .../EncryptUtils.java} | 8 +- .../GZipUtil.java => util/GZipUtils.java} | 4 +- .../base/{utils => util}/JsonUtils.java | 2 +- .../ObjectUtil.java => util/ObjectUtils.java} | 6 +- .../ShaHashUtils.java} | 4 +- .../SortUtil.java => util/SortUtils.java} | 14 +- .../SpringContextUtils.java} | 6 +- .../TreeUtil.java => util/TreeUtils.java} | 6 +- .../WebUtil.java => util/WebUtils.java} | 12 +- .../streamx/console/base/utils/DateUtil.java | 58 ---- .../streamx/console/base/utils/IPUtil.java | 52 ---- .../console/core/entity/Application.java | 8 +- .../streamx/console/core/entity/Project.java | 12 +- .../core/metrics/flink/JvmProfiler.java | 4 +- .../core/runner/EnvInitializeRunner.java | 6 +- .../impl/ApplicationBackUpServiceImpl.java | 4 +- .../impl/ApplicationConfigServiceImpl.java | 8 +- .../impl/ApplicationLogServiceImpl.java | 4 +- .../service/impl/ApplicationServiceImpl.java | 16 +- .../service/impl/FlameGraphServiceImpl.java | 10 +- .../service/impl/FlinkSqlServiceImpl.java | 8 +- .../core/service/impl/ProjectServiceImpl.java | 12 +- .../service/impl/SavePointServiceImpl.java | 8 +- .../console/core/task/MetricsTask.java | 4 +- .../system/authentication/JWTFilter.java | 8 +- .../system/authentication/JWTUtil.java | 4 +- .../system/controller/PassportController.java | 12 +- .../system/controller/UserController.java | 4 +- .../system/service/impl/MenuServiceImpl.java | 6 +- .../system/service/impl/UserServiceImpl.java | 14 +- .../resources/db/migration/V1_0__init_db.sql | 286 ------------------ .../db/migration/V1_1__init_data.sql | 156 ---------- .../mapper/core/FlameGraphMapper.xml | 2 +- .../flink/core/java/sink/JdbcSink.java | 4 +- .../flink/core/scala/source/HBaseSource.scala | 3 +- .../flink/core/scala/source/JdbcSource.scala | 3 +- .../flink/core/scala/source/MongoSource.scala | 3 +- streamx-parent/pom.xml | 2 +- .../flink/submit/impl/ApplicationSubmit.scala | 16 +- 47 files changed, 258 insertions(+), 708 deletions(-) rename streamx-common/src/main/scala/com/streamxhub/streamx/common/util/{AssertUtil.scala => AssertUtils.scala} (99%) create mode 100644 streamx-common/src/main/scala/com/streamxhub/streamx/common/util/FlinkClientUtils.scala rename {streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala => streamx-common/src/main/scala/com/streamxhub/streamx/common}/util/FlinkUtils.scala (96%) rename streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/{utils/CommonUtil.java => util/CommonUtils.java} (94%) rename streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/{utils/EncryptUtil.java => util/EncryptUtils.java} (94%) rename streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/{utils/GZipUtil.java => util/GZipUtils.java} (98%) rename streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/{utils => util}/JsonUtils.java (97%) rename streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/{utils/ObjectUtil.java => util/ObjectUtils.java} (99%) rename streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/{utils/ShaHashUtil.java => util/ShaHashUtils.java} (96%) rename streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/{utils/SortUtil.java => util/SortUtils.java} (93%) rename streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/{utils/SpringContextUtil.java => util/SpringContextUtils.java} (91%) rename streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/{utils/TreeUtil.java => util/TreeUtils.java} (97%) rename streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/{utils/WebUtil.java => util/WebUtils.java} (88%) delete mode 100644 streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/DateUtil.java delete mode 100644 streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/IPUtil.java delete mode 100644 streamx-console/streamx-console-service/src/main/resources/db/migration/V1_0__init_db.sql delete mode 100644 streamx-console/streamx-console-service/src/main/resources/db/migration/V1_1__init_data.sql diff --git a/streamx-common/pom.xml b/streamx-common/pom.xml index d349039f8f..b92b76040f 100644 --- a/streamx-common/pom.xml +++ b/streamx-common/pom.xml @@ -69,13 +69,13 @@ mysql mysql-connector-java - provided + true redis.clients jedis - provided + true @@ -134,36 +134,51 @@ commons-cli + + + org.apache.flink + flink-core + ${flink.version} + true + + + + org.apache.flink + flink-clients_${scala.binary.version} + ${flink.version} + true + + org.apache.hadoop hadoop-client - provided + true org.apache.hbase hbase-client - provided + true org.apache.hadoop hadoop-yarn-api - provided + true org.apache.hadoop hadoop-yarn-client - provided + true org.mongodb mongo-java-driver 3.12.2 - provided + true @@ -175,14 +190,14 @@ org.apache.curator curator-framework 2.6.0 - provided + true org.apache.ivy ivy 2.4.0 - provided + true diff --git a/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/AssertUtil.scala b/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/AssertUtils.scala similarity index 99% rename from streamx-common/src/main/scala/com/streamxhub/streamx/common/util/AssertUtil.scala rename to streamx-common/src/main/scala/com/streamxhub/streamx/common/util/AssertUtils.scala index 5ff6a7e565..852e47ef2e 100644 --- a/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/AssertUtil.scala +++ b/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/AssertUtils.scala @@ -24,7 +24,7 @@ package com.streamxhub.streamx.common.util import java.util; -object AssertUtil { +object AssertUtils { /** * Assert a boolean expression, throwing IllegalArgumentException if the test result diff --git a/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/DateUtils.scala b/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/DateUtils.scala index 140e424180..c1e5b02828 100644 --- a/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/DateUtils.scala +++ b/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/DateUtils.scala @@ -20,7 +20,9 @@ */ package com.streamxhub.streamx.common.util -import java.text.SimpleDateFormat +import java.text.{ParseException, SimpleDateFormat} +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter import java.util.concurrent.TimeUnit import java.util.{Calendar, TimeZone, _} import scala.util._ @@ -181,6 +183,24 @@ object DateUtils { } } + def formatFullTime(localDateTime: LocalDateTime): String = formatFullTime(localDateTime, fullFormat) + + def formatFullTime(localDateTime: LocalDateTime, pattern: String): String = { + val dateTimeFormatter = DateTimeFormatter.ofPattern(pattern) + localDateTime.format(dateTimeFormatter) + } + + private def getDateFormat(date: Date, dateFormatType: String) = { + val simformat = new SimpleDateFormat(dateFormatType) + simformat.format(date) + } + + @throws[ParseException] def formatCSTTime(date: String, format: String): String = { + val sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US) + val d = sdf.parse(date) + DateUtils.getDateFormat(d, format) + } + def main(args: Array[String]): Unit = { println(DateUtils.+-(-1)) } diff --git a/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/FlinkClientUtils.scala b/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/FlinkClientUtils.scala new file mode 100644 index 0000000000..4150ebcdba --- /dev/null +++ b/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/FlinkClientUtils.scala @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019 The StreamX Project + *

+ * 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 com.streamxhub.streamx.common.util + +import org.apache.flink.api.common.Plan +import org.apache.flink.client.program.{PackagedProgram, PackagedProgramUtils, ProgramInvocationException} +import org.apache.flink.configuration.{Configuration, JobManagerOptions} +import org.apache.flink.optimizer.costs.DefaultCostEstimator +import org.apache.flink.optimizer.plan.OptimizedPlan +import org.apache.flink.optimizer.plandump.PlanJSONDumpGenerator +import org.apache.flink.optimizer.{DataStatistics, Optimizer} + +import java.net.{InetAddress, InetSocketAddress, ServerSocket} + +object FlinkClientUtils { + + + /** + * getExecutionPlan + * + * @param packagedProgram + * @throws + * @return + */ + @throws[ProgramInvocationException] def getExecutionPlan(packagedProgram: PackagedProgram): String = { + require(packagedProgram != null) + val address: InetAddress = InetAddress.getLocalHost + val jmAddress = new InetSocketAddress(address, new ServerSocket(0).getLocalPort) + + val config = new Configuration + config.setString(JobManagerOptions.ADDRESS, jmAddress.getHostName) + config.setInteger(JobManagerOptions.PORT, jmAddress.getPort) + + val optimizer = new Optimizer(new DataStatistics, new DefaultCostEstimator, config) + val plan: Plan = PackagedProgramUtils.getPipelineFromProgram(packagedProgram, config, -1, true).asInstanceOf[Plan] + val optimizedPlan: OptimizedPlan = optimizer.compile(plan) + require(optimizedPlan != null) + + val dumper = new PlanJSONDumpGenerator + dumper.setEncodeForHTML(true) + dumper.getOptimizerPlanAsJSON(optimizedPlan) + } + +} diff --git a/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/util/FlinkUtils.scala b/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/FlinkUtils.scala similarity index 96% rename from streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/util/FlinkUtils.scala rename to streamx-common/src/main/scala/com/streamxhub/streamx/common/util/FlinkUtils.scala index 09f5e16ffa..ed01f8bcf7 100644 --- a/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/util/FlinkUtils.scala +++ b/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/FlinkUtils.scala @@ -18,7 +18,8 @@ * specific language governing permissions and limitations * under the License. */ -package com.streamxhub.streamx.flink.core.scala.util +package com.streamxhub.streamx.common.util + import org.apache.flink.api.common.state.{ListState, ListStateDescriptor} import org.apache.flink.api.common.typeinfo.TypeInformation @@ -30,5 +31,4 @@ object FlinkUtils { context.getOperatorStateStore.getUnionListState(new ListStateDescriptor(descriptorName, implicitly[TypeInformation[R]].getTypeClass)) } - } diff --git a/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/HadoopUtils.scala b/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/HadoopUtils.scala index 13f49ab103..ac1d0dcdd8 100644 --- a/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/HadoopUtils.scala +++ b/streamx-common/src/main/scala/com/streamxhub/streamx/common/util/HadoopUtils.scala @@ -106,7 +106,7 @@ object HadoopUtils extends Logger { if (!configurationCache.containsKey(confDir)) { FileUtils.exists(confDir) val hadoopConfDir = new File(confDir) - val confName = List("core-site.xml", "hdfs-site.xml", "yarn-site.xml") + val confName = List("core-site.xml", "hdfs-site.xml", "yarn-site.xml","mapred-site.xml") val files = hadoopConfDir.listFiles().filter(x => x.isFile && confName.contains(x.getName)).toList val conf = new Configuration() if (CollectionUtils.isNotEmpty(files)) { @@ -175,7 +175,7 @@ object HadoopUtils extends Logger { logInfo("kerberos authentication successful") } catch { case e: IOException => - logInfo(s"kerberos login failed,${e.getLocalizedMessage}") + logError(s"kerberos login failed,${e.getLocalizedMessage}") throw e } } diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/config/P6spySqlFormatConfig.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/config/P6spySqlFormatConfig.java index 3ee8aa9768..1c09ac061a 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/config/P6spySqlFormatConfig.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/config/P6spySqlFormatConfig.java @@ -21,7 +21,7 @@ package com.streamxhub.streamx.console.base.config; import com.p6spy.engine.spy.appender.MessageFormattingStrategy; -import com.streamxhub.streamx.console.base.utils.DateUtil; +import com.streamxhub.streamx.common.util.DateUtils; import org.apache.commons.lang3.StringUtils; import java.time.LocalDateTime; @@ -49,7 +49,7 @@ public String formatMessage( return StringUtils.isBlank(sql) ? "" : String.format( "%s | 耗时 %d ms | SQL 语句:\n %s;", - DateUtil.formatFullTime(LocalDateTime.now()), + DateUtils.formatFullTime(LocalDateTime.now()), elapsed, sql.replaceAll("[\\s]+", StringUtils.SPACE) ); diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/CommonUtil.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/CommonUtils.java similarity index 94% rename from streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/CommonUtil.java rename to streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/CommonUtils.java index 47f59dbcd3..141bdb6695 100755 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/CommonUtil.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/CommonUtils.java @@ -18,9 +18,9 @@ * specific language governing permissions and limitations * under the License. */ -package com.streamxhub.streamx.console.base.utils; +package com.streamxhub.streamx.console.base.util; -import com.streamxhub.streamx.common.util.AssertUtil; +import com.streamxhub.streamx.common.util.AssertUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.cglib.beans.BeanMap; @@ -30,7 +30,7 @@ import java.util.*; @Slf4j -public class CommonUtil implements Serializable { +public class CommonUtils implements Serializable { private static final long serialVersionUID = 6458428317155311192L; @@ -41,7 +41,6 @@ public class CommonUtil implements Serializable { * * @param objs 要判断,处理的对象 * @return Boolean - * @author Ben * @see 对象为Null返回true,集合的大小为0也返回true,迭代器没有下一个也返回true.. * @since 1.0 */ @@ -110,7 +109,6 @@ public static Boolean isEmpty(Object... objs) { * * @param obj 要判断,处理的对象 * @return Boolean - * @author Ben * @see 与非空相反 * @since 1.0 */ @@ -179,14 +177,14 @@ public static Float toFloat(Object val) { } public static List arrayToList(Object source) { - return Arrays.asList(ObjectUtil.toObjectArray(source)); + return Arrays.asList(ObjectUtils.toObjectArray(source)); } public static boolean contains(Iterator iterator, Object element) { if (iterator != null) { while (iterator.hasNext()) { Object candidate = iterator.next(); - if (ObjectUtil.safeEquals(candidate, element)) { + if (ObjectUtils.safeEquals(candidate, element)) { return true; } } @@ -205,7 +203,7 @@ public static boolean contains(Enumeration enumeration, Object element) { if (enumeration != null) { while (enumeration.hasMoreElements()) { Object candidate = enumeration.nextElement(); - if (ObjectUtil.safeEquals(candidate, element)) { + if (ObjectUtils.safeEquals(candidate, element)) { return true; } } @@ -420,10 +418,10 @@ public static boolean isUnix() { */ public static int getPlatform() { int platform = 0; - if (CommonUtil.isUnix()) { + if (CommonUtils.isUnix()) { platform = 1; } - if (CommonUtil.isWindows()) { + if (CommonUtils.isWindows()) { platform = 2; } return platform; @@ -440,7 +438,7 @@ public static > Map sortMapByValue(Map< } public static T[] arrayRemoveElements(T[] array, T... elem) { - AssertUtil.notNull(array); + AssertUtils.notNull(array); List arrayList = new ArrayList<>(0); Collections.addAll(arrayList, array); if (isEmpty(elem)) { @@ -453,7 +451,7 @@ public static T[] arrayRemoveElements(T[] array, T... elem) { } public static T[] arrayRemoveIndex(T[] array, int... index) { - AssertUtil.notNull(array); + AssertUtils.notNull(array); for (int j : index) { if (j < 0 || j > array.length - 1) { throw new IndexOutOfBoundsException("index error.@" + j); @@ -470,7 +468,7 @@ public static T[] arrayRemoveIndex(T[] array, int... index) { } public static T[] arrayInsertIndex(T[] array, int index, T t) { - AssertUtil.notNull(array); + AssertUtils.notNull(array); List arrayList = new ArrayList(array.length + 1); if (index == 0) { arrayList.add(t); @@ -579,8 +577,8 @@ public static List> objectsToMaps(List objList) { if (objList != null && objList.size() > 0) { Map map = null; T bean = null; - for (int i = 0, size = objList.size(); i < size; i++) { - bean = objList.get(i); + for (T t : objList) { + bean = t; map = beanToMap(bean); list.add(map); } @@ -601,10 +599,10 @@ public static List mapsToObjects(List> maps, Class throws InstantiationException, IllegalAccessException { List list = new ArrayList<>(); if (maps != null && maps.size() > 0) { - Map map = null; - T bean = null; - for (int i = 0, size = maps.size(); i < size; i++) { - map = maps.get(i); + Map map; + T bean; + for (Map stringObjectMap : maps) { + map = stringObjectMap; bean = clazz.newInstance(); mapToBean(map, bean); list.add(bean); diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/EncryptUtil.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/EncryptUtils.java similarity index 94% rename from streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/EncryptUtil.java rename to streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/EncryptUtils.java index ed21b1f4b1..2f62a4eb64 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/EncryptUtil.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/EncryptUtils.java @@ -18,12 +18,12 @@ * specific language governing permissions and limitations * under the License. */ -package com.streamxhub.streamx.console.base.utils; +package com.streamxhub.streamx.console.base.util; import javax.crypto.Cipher; import java.security.Key; -public class EncryptUtil { +public class EncryptUtils { // 设置默认密匙 private static String strDefaultKey = "defaultKey"; @@ -60,11 +60,11 @@ private static byte[] hexStr2ByteArr(String strIn) { return arrOut; } - public EncryptUtil() throws Exception { + public EncryptUtils() throws Exception { this(strDefaultKey); } - EncryptUtil(String strKey) throws Exception { + EncryptUtils(String strKey) throws Exception { /* * Security.addProvider(new com.sun.crypto.provider.SunJCE()); */ diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/GZipUtil.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/GZipUtils.java similarity index 98% rename from streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/GZipUtil.java rename to streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/GZipUtils.java index 55f01343e4..5d2e20f066 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/GZipUtil.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/GZipUtils.java @@ -18,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package com.streamxhub.streamx.console.base.utils; +package com.streamxhub.streamx.console.base.util; import org.apache.commons.compress.archivers.ArchiveInputStream; import org.apache.commons.compress.archivers.ArchiveStreamFactory; @@ -30,7 +30,7 @@ /** * @author benjobs */ -public class GZipUtil { +public class GZipUtils { /** * @param tarZipSource 源文件 * @param targetDir 目标目录 diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/JsonUtils.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/JsonUtils.java similarity index 97% rename from streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/JsonUtils.java rename to streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/JsonUtils.java index c3f4d37230..cbb326bfdd 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/JsonUtils.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/JsonUtils.java @@ -18,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package com.streamxhub.streamx.console.base.utils; +package com.streamxhub.streamx.console.base.util; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/ObjectUtil.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/ObjectUtils.java similarity index 99% rename from streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/ObjectUtil.java rename to streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/ObjectUtils.java index c039e6256a..9d13276f0d 100755 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/ObjectUtil.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/ObjectUtils.java @@ -19,11 +19,9 @@ * under the License. */ -package com.streamxhub.streamx.console.base.utils; +package com.streamxhub.streamx.console.base.util; /** - * @Package: cn.damai.usercenter.common.util @Description: TODO - * @author: Wanghuajie * @date: 13-3-6 - 上午11:17 * @version: V1.0 * @company: damai @@ -32,7 +30,7 @@ import java.lang.reflect.Array; import java.util.Arrays; -public class ObjectUtil { +public class ObjectUtils { private static final int INITIAL_HASH = 7; private static final int MULTIPLIER = 31; diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/ShaHashUtil.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/ShaHashUtils.java similarity index 96% rename from streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/ShaHashUtil.java rename to streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/ShaHashUtils.java index b5703897a4..50f94568c0 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/ShaHashUtil.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/ShaHashUtils.java @@ -18,14 +18,14 @@ * specific language governing permissions and limitations * under the License. */ -package com.streamxhub.streamx.console.base.utils; +package com.streamxhub.streamx.console.base.util; import org.apache.shiro.crypto.hash.Sha256Hash; import org.apache.shiro.util.ByteSource; import java.util.Random; -public class ShaHashUtil { +public class ShaHashUtils { /** * 用户密码加密 diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/SortUtil.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/SortUtils.java similarity index 93% rename from streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/SortUtil.java rename to streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/SortUtils.java index 3f41ac34c7..ea2c18f875 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/SortUtil.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/SortUtils.java @@ -18,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package com.streamxhub.streamx.console.base.utils; +package com.streamxhub.streamx.console.base.util; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -30,7 +30,7 @@ * 处理排序工具类 */ @SuppressWarnings("unchecked") -public class SortUtil { +public class SortUtils { /** * 处理排序(分页情况下) for mybatis-plus * @@ -48,10 +48,10 @@ public static void handlePageSort( boolean camelToUnderscore) { page.setCurrent(request.getPageNum()); page.setSize(request.getPageSize()); - String sortField = WebUtil.camelToUnderscore(request.getSortField()); + String sortField = WebUtils.camelToUnderscore(request.getSortField()); if (camelToUnderscore) { - sortField = WebUtil.camelToUnderscore(sortField); - defaultSort = WebUtil.camelToUnderscore(defaultSort); + sortField = WebUtils.camelToUnderscore(sortField); + defaultSort = WebUtils.camelToUnderscore(defaultSort); } if (StringUtils.isNotBlank(request.getSortField()) && StringUtils.isNotBlank(request.getSortOrder()) @@ -111,8 +111,8 @@ public static void handleWrapperSort( boolean camelToUnderscore) { String sortField = request.getSortField(); if (camelToUnderscore) { - sortField = WebUtil.camelToUnderscore(sortField); - defaultSort = WebUtil.camelToUnderscore(defaultSort); + sortField = WebUtils.camelToUnderscore(sortField); + defaultSort = WebUtils.camelToUnderscore(defaultSort); } if (StringUtils.isNotBlank(request.getSortField()) && StringUtils.isNotBlank(request.getSortOrder()) diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/SpringContextUtil.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/SpringContextUtils.java similarity index 91% rename from streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/SpringContextUtil.java rename to streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/SpringContextUtils.java index 59b1ce92a9..c7c92ad980 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/SpringContextUtil.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/SpringContextUtils.java @@ -18,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package com.streamxhub.streamx.console.base.utils; +package com.streamxhub.streamx.console.base.util; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; @@ -31,12 +31,12 @@ * @author benjobs */ @Component -public class SpringContextUtil implements ApplicationContextAware { +public class SpringContextUtils implements ApplicationContextAware { private static ApplicationContext applicationContext; @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - SpringContextUtil.applicationContext = applicationContext; + SpringContextUtils.applicationContext = applicationContext; } public static Object getBean(String name) { diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/TreeUtil.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/TreeUtils.java similarity index 97% rename from streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/TreeUtil.java rename to streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/TreeUtils.java index 8e1a7d8b79..6470b5afb3 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/TreeUtil.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/TreeUtils.java @@ -18,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package com.streamxhub.streamx.console.base.utils; +package com.streamxhub.streamx.console.base.util; import com.streamxhub.streamx.console.base.domain.router.RouterTree; import com.streamxhub.streamx.console.base.domain.router.VueRouter; @@ -26,9 +26,9 @@ import java.util.ArrayList; import java.util.List; -public class TreeUtil { +public class TreeUtils { - protected TreeUtil() { + protected TreeUtils() { } private static final String TOP_NODE_ID = "0"; diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/WebUtil.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/WebUtils.java similarity index 88% rename from streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/WebUtil.java rename to streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/WebUtils.java index 702b281a67..0e85282ff8 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/WebUtil.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/util/WebUtils.java @@ -18,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package com.streamxhub.streamx.console.base.utils; +package com.streamxhub.streamx.console.base.util; import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.streamxhub.streamx.console.base.domain.Constant; @@ -32,7 +32,7 @@ * 工具类 */ @Slf4j -public class WebUtil { +public class WebUtils { /** * token 加密 @@ -42,8 +42,8 @@ public class WebUtil { */ public static String encryptToken(String token) { try { - EncryptUtil encryptUtil = new EncryptUtil(Constant.TOKEN_CACHE_PREFIX); - return encryptUtil.encrypt(token); + EncryptUtils encryptUtils = new EncryptUtils(Constant.TOKEN_CACHE_PREFIX); + return encryptUtils.encrypt(token); } catch (Exception e) { log.info("token加密失败:", e); return null; @@ -58,8 +58,8 @@ public static String encryptToken(String token) { */ public static String decryptToken(String encryptToken) { try { - EncryptUtil encryptUtil = new EncryptUtil(Constant.TOKEN_CACHE_PREFIX); - return encryptUtil.decrypt(encryptToken); + EncryptUtils encryptUtils = new EncryptUtils(Constant.TOKEN_CACHE_PREFIX); + return encryptUtils.decrypt(encryptToken); } catch (Exception e) { log.info("token解密失败:", e); return null; diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/DateUtil.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/DateUtil.java deleted file mode 100644 index ce8dbf24ca..0000000000 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/DateUtil.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2019 The StreamX Project - *

- * 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 com.streamxhub.streamx.console.base.utils; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Date; -import java.util.Locale; - -/** - * 时间工具类 - */ -public class DateUtil { - - public static final String FULL_TIME_PATTERN = "yyyyMMddHHmmss"; - - public static final String FULL_TIME_SPLIT_PATTERN = "yyyy-MM-dd HH:mm:ss"; - - public static String formatFullTime(LocalDateTime localDateTime) { - return formatFullTime(localDateTime, FULL_TIME_PATTERN); - } - - public static String formatFullTime(LocalDateTime localDateTime, String pattern) { - DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern); - return localDateTime.format(dateTimeFormatter); - } - - private static String getDateFormat(Date date, String dateFormatType) { - SimpleDateFormat simformat = new SimpleDateFormat(dateFormatType); - return simformat.format(date); - } - - public static String formatCSTTime(String date, String format) throws ParseException { - SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); - Date d = sdf.parse(date); - return DateUtil.getDateFormat(d, format); - } -} diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/IPUtil.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/IPUtil.java deleted file mode 100644 index 922e9ddaae..0000000000 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/base/utils/IPUtil.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2019 The StreamX Project - *

- * 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 com.streamxhub.streamx.console.base.utils; - -import javax.servlet.http.HttpServletRequest; - -/** - * @author benjobs - */ -public class IPUtil { - - private static final String UNKNOWN = "unknown"; - - protected IPUtil() { - } - - /** - * 获取 IP地址 使用 Nginx等反向代理软件, 则不能通过 request.getRemoteAddr()获取 IP地址 - * 如果使用了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP地址, X-Forwarded-For中第一个非 unknown的有效IP字符串,则为真实IP地址 - */ - public static String getIpAddr(HttpServletRequest request) { - String ip = request.getHeader("x-forwarded-for"); - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("WL-Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getRemoteAddr(); - } - return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip; - } -} diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/entity/Application.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/entity/Application.java index 182759798c..d98ffbc6e7 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/entity/Application.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/entity/Application.java @@ -31,8 +31,8 @@ import com.streamxhub.streamx.common.util.HadoopUtils; import com.streamxhub.streamx.common.util.HttpClientUtils; import com.streamxhub.streamx.common.util.Utils; -import com.streamxhub.streamx.console.base.utils.JsonUtils; -import com.streamxhub.streamx.console.base.utils.SpringContextUtil; +import com.streamxhub.streamx.console.base.util.JsonUtils; +import com.streamxhub.streamx.console.base.util.SpringContextUtils; import com.streamxhub.streamx.console.core.enums.ApplicationType; import com.streamxhub.streamx.console.core.enums.DeployState; import com.streamxhub.streamx.console.core.enums.FlinkAppState; @@ -236,13 +236,13 @@ public boolean eqFlinkJob(Application other) { @JsonIgnore public File getLocalAppBase() { - String localWorkspace = SpringContextUtil.getBean(SettingService.class).getStreamXWorkspace(); + String localWorkspace = SpringContextUtils.getBean(SettingService.class).getStreamXWorkspace(); return new File(localWorkspace.concat("/app/").concat(projectId.toString())); } @JsonIgnore public File getLocalFlinkSqlBase() { - String localWorkspace = SpringContextUtil.getBean(SettingService.class).getStreamXWorkspace(); + String localWorkspace = SpringContextUtils.getBean(SettingService.class).getStreamXWorkspace(); File flinkSql = new File(localWorkspace, "flinksql"); if (!flinkSql.exists()) { flinkSql.mkdirs(); diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/entity/Project.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/entity/Project.java index 724eee76b1..b568c67e40 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/entity/Project.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/entity/Project.java @@ -25,8 +25,8 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.streamxhub.streamx.console.base.utils.CommonUtil; -import com.streamxhub.streamx.console.base.utils.SpringContextUtil; +import com.streamxhub.streamx.console.base.util.CommonUtils; +import com.streamxhub.streamx.console.base.util.SpringContextUtils; import com.streamxhub.streamx.console.core.enums.GitAuthorizedError; import com.streamxhub.streamx.console.core.service.SettingService; import lombok.Data; @@ -103,7 +103,7 @@ public class Project implements Serializable { private String getStreamXWorkspace() { if (settingService == null) { - settingService = SpringContextUtil.getBean(SettingService.class); + settingService = SpringContextUtils.getBean(SettingService.class); } return settingService.getStreamXWorkspace(); } @@ -159,7 +159,7 @@ public void delete() throws IOException { public List getAllBranches() { try { Collection refList; - if (CommonUtil.notEmpty(username, password)) { + if (CommonUtils.notEmpty(username, password)) { UsernamePasswordCredentialsProvider pro = new UsernamePasswordCredentialsProvider(username, password); refList = Git.lsRemoteRepository().setRemote(url).setCredentialsProvider(pro).call(); } else { @@ -182,7 +182,7 @@ public List getAllBranches() { @JsonIgnore public GitAuthorizedError gitCheck() { try { - if (CommonUtil.notEmpty(username, password)) { + if (CommonUtils.notEmpty(username, password)) { UsernamePasswordCredentialsProvider credentialsProvider = new UsernamePasswordCredentialsProvider(username, password); Git.lsRemoteRepository().setRemote(url).setCredentialsProvider(credentialsProvider).call(); } else { @@ -221,7 +221,7 @@ public void cleanCloned() throws IOException { @JsonIgnore public List getMavenBuildCmd() { String buildHome = this.getAppSource().getAbsolutePath(); - if (CommonUtil.notEmpty(this.getPom())) { + if (CommonUtils.notEmpty(this.getPom())) { buildHome = new File(buildHome.concat("/").concat(this.getPom())) .getParentFile() .getAbsolutePath(); diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/metrics/flink/JvmProfiler.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/metrics/flink/JvmProfiler.java index 25d7558c24..761e246f9e 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/metrics/flink/JvmProfiler.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/metrics/flink/JvmProfiler.java @@ -23,7 +23,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.ObjectMapper; import com.streamxhub.streamx.common.util.DeflaterUtils; -import com.streamxhub.streamx.console.base.utils.CommonUtil; +import com.streamxhub.streamx.console.base.util.CommonUtils; import lombok.Data; import java.io.IOException; @@ -48,7 +48,7 @@ public class JvmProfiler implements Serializable { @JsonIgnore public Map getMetricsAsMap() throws IOException { - if (CommonUtil.notEmpty(metric)) { + if (CommonUtils.notEmpty(metric)) { String content = DeflaterUtils.unzipString(metric); return mapper.readValue(content, Map.class); } diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/runner/EnvInitializeRunner.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/runner/EnvInitializeRunner.java index 6008a841a3..6c7ccb448c 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/runner/EnvInitializeRunner.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/runner/EnvInitializeRunner.java @@ -22,7 +22,7 @@ import com.streamxhub.streamx.common.conf.ConfigConst; import com.streamxhub.streamx.common.util.HdfsUtils; -import com.streamxhub.streamx.console.base.utils.WebUtil; +import com.streamxhub.streamx.console.base.util.WebUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; @@ -102,7 +102,7 @@ public void run(ApplicationArguments args) throws Exception { String keepFile = ".gitkeep"; - File plugins = new File(WebUtil.getAppDir("plugins")); + File plugins = new File(WebUtils.getAppDir("plugins")); for (File file : Objects.requireNonNull(plugins.listFiles())) { String plugin = appPlugins.concat("/").concat(file.getName()); if (!HdfsUtils.exists(plugin) && !keepFile.equals(file.getName())) { @@ -117,7 +117,7 @@ public void run(ApplicationArguments args) throws Exception { } String regex = "^streamx-flink-shims_flink-(1.12|1.13)-(.*).jar$"; Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE | Pattern.DOTALL); - File[] shims = new File(WebUtil.getAppDir("lib")).listFiles(pathname -> pathname.getName().matches(regex)); + File[] shims = new File(WebUtils.getAppDir("lib")).listFiles(pathname -> pathname.getName().matches(regex)); for (File file : Objects.requireNonNull(shims)) { Matcher matcher = pattern.matcher(file.getName()); if (!keepFile.equals(file.getName()) && matcher.matches()) { diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationBackUpServiceImpl.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationBackUpServiceImpl.java index 28dc862ecc..43b457e168 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationBackUpServiceImpl.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationBackUpServiceImpl.java @@ -32,7 +32,7 @@ import com.streamxhub.streamx.console.base.domain.Constant; import com.streamxhub.streamx.console.base.domain.RestRequest; import com.streamxhub.streamx.console.base.exception.ServiceException; -import com.streamxhub.streamx.console.base.utils.SortUtil; +import com.streamxhub.streamx.console.base.util.SortUtils; import com.streamxhub.streamx.console.core.dao.ApplicationBackUpMapper; import com.streamxhub.streamx.console.core.entity.Application; import com.streamxhub.streamx.console.core.entity.ApplicationBackUp; @@ -90,7 +90,7 @@ public class ApplicationBackUpServiceImpl @Override public IPage page(ApplicationBackUp backUp, RestRequest request) { Page page = new Page<>(); - SortUtil.handlePageSort(request, page, "create_time", Constant.ORDER_DESC, false); + SortUtils.handlePageSort(request, page, "create_time", Constant.ORDER_DESC, false); return this.baseMapper.page(page, backUp.getAppId()); } diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationConfigServiceImpl.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationConfigServiceImpl.java index 93be50197b..9d27e02d3b 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationConfigServiceImpl.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationConfigServiceImpl.java @@ -31,8 +31,8 @@ import com.streamxhub.streamx.common.util.Utils; import com.streamxhub.streamx.console.base.domain.Constant; import com.streamxhub.streamx.console.base.domain.RestRequest; -import com.streamxhub.streamx.console.base.utils.SortUtil; -import com.streamxhub.streamx.console.base.utils.WebUtil; +import com.streamxhub.streamx.console.base.util.SortUtils; +import com.streamxhub.streamx.console.base.util.WebUtils; import com.streamxhub.streamx.console.core.dao.ApplicationConfigMapper; import com.streamxhub.streamx.console.core.entity.Application; import com.streamxhub.streamx.console.core.entity.ApplicationConfig; @@ -214,7 +214,7 @@ public ApplicationConfig get(Long id) { @Override public IPage page(ApplicationConfig config, RestRequest request) { Page page = new Page<>(); - SortUtil.handlePageSort(request, page, "version", Constant.ORDER_DESC, false); + SortUtils.handlePageSort(request, page, "version", Constant.ORDER_DESC, false); return this.baseMapper.page(page, config.getAppId()); } @@ -243,7 +243,7 @@ public synchronized String readTemplate() { String path; if (profiles.equals(PROD_ENV_NAME)) { //生产环境部署读取conf/flink-application.template - path = WebUtil.getAppDir("conf").concat("/flink-application.template"); + path = WebUtils.getAppDir("conf").concat("/flink-application.template"); } else { URL url = Thread.currentThread().getContextClassLoader().getResource("flink-application.template"); assert url != null; diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationLogServiceImpl.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationLogServiceImpl.java index e31f536b10..7dce7250a3 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationLogServiceImpl.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationLogServiceImpl.java @@ -25,7 +25,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.streamxhub.streamx.console.base.domain.Constant; import com.streamxhub.streamx.console.base.domain.RestRequest; -import com.streamxhub.streamx.console.base.utils.SortUtil; +import com.streamxhub.streamx.console.base.util.SortUtils; import com.streamxhub.streamx.console.core.dao.ApplicationLogMapper; import com.streamxhub.streamx.console.core.entity.Application; import com.streamxhub.streamx.console.core.entity.ApplicationLog; @@ -47,7 +47,7 @@ public class ApplicationLogServiceImpl extends ServiceImpl page(ApplicationLog applicationLog, RestRequest request) { Page page = new Page<>(); - SortUtil.handlePageSort(request, page, "start_time", Constant.ORDER_DESC, false); + SortUtils.handlePageSort(request, page, "start_time", Constant.ORDER_DESC, false); return this.baseMapper.page(page, applicationLog.getAppId()); } diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationServiceImpl.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationServiceImpl.java index 0e52c7c163..d80c9a53ba 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationServiceImpl.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationServiceImpl.java @@ -34,9 +34,9 @@ import com.streamxhub.streamx.console.base.domain.Constant; import com.streamxhub.streamx.console.base.domain.RestRequest; import com.streamxhub.streamx.console.base.exception.ServiceException; -import com.streamxhub.streamx.console.base.utils.CommonUtil; -import com.streamxhub.streamx.console.base.utils.SortUtil; -import com.streamxhub.streamx.console.base.utils.WebUtil; +import com.streamxhub.streamx.console.base.util.CommonUtils; +import com.streamxhub.streamx.console.base.util.SortUtils; +import com.streamxhub.streamx.console.base.util.WebUtils; import com.streamxhub.streamx.console.core.annotation.RefreshCache; import com.streamxhub.streamx.console.core.dao.ApplicationMapper; import com.streamxhub.streamx.console.core.entity.*; @@ -229,7 +229,7 @@ public boolean upload(MultipartFile file) throws IOException { } //2) 确定需要上传,先上传到本地零时目录 - String temp = WebUtil.getAppDir("temp"); + String temp = WebUtils.getAppDir("temp"); File saveFile = new File(temp, file.getOriginalFilename()); // delete when exsit if (saveFile.exists()) { @@ -354,7 +354,7 @@ private void removeApp(Long appId) { @Override public IPage page(Application appParam, RestRequest request) { Page page = new Page<>(); - SortUtil.handlePageSort(request, page, "create_time", Constant.ORDER_DESC, false); + SortUtils.handlePageSort(request, page, "create_time", Constant.ORDER_DESC, false); this.baseMapper.page(page, appParam); //瞒天过海,暗度陈仓,偷天换日,鱼目混珠. List records = page.getRecords(); @@ -660,7 +660,7 @@ private void downloadDependency(Application application) throws Exception { //1) init. File jobLocalHome = application.getLocalFlinkSqlBase(); if (jobLocalHome.exists()) { - if (!CommonUtil.deleteFile(jobLocalHome)) { + if (!CommonUtils.deleteFile(jobLocalHome)) { throw new RuntimeException(jobLocalHome + " delete failed."); } } @@ -961,7 +961,7 @@ public boolean start(Application appParam, boolean auto) throws Exception { this.flinkSqlService.cleanCandidate(flinkSql.getId()); //1) dist_userJar - File localPlugins = new File(WebUtil.getAppDir("plugins")); + File localPlugins = new File(WebUtils.getAppDir("plugins")); assert localPlugins.exists(); List jars = Arrays.stream(Objects.requireNonNull(localPlugins.list())).filter(x -> x.matches("streamx-flink-sqlclient-.*\\.jar")).collect(Collectors.toList()); if (jars.isEmpty()) { @@ -1004,7 +1004,7 @@ public boolean start(Application appParam, boolean auto) throws Exception { option.append(" -n "); } - String[] dynamicOption = CommonUtil.notEmpty(application.getDynamicOptions()) + String[] dynamicOption = CommonUtils.notEmpty(application.getDynamicOptions()) ? application.getDynamicOptions().split("\\s+") : new String[0]; diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/FlameGraphServiceImpl.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/FlameGraphServiceImpl.java index 2025e95708..2a88aa013d 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/FlameGraphServiceImpl.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/FlameGraphServiceImpl.java @@ -22,8 +22,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.streamxhub.streamx.common.util.CommandUtils; -import com.streamxhub.streamx.console.base.utils.CommonUtil; -import com.streamxhub.streamx.console.base.utils.WebUtil; +import com.streamxhub.streamx.console.base.util.CommonUtils; +import com.streamxhub.streamx.console.base.util.WebUtils; import com.streamxhub.streamx.console.core.dao.FlameGraphMapper; import com.streamxhub.streamx.console.core.entity.Application; import com.streamxhub.streamx.console.core.entity.FlameGraph; @@ -62,7 +62,7 @@ public String generateFlameGraph(FlameGraph flameGraph) throws IOException { flameGraph.getStart(), flameGraph.getEnd() ); - if (CommonUtil.notEmpty(flameGraphList)) { + if (CommonUtils.notEmpty(flameGraphList)) { StringBuffer jsonBuffer = new StringBuffer(); flameGraphList.forEach(x -> jsonBuffer.append(x.getUnzipContent()).append("\r\n")); @@ -73,10 +73,10 @@ public String generateFlameGraph(FlameGraph flameGraph) throws IOException { flameGraph.getStart().getTime(), flameGraph.getEnd().getTime() ); - String jsonPath = WebUtil.getAppDir("temp").concat(File.separator).concat(jsonName); + String jsonPath = WebUtils.getAppDir("temp").concat(File.separator).concat(jsonName); String foldedPath = jsonPath.replace(".json", ".folded"); String svgPath = jsonPath.replace(".json", ".svg"); - String flameGraphPath = WebUtil.getAppDir("bin/flame-graph"); + String flameGraphPath = WebUtils.getAppDir("bin/flame-graph"); // write json FileOutputStream fileOutputStream = new FileOutputStream(jsonPath); diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/FlinkSqlServiceImpl.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/FlinkSqlServiceImpl.java index 5c4937a4ba..f24c1216c6 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/FlinkSqlServiceImpl.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/FlinkSqlServiceImpl.java @@ -25,9 +25,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.streamxhub.streamx.common.util.ClassLoaderUtils; import com.streamxhub.streamx.common.util.DeflaterUtils; -import com.streamxhub.streamx.console.base.utils.WebUtil; +import com.streamxhub.streamx.console.base.util.WebUtils; import com.streamxhub.streamx.console.core.dao.FlinkSqlMapper; import com.streamxhub.streamx.console.core.entity.Application; import com.streamxhub.streamx.console.core.entity.FlinkSql; @@ -52,7 +51,6 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import java.util.function.Supplier; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -200,7 +198,7 @@ private synchronized ClassLoader getFlinkShimsClassLoader() { String shimsRegex = "(^|.*)streamx-flink-shims_flink-(1.12|1.13)-(.*).jar$"; Pattern pattern = Pattern.compile(shimsRegex, Pattern.CASE_INSENSITIVE | Pattern.DOTALL); - File[] libJars = new File(WebUtil.getAppDir("lib")).listFiles(pathname -> !pathname.getName().matches(shimsRegex)); + File[] libJars = new File(WebUtils.getAppDir("lib")).listFiles(pathname -> !pathname.getName().matches(shimsRegex)); assert libJars != null; List libList = new ArrayList<>(0); for (File jar : libJars) { @@ -208,7 +206,7 @@ private synchronized ClassLoader getFlinkShimsClassLoader() { } List shimsList = new ArrayList<>(0); - File[] shimsJars = new File(WebUtil.getAppDir("lib")).listFiles(pathname -> pathname.getName().matches(shimsRegex)); + File[] shimsJars = new File(WebUtils.getAppDir("lib")).listFiles(pathname -> pathname.getName().matches(shimsRegex)); assert shimsJars != null; for (File jar : shimsJars) { shimsList.add(jar.toURI().toURL()); diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ProjectServiceImpl.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ProjectServiceImpl.java index b064b2e9a5..f4c3fa5026 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ProjectServiceImpl.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ProjectServiceImpl.java @@ -31,9 +31,9 @@ import com.streamxhub.streamx.console.base.domain.Constant; import com.streamxhub.streamx.console.base.domain.RestRequest; import com.streamxhub.streamx.console.base.domain.RestResponse; -import com.streamxhub.streamx.console.base.utils.CommonUtil; -import com.streamxhub.streamx.console.base.utils.GZipUtil; -import com.streamxhub.streamx.console.base.utils.SortUtil; +import com.streamxhub.streamx.console.base.util.CommonUtils; +import com.streamxhub.streamx.console.base.util.GZipUtils; +import com.streamxhub.streamx.console.base.util.SortUtils; import com.streamxhub.streamx.console.core.dao.ApplicationMapper; import com.streamxhub.streamx.console.core.dao.ProjectMapper; import com.streamxhub.streamx.console.core.entity.Application; @@ -129,7 +129,7 @@ public boolean delete(Long id) { @Override public IPage page(Project project, RestRequest request) { Page page = new Page<>(); - SortUtil.handlePageSort(request, page, "date", Constant.ORDER_DESC, false); + SortUtils.handlePageSort(request, page, "date", Constant.ORDER_DESC, false); return this.baseMapper.findProject(page, project); } @@ -303,7 +303,7 @@ public List> listConf(Project project) { File file = new File(project.getAppBase(), project.getModule()); File unzipFile = new File(file.getAbsolutePath().replaceAll(".tar.gz", "")); if (!unzipFile.exists()) { - GZipUtil.decompress(file.getAbsolutePath(), file.getParentFile().getAbsolutePath()); + GZipUtils.decompress(file.getAbsolutePath(), file.getParentFile().getAbsolutePath()); } List> list = new ArrayList<>(); // 只过滤conf这个目录 @@ -329,7 +329,7 @@ private boolean cloneSourceCode(Project project) { .setDirectory(project.getAppSource()) .setBranch(project.getBranches()); - if (CommonUtil.notEmpty(project.getUsername(), project.getPassword())) { + if (CommonUtils.notEmpty(project.getUsername(), project.getPassword())) { cloneCommand.setCredentialsProvider(project.getCredentialsProvider()); } diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/SavePointServiceImpl.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/SavePointServiceImpl.java index 417e356a51..714ed2f592 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/SavePointServiceImpl.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/SavePointServiceImpl.java @@ -30,8 +30,8 @@ import com.streamxhub.streamx.console.base.domain.Constant; import com.streamxhub.streamx.console.base.domain.RestRequest; import com.streamxhub.streamx.console.base.exception.ServiceException; -import com.streamxhub.streamx.console.base.utils.CommonUtil; -import com.streamxhub.streamx.console.base.utils.SortUtil; +import com.streamxhub.streamx.console.base.util.CommonUtils; +import com.streamxhub.streamx.console.base.util.SortUtils; import com.streamxhub.streamx.console.core.dao.SavePointMapper; import com.streamxhub.streamx.console.core.entity.SavePoint; import com.streamxhub.streamx.console.core.enums.CheckPointType; @@ -108,7 +108,7 @@ public SavePoint getLatest(Long id) { public Boolean delete(Long id) throws ServiceException { SavePoint savePoint = getById(id); try { - if (CommonUtil.notEmpty(savePoint.getPath())) { + if (CommonUtils.notEmpty(savePoint.getPath())) { HdfsUtils.delete(savePoint.getPath()); } removeById(id); @@ -121,7 +121,7 @@ public Boolean delete(Long id) throws ServiceException { @Override public IPage page(SavePoint savePoint, RestRequest request) { Page page = new Page<>(); - SortUtil.handlePageSort(request, page, "trigger_time", Constant.ORDER_DESC, false); + SortUtils.handlePageSort(request, page, "trigger_time", Constant.ORDER_DESC, false); return this.baseMapper.page(page, savePoint.getAppId()); } diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/task/MetricsTask.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/task/MetricsTask.java index 883d84c4bb..37cdab50b0 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/task/MetricsTask.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/task/MetricsTask.java @@ -20,7 +20,7 @@ */ package com.streamxhub.streamx.console.core.task; -import com.streamxhub.streamx.console.base.utils.WebUtil; +import com.streamxhub.streamx.console.base.util.WebUtils; import com.streamxhub.streamx.console.core.service.FlameGraphService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -48,7 +48,7 @@ public class MetricsTask { @Scheduled(cron = "0 0 * * * ?") public void cleanFlameGraph() { // 1) clean file - String tempPath = WebUtil.getAppDir("temp"); + String tempPath = WebUtils.getAppDir("temp"); File temp = new File(tempPath); Arrays.stream(Objects.requireNonNull(temp.listFiles())) .filter(x -> x.getName().matches(FLAMEGRAPH_FILE_REGEXP)) diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/authentication/JWTFilter.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/authentication/JWTFilter.java index 289c553ea8..d4335d6ad5 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/authentication/JWTFilter.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/authentication/JWTFilter.java @@ -22,8 +22,8 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.streamxhub.streamx.console.base.properties.ShiroProperties; -import com.streamxhub.streamx.console.base.utils.SpringContextUtil; -import com.streamxhub.streamx.console.base.utils.WebUtil; +import com.streamxhub.streamx.console.base.util.SpringContextUtils; +import com.streamxhub.streamx.console.base.util.WebUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.UnauthorizedException; @@ -52,7 +52,7 @@ protected boolean isAccessAllowed( ServletRequest request, ServletResponse response, Object mappedValue) throws UnauthorizedException { HttpServletRequest httpServletRequest = (HttpServletRequest) request; - ShiroProperties properties = SpringContextUtil.getBean(ShiroProperties.class); + ShiroProperties properties = SpringContextUtils.getBean(ShiroProperties.class); String[] anonUrl = StringUtils.splitByWholeSeparatorPreserveAllTokens( properties.getAnonUrl(), StringPool.COMMA @@ -81,7 +81,7 @@ protected boolean isLoginAttempt(ServletRequest request, ServletResponse respons protected boolean executeLogin(ServletRequest request, ServletResponse response) { HttpServletRequest httpServletRequest = (HttpServletRequest) request; String token = httpServletRequest.getHeader(TOKEN); - JWTToken jwtToken = new JWTToken(WebUtil.decryptToken(token)); + JWTToken jwtToken = new JWTToken(WebUtils.decryptToken(token)); try { getSubject(request, response).login(jwtToken); return true; diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/authentication/JWTUtil.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/authentication/JWTUtil.java index dfddb5a484..50df452582 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/authentication/JWTUtil.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/authentication/JWTUtil.java @@ -26,7 +26,7 @@ import com.auth0.jwt.exceptions.JWTDecodeException; import com.auth0.jwt.interfaces.DecodedJWT; import com.streamxhub.streamx.console.base.properties.ShiroProperties; -import com.streamxhub.streamx.console.base.utils.SpringContextUtil; +import com.streamxhub.streamx.console.base.util.SpringContextUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -38,7 +38,7 @@ @Slf4j public class JWTUtil { - private static final long EXPIRE_TIME = SpringContextUtil.getBean(ShiroProperties.class).getJwtTimeOut() * 1000; + private static final long EXPIRE_TIME = SpringContextUtils.getBean(ShiroProperties.class).getJwtTimeOut() * 1000; /** * 校验 token是否正确 diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/controller/PassportController.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/controller/PassportController.java index 8179baf88b..e285462ba5 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/controller/PassportController.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/controller/PassportController.java @@ -20,11 +20,11 @@ */ package com.streamxhub.streamx.console.system.controller; +import com.streamxhub.streamx.common.util.DateUtils; import com.streamxhub.streamx.console.base.domain.RestResponse; import com.streamxhub.streamx.console.base.properties.ShiroProperties; -import com.streamxhub.streamx.console.base.utils.DateUtil; -import com.streamxhub.streamx.console.base.utils.ShaHashUtil; -import com.streamxhub.streamx.console.base.utils.WebUtil; +import com.streamxhub.streamx.console.base.util.ShaHashUtils; +import com.streamxhub.streamx.console.base.util.WebUtils; import com.streamxhub.streamx.console.system.authentication.JWTToken; import com.streamxhub.streamx.console.system.authentication.JWTUtil; import com.streamxhub.streamx.console.system.entity.User; @@ -75,7 +75,7 @@ public RestResponse signin( } String salt = user.getSalt(); - password = ShaHashUtil.encrypt(salt, password); + password = ShaHashUtils.encrypt(salt, password); if (!StringUtils.equals(user.getPassword(), password)) { return RestResponse.create().put("code", 0); @@ -87,9 +87,9 @@ public RestResponse signin( // 更新用户登录时间 this.userService.updateLoginTime(username); - String token = WebUtil.encryptToken(JWTUtil.sign(username, password)); + String token = WebUtils.encryptToken(JWTUtil.sign(username, password)); LocalDateTime expireTime = LocalDateTime.now().plusSeconds(properties.getJwtTimeOut()); - String expireTimeStr = DateUtil.formatFullTime(expireTime); + String expireTimeStr = DateUtils.formatFullTime(expireTime); JWTToken jwtToken = new JWTToken(token, expireTimeStr); String userId = RandomStringUtils.randomAlphanumeric(20); user.setId(userId); diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/controller/UserController.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/controller/UserController.java index b1cb4af36e..15c72ae499 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/controller/UserController.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/controller/UserController.java @@ -25,7 +25,7 @@ import com.streamxhub.streamx.console.base.domain.RestRequest; import com.streamxhub.streamx.console.base.domain.RestResponse; import com.streamxhub.streamx.console.base.exception.ServiceException; -import com.streamxhub.streamx.console.base.utils.ShaHashUtil; +import com.streamxhub.streamx.console.base.util.ShaHashUtils; import com.streamxhub.streamx.console.system.entity.User; import com.streamxhub.streamx.console.system.service.UserService; import lombok.extern.slf4j.Slf4j; @@ -111,7 +111,7 @@ public RestResponse checkPassword( User user = userService.findByName(username); String salt = user.getSalt(); - String encryptPassword = ShaHashUtil.encrypt(salt, password); + String encryptPassword = ShaHashUtils.encrypt(salt, password); boolean result = StringUtils.equals(user.getPassword(), encryptPassword); return RestResponse.create().data(result); } diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/service/impl/MenuServiceImpl.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/service/impl/MenuServiceImpl.java index 34c83c62f4..7f730eebfd 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/service/impl/MenuServiceImpl.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/service/impl/MenuServiceImpl.java @@ -26,7 +26,7 @@ import com.streamxhub.streamx.console.base.domain.router.RouterMeta; import com.streamxhub.streamx.console.base.domain.router.RouterTree; import com.streamxhub.streamx.console.base.domain.router.VueRouter; -import com.streamxhub.streamx.console.base.utils.TreeUtil; +import com.streamxhub.streamx.console.base.util.TreeUtils; import com.streamxhub.streamx.console.system.dao.MenuMapper; import com.streamxhub.streamx.console.system.entity.Menu; import com.streamxhub.streamx.console.system.entity.User; @@ -70,7 +70,7 @@ public Map findMenus(Menu menu) { if (StringUtils.equals(menu.getType(), Constant.TYPE_BUTTON)) { result.put("rows", trees); } else { - RouterTree

menuTree = TreeUtil.build(trees); + RouterTree menuTree = TreeUtils.build(trees); result.put("rows", menuTree); } result.put("total", menus.size()); @@ -133,7 +133,7 @@ public ArrayList> getUserRouters(User user) { route.setMeta(new RouterMeta(true, hidden, true, menu.getIcon())); routes.add(route); }); - return TreeUtil.buildVueRouter(routes); + return TreeUtils.buildVueRouter(routes); } private void buildTrees(List> trees, List menus, List ids) { diff --git a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/service/impl/UserServiceImpl.java b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/service/impl/UserServiceImpl.java index 2bb1590e56..d11545ced6 100644 --- a/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/service/impl/UserServiceImpl.java +++ b/streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/system/service/impl/UserServiceImpl.java @@ -26,7 +26,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.streamxhub.streamx.console.base.domain.RestRequest; -import com.streamxhub.streamx.console.base.utils.ShaHashUtil; +import com.streamxhub.streamx.console.base.util.ShaHashUtils; import com.streamxhub.streamx.console.system.dao.UserMapper; import com.streamxhub.streamx.console.system.entity.Menu; import com.streamxhub.streamx.console.system.entity.User; @@ -88,8 +88,8 @@ public void createUser(User user) throws Exception { // 创建用户 user.setCreateTime(new Date()); user.setAvatar(User.DEFAULT_AVATAR); - String salt = ShaHashUtil.getRandomSalt(26); - String password = ShaHashUtil.encrypt(salt, user.getPassword()); + String salt = ShaHashUtils.getRandomSalt(26); + String password = ShaHashUtils.encrypt(salt, user.getPassword()); user.setSalt(salt); user.setPassword(password); save(user); @@ -137,8 +137,8 @@ public void updateAvatar(String username, String avatar) throws Exception { @Transactional(rollbackFor = Exception.class) public void updatePassword(String username, String password) throws Exception { User user = new User(); - String salt = ShaHashUtil.getRandomSalt(26); - password = ShaHashUtil.encrypt(salt, password); + String salt = ShaHashUtils.getRandomSalt(26); + password = ShaHashUtils.encrypt(salt, password); user.setSalt(salt); user.setPassword(password); this.baseMapper.update(user, new LambdaQueryWrapper().eq(User::getUsername, username)); @@ -149,8 +149,8 @@ public void updatePassword(String username, String password) throws Exception { public void resetPassword(String[] usernames) throws Exception { for (String username : usernames) { User user = new User(); - String salt = ShaHashUtil.getRandomSalt(26); - String password = ShaHashUtil.encrypt(salt, User.DEFAULT_PASSWORD); + String salt = ShaHashUtils.getRandomSalt(26); + String password = ShaHashUtils.encrypt(salt, User.DEFAULT_PASSWORD); user.setSalt(salt); user.setPassword(password); this.baseMapper.update(user, new LambdaQueryWrapper().eq(User::getUsername, username)); diff --git a/streamx-console/streamx-console-service/src/main/resources/db/migration/V1_0__init_db.sql b/streamx-console/streamx-console-service/src/main/resources/db/migration/V1_0__init_db.sql deleted file mode 100644 index 34bad27b58..0000000000 --- a/streamx-console/streamx-console-service/src/main/resources/db/migration/V1_0__init_db.sql +++ /dev/null @@ -1,286 +0,0 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for t_app_backup --- ---------------------------- -DROP TABLE IF EXISTS `t_app_backup`; -CREATE TABLE `t_app_backup` ( -`ID` bigint NOT NULL AUTO_INCREMENT, -`APP_ID` bigint DEFAULT NULL, -`SQL_ID` bigint DEFAULT NULL, -`CONFIG_ID` bigint DEFAULT NULL, -`VERSION` int DEFAULT NULL, -`PATH` varchar(255) DEFAULT NULL, -`DESCRIPTION` varchar(255) DEFAULT NULL, -`CREATE_TIME` datetime DEFAULT NULL, -PRIMARY KEY (`ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_flame_graph --- ---------------------------- -DROP TABLE IF EXISTS `t_flame_graph`; -CREATE TABLE `t_flame_graph` ( -`ID` bigint NOT NULL AUTO_INCREMENT, -`APP_ID` bigint DEFAULT NULL, -`PROFILER` varchar(255) DEFAULT NULL, -`TIMELINE` datetime DEFAULT NULL, -`CONTENT` varchar(2000) DEFAULT NULL, -PRIMARY KEY (`ID`) USING BTREE, -KEY `INX_TIME` (`TIMELINE`) USING HASH, -KEY `INX_APPID` (`APP_ID`) USING HASH -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_flink_app --- ---------------------------- -DROP TABLE IF EXISTS `t_flink_app`; - -CREATE TABLE `t_flink_app` ( -`ID` bigint NOT NULL AUTO_INCREMENT, -`JOB_TYPE` tinyint DEFAULT NULL, -`EXECUTION_MODE` tinyint DEFAULT NULL, -`PROJECT_ID` varchar(64) DEFAULT NULL, -`JOB_NAME` varchar(255) DEFAULT NULL, -`MODULE` varchar(255) DEFAULT NULL, -`JAR` varchar(255) DEFAULT NULL, -`MAIN_CLASS` varchar(255) DEFAULT NULL, -`ARGS` text DEFAULT NULL, -`OPTIONS` text DEFAULT NULL, -`USER_ID` bigint DEFAULT NULL, -`APP_ID` varchar(255) DEFAULT NULL, -`APP_TYPE` tinyint DEFAULT NULL, -`DURATION` bigint DEFAULT NULL, -`JOB_ID` varchar(64) DEFAULT NULL, -`STATE` varchar(50) DEFAULT NULL, -`RESTART_SIZE` int DEFAULT NULL, -`RESTART_COUNT` int DEFAULT NULL, -`CP_THRESHOLD` int DEFAULT NULL, -`CP_MAX_FAILURE_INTERVAL` int NULL, -`CP_FAILURE_RATE_INTERVAL` int NULL, -`CP_FAILURE_ACTION` tinyint NULL, -`DYNAMIC_OPTIONS` text DEFAULT NULL, -`DESCRIPTION` varchar(255) DEFAULT NULL, -`RESOLVE_ORDER` tinyint DEFAULT NULL, -`FLAME_GRAPH` tinyint DEFAULT '0', -`JM_MEMORY` int DEFAULT NULL, -`TM_MEMORY` int DEFAULT NULL, -`TOTAL_TASK` int DEFAULT NULL, -`TOTAL_TM` int DEFAULT NULL, -`TOTAL_SLOT` int DEFAULT NULL, -`AVAILABLE_SLOT` int DEFAULT NULL, -`OPTION_STATE` tinyint DEFAULT NULL, -`TRACKING` tinyint DEFAULT NULL, -`CREATE_TIME` datetime DEFAULT NULL, -`DEPLOY` tinyint DEFAULT '0', -`START_TIME` datetime DEFAULT NULL, -`END_TIME` datetime DEFAULT NULL, -`ALERT_EMAIL` varchar(255) DEFAULT NULL, -PRIMARY KEY (`ID`) USING BTREE, -KEY `INX_STATE` (`STATE`) USING BTREE, -KEY `INX_JOB_TYPE` (`JOB_TYPE`) USING BTREE, -KEY `INX_TRACK` (`TRACKING`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_flink_config --- ---------------------------- -DROP TABLE IF EXISTS `t_flink_config`; -CREATE TABLE `t_flink_config` ( -`ID` bigint NOT NULL AUTO_INCREMENT, -`APP_ID` bigint NOT NULL, -`FORMAT` tinyint NOT NULL DEFAULT '0', -`VERSION` int NOT NULL, -`LATEST` tinyint NOT NULL DEFAULT '0', -`CONTENT` text NOT NULL, -`CREATE_TIME` datetime DEFAULT NULL, -PRIMARY KEY (`ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_flink_effective --- ---------------------------- -DROP TABLE IF EXISTS `t_flink_effective`; -CREATE TABLE `t_flink_effective` ( -`ID` bigint NOT NULL AUTO_INCREMENT, -`APP_ID` bigint NOT NULL, -`TARGET_TYPE` tinyint NOT NULL COMMENT '1) config 2) flink sql', -`TARGET_ID` bigint NOT NULL COMMENT 'configId or sqlId', -`CREATE_TIME` datetime DEFAULT NULL, -PRIMARY KEY (`ID`) USING BTREE, -UNIQUE KEY `UN_INX` (`APP_ID`,`TARGET_TYPE`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_flink_log --- ---------------------------- -DROP TABLE IF EXISTS `t_flink_log`; -CREATE TABLE `t_flink_log` ( -`ID` bigint NOT NULL AUTO_INCREMENT, -`APP_ID` bigint DEFAULT NULL, -`YARN_APP_ID` varchar(50) DEFAULT NULL, -`SUCCESS` tinyint DEFAULT NULL, -`EXCEPTION` text DEFAULT NULL, -`START_TIME` datetime DEFAULT NULL, -PRIMARY KEY (`ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_flink_project --- ---------------------------- -DROP TABLE IF EXISTS `t_flink_project`; -CREATE TABLE `t_flink_project` ( -`ID` bigint NOT NULL AUTO_INCREMENT, -`NAME` varchar(255) DEFAULT NULL, -`URL` varchar(1000) DEFAULT NULL, -`BRANCHES` varchar(1000) DEFAULT NULL, -`USERNAME` varchar(255) DEFAULT NULL, -`PASSWORD` varchar(255) DEFAULT NULL, -`POM` varchar(255) DEFAULT NULL, -`TYPE` tinyint DEFAULT NULL, -`REPOSITORY` tinyint DEFAULT NULL, -`DATE` datetime DEFAULT NULL, -`LASTBUILD` datetime DEFAULT NULL, -`DESCRIPTION` varchar(255) DEFAULT NULL, -`BUILDSTATE` tinyint DEFAULT '-1', -PRIMARY KEY (`ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_flink_savepoint --- ---------------------------- -DROP TABLE IF EXISTS `t_flink_savepoint`; -CREATE TABLE `t_flink_savepoint` ( -`ID` bigint NOT NULL AUTO_INCREMENT, -`APP_ID` bigint NOT NULL, -`TYPE` tinyint DEFAULT NULL, -`PATH` varchar(255) DEFAULT NULL, -`LATEST` tinyint NOT NULL, -`TRIGGER_TIME` datetime DEFAULT NULL, -`CREATE_TIME` datetime DEFAULT NULL, -PRIMARY KEY (`ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_flink_sql --- ---------------------------- -DROP TABLE IF EXISTS `t_flink_sql`; -CREATE TABLE `t_flink_sql` ( -`ID` bigint NOT NULL, -`APP_ID` bigint DEFAULT NULL, -`SQL` text DEFAULT NULL, -`DEPENDENCY` text DEFAULT NULL, -`VERSION` int DEFAULT NULL, -`CANDIDATE` tinyint NOT NULL DEFAULT '0', -`CREATE_TIME` datetime DEFAULT NULL, -PRIMARY KEY (`ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_flink_tutorial --- ---------------------------- -DROP TABLE IF EXISTS `t_flink_tutorial`; -CREATE TABLE `t_flink_tutorial` ( -`ID` int NOT NULL AUTO_INCREMENT, -`TYPE` tinyint DEFAULT NULL, -`NAME` varchar(255) DEFAULT NULL, -`CONTENT` text DEFAULT NULL, -`CREATE_TIME` datetime DEFAULT NULL, -PRIMARY KEY (`ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_menu --- ---------------------------- -DROP TABLE IF EXISTS `t_menu`; -CREATE TABLE `t_menu` ( -`MENU_ID` bigint NOT NULL AUTO_INCREMENT COMMENT '菜单/按钮ID', -`PARENT_ID` bigint NOT NULL COMMENT '上级菜单ID', -`MENU_NAME` varchar(50) NOT NULL COMMENT '菜单/按钮名称', -`PATH` varchar(255) DEFAULT NULL COMMENT '对应路由path', -`COMPONENT` varchar(255) DEFAULT NULL COMMENT '对应路由组件component', -`PERMS` varchar(50) DEFAULT NULL COMMENT '权限标识', -`ICON` varchar(50) DEFAULT NULL COMMENT '图标', -`TYPE` char(2) COMMENT '类型 0菜单 1按钮', -`DISPLAY` char(2) NOT NULL DEFAULT '1' COMMENT '菜单是否显示', -`ORDER_NUM` double(20,0) DEFAULT NULL COMMENT '排序', -`CREATE_TIME` datetime NOT NULL COMMENT '创建时间', -`MODIFY_TIME` datetime DEFAULT NULL COMMENT '修改时间', - PRIMARY KEY (`MENU_ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_role --- ---------------------------- -DROP TABLE IF EXISTS `t_role`; -CREATE TABLE `t_role` ( -`ROLE_ID` bigint NOT NULL AUTO_INCREMENT COMMENT '角色ID', -`ROLE_NAME` varchar(50) NOT NULL COMMENT '角色名称', -`REMARK` varchar(100) DEFAULT NULL COMMENT '角色描述', -`CREATE_TIME` datetime NOT NULL COMMENT '创建时间', -`MODIFY_TIME` datetime DEFAULT NULL COMMENT '修改时间', -`ROLE_CODE` varchar(255) DEFAULT NULL COMMENT '角色标识', -PRIMARY KEY (`ROLE_ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_role_menu --- ---------------------------- -DROP TABLE IF EXISTS `t_role_menu`; -CREATE TABLE `t_role_menu` ( -`ROLE_ID` bigint NOT NULL, -`MENU_ID` bigint NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_setting --- ---------------------------- -DROP TABLE IF EXISTS `t_setting`; -CREATE TABLE `t_setting` ( -`NUM` int DEFAULT NULL, -`KEY` varchar(50) NOT NULL, -`VALUE` varchar(255) DEFAULT NULL, -`TITLE` varchar(255) DEFAULT NULL, -`DESCRIPTION` varchar(255) DEFAULT NULL, -`TYPE` tinyint NOT NULL COMMENT '1: input 2: boolean 3: number', -PRIMARY KEY (`KEY`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_user --- ---------------------------- -DROP TABLE IF EXISTS `t_user`; -CREATE TABLE `t_user` ( -`USER_ID` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID', -`USERNAME` varchar(255) DEFAULT NULL COMMENT '登录用户名', -`NICK_NAME` varchar(50) NOT NULL COMMENT '昵称', -`SALT` varchar(255) DEFAULT NULL COMMENT '密码加盐', -`PASSWORD` varchar(128) NOT NULL COMMENT '密码', -`DEPT_ID` bigint DEFAULT NULL COMMENT '部门ID', -`EMAIL` varchar(128) DEFAULT NULL COMMENT '邮箱', -`MOBILE` varchar(20) DEFAULT NULL COMMENT '联系电话', -`STATUS` char(1) NOT NULL COMMENT '状态 0锁定 1有效', -`CREATE_TIME` datetime NOT NULL COMMENT '创建时间', -`MODIFY_TIME` datetime DEFAULT NULL COMMENT '修改时间', -`LAST_LOGIN_TIME` datetime DEFAULT NULL COMMENT '最近访问时间', -`SEX` char(1) DEFAULT NULL COMMENT '性别 0男 1女 2保密', -`DESCRIPTION` varchar(100) DEFAULT NULL COMMENT '描述', -`AVATAR` varchar(100) DEFAULT NULL COMMENT '用户头像', -`USER_TYPE` char(1) NOT NULL DEFAULT '2' COMMENT '用户类型 1内部用户 2外部用户', -PRIMARY KEY (`USER_ID`) USING BTREE, -UNIQUE KEY `UN_USERNAME` (`NICK_NAME`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- ---------------------------- --- Table structure for t_user_role --- ---------------------------- -DROP TABLE IF EXISTS `t_user_role`; -CREATE TABLE `t_user_role` ( -`USER_ID` bigint DEFAULT NULL COMMENT '用户ID', -`ROLE_ID` bigint DEFAULT NULL COMMENT '角色ID' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - -SET FOREIGN_KEY_CHECKS = 1; - -COMMIT diff --git a/streamx-console/streamx-console-service/src/main/resources/db/migration/V1_1__init_data.sql b/streamx-console/streamx-console-service/src/main/resources/db/migration/V1_1__init_data.sql deleted file mode 100644 index d0a3199458..0000000000 --- a/streamx-console/streamx-console-service/src/main/resources/db/migration/V1_1__init_data.sql +++ /dev/null @@ -1,156 +0,0 @@ -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Records of t_flink_project --- ---------------------------- -INSERT INTO `t_flink_project` VALUES (1, 'streamx-quickstart', 'https://gitee.com/benjobs/streamx-quickstart.git', 'main', NULL, NULL, NULL, 1, 1, NOW(), NULL, 'streamx-quickstart', 1); - --- ---------------------------- --- Records of t_flink_app --- ---------------------------- -INSERT INTO `t_flink_app` VALUES (1401710007170375681, 2, 4, NULL, 'Flink SQL Demo', NULL, NULL, NULL, NULL, '{\"jobmanager.memory.process.size\":\"1024mb\",\"taskmanager.memory.process.size\":\"1024mb\",\"parallelism.default\":1,\"taskmanager.numberOfTaskSlots\":1}', 1, NULL, 1, NULL, NULL, '2', 0, NULL, NULL, NULL, NULL, NULL, NULL, 'Flink SQL Demo', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NOW(), 0, NULL, NULL, NULL); - --- ---------------------------- --- Records of t_flink_sql --- ---------------------------- -INSERT INTO `t_flink_sql` VALUES (1401710007208124417, 1401710007170375681, 'eNqlUUtPhDAQvu+vmFs1AYIHT5s94AaVqGxSSPZIKgxrY2mxrdGfb4GS3c0+LnJo6Mz36syapkmZQpk8vKbQMMt2KOFmAe5rK4Nf3yhrhCwvA1/TTDaqO61UxmooSprlT1PDGkgKEKpmwvIOjWVdP3W2zpG+JfQFHjfU46xxrVvYZuWztye1khJrqzSBFRCfjUwSYQiqt1xJJvyPcbWJp9WPCXvUoUEn0ZAVufcs0nIUjYn2L4s++YiY75eBLr+2Dnl3GYKTWRyfQKYRRR2XZxXmNvu9yh9GHAmUO/sxyMRkGNly4c714RZ7zaWtLHsX+N9NjvVrWxm99jmyvEhpOUhujmIYFI5zkCOYzYIj11a7QH7Tyz+nE8bw', NULL, 1, 0, NOW()); - --- ---------------------------- --- Records of t_flink_effective --- ---------------------------- -INSERT INTO `t_flink_effective` VALUES (1401710007468171265, 1401710007170375681, 2, 1401710007208124417, NOW()); - --- ---------------------------- --- Records of t_flink_tutorial --- ---------------------------- -INSERT INTO `t_flink_tutorial` VALUES (1, 1, 'repl', '### Introduction\n\n[Apache Flink](https://flink.apache.org/) is a framework and distributed processing engine for stateful computations over unbounded and bounded data streams. This is Flink tutorial for running classical wordcount in both batch and streaming mode.\n\nThere\'re 3 things you need to do before using flink in StreamX Notebook.\n\n* Download [Flink 1.11](https://flink.apache.org/downloads.html) for scala 2.11 (Only scala-2.11 is supported, scala-2.12 is not supported yet in StreamX Notebook), unpack it and set `FLINK_HOME` in flink interpreter setting to this location.\n* Copy flink-python_2.11–1.11.1.jar from flink opt folder to flink lib folder (it is used by pyflink which is supported)\n* If you want to run yarn mode, you need to set `HADOOP_CONF_DIR` in flink interpreter setting. And make sure `hadoop` is in your `PATH`, because internally flink will call command `hadoop classpath` and put all the hadoop related jars in the classpath of flink interpreter process.\n\nThere\'re 6 sub interpreters in flink interpreter, each is used for different purpose. However they are in the the JVM and share the same ExecutionEnviroment/StremaExecutionEnvironment/BatchTableEnvironment/StreamTableEnvironment.\n\n* `flink` - Creates ExecutionEnvironment/StreamExecutionEnvironment/BatchTableEnvironment/StreamTableEnvironment and provides a Scala environment\n* `pyflink` - Provides a python environment\n* `ipyflink` - Provides an ipython environment\n* `ssql` - Provides a stream sql environment\n* `bsql` - Provides a batch sql environment\n', now()); - --- ---------------------------- --- Records of t_menu --- ---------------------------- -INSERT INTO `t_menu` VALUES (1, 0, 'System', '/system', 'PageView', NULL, 'desktop', '0', '1', 1, NOW(), NULL); -INSERT INTO `t_menu` VALUES (2, 1, 'User Management', '/system/user', 'system/user/User', 'user:view', 'user', '0', '1', 1, NOW(), NULL); -INSERT INTO `t_menu` VALUES (3, 1, 'Role Management', '/system/role', 'system/role/Role', 'role:view', 'smile', '0', '1', 2, NOW(), NULL); -INSERT INTO `t_menu` VALUES (4, 1, 'Router Management', '/system/menu', 'system/menu/Menu', 'menu:view', 'bars', '0', '1', 3, NOW(), NULL); -INSERT INTO `t_menu` VALUES (5, 2, 'add', NULL, NULL, 'user:add', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (6, 2, 'update', NULL, NULL, 'user:update', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (7, 2, 'delete', NULL, NULL, 'user:delete', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (8, 3, 'add', NULL, NULL, 'role:add', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (9, 3, 'update', NULL, NULL, 'role:update', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (10, 3, 'delete', NULL, NULL, 'role:delete', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (11, 4, 'add', NULL, NULL, 'menu:add', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (12, 4, 'update', NULL, NULL, 'menu:update', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (13, 2, 'reset', NULL, NULL, 'user:reset', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (14, 0, 'StreamX', '/flink', 'PageView', NULL, 'build', '0', '1', 2, NOW(), NULL); -INSERT INTO `t_menu` VALUES (15, 14, 'Project', '/flink/project', 'flink/project/View', 'project:view', 'github', '0', '1', 1, NOW(), NULL); -INSERT INTO `t_menu` VALUES (16, 14, 'Application', '/flink/app', 'flink/app/View', 'app:view', 'mobile', '0', '1', 2, NOW(), NULL); -INSERT INTO `t_menu` VALUES (17, 14, 'Add Application', '/flink/app/add', 'flink/app/Add', 'app:create', '', '0', '0', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (18, 14, 'Add Project', '/flink/project/add', 'flink/project/Add', 'project:create', '', '0', '0', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (19, 14, 'App Detail', '/flink/app/detail', 'flink/app/Detail', 'app:detail', '', '0', '0', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (20, 14, 'Notebook', '/flink/notebook/view', 'flink/notebook/Submit', 'notebook:submit', 'read', '0', '1', 3, NOW(), NULL); -INSERT INTO `t_menu` VALUES (21, 14, 'Edit Flink App', '/flink/app/edit_flink', 'flink/app/EditFlink', 'app:update', '', '0', '0', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (22, 14, 'Edit StreamX App', '/flink/app/edit_streamx', 'flink/app/EditStreamX', 'app:update', '', '0', '0', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (23, 15, 'build', NULL, NULL, 'project:build', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (24, 15, 'delete', NULL, NULL, 'project:delete', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (25, 16, 'mapping', NULL, NULL, 'app:mapping', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (26, 16, 'deploy', NULL, NULL, 'app:deploy', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (27, 16, 'start', NULL, NULL, 'app:start', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (28, 16, 'clean', NULL, NULL, 'app:clean', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (29, 16, 'cancel', NULL, NULL, 'app:cancel', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (30, 16, 'savepoint delete', NULL, NULL, 'savepoint:delete', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (31, 16, 'backup rollback', NULL, NULL, 'backup:rollback', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (32, 16, 'backup delete', NULL, NULL, 'backup:delete', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (33, 16, 'conf delete', NULL, NULL, 'conf:delete', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (34, 16, 'flame Graph', NULL, NULL, 'app:flameGraph', NULL, '1', '1', NULL, NOW(), NULL); -INSERT INTO `t_menu` VALUES (35, 14, 'Setting', '/flink/setting', 'flink/setting/View', 'setting:view', 'setting', '0', '1', 4, NOW(), NULL); -INSERT INTO `t_menu` VALUES (36, 35, 'Setting Update', NULL, NULL, 'setting:update', NULL, '1', '1', NULL, NOW(), NULL); --- ---------------------------- --- Records of t_role --- ---------------------------- -INSERT INTO `t_role` VALUES (1, 'admin', 'admin', NOW(), NULL, 'admin'); -INSERT INTO `t_role` VALUES (2, 'developer', 'developer', NOW(), NULL, NULL); - --- ---------------------------- --- Records of t_role_menu --- ---------------------------- - - --- ---------------------------- --- Records of t_role_menu --- ---------------------------- -INSERT INTO `t_role_menu` VALUES (1, 1); -INSERT INTO `t_role_menu` VALUES (1, 2); -INSERT INTO `t_role_menu` VALUES (1, 3); -INSERT INTO `t_role_menu` VALUES (1, 4); -INSERT INTO `t_role_menu` VALUES (1, 5); -INSERT INTO `t_role_menu` VALUES (1, 6); -INSERT INTO `t_role_menu` VALUES (1, 7); -INSERT INTO `t_role_menu` VALUES (1, 8); -INSERT INTO `t_role_menu` VALUES (1, 9); -INSERT INTO `t_role_menu` VALUES (1, 10); -INSERT INTO `t_role_menu` VALUES (1, 11); -INSERT INTO `t_role_menu` VALUES (1, 12); -INSERT INTO `t_role_menu` VALUES (1, 13); -INSERT INTO `t_role_menu` VALUES (1, 14); -INSERT INTO `t_role_menu` VALUES (1, 15); -INSERT INTO `t_role_menu` VALUES (1, 16); -INSERT INTO `t_role_menu` VALUES (1, 17); -INSERT INTO `t_role_menu` VALUES (1, 18); -INSERT INTO `t_role_menu` VALUES (1, 19); -INSERT INTO `t_role_menu` VALUES (1, 20); -INSERT INTO `t_role_menu` VALUES (1, 21); -INSERT INTO `t_role_menu` VALUES (1, 22); -INSERT INTO `t_role_menu` VALUES (1, 23); -INSERT INTO `t_role_menu` VALUES (1, 24); -INSERT INTO `t_role_menu` VALUES (1, 25); -INSERT INTO `t_role_menu` VALUES (1, 26); -INSERT INTO `t_role_menu` VALUES (1, 27); -INSERT INTO `t_role_menu` VALUES (1, 28); -INSERT INTO `t_role_menu` VALUES (1, 29); -INSERT INTO `t_role_menu` VALUES (1, 30); -INSERT INTO `t_role_menu` VALUES (1, 31); -INSERT INTO `t_role_menu` VALUES (1, 32); -INSERT INTO `t_role_menu` VALUES (1, 33); -INSERT INTO `t_role_menu` VALUES (1, 34); -INSERT INTO `t_role_menu` VALUES (1, 35); -INSERT INTO `t_role_menu` VALUES (1, 36); -INSERT INTO `t_role_menu` VALUES (2, 16); -INSERT INTO `t_role_menu` VALUES (2, 17); -INSERT INTO `t_role_menu` VALUES (2, 18); -INSERT INTO `t_role_menu` VALUES (2, 19); -INSERT INTO `t_role_menu` VALUES (2, 20); -INSERT INTO `t_role_menu` VALUES (2, 21); -INSERT INTO `t_role_menu` VALUES (2, 22); -INSERT INTO `t_role_menu` VALUES (2, 25); -INSERT INTO `t_role_menu` VALUES (2, 26); -INSERT INTO `t_role_menu` VALUES (2, 27); -INSERT INTO `t_role_menu` VALUES (2, 28); -INSERT INTO `t_role_menu` VALUES (2, 29); -INSERT INTO `t_role_menu` VALUES (2, 30); -INSERT INTO `t_role_menu` VALUES (2, 31); -INSERT INTO `t_role_menu` VALUES (2, 32); -INSERT INTO `t_role_menu` VALUES (2, 33); -INSERT INTO `t_role_menu` VALUES (2, 34); --- ---------------------------- --- Records of t_setting --- ---------------------------- -INSERT INTO `t_setting` VALUES (1, 'env.flink.home', NULL, 'Flink Home', 'Flink Home', 1); -INSERT INTO `t_setting` VALUES (2, 'maven.central.repository', NULL, 'Maven Central Repository', 'Maven 私服地址', 1); -INSERT INTO `t_setting` VALUES (3, 'streamx.console.webapp.address', NULL, 'StreamX Webapp address', 'StreamX Console Web 应用程序HTTP URL', 1); -INSERT INTO `t_setting` VALUES (4, 'streamx.console.workspace', '/streamx/workspace', 'StreamX Console Workspace', 'StreamX Console 的工作空间,用于存放项目源码,编译后的项目等', 1); -INSERT INTO `t_setting` VALUES (5, 'alert.email.host', NULL, 'Alert Email Smtp Host', '告警邮箱Smtp Host', 1); -INSERT INTO `t_setting` VALUES (6, 'alert.email.port', NULL, 'Alert Email Smtp Port', '告警邮箱的Smtp Port', 1); -INSERT INTO `t_setting` VALUES (7, 'alert.email.address', NULL, 'Alert Email Sender', '用来发送告警邮箱的mail', 1); -INSERT INTO `t_setting` VALUES (8, 'alert.email.password', NULL, 'Alert Email Password', '发送告警的邮箱的密码', 1); -INSERT INTO `t_setting` VALUES (9, 'alert.email.ssl', 'false', 'Alert Email Is SSL', '发送告警的邮箱是否开启SSL', 2); --- ---------------------------- --- Records of t_user --- ---------------------------- -INSERT INTO `t_user` VALUES (1, 'admin', '', 'ats6sdxdqf8vsqjtz0utj461wr', '829b009a6b9cc8ea486a4abbc38e56529f3c6f4c9c6fcd3604b41b1d6eca1a57', 1, 'benjobs@qq.com', '13800000000', '1', NOW(), NULL, NULL, '0', 'author。', 'ubnKSIfAJTxIgXOKlciN.png', '1'); - --- ---------------------------- --- Records of t_user_role --- ---------------------------- -INSERT INTO `t_user_role` VALUES (1, 1); - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/streamx-console/streamx-console-service/src/main/resources/mapper/core/FlameGraphMapper.xml b/streamx-console/streamx-console-service/src/main/resources/mapper/core/FlameGraphMapper.xml index 786b0000fd..daeca284c3 100644 --- a/streamx-console/streamx-console-service/src/main/resources/mapper/core/FlameGraphMapper.xml +++ b/streamx-console/streamx-console-service/src/main/resources/mapper/core/FlameGraphMapper.xml @@ -6,6 +6,6 @@ - + diff --git a/streamx-flink/streamx-flink-core/src/main/java/com/streamxhub/streamx/flink/core/java/sink/JdbcSink.java b/streamx-flink/streamx-flink-core/src/main/java/com/streamxhub/streamx/flink/core/java/sink/JdbcSink.java index 35fece2f83..73418c1484 100644 --- a/streamx-flink/streamx-flink-core/src/main/java/com/streamxhub/streamx/flink/core/java/sink/JdbcSink.java +++ b/streamx-flink/streamx-flink-core/src/main/java/com/streamxhub/streamx/flink/core/java/sink/JdbcSink.java @@ -20,7 +20,7 @@ */ package com.streamxhub.streamx.flink.core.java.sink; -import com.streamxhub.streamx.common.util.AssertUtil; +import com.streamxhub.streamx.common.util.AssertUtils; import com.streamxhub.streamx.common.util.ConfigUtils; import com.streamxhub.streamx.flink.core.java.function.SQLFromFunction; import com.streamxhub.streamx.flink.core.scala.StreamingContext; @@ -60,7 +60,7 @@ public JdbcSink sql(SQLFromFunction func) { } public DataStreamSink sink(DataStream dataStream) { - AssertUtil.notNull(sqlFunc); + AssertUtils.notNull(sqlFunc); this.jdbc = this.jdbc == null ? ConfigUtils.getJdbcConf(context.parameter().toMap(), alias) : this.jdbc; JdbcSinkFunction sinkFun = new JdbcSinkFunction<>(this.jdbc, this.sqlFunc); return dataStream.addSink(sinkFun); diff --git a/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/source/HBaseSource.scala b/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/source/HBaseSource.scala index bd974ed228..52d266acbf 100644 --- a/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/source/HBaseSource.scala +++ b/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/source/HBaseSource.scala @@ -22,11 +22,10 @@ package com.streamxhub.streamx.flink.core.scala.source import com.streamxhub.streamx.common.enums.ApiType import com.streamxhub.streamx.common.enums.ApiType.ApiType -import com.streamxhub.streamx.common.util.{Logger, Utils} +import com.streamxhub.streamx.common.util.{FlinkUtils, Logger, Utils} import com.streamxhub.streamx.flink.core.java.function.{HBaseQueryFunction, HBaseResultFunction, RunningFunction} import com.streamxhub.streamx.flink.core.java.wrapper.HBaseQuery import com.streamxhub.streamx.flink.core.scala.StreamingContext -import com.streamxhub.streamx.flink.core.scala.util.FlinkUtils import org.apache.flink.api.common.state.ListState import org.apache.flink.api.common.typeinfo.TypeInformation import org.apache.flink.configuration.Configuration diff --git a/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/source/JdbcSource.scala b/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/source/JdbcSource.scala index 9ce1240ebc..6def2ea83a 100644 --- a/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/source/JdbcSource.scala +++ b/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/source/JdbcSource.scala @@ -22,10 +22,9 @@ package com.streamxhub.streamx.flink.core.scala.source import com.streamxhub.streamx.common.enums.ApiType import com.streamxhub.streamx.common.enums.ApiType.ApiType -import com.streamxhub.streamx.common.util.{JdbcUtils, Logger, Utils} +import com.streamxhub.streamx.common.util.{FlinkUtils, JdbcUtils, Logger, Utils} import com.streamxhub.streamx.flink.core.java.function.{RunningFunction, SQLQueryFunction, SQLResultFunction} import com.streamxhub.streamx.flink.core.scala.StreamingContext -import com.streamxhub.streamx.flink.core.scala.util.FlinkUtils import org.apache.flink.api.common.state.ListState import org.apache.flink.api.common.typeinfo.TypeInformation import org.apache.flink.runtime.state.{CheckpointListener, FunctionInitializationContext, FunctionSnapshotContext} diff --git a/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/source/MongoSource.scala b/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/source/MongoSource.scala index aa2be8bcb5..d7f5cc3e26 100644 --- a/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/source/MongoSource.scala +++ b/streamx-flink/streamx-flink-core/src/main/scala/com/streamxhub/streamx/flink/core/scala/source/MongoSource.scala @@ -24,10 +24,9 @@ import com.mongodb.MongoClient import com.mongodb.client.{FindIterable, MongoCollection, MongoCursor} import com.streamxhub.streamx.common.enums.ApiType import com.streamxhub.streamx.common.enums.ApiType.ApiType -import com.streamxhub.streamx.common.util.{Logger, MongoConfig, Utils} +import com.streamxhub.streamx.common.util.{FlinkUtils, Logger, MongoConfig, Utils} import com.streamxhub.streamx.flink.core.java.function.{MongoQueryFunction, MongoResultFunction, RunningFunction} import com.streamxhub.streamx.flink.core.scala.StreamingContext -import com.streamxhub.streamx.flink.core.scala.util.FlinkUtils import org.apache.flink.api.common.state.ListState import org.apache.flink.api.common.typeinfo.TypeInformation import org.apache.flink.configuration.Configuration diff --git a/streamx-parent/pom.xml b/streamx-parent/pom.xml index 78b33a3a44..9a91e197ef 100644 --- a/streamx-parent/pom.xml +++ b/streamx-parent/pom.xml @@ -18,7 +18,7 @@ UTF-8 2.2.0 2.3.4 - 1.12.0 + 1.13.0 2.0.39 3.8.5 2.10.1 diff --git a/streamx-plugin/streamx-flink-submit/src/main/scala/com/streamxhub/streamx/flink/submit/impl/ApplicationSubmit.scala b/streamx-plugin/streamx-flink-submit/src/main/scala/com/streamxhub/streamx/flink/submit/impl/ApplicationSubmit.scala index 95bbceee15..21f0c559fd 100644 --- a/streamx-plugin/streamx-flink-submit/src/main/scala/com/streamxhub/streamx/flink/submit/impl/ApplicationSubmit.scala +++ b/streamx-plugin/streamx-flink-submit/src/main/scala/com/streamxhub/streamx/flink/submit/impl/ApplicationSubmit.scala @@ -32,10 +32,13 @@ import org.apache.flink.client.deployment.application.ApplicationConfiguration import org.apache.flink.client.program.PackagedProgramUtils import org.apache.flink.configuration._ import org.apache.flink.runtime.security.{SecurityConfiguration, SecurityUtils} +import org.apache.flink.runtime.util.HadoopUtils import org.apache.flink.util.Preconditions.checkNotNull import org.apache.flink.yarn.configuration.{YarnConfigOptions, YarnDeploymentTarget} +import org.apache.hadoop.security.UserGroupInformation import org.apache.hadoop.yarn.api.records.ApplicationId +import java.lang.{Boolean => JavaBool} import java.util.concurrent.Callable import java.util.{Collections, List => JavaList} import scala.collection.JavaConverters._ @@ -83,7 +86,7 @@ object ApplicationSubmit extends YarnSubmitTrait { logInfo( s""" ||--------------------------<>--------------------------| - || Flink Job Started: applicationId: $applicationId | + || Flink Job Started: applicationId: $applicationId| ||_____________________________________________________________________| |""".stripMargin) @@ -148,6 +151,17 @@ object ApplicationSubmit extends YarnSubmitTrait { } providedLibs -> programArgs } + + val currentUser = UserGroupInformation.getCurrentUser + logDebug(s"UserGroupInformation currentUser: $currentUser") + if (HadoopUtils.isKerberosSecurityEnabled(currentUser)) { + logDebug(s"kerberos Security is Enabled...") + val useTicketCache = getOptionFromDefaultFlinkConfig[JavaBool](submitRequest.flinkHome, SecurityOptions.KERBEROS_LOGIN_USETICKETCACHE) + if (!HadoopUtils.areKerberosCredentialsValid(currentUser, useTicketCache)) { + throw new RuntimeException(s"Hadoop security with Kerberos is enabled but the login user ${currentUser} does not have Kerberos credentials or delegation tokens!") + } + } + //yarn.provided.lib.dirs effectiveConfiguration.set(YarnConfigOptions.PROVIDED_LIB_DIRS, providedLibs.asJava) //flinkDistJar From 901df2869e3dd3bafc767ab1b7288169cb6f59b3 Mon Sep 17 00:00:00 2001 From: benjobs Date: Sun, 27 Jun 2021 18:44:52 +0800 Subject: [PATCH 2/2] streamx 1.0.0 release --- .../resources/db/migration/V1_0__init_db.sql | 286 ++++++++++++++++++ .../db/migration/V1_1__init_data.sql | 156 ++++++++++ 2 files changed, 442 insertions(+) create mode 100644 streamx-console/streamx-console-service/src/main/resources/db/migration/V1_0__init_db.sql create mode 100644 streamx-console/streamx-console-service/src/main/resources/db/migration/V1_1__init_data.sql diff --git a/streamx-console/streamx-console-service/src/main/resources/db/migration/V1_0__init_db.sql b/streamx-console/streamx-console-service/src/main/resources/db/migration/V1_0__init_db.sql new file mode 100644 index 0000000000..4d0f37a1e8 --- /dev/null +++ b/streamx-console/streamx-console-service/src/main/resources/db/migration/V1_0__init_db.sql @@ -0,0 +1,286 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for t_app_backup +-- ---------------------------- +DROP TABLE IF EXISTS `t_app_backup`; +CREATE TABLE `t_app_backup` ( +`ID` bigint NOT NULL AUTO_INCREMENT, +`APP_ID` bigint DEFAULT NULL, +`SQL_ID` bigint DEFAULT NULL, +`CONFIG_ID` bigint DEFAULT NULL, +`VERSION` int DEFAULT NULL, +`PATH` varchar(255) DEFAULT NULL, +`DESCRIPTION` varchar(255) DEFAULT NULL, +`CREATE_TIME` datetime DEFAULT NULL, +PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_flame_graph +-- ---------------------------- +DROP TABLE IF EXISTS `t_flame_graph`; +CREATE TABLE `t_flame_graph` ( +`ID` bigint NOT NULL AUTO_INCREMENT, +`APP_ID` bigint DEFAULT NULL, +`PROFILER` varchar(255) DEFAULT NULL, +`TIMELINE` datetime DEFAULT NULL, +`CONTENT` text DEFAULT NULL, +PRIMARY KEY (`ID`) USING BTREE, +KEY `INX_TIME` (`TIMELINE`) USING HASH, +KEY `INX_APPID` (`APP_ID`) USING HASH +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_flink_app +-- ---------------------------- +DROP TABLE IF EXISTS `t_flink_app`; + +CREATE TABLE `t_flink_app` ( +`ID` bigint NOT NULL AUTO_INCREMENT, +`JOB_TYPE` tinyint DEFAULT NULL, +`EXECUTION_MODE` tinyint DEFAULT NULL, +`PROJECT_ID` varchar(64) DEFAULT NULL, +`JOB_NAME` varchar(255) DEFAULT NULL, +`MODULE` varchar(255) DEFAULT NULL, +`JAR` varchar(255) DEFAULT NULL, +`MAIN_CLASS` varchar(255) DEFAULT NULL, +`ARGS` text DEFAULT NULL, +`OPTIONS` text DEFAULT NULL, +`USER_ID` bigint DEFAULT NULL, +`APP_ID` varchar(255) DEFAULT NULL, +`APP_TYPE` tinyint DEFAULT NULL, +`DURATION` bigint DEFAULT NULL, +`JOB_ID` varchar(64) DEFAULT NULL, +`STATE` varchar(50) DEFAULT NULL, +`RESTART_SIZE` int DEFAULT NULL, +`RESTART_COUNT` int DEFAULT NULL, +`CP_THRESHOLD` int DEFAULT NULL, +`CP_MAX_FAILURE_INTERVAL` int NULL, +`CP_FAILURE_RATE_INTERVAL` int NULL, +`CP_FAILURE_ACTION` tinyint NULL, +`DYNAMIC_OPTIONS` text DEFAULT NULL, +`DESCRIPTION` varchar(255) DEFAULT NULL, +`RESOLVE_ORDER` tinyint DEFAULT NULL, +`FLAME_GRAPH` tinyint DEFAULT '0', +`JM_MEMORY` int DEFAULT NULL, +`TM_MEMORY` int DEFAULT NULL, +`TOTAL_TASK` int DEFAULT NULL, +`TOTAL_TM` int DEFAULT NULL, +`TOTAL_SLOT` int DEFAULT NULL, +`AVAILABLE_SLOT` int DEFAULT NULL, +`OPTION_STATE` tinyint DEFAULT NULL, +`TRACKING` tinyint DEFAULT NULL, +`CREATE_TIME` datetime DEFAULT NULL, +`DEPLOY` tinyint DEFAULT '0', +`START_TIME` datetime DEFAULT NULL, +`END_TIME` datetime DEFAULT NULL, +`ALERT_EMAIL` varchar(255) DEFAULT NULL, +PRIMARY KEY (`ID`) USING BTREE, +KEY `INX_STATE` (`STATE`) USING BTREE, +KEY `INX_JOB_TYPE` (`JOB_TYPE`) USING BTREE, +KEY `INX_TRACK` (`TRACKING`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_flink_config +-- ---------------------------- +DROP TABLE IF EXISTS `t_flink_config`; +CREATE TABLE `t_flink_config` ( +`ID` bigint NOT NULL AUTO_INCREMENT, +`APP_ID` bigint NOT NULL, +`FORMAT` tinyint NOT NULL DEFAULT '0', +`VERSION` int NOT NULL, +`LATEST` tinyint NOT NULL DEFAULT '0', +`CONTENT` text NOT NULL, +`CREATE_TIME` datetime DEFAULT NULL, +PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_flink_effective +-- ---------------------------- +DROP TABLE IF EXISTS `t_flink_effective`; +CREATE TABLE `t_flink_effective` ( +`ID` bigint NOT NULL AUTO_INCREMENT, +`APP_ID` bigint NOT NULL, +`TARGET_TYPE` tinyint NOT NULL COMMENT '1) config 2) flink sql', +`TARGET_ID` bigint NOT NULL COMMENT 'configId or sqlId', +`CREATE_TIME` datetime DEFAULT NULL, +PRIMARY KEY (`ID`) USING BTREE, +UNIQUE KEY `UN_INX` (`APP_ID`,`TARGET_TYPE`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_flink_log +-- ---------------------------- +DROP TABLE IF EXISTS `t_flink_log`; +CREATE TABLE `t_flink_log` ( +`ID` bigint NOT NULL AUTO_INCREMENT, +`APP_ID` bigint DEFAULT NULL, +`YARN_APP_ID` varchar(50) DEFAULT NULL, +`SUCCESS` tinyint DEFAULT NULL, +`EXCEPTION` text DEFAULT NULL, +`START_TIME` datetime DEFAULT NULL, +PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_flink_project +-- ---------------------------- +DROP TABLE IF EXISTS `t_flink_project`; +CREATE TABLE `t_flink_project` ( +`ID` bigint NOT NULL AUTO_INCREMENT, +`NAME` varchar(255) DEFAULT NULL, +`URL` varchar(1000) DEFAULT NULL, +`BRANCHES` varchar(1000) DEFAULT NULL, +`USERNAME` varchar(255) DEFAULT NULL, +`PASSWORD` varchar(255) DEFAULT NULL, +`POM` varchar(255) DEFAULT NULL, +`TYPE` tinyint DEFAULT NULL, +`REPOSITORY` tinyint DEFAULT NULL, +`DATE` datetime DEFAULT NULL, +`LASTBUILD` datetime DEFAULT NULL, +`DESCRIPTION` varchar(255) DEFAULT NULL, +`BUILDSTATE` tinyint DEFAULT '-1', +PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_flink_savepoint +-- ---------------------------- +DROP TABLE IF EXISTS `t_flink_savepoint`; +CREATE TABLE `t_flink_savepoint` ( +`ID` bigint NOT NULL AUTO_INCREMENT, +`APP_ID` bigint NOT NULL, +`TYPE` tinyint DEFAULT NULL, +`PATH` varchar(255) DEFAULT NULL, +`LATEST` tinyint NOT NULL, +`TRIGGER_TIME` datetime DEFAULT NULL, +`CREATE_TIME` datetime DEFAULT NULL, +PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_flink_sql +-- ---------------------------- +DROP TABLE IF EXISTS `t_flink_sql`; +CREATE TABLE `t_flink_sql` ( +`ID` bigint NOT NULL, +`APP_ID` bigint DEFAULT NULL, +`SQL` text DEFAULT NULL, +`DEPENDENCY` text DEFAULT NULL, +`VERSION` int DEFAULT NULL, +`CANDIDATE` tinyint NOT NULL DEFAULT '0', +`CREATE_TIME` datetime DEFAULT NULL, +PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_flink_tutorial +-- ---------------------------- +DROP TABLE IF EXISTS `t_flink_tutorial`; +CREATE TABLE `t_flink_tutorial` ( +`ID` int NOT NULL AUTO_INCREMENT, +`TYPE` tinyint DEFAULT NULL, +`NAME` varchar(255) DEFAULT NULL, +`CONTENT` text DEFAULT NULL, +`CREATE_TIME` datetime DEFAULT NULL, +PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_menu +-- ---------------------------- +DROP TABLE IF EXISTS `t_menu`; +CREATE TABLE `t_menu` ( +`MENU_ID` bigint NOT NULL AUTO_INCREMENT COMMENT '菜单/按钮ID', +`PARENT_ID` bigint NOT NULL COMMENT '上级菜单ID', +`MENU_NAME` varchar(50) NOT NULL COMMENT '菜单/按钮名称', +`PATH` varchar(255) DEFAULT NULL COMMENT '对应路由path', +`COMPONENT` varchar(255) DEFAULT NULL COMMENT '对应路由组件component', +`PERMS` varchar(50) DEFAULT NULL COMMENT '权限标识', +`ICON` varchar(50) DEFAULT NULL COMMENT '图标', +`TYPE` char(2) COMMENT '类型 0菜单 1按钮', +`DISPLAY` char(2) NOT NULL DEFAULT '1' COMMENT '菜单是否显示', +`ORDER_NUM` double(20,0) DEFAULT NULL COMMENT '排序', +`CREATE_TIME` datetime NOT NULL COMMENT '创建时间', +`MODIFY_TIME` datetime DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`MENU_ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_role +-- ---------------------------- +DROP TABLE IF EXISTS `t_role`; +CREATE TABLE `t_role` ( +`ROLE_ID` bigint NOT NULL AUTO_INCREMENT COMMENT '角色ID', +`ROLE_NAME` varchar(50) NOT NULL COMMENT '角色名称', +`REMARK` varchar(100) DEFAULT NULL COMMENT '角色描述', +`CREATE_TIME` datetime NOT NULL COMMENT '创建时间', +`MODIFY_TIME` datetime DEFAULT NULL COMMENT '修改时间', +`ROLE_CODE` varchar(255) DEFAULT NULL COMMENT '角色标识', +PRIMARY KEY (`ROLE_ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_role_menu +-- ---------------------------- +DROP TABLE IF EXISTS `t_role_menu`; +CREATE TABLE `t_role_menu` ( +`ROLE_ID` bigint NOT NULL, +`MENU_ID` bigint NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_setting +-- ---------------------------- +DROP TABLE IF EXISTS `t_setting`; +CREATE TABLE `t_setting` ( +`NUM` int DEFAULT NULL, +`KEY` varchar(50) NOT NULL, +`VALUE` varchar(255) DEFAULT NULL, +`TITLE` varchar(255) DEFAULT NULL, +`DESCRIPTION` varchar(255) DEFAULT NULL, +`TYPE` tinyint NOT NULL COMMENT '1: input 2: boolean 3: number', +PRIMARY KEY (`KEY`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_user +-- ---------------------------- +DROP TABLE IF EXISTS `t_user`; +CREATE TABLE `t_user` ( +`USER_ID` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID', +`USERNAME` varchar(255) DEFAULT NULL COMMENT '登录用户名', +`NICK_NAME` varchar(50) NOT NULL COMMENT '昵称', +`SALT` varchar(255) DEFAULT NULL COMMENT '密码加盐', +`PASSWORD` varchar(128) NOT NULL COMMENT '密码', +`DEPT_ID` bigint DEFAULT NULL COMMENT '部门ID', +`EMAIL` varchar(128) DEFAULT NULL COMMENT '邮箱', +`MOBILE` varchar(20) DEFAULT NULL COMMENT '联系电话', +`STATUS` char(1) NOT NULL COMMENT '状态 0锁定 1有效', +`CREATE_TIME` datetime NOT NULL COMMENT '创建时间', +`MODIFY_TIME` datetime DEFAULT NULL COMMENT '修改时间', +`LAST_LOGIN_TIME` datetime DEFAULT NULL COMMENT '最近访问时间', +`SEX` char(1) DEFAULT NULL COMMENT '性别 0男 1女 2保密', +`DESCRIPTION` varchar(100) DEFAULT NULL COMMENT '描述', +`AVATAR` varchar(100) DEFAULT NULL COMMENT '用户头像', +`USER_TYPE` char(1) NOT NULL DEFAULT '2' COMMENT '用户类型 1内部用户 2外部用户', +PRIMARY KEY (`USER_ID`) USING BTREE, +UNIQUE KEY `UN_USERNAME` (`NICK_NAME`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- ---------------------------- +-- Table structure for t_user_role +-- ---------------------------- +DROP TABLE IF EXISTS `t_user_role`; +CREATE TABLE `t_user_role` ( +`USER_ID` bigint DEFAULT NULL COMMENT '用户ID', +`ROLE_ID` bigint DEFAULT NULL COMMENT '角色ID' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +SET FOREIGN_KEY_CHECKS = 1; + +COMMIT diff --git a/streamx-console/streamx-console-service/src/main/resources/db/migration/V1_1__init_data.sql b/streamx-console/streamx-console-service/src/main/resources/db/migration/V1_1__init_data.sql new file mode 100644 index 0000000000..d0a3199458 --- /dev/null +++ b/streamx-console/streamx-console-service/src/main/resources/db/migration/V1_1__init_data.sql @@ -0,0 +1,156 @@ +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Records of t_flink_project +-- ---------------------------- +INSERT INTO `t_flink_project` VALUES (1, 'streamx-quickstart', 'https://gitee.com/benjobs/streamx-quickstart.git', 'main', NULL, NULL, NULL, 1, 1, NOW(), NULL, 'streamx-quickstart', 1); + +-- ---------------------------- +-- Records of t_flink_app +-- ---------------------------- +INSERT INTO `t_flink_app` VALUES (1401710007170375681, 2, 4, NULL, 'Flink SQL Demo', NULL, NULL, NULL, NULL, '{\"jobmanager.memory.process.size\":\"1024mb\",\"taskmanager.memory.process.size\":\"1024mb\",\"parallelism.default\":1,\"taskmanager.numberOfTaskSlots\":1}', 1, NULL, 1, NULL, NULL, '2', 0, NULL, NULL, NULL, NULL, NULL, NULL, 'Flink SQL Demo', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NOW(), 0, NULL, NULL, NULL); + +-- ---------------------------- +-- Records of t_flink_sql +-- ---------------------------- +INSERT INTO `t_flink_sql` VALUES (1401710007208124417, 1401710007170375681, 'eNqlUUtPhDAQvu+vmFs1AYIHT5s94AaVqGxSSPZIKgxrY2mxrdGfb4GS3c0+LnJo6Mz36syapkmZQpk8vKbQMMt2KOFmAe5rK4Nf3yhrhCwvA1/TTDaqO61UxmooSprlT1PDGkgKEKpmwvIOjWVdP3W2zpG+JfQFHjfU46xxrVvYZuWztye1khJrqzSBFRCfjUwSYQiqt1xJJvyPcbWJp9WPCXvUoUEn0ZAVufcs0nIUjYn2L4s++YiY75eBLr+2Dnl3GYKTWRyfQKYRRR2XZxXmNvu9yh9GHAmUO/sxyMRkGNly4c714RZ7zaWtLHsX+N9NjvVrWxm99jmyvEhpOUhujmIYFI5zkCOYzYIj11a7QH7Tyz+nE8bw', NULL, 1, 0, NOW()); + +-- ---------------------------- +-- Records of t_flink_effective +-- ---------------------------- +INSERT INTO `t_flink_effective` VALUES (1401710007468171265, 1401710007170375681, 2, 1401710007208124417, NOW()); + +-- ---------------------------- +-- Records of t_flink_tutorial +-- ---------------------------- +INSERT INTO `t_flink_tutorial` VALUES (1, 1, 'repl', '### Introduction\n\n[Apache Flink](https://flink.apache.org/) is a framework and distributed processing engine for stateful computations over unbounded and bounded data streams. This is Flink tutorial for running classical wordcount in both batch and streaming mode.\n\nThere\'re 3 things you need to do before using flink in StreamX Notebook.\n\n* Download [Flink 1.11](https://flink.apache.org/downloads.html) for scala 2.11 (Only scala-2.11 is supported, scala-2.12 is not supported yet in StreamX Notebook), unpack it and set `FLINK_HOME` in flink interpreter setting to this location.\n* Copy flink-python_2.11–1.11.1.jar from flink opt folder to flink lib folder (it is used by pyflink which is supported)\n* If you want to run yarn mode, you need to set `HADOOP_CONF_DIR` in flink interpreter setting. And make sure `hadoop` is in your `PATH`, because internally flink will call command `hadoop classpath` and put all the hadoop related jars in the classpath of flink interpreter process.\n\nThere\'re 6 sub interpreters in flink interpreter, each is used for different purpose. However they are in the the JVM and share the same ExecutionEnviroment/StremaExecutionEnvironment/BatchTableEnvironment/StreamTableEnvironment.\n\n* `flink` - Creates ExecutionEnvironment/StreamExecutionEnvironment/BatchTableEnvironment/StreamTableEnvironment and provides a Scala environment\n* `pyflink` - Provides a python environment\n* `ipyflink` - Provides an ipython environment\n* `ssql` - Provides a stream sql environment\n* `bsql` - Provides a batch sql environment\n', now()); + +-- ---------------------------- +-- Records of t_menu +-- ---------------------------- +INSERT INTO `t_menu` VALUES (1, 0, 'System', '/system', 'PageView', NULL, 'desktop', '0', '1', 1, NOW(), NULL); +INSERT INTO `t_menu` VALUES (2, 1, 'User Management', '/system/user', 'system/user/User', 'user:view', 'user', '0', '1', 1, NOW(), NULL); +INSERT INTO `t_menu` VALUES (3, 1, 'Role Management', '/system/role', 'system/role/Role', 'role:view', 'smile', '0', '1', 2, NOW(), NULL); +INSERT INTO `t_menu` VALUES (4, 1, 'Router Management', '/system/menu', 'system/menu/Menu', 'menu:view', 'bars', '0', '1', 3, NOW(), NULL); +INSERT INTO `t_menu` VALUES (5, 2, 'add', NULL, NULL, 'user:add', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (6, 2, 'update', NULL, NULL, 'user:update', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (7, 2, 'delete', NULL, NULL, 'user:delete', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (8, 3, 'add', NULL, NULL, 'role:add', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (9, 3, 'update', NULL, NULL, 'role:update', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (10, 3, 'delete', NULL, NULL, 'role:delete', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (11, 4, 'add', NULL, NULL, 'menu:add', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (12, 4, 'update', NULL, NULL, 'menu:update', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (13, 2, 'reset', NULL, NULL, 'user:reset', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (14, 0, 'StreamX', '/flink', 'PageView', NULL, 'build', '0', '1', 2, NOW(), NULL); +INSERT INTO `t_menu` VALUES (15, 14, 'Project', '/flink/project', 'flink/project/View', 'project:view', 'github', '0', '1', 1, NOW(), NULL); +INSERT INTO `t_menu` VALUES (16, 14, 'Application', '/flink/app', 'flink/app/View', 'app:view', 'mobile', '0', '1', 2, NOW(), NULL); +INSERT INTO `t_menu` VALUES (17, 14, 'Add Application', '/flink/app/add', 'flink/app/Add', 'app:create', '', '0', '0', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (18, 14, 'Add Project', '/flink/project/add', 'flink/project/Add', 'project:create', '', '0', '0', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (19, 14, 'App Detail', '/flink/app/detail', 'flink/app/Detail', 'app:detail', '', '0', '0', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (20, 14, 'Notebook', '/flink/notebook/view', 'flink/notebook/Submit', 'notebook:submit', 'read', '0', '1', 3, NOW(), NULL); +INSERT INTO `t_menu` VALUES (21, 14, 'Edit Flink App', '/flink/app/edit_flink', 'flink/app/EditFlink', 'app:update', '', '0', '0', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (22, 14, 'Edit StreamX App', '/flink/app/edit_streamx', 'flink/app/EditStreamX', 'app:update', '', '0', '0', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (23, 15, 'build', NULL, NULL, 'project:build', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (24, 15, 'delete', NULL, NULL, 'project:delete', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (25, 16, 'mapping', NULL, NULL, 'app:mapping', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (26, 16, 'deploy', NULL, NULL, 'app:deploy', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (27, 16, 'start', NULL, NULL, 'app:start', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (28, 16, 'clean', NULL, NULL, 'app:clean', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (29, 16, 'cancel', NULL, NULL, 'app:cancel', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (30, 16, 'savepoint delete', NULL, NULL, 'savepoint:delete', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (31, 16, 'backup rollback', NULL, NULL, 'backup:rollback', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (32, 16, 'backup delete', NULL, NULL, 'backup:delete', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (33, 16, 'conf delete', NULL, NULL, 'conf:delete', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (34, 16, 'flame Graph', NULL, NULL, 'app:flameGraph', NULL, '1', '1', NULL, NOW(), NULL); +INSERT INTO `t_menu` VALUES (35, 14, 'Setting', '/flink/setting', 'flink/setting/View', 'setting:view', 'setting', '0', '1', 4, NOW(), NULL); +INSERT INTO `t_menu` VALUES (36, 35, 'Setting Update', NULL, NULL, 'setting:update', NULL, '1', '1', NULL, NOW(), NULL); +-- ---------------------------- +-- Records of t_role +-- ---------------------------- +INSERT INTO `t_role` VALUES (1, 'admin', 'admin', NOW(), NULL, 'admin'); +INSERT INTO `t_role` VALUES (2, 'developer', 'developer', NOW(), NULL, NULL); + +-- ---------------------------- +-- Records of t_role_menu +-- ---------------------------- + + +-- ---------------------------- +-- Records of t_role_menu +-- ---------------------------- +INSERT INTO `t_role_menu` VALUES (1, 1); +INSERT INTO `t_role_menu` VALUES (1, 2); +INSERT INTO `t_role_menu` VALUES (1, 3); +INSERT INTO `t_role_menu` VALUES (1, 4); +INSERT INTO `t_role_menu` VALUES (1, 5); +INSERT INTO `t_role_menu` VALUES (1, 6); +INSERT INTO `t_role_menu` VALUES (1, 7); +INSERT INTO `t_role_menu` VALUES (1, 8); +INSERT INTO `t_role_menu` VALUES (1, 9); +INSERT INTO `t_role_menu` VALUES (1, 10); +INSERT INTO `t_role_menu` VALUES (1, 11); +INSERT INTO `t_role_menu` VALUES (1, 12); +INSERT INTO `t_role_menu` VALUES (1, 13); +INSERT INTO `t_role_menu` VALUES (1, 14); +INSERT INTO `t_role_menu` VALUES (1, 15); +INSERT INTO `t_role_menu` VALUES (1, 16); +INSERT INTO `t_role_menu` VALUES (1, 17); +INSERT INTO `t_role_menu` VALUES (1, 18); +INSERT INTO `t_role_menu` VALUES (1, 19); +INSERT INTO `t_role_menu` VALUES (1, 20); +INSERT INTO `t_role_menu` VALUES (1, 21); +INSERT INTO `t_role_menu` VALUES (1, 22); +INSERT INTO `t_role_menu` VALUES (1, 23); +INSERT INTO `t_role_menu` VALUES (1, 24); +INSERT INTO `t_role_menu` VALUES (1, 25); +INSERT INTO `t_role_menu` VALUES (1, 26); +INSERT INTO `t_role_menu` VALUES (1, 27); +INSERT INTO `t_role_menu` VALUES (1, 28); +INSERT INTO `t_role_menu` VALUES (1, 29); +INSERT INTO `t_role_menu` VALUES (1, 30); +INSERT INTO `t_role_menu` VALUES (1, 31); +INSERT INTO `t_role_menu` VALUES (1, 32); +INSERT INTO `t_role_menu` VALUES (1, 33); +INSERT INTO `t_role_menu` VALUES (1, 34); +INSERT INTO `t_role_menu` VALUES (1, 35); +INSERT INTO `t_role_menu` VALUES (1, 36); +INSERT INTO `t_role_menu` VALUES (2, 16); +INSERT INTO `t_role_menu` VALUES (2, 17); +INSERT INTO `t_role_menu` VALUES (2, 18); +INSERT INTO `t_role_menu` VALUES (2, 19); +INSERT INTO `t_role_menu` VALUES (2, 20); +INSERT INTO `t_role_menu` VALUES (2, 21); +INSERT INTO `t_role_menu` VALUES (2, 22); +INSERT INTO `t_role_menu` VALUES (2, 25); +INSERT INTO `t_role_menu` VALUES (2, 26); +INSERT INTO `t_role_menu` VALUES (2, 27); +INSERT INTO `t_role_menu` VALUES (2, 28); +INSERT INTO `t_role_menu` VALUES (2, 29); +INSERT INTO `t_role_menu` VALUES (2, 30); +INSERT INTO `t_role_menu` VALUES (2, 31); +INSERT INTO `t_role_menu` VALUES (2, 32); +INSERT INTO `t_role_menu` VALUES (2, 33); +INSERT INTO `t_role_menu` VALUES (2, 34); +-- ---------------------------- +-- Records of t_setting +-- ---------------------------- +INSERT INTO `t_setting` VALUES (1, 'env.flink.home', NULL, 'Flink Home', 'Flink Home', 1); +INSERT INTO `t_setting` VALUES (2, 'maven.central.repository', NULL, 'Maven Central Repository', 'Maven 私服地址', 1); +INSERT INTO `t_setting` VALUES (3, 'streamx.console.webapp.address', NULL, 'StreamX Webapp address', 'StreamX Console Web 应用程序HTTP URL', 1); +INSERT INTO `t_setting` VALUES (4, 'streamx.console.workspace', '/streamx/workspace', 'StreamX Console Workspace', 'StreamX Console 的工作空间,用于存放项目源码,编译后的项目等', 1); +INSERT INTO `t_setting` VALUES (5, 'alert.email.host', NULL, 'Alert Email Smtp Host', '告警邮箱Smtp Host', 1); +INSERT INTO `t_setting` VALUES (6, 'alert.email.port', NULL, 'Alert Email Smtp Port', '告警邮箱的Smtp Port', 1); +INSERT INTO `t_setting` VALUES (7, 'alert.email.address', NULL, 'Alert Email Sender', '用来发送告警邮箱的mail', 1); +INSERT INTO `t_setting` VALUES (8, 'alert.email.password', NULL, 'Alert Email Password', '发送告警的邮箱的密码', 1); +INSERT INTO `t_setting` VALUES (9, 'alert.email.ssl', 'false', 'Alert Email Is SSL', '发送告警的邮箱是否开启SSL', 2); +-- ---------------------------- +-- Records of t_user +-- ---------------------------- +INSERT INTO `t_user` VALUES (1, 'admin', '', 'ats6sdxdqf8vsqjtz0utj461wr', '829b009a6b9cc8ea486a4abbc38e56529f3c6f4c9c6fcd3604b41b1d6eca1a57', 1, 'benjobs@qq.com', '13800000000', '1', NOW(), NULL, NULL, '0', 'author。', 'ubnKSIfAJTxIgXOKlciN.png', '1'); + +-- ---------------------------- +-- Records of t_user_role +-- ---------------------------- +INSERT INTO `t_user_role` VALUES (1, 1); + +SET FOREIGN_KEY_CHECKS = 1;