This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch 2350-new-processor-staticmetadataenrichment
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to
refs/heads/2350-new-processor-staticmetadataenrichment by this push:
new a4c365cb3 feat(#2350): Add documentation for new processing element
a4c365cb3 is described below
commit a4c365cb32b25c9157970efcf6a42774f1435406
Author: Philipp Zehnder <[email protected]>
AuthorDate: Thu Dec 21 08:21:54 2023 +0100
feat(#2350): Add documentation for new processing element
---
.../StaticMetaDataEnrichmentProcessor.java | 28 ++++----
.../documentation.md | 68 ++++++++++++++++++++
.../icon.png | Bin
.../strings.en | 3 -
.../documentation.md | 71 ---------------------
5 files changed, 80 insertions(+), 90 deletions(-)
diff --git
a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/staticmetadata/StaticMetaDataEnrichmentProcessor.java
b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/staticmetadata/StaticMetaDataEnrichmentProcessor.java
index c1354892a..e503e2b0a 100644
---
a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/staticmetadata/StaticMetaDataEnrichmentProcessor.java
+++
b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/staticmetadata/StaticMetaDataEnrichmentProcessor.java
@@ -44,7 +44,6 @@ public class StaticMetaDataEnrichmentProcessor extends
StreamPipesDataProcessor
implements
ResolvesContainerProvidedOutputStrategy<DataProcessorInvocation,
ProcessingElementParameterExtractor> {
private static final String STATIC_METADATA_INPUT = "static-metadata-input";
- private static final String STATIC_METADATA_INPUT_COLLECTION =
"static-metadata-input-collection";
private static final String STATIC_METADATA_INPUT_RUNTIME_NAME =
"static-metadata-input-runtime-name";
private static final String STATIC_METADATA_INPUT_VALUE =
"static-metadata-input-value";
private static final String STATIC_METADATA_INPUT_DATATYPE =
"static-metadata-input-datatype";
@@ -64,22 +63,19 @@ public class StaticMetaDataEnrichmentProcessor extends
StreamPipesDataProcessor
.category(DataProcessorType.ENRICH)
.withLocales(Locales.EN)
.withAssets(Assets.DOCUMENTATION,
Assets.ICON)
- .requiredParameterAsCollection(
+ .requiredCollection(
Labels.withId(STATIC_METADATA_INPUT),
- StaticProperties.collection(
-
Labels.withId(STATIC_METADATA_INPUT_COLLECTION),
-
StaticProperties.stringFreeTextProperty(Labels.withId(
-
STATIC_METADATA_INPUT_RUNTIME_NAME)),
-
StaticProperties.stringFreeTextProperty(
-
Labels.withId(STATIC_METADATA_INPUT_VALUE)),
-
StaticProperties.singleValueSelection(
-
Labels.withId(STATIC_METADATA_INPUT_DATATYPE),
- Options.from(
- OPTION_BOOL,
- OPTION_STRING,
- OPTION_FLOAT,
- OPTION_INTEGER
- )
+
StaticProperties.stringFreeTextProperty(Labels.withId(
+
STATIC_METADATA_INPUT_RUNTIME_NAME)),
+ StaticProperties.stringFreeTextProperty(
+
Labels.withId(STATIC_METADATA_INPUT_VALUE)),
+ StaticProperties.singleValueSelection(
+
Labels.withId(STATIC_METADATA_INPUT_DATATYPE),
+ Options.from(
+ OPTION_BOOL,
+ OPTION_STRING,
+ OPTION_FLOAT,
+ OPTION_INTEGER
)
)
)
diff --git
a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processor.staticmetadata/documentation.md
b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processor.staticmetadata/documentation.md
new file mode 100644
index 000000000..ebfc4a709
--- /dev/null
+++
b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processor.staticmetadata/documentation.md
@@ -0,0 +1,68 @@
+<!--
+ ~ 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.
+ ~
+ -->
+## Static Metadata Enricher
+
+Enrich a data stream by dynamically adding fields based on user-provided
static metadata configuration.
+
+---
+
+## Description
+
+The Static Metadata Enricher is designed to enrich a data stream by
dynamically adding fields based on user-provided
+metadata configuration. Users can specify static properties, and the processor
will process each event, adding fields
+according to the provided key-value pairs. The output strategy is determined
dynamically based on the provided metadata.
+For added convenience, users also have the option of uploading a CSV file with
metadata information.
+
+### Configuration
+
+For each metadata entry, configure the following three options:
+
+- **Runtime Name:** A unique identifier for the property during runtime.
+- **Value:** The value associated with the property.
+- **Data Type:** The data type of the property value.
+
+#### Using CSV Option
+
+Alternatively, you can utilize the CSV upload feature by creating a CSV file
with the following format:
+
+```
+Runtime Name,Runtime Value,Data Type
+sensorType,Temperature,String
+maxSensorValue,100.0,Float
+minSensorValue,0,Float
+```
+
+## Example
+### Input Event
+
+```json
+{
+ "reading": 25.5
+}
+```
+
+### Output Event
+
+```json
+{
+ "reading": 25.5,
+ "sensorType": "Temperature",
+ "maxSensorValue": 100.0,
+ "minSensorValue": 0.0
+}
+```
diff --git
a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processors.staticmetadata/icon.png
b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processor.staticmetadata/icon.png
similarity index 100%
rename from
streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processors.staticmetadata/icon.png
rename to
streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processor.staticmetadata/icon.png
diff --git
a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processors.staticmetadata/strings.en
b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processor.staticmetadata/strings.en
similarity index 93%
rename from
streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processors.staticmetadata/strings.en
rename to
streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processor.staticmetadata/strings.en
index 5c8ca0447..2c2826d82 100644
---
a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processors.staticmetadata/strings.en
+++
b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processor.staticmetadata/strings.en
@@ -21,9 +21,6 @@
org.apache.streampipes.processors.transformation.jvm.processor.staticmetadata.de
static-metadata-input.title=Metadata Input
static-metadata-input.description=Input collection of metadata that will be
enriched to the event
-static-metadata-input-collection.title=Input Collection
-static-metadata-input-collection.description=
-
static-metadata-input-runtime-name.title=Runtime Name
static-metadata-input-runtime-name.description=This is used for the runtime
name in the event
diff --git
a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processors.staticmetadata/documentation.md
b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processors.staticmetadata/documentation.md
deleted file mode 100644
index 9080e2d09..000000000
---
a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/resources/org.apache.streampipes.processors.transformation.jvm.processors.staticmetadata/documentation.md
+++ /dev/null
@@ -1,71 +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.
- ~
- -->
-
-## CSV Metadata Enrichment
-Enrich a datastream with information provided in a CSV file.
-The data of the CSV file is matched by an id column with a property value of a
String in the data stream.
-
-***
-
-## Description
-Upload a CSV file with static meta information that will be appended to each
event.
-The file can contain different information for different keys in the stream.
-
-
-### Structure of CSV file
-The first row containes the runtime names for the properties to insert.
-Once the file is uploaded the user can select which column to use for the
matching property
-and which values should be appended.
-Delimiter: ';'
-
-
-***
-
-## Example
-Add the location of a production line to the event
-
-### Input event
-```
-{
- 'line_id': 'line1',
- 'timestamp': 1586378041
-}
-```
-
-### CSV File
-```
-production_line;location
-line1;germany
-line2;uk
-line3;usa
-```
-
-### Configuration
-* The field that is used for the lookup (Example: line_id)
-* The CSV file (Example: Upload the csv file)
-* Field to match (Example: production_line)
-* Fields to append (Example: location)
-
-### Output event
-```
-{
- 'line_id': 'line1',
- 'timestamp': 1586378041,
- 'location': 'germany'
-}
-```