You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/09/23 10:12:20 UTC
[incubator-eventmesh] branch eventmesh-filters updated: [ISSUE #1384] Add filters to implement the interface
This is an automated email from the ASF dual-hosted git repository.
mikexue pushed a commit to branch eventmesh-filters
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git
The following commit(s) were added to refs/heads/eventmesh-filters by this push:
new ad7ce1df [ISSUE #1384] Add filters to implement the interface
new ca74dbdd Merge pull request #1385 from xwm1992/eventmesh-filter
ad7ce1df is described below
commit ad7ce1dface3cee44df64eb30339ce62235712a6
Author: xwm1992 <mi...@126.com>
AuthorDate: Fri Sep 23 18:06:01 2022 +0800
[ISSUE #1384] Add filters to implement the interface
---
.../apache/eventmesh/filter/api/FilterConfig.java | 21 +++++++++++
.../apache/eventmesh/filter/api/FilterType.java | 34 ++++++++++++++++++
.../apache/eventmesh/filter/api/SinkFilter.java | 42 ++++++++++++++++++++++
.../apache/eventmesh/filter/api/SourceFilter.java | 42 ++++++++++++++++++++++
4 files changed, 139 insertions(+)
diff --git a/eventmesh-filter-plugin/eventmesh-filter-api/src/main/java/org/apache/eventmesh/filter/api/FilterConfig.java b/eventmesh-filter-plugin/eventmesh-filter-api/src/main/java/org/apache/eventmesh/filter/api/FilterConfig.java
new file mode 100644
index 00000000..781d8ca8
--- /dev/null
+++ b/eventmesh-filter-plugin/eventmesh-filter-api/src/main/java/org/apache/eventmesh/filter/api/FilterConfig.java
@@ -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.
+ */
+
+package org.apache.eventmesh.filter.api;
+
+public class FilterConfig {
+}
diff --git a/eventmesh-filter-plugin/eventmesh-filter-api/src/main/java/org/apache/eventmesh/filter/api/FilterType.java b/eventmesh-filter-plugin/eventmesh-filter-api/src/main/java/org/apache/eventmesh/filter/api/FilterType.java
new file mode 100644
index 00000000..9f77d328
--- /dev/null
+++ b/eventmesh-filter-plugin/eventmesh-filter-api/src/main/java/org/apache/eventmesh/filter/api/FilterType.java
@@ -0,0 +1,34 @@
+/*
+ * 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.filter.api;
+
+public enum FilterType {
+
+ SOURCE("source"), SINK("sink");
+
+ private final String filterType;
+
+ FilterType(String filterType) {
+ this.filterType = filterType;
+ }
+
+ @Override
+ public String toString() {
+ return filterType;
+ }
+}
diff --git a/eventmesh-filter-plugin/eventmesh-filter-api/src/main/java/org/apache/eventmesh/filter/api/SinkFilter.java b/eventmesh-filter-plugin/eventmesh-filter-api/src/main/java/org/apache/eventmesh/filter/api/SinkFilter.java
new file mode 100644
index 00000000..85177f98
--- /dev/null
+++ b/eventmesh-filter-plugin/eventmesh-filter-api/src/main/java/org/apache/eventmesh/filter/api/SinkFilter.java
@@ -0,0 +1,42 @@
+/*
+ * 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.filter.api;
+
+import io.cloudevents.CloudEvent;
+
+public abstract class SinkFilter<T extends CloudEvent> implements EventMeshFilter<T, T> {
+
+ @Override
+ public FilterType filterType() {
+ return FilterType.SINK;
+ }
+
+ private FilterConfig filterConfig;
+
+ public SinkFilter(FilterConfig filterConfig) {
+ this.filterConfig = filterConfig;
+ }
+
+ public FilterConfig getFilterConfig() {
+ return filterConfig;
+ }
+
+ public void setFilterConfig(FilterConfig filterConfig) {
+ this.filterConfig = filterConfig;
+ }
+}
diff --git a/eventmesh-filter-plugin/eventmesh-filter-api/src/main/java/org/apache/eventmesh/filter/api/SourceFilter.java b/eventmesh-filter-plugin/eventmesh-filter-api/src/main/java/org/apache/eventmesh/filter/api/SourceFilter.java
new file mode 100644
index 00000000..1cabba3a
--- /dev/null
+++ b/eventmesh-filter-plugin/eventmesh-filter-api/src/main/java/org/apache/eventmesh/filter/api/SourceFilter.java
@@ -0,0 +1,42 @@
+/*
+ * 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.filter.api;
+
+import io.cloudevents.CloudEvent;
+
+public abstract class SourceFilter<T extends CloudEvent> implements EventMeshFilter<T, T> {
+
+ @Override
+ public FilterType filterType() {
+ return FilterType.SOURCE;
+ }
+
+ private FilterConfig filterConfig;
+
+ public SourceFilter(FilterConfig filterConfig) {
+ this.filterConfig = filterConfig;
+ }
+
+ public FilterConfig getFilterConfig() {
+ return filterConfig;
+ }
+
+ public void setFilterConfig(FilterConfig filterConfig) {
+ this.filterConfig = filterConfig;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org