This is an automated email from the ASF dual-hosted git repository. wiener pushed a commit to branch edge-extensions in repository https://gitbox.apache.org/repos/asf/incubator-streampipes-extensions.git
commit 1a79ec2ff313934ed0cf9d003fe3302978930a69 Author: Patrick Wiener <[email protected]> AuthorDate: Wed Mar 17 13:18:10 2021 +0100 add dummy processor for reconfigurable static property --- .../runConfigurations/node_controller_edge_01.xml | 11 +- .../runConfigurations/node_controller_edge_02.xml | 11 +- pom.xml | 1 - streampipes-extensions-all-jvm/Dockerfile | 3 +- streampipes-extensions-all-jvm/aarch64.Dockerfile | 3 +- streampipes-extensions-all-jvm/arm.Dockerfile | 3 +- .../extensions/all/jvm/AllExtensionsInit.java | 5 +- .../all/jvm/config/AllExtensionsConfig.java | 17 +++ streampipes-pipeline-elements-all-jvm/pom.xml | 6 -- .../pe/jvm/AllPipelineElementsInit.java | 4 +- .../pe/jvm/config/AllPipelineElementsConfig.java | 3 + streampipes-processors-dummy-jvm/Dockerfile | 25 ----- .../aarch64.Dockerfile | 26 ----- streampipes-processors-dummy-jvm/arm.Dockerfile | 26 ----- streampipes-processors-dummy-jvm/development/env | 19 ---- streampipes-processors-dummy-jvm/pom.xml | 114 --------------------- .../processors/dummy/jvm/DummyJvmInit.java | 52 ---------- .../processors/dummy/jvm/config/ConfigKeys.java | 25 ----- .../dummy/jvm/config/DummyJvmConfig.java | 60 ----------- .../dummy/jvm/processor/dummy/Dummy.java | 45 -------- .../dummy/jvm/processor/dummy/DummyController.java | 59 ----------- .../dummy/jvm/processor/dummy/DummyParameters.java | 29 ------ .../strings.en | 2 - .../processors/filters/jvm/FiltersJvmInit.java | 5 +- .../jvm/processor/dummy/DummyController.java | 82 +++++++++++++++ .../documentation.md | 0 .../icon.png | Bin .../strings.en | 8 ++ 28 files changed, 129 insertions(+), 515 deletions(-) diff --git a/.idea/runConfigurations/node_controller_edge_01.xml b/.idea/runConfigurations/node_controller_edge_01.xml index bf68370..fce3f4c 100644 --- a/.idea/runConfigurations/node_controller_edge_01.xml +++ b/.idea/runConfigurations/node_controller_edge_01.xml @@ -4,21 +4,14 @@ <option name="SPRING_BOOT_MAIN_CLASS" value="org.apache.streampipes.node.controller.container.NodeControllerInit" /> <option name="ALTERNATIVE_JRE_PATH" /> <envs> - <env name="SP_BACKEND_HOST" value="host.docker.internal" /> - <env name="CONSUL_LOCATION" value="host.docker.internal" /> - <env name="SP_NODE_HOST" value="edge01.example.de" /> - <env name="SP_NODE_TYPE" value="edge" /> <env name="SP_NODE_CONTROLLER_ID" value="edge-01.node-controller" /> - <env name="SP_NODE_CONTROLLER_CONTAINER_HOST" value="edge01.example.de" /> - <env name="SP_NODE_CONTROLLER_CONTAINER_PORT" value="7077" /> - <env name="SP_NODE_BROKER_CONTAINER_HOST" value="localhost" /> <env name="SP_NODE_BROKER_CONTAINER_PORT" value="1884" /> <env name="SP_NODE_ACCESSIBLE_FIELD_DEVICE_ROS" value="ros;universalrobot;network;192.168.0.90:9090" /> - <env name="SP_NODE_HAS_GPU" value="false" /> <env name="SP_NODE_LOCATION" value="fzi;holl;UR" /> <env name="SP_DEBUG" value="true" /> - <env name="SP_VERSION" value="0.68.0-SNAPSHOT" /> <env name="SP_NODE_ACCESSIBLE_FIELD_DEVICE_ZED" value="zed;camera;usb;/dev/video1" /> + <env name="SP_URL" value="http://host.docker.internal:8030" /> + <env name="SP_NODE_CONTROLLER_URL" value="http://edge01.example.de:7077" /> </envs> <method v="2"> <option name="Make" enabled="true" /> diff --git a/.idea/runConfigurations/node_controller_edge_02.xml b/.idea/runConfigurations/node_controller_edge_02.xml index 525f974..6aae2c3 100644 --- a/.idea/runConfigurations/node_controller_edge_02.xml +++ b/.idea/runConfigurations/node_controller_edge_02.xml @@ -4,20 +4,13 @@ <option name="SPRING_BOOT_MAIN_CLASS" value="org.apache.streampipes.node.controller.container.NodeControllerInit" /> <option name="ALTERNATIVE_JRE_PATH" /> <envs> - <env name="SP_BACKEND_HOST" value="host.docker.internal" /> - <env name="CONSUL_LOCATION" value="host.docker.internal" /> - <env name="SP_NODE_HOST" value="edge02.example.de" /> - <env name="SP_NODE_TYPE" value="edge" /> <env name="SP_NODE_CONTROLLER_ID" value="edge-02.node-controller" /> - <env name="SP_NODE_CONTROLLER_CONTAINER_HOST" value="edge02.example.de" /> - <env name="SP_NODE_CONTROLLER_CONTAINER_PORT" value="7078" /> - <env name="SP_NODE_BROKER_CONTAINER_HOST" value="localhost" /> <env name="SP_NODE_BROKER_CONTAINER_PORT" value="1887" /> <env name="SP_NODE_ACCESSIBLE_FIELD_DEVICE_ZED" value="zed;camera;usb;/dev/video0" /> - <env name="SP_NODE_HAS_GPU" value="true" /> <env name="SP_NODE_LOCATION" value="fzi;main" /> <env name="SP_DEBUG" value="true" /> - <env name="SP_VERSION" value="0.68.0-SNAPSHOT" /> + <env name="SP_URL" value="http://host.docker.internal:8030" /> + <env name="SP_NODE_CONTROLLER_URL" value="http://edge02.example.de:7078" /> </envs> <method v="2"> <option name="Make" enabled="true" /> diff --git a/pom.xml b/pom.xml index a226c64..10a767b 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,6 @@ <module>streampipes-pipeline-elements-all-flink</module> <module>streampipes-processors-change-detection-jvm</module> <module>streampipes-extensions-all-jvm</module> - <module>streampipes-processors-dummy-jvm</module> </modules> <properties> diff --git a/streampipes-extensions-all-jvm/Dockerfile b/streampipes-extensions-all-jvm/Dockerfile index ad05014..1177750 100644 --- a/streampipes-extensions-all-jvm/Dockerfile +++ b/streampipes-extensions-all-jvm/Dockerfile @@ -16,8 +16,9 @@ ARG BASE_IMAGE=adoptopenjdk/openjdk9-openj9:alpine FROM $BASE_IMAGE -ENV CONSUL_LOCATION consul +MAINTAINER [email protected] +ENV CONSUL_LOCATION consul EXPOSE 8090 # needed pkgs processors-image-processing-jvm diff --git a/streampipes-extensions-all-jvm/aarch64.Dockerfile b/streampipes-extensions-all-jvm/aarch64.Dockerfile index 2c38304..3063f48 100644 --- a/streampipes-extensions-all-jvm/aarch64.Dockerfile +++ b/streampipes-extensions-all-jvm/aarch64.Dockerfile @@ -16,8 +16,9 @@ ARG BASE_IMAGE=arm64v8/openjdk:11-jre-slim FROM $BASE_IMAGE -ENV CONSUL_LOCATION consul +MAINTAINER [email protected] +ENV CONSUL_LOCATION consul EXPOSE 8090 COPY qemu-aarch64-static /usr/bin diff --git a/streampipes-extensions-all-jvm/arm.Dockerfile b/streampipes-extensions-all-jvm/arm.Dockerfile index 6f258e1..a16eaad 100644 --- a/streampipes-extensions-all-jvm/arm.Dockerfile +++ b/streampipes-extensions-all-jvm/arm.Dockerfile @@ -16,8 +16,9 @@ ARG BASE_IMAGE=arm32v7/openjdk:11-jre-slim FROM $BASE_IMAGE -ENV CONSUL_LOCATION consul +MAINTAINER [email protected] +ENV CONSUL_LOCATION consul EXPOSE 8090 COPY qemu-arm-static /usr/bin diff --git a/streampipes-extensions-all-jvm/src/main/java/org/apache/streampipes/extensions/all/jvm/AllExtensionsInit.java b/streampipes-extensions-all-jvm/src/main/java/org/apache/streampipes/extensions/all/jvm/AllExtensionsInit.java index 7d817b5..375edc6 100644 --- a/streampipes-extensions-all-jvm/src/main/java/org/apache/streampipes/extensions/all/jvm/AllExtensionsInit.java +++ b/streampipes-extensions-all-jvm/src/main/java/org/apache/streampipes/extensions/all/jvm/AllExtensionsInit.java @@ -51,7 +51,7 @@ import org.apache.streampipes.connect.protocol.stream.pulsar.PulsarProtocol; import org.apache.streampipes.container.extensions.ExtensionsModelSubmitter; import org.apache.streampipes.container.init.DeclarersSingleton; import org.apache.streampipes.extensions.all.jvm.config.AllExtensionsConfig; -import org.apache.streampipes.processors.dummy.jvm.processor.dummy.DummyController; +import org.apache.streampipes.processors.filters.jvm.processor.dummy.DummyController; import org.apache.streampipes.processors.enricher.jvm.processor.jseval.JSEvalController; import org.apache.streampipes.processors.enricher.jvm.processor.sizemeasure.SizeMeasureController; import org.apache.streampipes.processors.filters.jvm.processor.compose.ComposeController; @@ -222,7 +222,8 @@ public class AllExtensionsInit extends ExtensionsModelSubmitter { .add(new TelegramController()) .add(new OneSignalController()) .add(new SlackNotificationController()) - // streampipes-processors-dummy-jvm + // streampipes-processors-filters-jvm + //TODO: delete after testing .add(new DummyController()) // streampipes-sinks-brokers-jvm .add(new KafkaController()) diff --git a/streampipes-extensions-all-jvm/src/main/java/org/apache/streampipes/extensions/all/jvm/config/AllExtensionsConfig.java b/streampipes-extensions-all-jvm/src/main/java/org/apache/streampipes/extensions/all/jvm/config/AllExtensionsConfig.java index c49411b..b06f178 100644 --- a/streampipes-extensions-all-jvm/src/main/java/org/apache/streampipes/extensions/all/jvm/config/AllExtensionsConfig.java +++ b/streampipes-extensions-all-jvm/src/main/java/org/apache/streampipes/extensions/all/jvm/config/AllExtensionsConfig.java @@ -21,6 +21,9 @@ import org.apache.streampipes.config.SpConfig; import org.apache.streampipes.container.model.EdgeExtensionsConfig; import org.apache.streampipes.container.model.ExtensionsConfig; +import java.net.InetAddress; +import java.net.UnknownHostException; + public enum AllExtensionsConfig implements EdgeExtensionsConfig { INSTANCE; @@ -48,6 +51,7 @@ public enum AllExtensionsConfig implements EdgeExtensionsConfig { // adapterConfig.register(ConfigKeys.NODE_CONTROLLER_CONTAINER_PORT, 7077, "node controller port"); } + @Override public String getHost() { return peConfig.getString(ConfigKeys.HOST); @@ -88,6 +92,19 @@ public enum AllExtensionsConfig implements EdgeExtensionsConfig { return adapterConfig.getInteger(ConfigKeys.BACKEND_PORT); } + + private String checkHostOrUseDefault(String key, String defaultValue) { + if ("true".equals(System.getenv("SP_DEBUG"))) { + try { + return InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + throw new RuntimeException("Could not retrieve host IP", e); + } + } else { + return getEnvOrDefault(key, defaultValue, String.class); + } + } + private <T> T getEnvOrDefault(String k, T defaultValue, Class<T> type) { if(type.equals(Integer.class)) { return System.getenv(k) != null ? (T) Integer.valueOf(System.getenv(k)) : defaultValue; diff --git a/streampipes-pipeline-elements-all-jvm/pom.xml b/streampipes-pipeline-elements-all-jvm/pom.xml index 150ba1d..4bea755 100644 --- a/streampipes-pipeline-elements-all-jvm/pom.xml +++ b/streampipes-pipeline-elements-all-jvm/pom.xml @@ -100,12 +100,6 @@ <version>${streampipes.version}</version> <classifier>embed</classifier> </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-processors-dummy-jvm</artifactId> - <version>${streampipes.version}</version> - <scope>embded</scope> - </dependency> <!-- 3rd party dependencies to avoid convergence errors --> <dependency> diff --git a/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/AllPipelineElementsInit.java b/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/AllPipelineElementsInit.java index 5cdf480..8102347 100644 --- a/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/AllPipelineElementsInit.java +++ b/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/AllPipelineElementsInit.java @@ -28,10 +28,10 @@ import org.apache.streampipes.messaging.kafka.SpKafkaProtocolFactory; import org.apache.streampipes.messaging.mqtt.SpMqttProtocolFactory; import org.apache.streampipes.pe.jvm.config.AllPipelineElementsConfig; import org.apache.streampipes.processors.changedetection.jvm.cusum.CusumController; -import org.apache.streampipes.processors.dummy.jvm.processor.dummy.DummyController; import org.apache.streampipes.processors.enricher.jvm.processor.jseval.JSEvalController; import org.apache.streampipes.processors.enricher.jvm.processor.sizemeasure.SizeMeasureController; import org.apache.streampipes.processors.filters.jvm.processor.compose.ComposeController; +import org.apache.streampipes.processors.filters.jvm.processor.dummy.DummyController; import org.apache.streampipes.processors.filters.jvm.processor.enrich.MergeByEnrichController; import org.apache.streampipes.processors.filters.jvm.processor.limit.RateLimitController; import org.apache.streampipes.processors.filters.jvm.processor.merge.MergeByTimeController; @@ -205,7 +205,7 @@ public class AllPipelineElementsInit extends StandaloneModelSubmitter { .add(new OneSignalController()) .add(new SlackNotificationController()) // TODO: delete this one after testing - // streampipes-projecessors-dummy-jvm + // streampipes-processors-filters-jvm .add(new DummyController()); DeclarersSingleton.getInstance().registerDataFormats( diff --git a/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/config/AllPipelineElementsConfig.java b/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/config/AllPipelineElementsConfig.java index f640bee..e003aa6 100644 --- a/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/config/AllPipelineElementsConfig.java +++ b/streampipes-pipeline-elements-all-jvm/src/main/java/org/apache/streampipes/pe/jvm/config/AllPipelineElementsConfig.java @@ -20,6 +20,9 @@ package org.apache.streampipes.pe.jvm.config; import org.apache.streampipes.config.SpConfig; import org.apache.streampipes.container.model.PeConfig; +import java.net.InetAddress; +import java.net.UnknownHostException; + public enum AllPipelineElementsConfig implements PeConfig { INSTANCE; diff --git a/streampipes-processors-dummy-jvm/Dockerfile b/streampipes-processors-dummy-jvm/Dockerfile deleted file mode 100644 index ddcc51a..0000000 --- a/streampipes-processors-dummy-jvm/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -# 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. - -ARG BASE_IMAGE=adoptopenjdk/openjdk8-openj9:alpine -FROM $BASE_IMAGE - -ENV CONSUL_LOCATION consul - -EXPOSE 8090 - -COPY target/streampipes-processors-dummy-jvm.jar /streampipes-processing-element-container.jar - -ENTRYPOINT ["java", "-jar", "/streampipes-processing-element-container.jar"] diff --git a/streampipes-processors-dummy-jvm/aarch64.Dockerfile b/streampipes-processors-dummy-jvm/aarch64.Dockerfile deleted file mode 100644 index ba91f2f..0000000 --- a/streampipes-processors-dummy-jvm/aarch64.Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -# 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. - -ARG BASE_IMAGE=arm64v8/openjdk:11-jre-slim -FROM $BASE_IMAGE - -ENV CONSUL_LOCATION consul - -EXPOSE 8090 - -COPY qemu-aarch64-static /usr/bin -COPY target/streampipes-processors-dummy-jvm.jar /streampipes-processing-element-container.jar - -ENTRYPOINT ["java", "-jar", "/streampipes-processing-element-container.jar"] diff --git a/streampipes-processors-dummy-jvm/arm.Dockerfile b/streampipes-processors-dummy-jvm/arm.Dockerfile deleted file mode 100644 index c8cc39a..0000000 --- a/streampipes-processors-dummy-jvm/arm.Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -# 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. - -ARG BASE_IMAGE=arm32v7/openjdk:11-jre-slim -FROM $BASE_IMAGE - -ENV CONSUL_LOCATION consul - -EXPOSE 8090 - -COPY qemu-arm-static /usr/bin -COPY target/streampipes-processors-dummy-jvm.jar /streampipes-processing-element-container.jar - -ENTRYPOINT ["java", "-jar", "/streampipes-processing-element-container.jar"] diff --git a/streampipes-processors-dummy-jvm/development/env b/streampipes-processors-dummy-jvm/development/env deleted file mode 100644 index 60be7a3..0000000 --- a/streampipes-processors-dummy-jvm/development/env +++ /dev/null @@ -1,19 +0,0 @@ -# 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. - -# Those parameters are used by IntelliJ to set the default consul parameters for development -SP_PORT=6015 -SP_HOST=localhost -SP_DEBUG=true diff --git a/streampipes-processors-dummy-jvm/pom.xml b/streampipes-processors-dummy-jvm/pom.xml deleted file mode 100644 index 4bb320b..0000000 --- a/streampipes-processors-dummy-jvm/pom.xml +++ /dev/null @@ -1,114 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - ~ - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>streampipes-extensions</artifactId> - <groupId>org.apache.streampipes</groupId> - <version>0.68.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>streampipes-processors-dummy-jvm</artifactId> - - <dependencies> - <!-- StreamPipes dependencies --> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-config</artifactId> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-container-standalone</artifactId> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-dataformat-json</artifactId> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-dataformat-cbor</artifactId> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-dataformat-smile</artifactId> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-dataformat-fst</artifactId> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-messaging-jms</artifactId> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-messaging-kafka</artifactId> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-messaging-mqtt</artifactId> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-sdk</artifactId> - </dependency> - <dependency> - <groupId>org.apache.streampipes</groupId> - <artifactId>streampipes-wrapper-standalone</artifactId> - </dependency> - <dependency> - <groupId>org.quartz-scheduler</groupId> - <artifactId>quartz</artifactId> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>jar</goal> - </goals> - <phase>package</phase> - <configuration> - <classifier>embed</classifier> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>repackage</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - <finalName>streampipes-processors-dummy-jvm</finalName> - - </build> -</project> \ No newline at end of file diff --git a/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/DummyJvmInit.java b/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/DummyJvmInit.java deleted file mode 100644 index c6811bc..0000000 --- a/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/DummyJvmInit.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.streampipes.processors.dummy.jvm; - -import org.apache.streampipes.container.init.DeclarersSingleton; -import org.apache.streampipes.container.standalone.init.StandaloneModelSubmitter; -import org.apache.streampipes.dataformat.cbor.CborDataFormatFactory; -import org.apache.streampipes.dataformat.fst.FstDataFormatFactory; -import org.apache.streampipes.dataformat.json.JsonDataFormatFactory; -import org.apache.streampipes.dataformat.smile.SmileDataFormatFactory; -import org.apache.streampipes.messaging.jms.SpJmsProtocolFactory; -import org.apache.streampipes.messaging.kafka.SpKafkaProtocolFactory; -import org.apache.streampipes.messaging.mqtt.SpMqttProtocolFactory; -import org.apache.streampipes.processors.dummy.jvm.config.DummyJvmConfig; -import org.apache.streampipes.processors.dummy.jvm.processor.dummy.DummyController; - -public class DummyJvmInit extends StandaloneModelSubmitter { - - public static void main(String[] args) { - DeclarersSingleton.getInstance() - .add(new DummyController()); - - DeclarersSingleton.getInstance().registerDataFormats( - new JsonDataFormatFactory(), - new CborDataFormatFactory(), - new SmileDataFormatFactory(), - new FstDataFormatFactory()); - - DeclarersSingleton.getInstance().registerProtocols( - new SpKafkaProtocolFactory(), - new SpMqttProtocolFactory(), - new SpJmsProtocolFactory()); - - new DummyJvmInit().init(DummyJvmConfig.INSTANCE); - } -} diff --git a/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/config/ConfigKeys.java b/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/config/ConfigKeys.java deleted file mode 100644 index e358fdc..0000000 --- a/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/config/ConfigKeys.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.streampipes.processors.dummy.jvm.config; - -public class ConfigKeys { - final static String HOST = "SP_HOST"; - final static String PORT = "SP_PORT"; - final static String SERVICE_NAME_KEY = "SP_SERVICE_NAME"; -} diff --git a/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/config/DummyJvmConfig.java b/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/config/DummyJvmConfig.java deleted file mode 100644 index 88e32fa..0000000 --- a/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/config/DummyJvmConfig.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.streampipes.processors.dummy.jvm.config; - -import org.apache.streampipes.config.SpConfig; -import org.apache.streampipes.container.model.PeConfig; - -public enum DummyJvmConfig implements PeConfig { - INSTANCE; - - private final SpConfig config; - - private final static String service_id = "pe/org.apache.streampipes.processors.dummy.jvm"; - private final static String service_name = "Processors Dummy JVM"; - private final static String service_container_name = "processors-dummy-jvm"; - - DummyJvmConfig() { - config = SpConfig.getSpConfig(service_id); - config.register(ConfigKeys.HOST, service_container_name, "Hostname"); - config.register(ConfigKeys.PORT, 8090, "Port"); - config.register(ConfigKeys.SERVICE_NAME_KEY, service_name, "The name of the service"); - } - - @Override - public String getHost() { - return config.getString(ConfigKeys.HOST); - } - - @Override - public int getPort() { - return config.getInteger(ConfigKeys.PORT); - } - - @Override - public String getId() { - return service_id; - } - - @Override - public String getName() { - return config.getString(ConfigKeys.SERVICE_NAME_KEY); - } - -} diff --git a/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/processor/dummy/Dummy.java b/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/processor/dummy/Dummy.java deleted file mode 100644 index 48938dd..0000000 --- a/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/processor/dummy/Dummy.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.streampipes.processors.dummy.jvm.processor.dummy; - -import org.apache.streampipes.model.runtime.Event; -import org.apache.streampipes.wrapper.context.EventProcessorRuntimeContext; -import org.apache.streampipes.wrapper.routing.SpOutputCollector; -import org.apache.streampipes.wrapper.runtime.EventProcessor; - -public class Dummy implements EventProcessor<DummyParameters> { - - private DummyParameters params; - - @Override - public void onInvocation(DummyParameters params, SpOutputCollector spOutputCollector, EventProcessorRuntimeContext - runtimeContext) { - this.params = params; - } - - @Override - public void onEvent(Event event, SpOutputCollector out) { - out.collect(event); - } - - @Override - public void onDetach() { - - } -} diff --git a/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/processor/dummy/DummyController.java b/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/processor/dummy/DummyController.java deleted file mode 100644 index 9149068..0000000 --- a/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/processor/dummy/DummyController.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.streampipes.processors.dummy.jvm.processor.dummy; - -import org.apache.streampipes.model.DataProcessorType; -import org.apache.streampipes.model.graph.DataProcessorDescription; -import org.apache.streampipes.model.graph.DataProcessorInvocation; -import org.apache.streampipes.sdk.builder.ProcessingElementBuilder; -import org.apache.streampipes.sdk.builder.ResourceRequirementsBuilder; -import org.apache.streampipes.sdk.builder.StreamRequirementsBuilder; -import org.apache.streampipes.sdk.extractor.ProcessingElementParameterExtractor; -import org.apache.streampipes.sdk.helpers.*; -import org.apache.streampipes.sdk.utils.Assets; -import org.apache.streampipes.wrapper.standalone.ConfiguredEventProcessor; -import org.apache.streampipes.wrapper.standalone.declarer.StandaloneEventProcessingDeclarer; - -public class DummyController extends StandaloneEventProcessingDeclarer<DummyParameters> { - - @Override - public DataProcessorDescription declareModel() { - return ProcessingElementBuilder.create("org.apache.streampipes.processors.dummy.jvm.dummy") - .category(DataProcessorType.FILTER) - .withAssets(Assets.DOCUMENTATION) - .withLocales(Locales.EN) - .requiredStream(StreamRequirementsBuilder - .create() - .requiredProperty(EpRequirements.anyProperty()).build()) - .requiredResource(ResourceRequirementsBuilder - .create() - .requiredProperty(NodeResourceRequirements.gpu()) - .build()) - .outputStrategy(OutputStrategies.keep()) - .build(); - } - - @Override - public ConfiguredEventProcessor<DummyParameters> onInvocation - (DataProcessorInvocation graph, ProcessingElementParameterExtractor extractor) { - - DummyParameters params = new DummyParameters(graph); - return new ConfiguredEventProcessor<>(params, Dummy::new); - } -} diff --git a/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/processor/dummy/DummyParameters.java b/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/processor/dummy/DummyParameters.java deleted file mode 100644 index 7ca18e4..0000000 --- a/streampipes-processors-dummy-jvm/src/main/java/org/apache/streampipes/processors/dummy/jvm/processor/dummy/DummyParameters.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.streampipes.processors.dummy.jvm.processor.dummy; - -import org.apache.streampipes.model.graph.DataProcessorInvocation; -import org.apache.streampipes.wrapper.params.binding.EventProcessorBindingParams; - -public class DummyParameters extends EventProcessorBindingParams { - - public DummyParameters(DataProcessorInvocation graph) { - super(graph); - } -} diff --git a/streampipes-processors-dummy-jvm/src/main/resources/org.apache.streampipes.processors.dummy.jvm.dummy/strings.en b/streampipes-processors-dummy-jvm/src/main/resources/org.apache.streampipes.processors.dummy.jvm.dummy/strings.en deleted file mode 100644 index 6d1d11a..0000000 --- a/streampipes-processors-dummy-jvm/src/main/resources/org.apache.streampipes.processors.dummy.jvm.dummy/strings.en +++ /dev/null @@ -1,2 +0,0 @@ -org.apache.streampipes.processors.dummy.jvm.dummy.title=Dummy Processor -org.apache.streampipes.processors.dummy.jvm.dummy.description=Dummy Processor Description \ No newline at end of file diff --git a/streampipes-processors-filters-jvm/src/main/java/org/apache/streampipes/processors/filters/jvm/FiltersJvmInit.java b/streampipes-processors-filters-jvm/src/main/java/org/apache/streampipes/processors/filters/jvm/FiltersJvmInit.java index bd6cfdc..1f7fdfa 100644 --- a/streampipes-processors-filters-jvm/src/main/java/org/apache/streampipes/processors/filters/jvm/FiltersJvmInit.java +++ b/streampipes-processors-filters-jvm/src/main/java/org/apache/streampipes/processors/filters/jvm/FiltersJvmInit.java @@ -29,6 +29,7 @@ import org.apache.streampipes.messaging.kafka.SpKafkaProtocolFactory; import org.apache.streampipes.messaging.mqtt.SpMqttProtocolFactory; import org.apache.streampipes.processors.filters.jvm.config.FiltersJvmConfig; import org.apache.streampipes.processors.filters.jvm.processor.compose.ComposeController; +import org.apache.streampipes.processors.filters.jvm.processor.dummy.DummyController; import org.apache.streampipes.processors.filters.jvm.processor.enrich.MergeByEnrichController; import org.apache.streampipes.processors.filters.jvm.processor.limit.RateLimitController; import org.apache.streampipes.processors.filters.jvm.processor.merge.MergeByTimeController; @@ -50,7 +51,9 @@ public class FiltersJvmInit extends StandaloneModelSubmitter { .add(new MergeByTimeController()) .add(new ComposeController()) .add(new NumericalTextFilterController()) - .add(new RateLimitController()); + .add(new RateLimitController()) + //TODO: delete after testing + .add(new DummyController()); DeclarersSingleton.getInstance().registerDataFormats( new JsonDataFormatFactory(), diff --git a/streampipes-processors-filters-jvm/src/main/java/org/apache/streampipes/processors/filters/jvm/processor/dummy/DummyController.java b/streampipes-processors-filters-jvm/src/main/java/org/apache/streampipes/processors/filters/jvm/processor/dummy/DummyController.java new file mode 100644 index 0000000..6fa7def --- /dev/null +++ b/streampipes-processors-filters-jvm/src/main/java/org/apache/streampipes/processors/filters/jvm/processor/dummy/DummyController.java @@ -0,0 +1,82 @@ +/* + * 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.streampipes.processors.filters.jvm.processor.dummy; + +import org.apache.streampipes.commons.exceptions.SpRuntimeException; +import org.apache.streampipes.model.DataProcessorType; +import org.apache.streampipes.model.graph.DataProcessorDescription; +import org.apache.streampipes.model.runtime.Event; +import org.apache.streampipes.sdk.builder.ProcessingElementBuilder; +import org.apache.streampipes.sdk.builder.ResourceRequirementsBuilder; +import org.apache.streampipes.sdk.builder.StreamRequirementsBuilder; +import org.apache.streampipes.sdk.helpers.*; +import org.apache.streampipes.sdk.utils.Assets; +import org.apache.streampipes.vocabulary.SO; +import org.apache.streampipes.wrapper.context.EventProcessorRuntimeContext; +import org.apache.streampipes.wrapper.routing.SpOutputCollector; +import org.apache.streampipes.wrapper.standalone.ProcessorParams; +import org.apache.streampipes.wrapper.standalone.StreamPipesReconfigurableProcessor; + +public class DummyController extends StreamPipesReconfigurableProcessor { + + private static double reconfigurableValue; + + @Override + public DataProcessorDescription declareModel() { + return ProcessingElementBuilder.create("org.apache.streampipes.processors.filters.jvm.dummy") + .category(DataProcessorType.FILTER) + .withAssets(Assets.DOCUMENTATION) + .withLocales(Locales.EN) + .requiredStream(StreamRequirementsBuilder.any()) + .requiredResource(ResourceRequirementsBuilder + .create() + .requiredProperty(NodeResourceRequirements.gpu()) + .build()) + .requiredFloatParameter(Labels.withId("static-float")) + .requiredReconfigurableFloatParameter(Labels.withId("i-am-reconfigurable")) +// .requiredReconfigurableIntegerParameter(Labels.withId("i-am-also-reconfigurable")) + .outputStrategy(OutputStrategies.append(EpProperties.numberEp(Labels.empty(), "appended-reconfigurable", + SO.Number))) + .build(); + } + + @Override + public void onInvocation(ProcessorParams parameters, SpOutputCollector spOutputCollector, + EventProcessorRuntimeContext runtimeContext) throws SpRuntimeException { + // do nothing + reconfigurableValue = parameters.extractor().singleValueParameter("i-am-reconfigurable", Double.class); + } + + @Override + public void onEvent(Event event, SpOutputCollector collector) throws SpRuntimeException { + // transform event + event.addField("appended-reconfigurable", reconfigurableValue); + collector.collect(event); + } + + @Override + public void onDetach() throws SpRuntimeException { + // do nothing + } + + @Override + public void onReconfigurationEvent(Event event) throws SpRuntimeException { + reconfigurableValue = event.getFieldByRuntimeName("i-am-reconfigurable").getAsPrimitive().getAsDouble(); + } +} diff --git a/streampipes-processors-dummy-jvm/src/main/resources/org.apache.streampipes.processors.dummy.jvm.dummy/documentation.md b/streampipes-processors-filters-jvm/src/main/resources/org.apache.streampipes.processors.filters.jvm.dummy/documentation.md similarity index 100% rename from streampipes-processors-dummy-jvm/src/main/resources/org.apache.streampipes.processors.dummy.jvm.dummy/documentation.md rename to streampipes-processors-filters-jvm/src/main/resources/org.apache.streampipes.processors.filters.jvm.dummy/documentation.md diff --git a/streampipes-processors-dummy-jvm/src/main/resources/org.apache.streampipes.processors.dummy.jvm.dummy/icon.png b/streampipes-processors-filters-jvm/src/main/resources/org.apache.streampipes.processors.filters.jvm.dummy/icon.png similarity index 100% rename from streampipes-processors-dummy-jvm/src/main/resources/org.apache.streampipes.processors.dummy.jvm.dummy/icon.png rename to streampipes-processors-filters-jvm/src/main/resources/org.apache.streampipes.processors.filters.jvm.dummy/icon.png diff --git a/streampipes-processors-filters-jvm/src/main/resources/org.apache.streampipes.processors.filters.jvm.dummy/strings.en b/streampipes-processors-filters-jvm/src/main/resources/org.apache.streampipes.processors.filters.jvm.dummy/strings.en new file mode 100644 index 0000000..658dbad --- /dev/null +++ b/streampipes-processors-filters-jvm/src/main/resources/org.apache.streampipes.processors.filters.jvm.dummy/strings.en @@ -0,0 +1,8 @@ +org.apache.streampipes.processors.filters.jvm.dummy.title=Dummy Processor +org.apache.streampipes.processors.filters.jvm.dummy.description=Dummy Processor Description + +static-float.title=static-float +static-float.description= + +i-am-reconfigurable.title=reconfigurable-float +i-am-reconfigurable.description= \ No newline at end of file
