diff --git a/build.gradle b/build.gradle index 432d410cab..99aaf4e09a 100644 --- a/build.gradle +++ b/build.gradle @@ -521,6 +521,7 @@ subprojects { dependency "com.h3xstream.findsecbugs:findsecbugs-plugin:1.11.0" dependency "com.mebigfatguy.fb-contrib:fb-contrib:7.6.0" + dependency "com.jayway.jsonpath:json-path:2.7.0" dependency "org.springframework.boot:spring-boot-starter-web:2.7.10" dependency "io.openmessaging:registry-server:0.0.1" diff --git a/eventmesh-common/build.gradle b/eventmesh-common/build.gradle index f2c627acdd..67cb886dec 100644 --- a/eventmesh-common/build.gradle +++ b/eventmesh-common/build.gradle @@ -25,8 +25,8 @@ dependencies { api "org.apache.commons:commons-text" api "org.apache.commons:commons-lang3" - implementation group: 'com.jayway.jsonpath', name: 'json-path', version: '2.7.0' - implementation 'commons-net:commons-net:3.9.0' + api "com.jayway.jsonpath:json-path" + api "io.cloudevents:cloudevents-core" api "io.cloudevents:cloudevents-json-jackson" diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/Variable.java b/eventmesh-filter/build.gradle similarity index 79% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/Variable.java rename to eventmesh-filter/build.gradle index b7f139f2b2..ba88591b41 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/Variable.java +++ b/eventmesh-filter/build.gradle @@ -15,16 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.common.transform; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class Variable { - - private String name; - private String jsonPath; +dependencies { + implementation project(":eventmesh-common") } diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/PatternEntry.java b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/PatternEntry.java similarity index 94% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/PatternEntry.java rename to eventmesh-filter/src/main/java/org/apache/eventmesh/filter/PatternEntry.java index b6f747e673..73878fb65e 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/PatternEntry.java +++ b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/PatternEntry.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.common.filter; +package org.apache.eventmesh.filter; -import org.apache.eventmesh.common.filter.condition.Condition; +import org.apache.eventmesh.filter.condition.Condition; import java.util.ArrayList; import java.util.List; diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/AnythingButCondition.java b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/AnythingButCondition.java similarity index 93% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/AnythingButCondition.java rename to eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/AnythingButCondition.java index f64dd1fc45..2d58136a70 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/AnythingButCondition.java +++ b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/AnythingButCondition.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.common.filter.condition; +package org.apache.eventmesh.filter.condition; import java.util.ArrayList; import java.util.Iterator; @@ -24,11 +24,11 @@ import com.fasterxml.jackson.databind.JsonNode; -class AnythingButCondition implements Condition { +public class AnythingButCondition implements Condition { private List conditionList = new ArrayList<>(); - AnythingButCondition(JsonNode condition) { + public AnythingButCondition(JsonNode condition) { if (condition.isValueNode()) { this.conditionList.add(new SpecifiedCondition(condition)); diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/Condition.java b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/Condition.java similarity index 94% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/Condition.java rename to eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/Condition.java index 4ae08616b9..fbb4276c7b 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/Condition.java +++ b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/Condition.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.common.filter.condition; +package org.apache.eventmesh.filter.condition; import com.fasterxml.jackson.databind.JsonNode; diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/ConditionsBuilder.java b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/ConditionsBuilder.java similarity index 94% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/ConditionsBuilder.java rename to eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/ConditionsBuilder.java index bceb09d57e..4e207663aa 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/ConditionsBuilder.java +++ b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/ConditionsBuilder.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.common.filter.condition; +package org.apache.eventmesh.filter.condition; import com.fasterxml.jackson.databind.JsonNode; @@ -38,7 +38,7 @@ public Condition build() { Condition condition = null; switch (this.key) { case "prefix": - condition = new PrefixxCondition(this.jsonNode); + condition = new PrefixCondition(this.jsonNode); break; case "suffix": condition = new SuffixCondition(this.jsonNode); diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/ExistsCondition.java b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/ExistsCondition.java similarity index 91% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/ExistsCondition.java rename to eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/ExistsCondition.java index 95d765d71b..53c15bb297 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/ExistsCondition.java +++ b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/ExistsCondition.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.common.filter.condition; +package org.apache.eventmesh.filter.condition; import com.fasterxml.jackson.databind.JsonNode; -class ExistsCondition implements Condition { +public class ExistsCondition implements Condition { private JsonNode exists; diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/NumericCondition.java b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/NumericCondition.java similarity index 96% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/NumericCondition.java rename to eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/NumericCondition.java index b5c28a4d13..5eb5374c7c 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/NumericCondition.java +++ b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/NumericCondition.java @@ -15,14 +15,14 @@ * limitations under the License. */ -package org.apache.eventmesh.common.filter.condition; +package org.apache.eventmesh.filter.condition; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.databind.JsonNode; -class NumericCondition implements Condition { +public class NumericCondition implements Condition { List operators = new ArrayList<>(); List nums = new ArrayList<>(); diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/PrefixxCondition.java b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/PrefixCondition.java similarity index 87% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/PrefixxCondition.java rename to eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/PrefixCondition.java index 22c1afa61b..633ed1fb02 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/PrefixxCondition.java +++ b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/PrefixCondition.java @@ -15,15 +15,15 @@ * limitations under the License. */ -package org.apache.eventmesh.common.filter.condition; +package org.apache.eventmesh.filter.condition; import com.fasterxml.jackson.databind.JsonNode; -class PrefixxCondition implements Condition { +public class PrefixCondition implements Condition { private final String prefix; - public PrefixxCondition(JsonNode suffix) { + public PrefixCondition(JsonNode suffix) { this.prefix = suffix.asText(); } diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/SpecifiedCondition.java b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/SpecifiedCondition.java similarity index 91% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/SpecifiedCondition.java rename to eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/SpecifiedCondition.java index b6fa884a1f..f9cc3fb5db 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/SpecifiedCondition.java +++ b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/SpecifiedCondition.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.common.filter.condition; +package org.apache.eventmesh.filter.condition; import com.fasterxml.jackson.databind.JsonNode; -class SpecifiedCondition implements Condition { +public class SpecifiedCondition implements Condition { private final JsonNode specified; diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/SuffixCondition.java b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/SuffixCondition.java similarity index 91% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/SuffixCondition.java rename to eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/SuffixCondition.java index b7187d6c19..805df0ee17 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/condition/SuffixCondition.java +++ b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/condition/SuffixCondition.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.common.filter.condition; +package org.apache.eventmesh.filter.condition; import com.fasterxml.jackson.databind.JsonNode; -class SuffixCondition implements Condition { +public class SuffixCondition implements Condition { private final String suffix; diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/pattern/Pattern.java b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/pattern/Pattern.java similarity index 96% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/pattern/Pattern.java rename to eventmesh-filter/src/main/java/org/apache/eventmesh/filter/pattern/Pattern.java index 6187a668b7..8abb306b84 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/pattern/Pattern.java +++ b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/pattern/Pattern.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.common.filter.pattern; +package org.apache.eventmesh.filter.pattern; -import org.apache.eventmesh.common.filter.PatternEntry; import org.apache.eventmesh.common.utils.JsonPathUtils; +import org.apache.eventmesh.filter.PatternEntry; import org.apache.commons.lang3.StringUtils; diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/patternbuild/PatternBuilder.java b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/patternbuild/PatternBuilder.java similarity index 95% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/patternbuild/PatternBuilder.java rename to eventmesh-filter/src/main/java/org/apache/eventmesh/filter/patternbuild/PatternBuilder.java index 4abf2af062..0a2fb01760 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/filter/patternbuild/PatternBuilder.java +++ b/eventmesh-filter/src/main/java/org/apache/eventmesh/filter/patternbuild/PatternBuilder.java @@ -15,13 +15,13 @@ * limitations under the License. */ -package org.apache.eventmesh.common.filter.patternbuild; +package org.apache.eventmesh.filter.patternbuild; import org.apache.eventmesh.common.exception.JsonException; -import org.apache.eventmesh.common.filter.PatternEntry; -import org.apache.eventmesh.common.filter.condition.Condition; -import org.apache.eventmesh.common.filter.condition.ConditionsBuilder; -import org.apache.eventmesh.common.filter.pattern.Pattern; +import org.apache.eventmesh.filter.PatternEntry; +import org.apache.eventmesh.filter.condition.Condition; +import org.apache.eventmesh.filter.condition.ConditionsBuilder; +import org.apache.eventmesh.filter.pattern.Pattern; import java.util.ArrayDeque; import java.util.Iterator; diff --git a/eventmesh-common/src/test/java/org/apache/eventmesh/common/filter/PatternTest.java b/eventmesh-filter/src/test/java/org/apache/eventmesh/filter/PatternTest.java similarity index 96% rename from eventmesh-common/src/test/java/org/apache/eventmesh/common/filter/PatternTest.java rename to eventmesh-filter/src/test/java/org/apache/eventmesh/filter/PatternTest.java index f5b14515f3..207992b0c1 100644 --- a/eventmesh-common/src/test/java/org/apache/eventmesh/common/filter/PatternTest.java +++ b/eventmesh-filter/src/test/java/org/apache/eventmesh/filter/PatternTest.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.eventmesh.common.filter; +package org.apache.eventmesh.filter; -import org.apache.eventmesh.common.filter.pattern.Pattern; -import org.apache.eventmesh.common.filter.patternbuild.PatternBuilder; +import org.apache.eventmesh.filter.pattern.Pattern; +import org.apache.eventmesh.filter.patternbuild.PatternBuilder; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/eventmesh-transformer/build.gradle b/eventmesh-transformer/build.gradle new file mode 100644 index 0000000000..ba88591b41 --- /dev/null +++ b/eventmesh-transformer/build.gradle @@ -0,0 +1,21 @@ +/* + * 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. + */ + + +dependencies { + implementation project(":eventmesh-common") +} diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/ConstantTransformer.java b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/ConstantTransformer.java similarity index 81% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/ConstantTransformer.java rename to eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/ConstantTransformer.java index e3df38e1e7..dd7c20aace 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/ConstantTransformer.java +++ b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/ConstantTransformer.java @@ -15,11 +15,9 @@ * limitations under the License. */ -package org.apache.eventmesh.common.transform; +package org.apache.eventmesh.transformer; -import org.apache.eventmesh.common.exception.EventMeshException; - -class ConstantTransformer implements Transformer { +public class ConstantTransformer implements Transformer { private final String jsonpath; @@ -28,7 +26,7 @@ class ConstantTransformer implements Transformer { } @Override - public String transform(String json) throws EventMeshException { + public String transform(String json) throws TransformException { return this.jsonpath; } } diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/JsonPathParser.java b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/JsonPathParser.java similarity index 93% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/JsonPathParser.java rename to eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/JsonPathParser.java index d35a22205a..a220fc0abd 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/JsonPathParser.java +++ b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/JsonPathParser.java @@ -15,9 +15,8 @@ * limitations under the License. */ -package org.apache.eventmesh.common.transform; +package org.apache.eventmesh.transformer; -import org.apache.eventmesh.common.exception.EventMeshException; import org.apache.eventmesh.common.utils.JsonPathUtils; import java.util.ArrayList; @@ -52,7 +51,7 @@ public JsonPathParser(String jsonPathString) { if (valueNode.isValueNode()) { variablesList.add(new Variable(name, valueNode.asText())); } else { - throw new EventMeshException("invalid config:" + jsonPathString); + throw new TransformException("invalid config:" + jsonPathString); } } @@ -67,7 +66,6 @@ public JsonPathParser(String jsonPathString) { */ public List match(String json) throws JsonProcessingException { - if (json == null || json.isEmpty()) { return new ArrayList<>(); } diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/OriginalTransformer.java b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/OriginalTransformer.java similarity index 95% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/OriginalTransformer.java rename to eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/OriginalTransformer.java index 708a2aeb2e..61aa059d59 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/OriginalTransformer.java +++ b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/OriginalTransformer.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.common.transform; +package org.apache.eventmesh.transformer; class OriginalTransformer implements Transformer { diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/Template.java b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/Template.java similarity index 78% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/Template.java rename to eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/Template.java index 348ed1a93d..5d2358dfe6 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/Template.java +++ b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/Template.java @@ -15,9 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.common.transform; - -import org.apache.eventmesh.common.exception.EventMeshException; +package org.apache.eventmesh.transformer; import org.apache.commons.text.StringSubstitutor; @@ -25,16 +23,15 @@ import java.util.Map; import java.util.stream.Collectors; -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor public class Template { private String template; - public String substitute(List variables) throws EventMeshException { + public Template(String template) { + this.template = template; + } + + public String substitute(List variables) throws TransformException { Map valuesMap = variables.stream() .filter(variable -> variable.getJsonPath() != null) @@ -44,4 +41,12 @@ public String substitute(List variables) throws EventMeshException { return sub.replace(template); } + + public String getTemplate() { + return template; + } + + public void setTemplate(String template) { + this.template = template; + } } \ No newline at end of file diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/TemplateTransformer.java b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/TemplateTransformer.java similarity index 96% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/TemplateTransformer.java rename to eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/TemplateTransformer.java index ea42d05de3..2a4db5fc3d 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/TemplateTransformer.java +++ b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/TemplateTransformer.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.common.transform; +package org.apache.eventmesh.transformer; import java.util.List; diff --git a/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/TransformException.java b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/TransformException.java new file mode 100644 index 0000000000..1b11a29d80 --- /dev/null +++ b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/TransformException.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.eventmesh.transformer; + +/** + * Transform exception + */ +public class TransformException extends RuntimeException { + + private static final long serialVersionUID = -4351489859520642285L; + + public TransformException(String message) { + super(message); + } + + public TransformException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/Transformer.java b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/Transformer.java similarity index 95% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/Transformer.java rename to eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/Transformer.java index fecfe4b18c..8239dfcb6e 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/Transformer.java +++ b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/Transformer.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.common.transform; +package org.apache.eventmesh.transformer; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/TransformerBuilder.java b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/TransformerBuilder.java similarity index 93% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/TransformerBuilder.java rename to eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/TransformerBuilder.java index 0eafdebb75..05ad583550 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/TransformerBuilder.java +++ b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/TransformerBuilder.java @@ -15,9 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.common.transform; - -import org.apache.eventmesh.common.exception.EventMeshException; +package org.apache.eventmesh.transformer; public class TransformerBuilder { @@ -50,7 +48,7 @@ public Transformer build() { case TEMPLATE: return buildTemplateTransFormer(this.content, this.template); default: - throw new EventMeshException("invalid config"); + throw new TransformException("invalid config"); } } diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/TransformerType.java b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/TransformerType.java similarity index 94% rename from eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/TransformerType.java rename to eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/TransformerType.java index 13a5c05d4e..5ca2142c34 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/transform/TransformerType.java +++ b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/TransformerType.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.eventmesh.common.transform; +package org.apache.eventmesh.transformer; public enum TransformerType { ORIGINAL, diff --git a/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/Variable.java b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/Variable.java new file mode 100644 index 0000000000..6b3cc4da47 --- /dev/null +++ b/eventmesh-transformer/src/main/java/org/apache/eventmesh/transformer/Variable.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.eventmesh.transformer; + +public class Variable { + + private String name; + + private String jsonPath; + + public Variable(String name, String jsonPath) { + this.name = name; + this.jsonPath = jsonPath; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getJsonPath() { + return jsonPath; + } + + public void setJsonPath(String jsonPath) { + this.jsonPath = jsonPath; + } +} diff --git a/eventmesh-common/src/test/java/org/apache/eventmesh/common/transform/TransformTest.java b/eventmesh-transformer/src/test/java/org/apache/eventmesh/transform/TransformTest.java similarity index 96% rename from eventmesh-common/src/test/java/org/apache/eventmesh/common/transform/TransformTest.java rename to eventmesh-transformer/src/test/java/org/apache/eventmesh/transform/TransformTest.java index f91681a425..b17460a410 100644 --- a/eventmesh-common/src/test/java/org/apache/eventmesh/common/transform/TransformTest.java +++ b/eventmesh-transformer/src/test/java/org/apache/eventmesh/transform/TransformTest.java @@ -15,7 +15,11 @@ * limitations under the License. */ -package org.apache.eventmesh.common.transform; +package org.apache.eventmesh.transform; + +import org.apache.eventmesh.transformer.Transformer; +import org.apache.eventmesh.transformer.TransformerBuilder; +import org.apache.eventmesh.transformer.TransformerType; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/eventmesh-webhook/eventmesh-webhook-admin/src/main/java/org/apache/eventmesh/webhook/admin/NacosWebHookConfigOperation.java b/eventmesh-webhook/eventmesh-webhook-admin/src/main/java/org/apache/eventmesh/webhook/admin/NacosWebHookConfigOperation.java index a87b43c78e..98e43a8e86 100644 --- a/eventmesh-webhook/eventmesh-webhook-admin/src/main/java/org/apache/eventmesh/webhook/admin/NacosWebHookConfigOperation.java +++ b/eventmesh-webhook/eventmesh-webhook-admin/src/main/java/org/apache/eventmesh/webhook/admin/NacosWebHookConfigOperation.java @@ -29,9 +29,6 @@ import org.apache.eventmesh.webhook.api.WebHookConfigOperation; import org.apache.eventmesh.webhook.api.WebHookOperationConstant; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Properties; diff --git a/settings.gradle b/settings.gradle index a1b63fd376..676cc6e79a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -23,6 +23,8 @@ include 'eventmesh-common' include 'eventmesh-starter' include 'eventmesh-examples' include 'eventmesh-spi' +include 'eventmesh-filter' +include 'eventmesh-transformer' include 'eventmesh-openconnect:eventmesh-openconnect-java' include 'eventmesh-openconnect:eventmesh-openconnect-offsetmgmt-plugin:eventmesh-openconnect-offsetmgmt-api' diff --git a/tools/dependency-check/known-dependencies.txt b/tools/dependency-check/known-dependencies.txt index 6022c3fbd6..7ccc8115b8 100644 --- a/tools/dependency-check/known-dependencies.txt +++ b/tools/dependency-check/known-dependencies.txt @@ -38,7 +38,6 @@ commons-digester-2.1.jar commons-io-2.11.0.jar commons-lang3-3.6.jar commons-logging-1.2.jar -commons-net-3.9.0.jar commons-text-1.9.jar commons-validator-1.7.jar consul-api-1.4.5.jar