enhancement #I5FNR4 减少Liteflow核心包对第三方包的依赖

This commit is contained in:
everywhere.z
2022-07-05 22:23:16 +08:00
parent db0548963b
commit ba2349038a
18 changed files with 100 additions and 20 deletions

View File

@@ -2,8 +2,8 @@ package com.yomahub.liteflow.builder;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists;
import com.yomahub.liteflow.enums.ConditionTypeEnum;
import com.yomahub.liteflow.flow.FlowBus;
import com.yomahub.liteflow.flow.element.Chain;
@@ -79,7 +79,7 @@ public class LiteFlowChainBuilder {
* build 前简单校验
*/
private void checkBuild() {
List<String> errorList = Lists.newArrayList();
List<String> errorList = new ArrayList<>();
if (StrUtil.isBlank(this.chain.getChainName())) {
errorList.add("name is blank");
}

View File

@@ -3,7 +3,6 @@ package com.yomahub.liteflow.builder;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists;
import com.yomahub.liteflow.enums.NodeTypeEnum;
import com.yomahub.liteflow.exception.NodeBuildException;
import com.yomahub.liteflow.flow.FlowBus;
@@ -11,6 +10,7 @@ import com.yomahub.liteflow.flow.element.Node;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -120,7 +120,7 @@ public class LiteFlowNodeBuilder {
* build 前简单校验
*/
private void checkBuild() {
List<String> errorList = Lists.newArrayList();
List<String> errorList = new ArrayList<>();
if (StrUtil.isBlank(this.node.getId())) {
errorList.add("id is blank");
}

View File

@@ -1,13 +1,10 @@
package com.yomahub.liteflow.builder.el;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists;
import com.ql.util.express.DefaultContext;
import com.ql.util.express.ExpressRunner;
import com.yomahub.liteflow.builder.el.operator.*;
import com.yomahub.liteflow.enums.ConditionTypeEnum;
import com.yomahub.liteflow.exception.ELParseException;
import com.yomahub.liteflow.exception.FlowSystemException;
import com.yomahub.liteflow.flow.FlowBus;
@@ -16,11 +13,8 @@ import com.yomahub.liteflow.flow.element.Executable;
import com.yomahub.liteflow.flow.element.condition.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
/**
* Chain基于代码形式的组装器
@@ -145,7 +139,7 @@ public class LiteFlowChainELBuilder {
* build 前简单校验
*/
private void checkBuild() {
List<String> errorList = Lists.newArrayList();
List<String> errorList = new ArrayList<>();
if (StrUtil.isBlank(this.chain.getChainName())) {
errorList.add("name is blank");
}

View File

@@ -1,8 +1,8 @@
package com.yomahub.liteflow.builder.entity;
import cn.hutool.core.collection.CollUtil;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.List;
/**
@@ -57,7 +57,7 @@ public class ExecutableEntity {
public ExecutableEntity addNodeCondComponent(ExecutableEntity conditionNodeEntity) {
if (CollUtil.isEmpty(this.nodeCondComponents)) {
this.nodeCondComponents = Lists.newArrayList();
this.nodeCondComponents = new ArrayList<>();
}
this.nodeCondComponents.add(conditionNodeEntity);
return this;

View File

@@ -13,7 +13,6 @@ import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists;
import com.yomahub.liteflow.enums.FlowParserTypeEnum;
import com.yomahub.liteflow.exception.*;
import com.yomahub.liteflow.flow.FlowBus;
@@ -120,7 +119,7 @@ public class FlowExecutor {
return;
}
List<String> sourceRulePathList = Lists.newArrayList(liteflowConfig.getRuleSource().split(",|;"));
List<String> sourceRulePathList = ListUtil.toList(liteflowConfig.getRuleSource().split(",|;"));
FlowParser parser = null;
Set<String> parserNameSet = new HashSet<>();

View File

@@ -1,7 +1,7 @@
package com.yomahub.liteflow.flow.executor;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.collect.Maps;
import com.yomahub.liteflow.spi.holder.ContextAwareHolder;
import java.util.Map;
@@ -17,7 +17,7 @@ public class NodeExecutorHelper {
private final Map<Class<? extends NodeExecutor>, NodeExecutor> nodeExecutorMap;
private NodeExecutorHelper() {
nodeExecutorMap = Maps.newConcurrentMap();
nodeExecutorMap = MapUtil.newConcurrentHashMap();
}
//使用静态内部类实现单例模式

View File

@@ -11,7 +11,6 @@ package com.yomahub.liteflow.thread;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Maps;
import com.yomahub.liteflow.exception.ThreadExecutorServiceCreateException;
import com.yomahub.liteflow.property.LiteflowConfig;
import com.yomahub.liteflow.property.LiteflowConfigGetter;
@@ -40,7 +39,7 @@ public class ExecutorHelper {
private final Map<String, ExecutorService> executorServiceMap;
private ExecutorHelper() {
executorServiceMap = Maps.newConcurrentMap();
executorServiceMap = MapUtil.newConcurrentHashMap();
}
/**

View File

@@ -39,6 +39,14 @@
<artifactId>zkclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -38,6 +38,14 @@
<artifactId>zkclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>liteflow-script-groovy</artifactId>

View File

@@ -36,6 +36,14 @@
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>liteflow-script-qlexpress</artifactId>

View File

@@ -38,6 +38,14 @@
<artifactId>zkclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -39,6 +39,14 @@
<artifactId>zkclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -38,6 +38,14 @@
<artifactId>zkclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -38,6 +38,14 @@
<artifactId>zkclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>liteflow-script-groovy</artifactId>

View File

@@ -36,6 +36,14 @@
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>liteflow-script-qlexpress</artifactId>

View File

@@ -35,6 +35,14 @@
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -49,6 +49,14 @@
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>

10
pom.xml
View File

@@ -97,7 +97,7 @@
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
<scope>test</scope>
<optional>true</optional>
</dependency>
<dependency>
@@ -124,6 +124,7 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
@@ -139,12 +140,14 @@
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>${curator.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
@@ -161,11 +164,14 @@
<groupId>org.apache.curator</groupId>
<artifactId>curator-test</artifactId>
<version>${curator-test.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
<version>${zkclient.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
@@ -193,6 +199,8 @@
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectjweaver.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>