You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2020/07/10 12:13:19 UTC

[incubator-streampipes-extensions] branch dev updated: Improve file stream adapter configuration

This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes-extensions.git


The following commit(s) were added to refs/heads/dev by this push:
     new 6a06c2c  Improve file stream adapter configuration
6a06c2c is described below

commit 6a06c2cddf7919f1d5cfb46af17a050c9a1d357d
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Fri Jul 10 14:12:55 2020 +0200

    Improve file stream adapter configuration
---
 .../connect/protocol/stream/FileStreamProtocol.java     | 17 +++++++++++------
 .../strings.en                                          | 10 +++-------
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/protocol/stream/FileStreamProtocol.java b/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/protocol/stream/FileStreamProtocol.java
index 3e29488..d29b2dc 100644
--- a/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/protocol/stream/FileStreamProtocol.java
+++ b/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/protocol/stream/FileStreamProtocol.java
@@ -140,10 +140,14 @@ public class FileStreamProtocol extends Protocol {
   @Override
   public Protocol getInstance(ProtocolDescription protocolDescription, Parser parser, Format format) {
     ParameterExtractor extractor = new ParameterExtractor(protocolDescription.getConfig());
-    String replaceTimestampString = extractor.selectedSingleValueOption("replaceTimestamp");
-    boolean replaceTimestamp = replaceTimestampString.equals("True") ? true : false;
+
+    List<String> replaceTimestampStringList = extractor.selectedMultiValues("replaceTimestamp");
+//    String replaceTimestampString = extractor.selectedSingleValueOption("replaceTimestamp");
+    boolean replaceTimestamp = replaceTimestampStringList.size() == 0 ? false : true;
+
     float speedUp = Float.parseFloat(extractor.singleValue("speed"));
-    int timeBetweenReplay = Integer.parseInt(extractor.singleValue("time-between-replay"));
+
+    int timeBetweenReplay = 1;
 
     FileStaticProperty fileStaticProperty = (FileStaticProperty) extractor.getStaticPropertyByName("filePath");
 
@@ -182,10 +186,11 @@ public class FileStreamProtocol extends Protocol {
             .sourceType(AdapterSourceType.STREAM)
             .category(AdapterType.Generic)
             .requiredFile(Labels.withId("filePath"))
-            .requiredSingleValueSelection(Labels.withId("replaceTimestamp"),
-                Options.from("True", "False"))
+//            .requiredSingleValueSelection(Labels.withId("replaceTimestamp"),
+//                Options.from("True", "False"))
+            .requiredMultiValueSelection(Labels.withId("replaceTimestamp"),
+                    Options.from(""))
             .requiredFloatParameter(Labels.withId("speed"))
-            .requiredFloatParameter(Labels.withId("time-between-replay"))
             .build();
   }
 
diff --git a/streampipes-connect-adapters/src/main/resources/org.apache.streampipes.connect.protocol.stream.file/strings.en b/streampipes-connect-adapters/src/main/resources/org.apache.streampipes.connect.protocol.stream.file/strings.en
index 51049b8..9146e11 100644
--- a/streampipes-connect-adapters/src/main/resources/org.apache.streampipes.connect.protocol.stream.file/strings.en
+++ b/streampipes-connect-adapters/src/main/resources/org.apache.streampipes.connect.protocol.stream.file/strings.en
@@ -4,13 +4,9 @@ org.apache.streampipes.connect.protocol.stream.file=Continuously streams the con
 filePath.title=File
 filePath.description=File Path
 
-replaceTimestamp.title=Use current time for timestamp?
-replaceTimestamp.description=Keep timestamps from File or replace with current.
+replaceTimestamp.title=Use current time
+replaceTimestamp.description=Replace Event Time with Current Timestamp
 
 speed.title=Replay Speed
-speed.description=Replay Speed. For original speed, set it to 1
-
-time-between-replay.title=Time Between Replay
-time-between-replay.description=Time between two rounds of replay. Time in seconds
-
+speed.description=original = 1; speedup 2x = 2; half speed  =  0.5