You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by bo...@apache.org on 2022/12/12 21:17:44 UTC
[streampipes] 02/05: add checkstyle to streampipes-sdk
This is an automated email from the ASF dual-hosted git repository.
bossenti pushed a commit to branch add-checkstyle
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit b770bca774a0796e086ed663643f41f8fd2db9c8
Author: bossenti <bo...@posteo.de>
AuthorDate: Mon Dec 12 22:11:19 2022 +0100
add checkstyle to streampipes-sdk
---
.../siddhi/trend/TestTrendProcessor.java | 8 +-
.../csvmetadata/CsvMetadataEnrichment.java | 6 +-
.../output/AppendOutputSchemaGenerator.java | 8 +-
.../output/CustomOutputSchemaGenerator.java | 4 +-
.../matching/v2/pipeline/ComputeOutputStep.java | 4 +-
.../manager/selector/TestPropertyRenaming.java | 2 +-
streampipes-sdk/pom.xml | 13 +-
.../apache/streampipes/sdk/StaticProperties.java | 65 ++-
...AbstractConfigurablePipelineElementBuilder.java | 586 ++++++++++++---------
.../builder/AbstractPipelineElementBuilder.java | 21 +-
.../builder/AbstractProcessingElementBuilder.java | 105 ++--
.../sdk/builder/BoundPipelineElementBuilder.java | 37 +-
.../streampipes/sdk/builder/DataSetBuilder.java | 6 +-
.../streampipes/sdk/builder/DataSinkBuilder.java | 11 +-
.../streampipes/sdk/builder/DataSourceBuilder.java | 14 +-
.../streampipes/sdk/builder/DataStreamBuilder.java | 198 +++----
.../sdk/builder/PipelineTemplateBuilder.java | 3 +-
.../sdk/builder/PrimitivePropertyBuilder.java | 242 +++++----
.../sdk/builder/ProcessingElementBuilder.java | 12 +-
.../sdk/builder/PropertyRequirementsBuilder.java | 25 +-
.../sdk/builder/StreamRequirementsBuilder.java | 50 +-
.../sdk/builder/WildcardTopicBuilder.java | 2 +-
.../builder/adapter/AdapterDescriptionBuilder.java | 20 +-
.../builder/adapter/FormatDescriptionBuilder.java | 9 +-
.../sdk/builder/adapter/GuessSchemaBuilder.java | 5 +-
.../adapter/ProtocolDescriptionBuilder.java | 17 +-
.../adapter/SpecificDataSetAdapterBuilder.java | 11 +-
.../adapter/SpecificDataStreamAdapterBuilder.java | 12 +-
.../sdk/extractor/AbstractParameterExtractor.java | 333 +++++++-----
.../sdk/extractor/DataSinkParameterExtractor.java | 8 +-
.../ProcessingElementParameterExtractor.java | 32 +-
.../sdk/extractor/StaticPropertyExtractor.java | 2 +-
.../streampipes/sdk/helpers/Alternatives.java | 7 +-
.../streampipes/sdk/helpers/CodeLanguage.java | 19 +-
.../sdk/helpers/CollectedStreamRequirements.java | 3 +-
.../streampipes/sdk/helpers/EpProperties.java | 36 +-
.../streampipes/sdk/helpers/EpRequirements.java | 3 +-
.../apache/streampipes/sdk/helpers/Formats.java | 5 +
.../apache/streampipes/sdk/helpers/Groundings.java | 24 +-
.../org/apache/streampipes/sdk/helpers/Labels.java | 25 +-
.../apache/streampipes/sdk/helpers/Locales.java | 4 +-
.../apache/streampipes/sdk/helpers/Options.java | 3 +-
.../streampipes/sdk/helpers/OutputStrategies.java | 184 ++++---
.../apache/streampipes/sdk/helpers/Protocols.java | 34 +-
.../streampipes/sdk/helpers/StreamIdentifier.java | 5 +-
.../streampipes/sdk/helpers/SupportedFormats.java | 5 +
.../sdk/helpers/SupportedProtocols.java | 3 +
.../sdk/helpers/TransformOperations.java | 44 +-
.../org/apache/streampipes/sdk/helpers/Tuple2.java | 30 +-
.../org/apache/streampipes/sdk/helpers/Tuple3.java | 34 +-
.../streampipes/sdk/stream/SchemaBuilder.java | 57 +-
.../streampipes/sdk/stream/StreamBuilder.java | 90 ++--
.../apache/streampipes/sdk/utils/Datatypes.java | 50 +-
.../GenericDataStreamAdapterBuilderTest.java | 1 +
54 files changed, 1406 insertions(+), 1131 deletions(-)
diff --git a/streampipes-extensions/streampipes-processors-filters-siddhi/src/test/java/org/apache/streampipes/processors/siddhi/trend/TestTrendProcessor.java b/streampipes-extensions/streampipes-processors-filters-siddhi/src/test/java/org/apache/streampipes/processors/siddhi/trend/TestTrendProcessor.java
index eae44ed4c..de9c2a1d2 100644
--- a/streampipes-extensions/streampipes-processors-filters-siddhi/src/test/java/org/apache/streampipes/processors/siddhi/trend/TestTrendProcessor.java
+++ b/streampipes-extensions/streampipes-processors-filters-siddhi/src/test/java/org/apache/streampipes/processors/siddhi/trend/TestTrendProcessor.java
@@ -141,10 +141,10 @@ public class TestTrendProcessor {
private void sendEvents(Trend trend) {
List<Tuple2<Integer, Event>> events = makeEvents();
for (Tuple2<Integer, Event> event : events) {
- LOG.info("Sending event with value " + event.b.getFieldBySelector("s0::randomValue"));
- trend.onEvent(event.b, null);
+ LOG.info("Sending event with value " + event.v.getFieldBySelector("s0::randomValue"));
+ trend.onEvent(event.v, null);
try {
- Thread.sleep(event.a);
+ Thread.sleep(event.k);
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -154,7 +154,7 @@ public class TestTrendProcessor {
private List<Tuple2<Integer, Event>> makeEvents() {
List<Tuple2<Integer, Event>> events = new ArrayList<>();
for (Tuple2<Integer, Integer> eventSetting : eventSettings) {
- events.add(makeEvent(eventSetting.a, eventSetting.b));
+ events.add(makeEvent(eventSetting.k, eventSetting.v));
}
return events;
}
diff --git a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/csvmetadata/CsvMetadataEnrichment.java b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/csvmetadata/CsvMetadataEnrichment.java
index b3ffa479e..159019920 100644
--- a/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/csvmetadata/CsvMetadataEnrichment.java
+++ b/streampipes-extensions/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/csvmetadata/CsvMetadataEnrichment.java
@@ -103,7 +103,7 @@ public class CsvMetadataEnrichment implements EventProcessor<CsvMetadataEnrichme
event.getFieldBySelector(mappingFieldSelector).getAsPrimitive().getAsString();
CSVRecord record = this.columnMap.get(lookupValue);
for (Tuple2<String, PrimitiveTypeParser> columnToAppend : columnsToAppend) {
- event.addField(columnToAppend.a, getRecordValueOrDefault(record, columnToAppend));
+ event.addField(columnToAppend.k, getRecordValueOrDefault(record, columnToAppend));
}
collector.collect(event);
}
@@ -111,9 +111,9 @@ public class CsvMetadataEnrichment implements EventProcessor<CsvMetadataEnrichme
private Object getRecordValueOrDefault(CSVRecord record, Tuple2<String,
PrimitiveTypeParser> columnToAppend) {
if (record != null) {
- return columnToAppend.b.parse(record.get(columnToAppend.a));
+ return columnToAppend.v.parse(record.get(columnToAppend.k));
} else {
- return columnToAppend.b.parse("0");
+ return columnToAppend.v.parse("0");
}
}
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/output/AppendOutputSchemaGenerator.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/output/AppendOutputSchemaGenerator.java
index a79402f69..70804f418 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/output/AppendOutputSchemaGenerator.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/output/AppendOutputSchemaGenerator.java
@@ -52,9 +52,9 @@ public class AppendOutputSchemaGenerator extends OutputSchemaGenerator<AppendOut
PropertySelector(stream.getEventSchema())
.createRenamedPropertyList(selectors, appendProperties);
- EventSchema outputSchema = new EventSchema(generatedOutputProperties.a);
+ EventSchema outputSchema = new EventSchema(generatedOutputProperties.k);
- return new Tuple2<>(outputSchema, getModifiedOutputStrategy(generatedOutputProperties.b));
+ return new Tuple2<>(outputSchema, getModifiedOutputStrategy(generatedOutputProperties.v));
}
@Override
@@ -68,9 +68,9 @@ public class AppendOutputSchemaGenerator extends OutputSchemaGenerator<AppendOut
PropertySelector(stream1.getEventSchema(), stream2.getEventSchema())
.createRenamedPropertyList(selectors, appendProperties);
- EventSchema outputSchema = new EventSchema(generatedOutputProperties.a);
+ EventSchema outputSchema = new EventSchema(generatedOutputProperties.k);
- return new Tuple2<>(outputSchema, getModifiedOutputStrategy(generatedOutputProperties.b));
+ return new Tuple2<>(outputSchema, getModifiedOutputStrategy(generatedOutputProperties.v));
}
private AppendOutputStrategy getModifiedOutputStrategy(List<PropertyRenameRule> propertyRenameRules) {
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/output/CustomOutputSchemaGenerator.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/output/CustomOutputSchemaGenerator.java
index 77cfcee87..051b2bf2a 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/output/CustomOutputSchemaGenerator.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/output/CustomOutputSchemaGenerator.java
@@ -56,9 +56,9 @@ public class CustomOutputSchemaGenerator extends OutputSchemaGenerator<CustomOut
PropertySelector(stream1.getEventSchema(),
stream2.getEventSchema()).createRenamedPropertyList(selectedPropertyKeys);
- EventSchema outputSchema = new EventSchema(generatedOutputProperties.a);
+ EventSchema outputSchema = new EventSchema(generatedOutputProperties.k);
- return new Tuple2<>(outputSchema, getModifiedOutputStrategy(generatedOutputProperties.b));
+ return new Tuple2<>(outputSchema, getModifiedOutputStrategy(generatedOutputProperties.v));
}
private CustomOutputStrategy getModifiedOutputStrategy(List<PropertyRenameRule> propertyRenameRules) {
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/v2/pipeline/ComputeOutputStep.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/v2/pipeline/ComputeOutputStep.java
index c2dc1284b..ceba5ceaa 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/v2/pipeline/ComputeOutputStep.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/v2/pipeline/ComputeOutputStep.java
@@ -61,8 +61,8 @@ public class ComputeOutputStep extends AbstractPipelineValidationStep {
.getOutputStrategies().get(0));
}
- pe.setOutputStrategies(Collections.singletonList(outputSettings.b));
- ((DataProcessorInvocation) target).getOutputStream().setEventSchema(outputSettings.a);
+ pe.setOutputStrategies(Collections.singletonList(outputSettings.v));
+ ((DataProcessorInvocation) target).getOutputStream().setEventSchema(outputSettings.k);
}
}
}
diff --git a/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/selector/TestPropertyRenaming.java b/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/selector/TestPropertyRenaming.java
index aefc7d1c4..374a9ff33 100644
--- a/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/selector/TestPropertyRenaming.java
+++ b/streampipes-pipeline-management/src/test/java/org/apache/streampipes/manager/selector/TestPropertyRenaming.java
@@ -41,6 +41,6 @@ public class TestPropertyRenaming {
Tuple2<List<EventProperty>, List<PropertyRenameRule>> properties = new PropertySelector
(schema1, schema2).createRenamedPropertyList(propertySelectors);
- assertEquals(properties.a.size(), 2);
+ assertEquals(properties.k.size(), 2);
}
}
diff --git a/streampipes-sdk/pom.xml b/streampipes-sdk/pom.xml
index b05974962..0f7b7aaf3 100644
--- a/streampipes-sdk/pom.xml
+++ b/streampipes-sdk/pom.xml
@@ -17,10 +17,11 @@
~
-->
-<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">
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.apache.streampipes</groupId>
- <artifactId>streampipes-parent</artifactId>
+ <artifactId>streampipes-parent</artifactId>
<version>0.91.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -62,4 +63,12 @@
<scope>test</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/StaticProperties.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/StaticProperties.java
index 2d3cabd53..4cc447f14 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/StaticProperties.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/StaticProperties.java
@@ -19,7 +19,22 @@
package org.apache.streampipes.sdk;
import org.apache.streampipes.model.schema.PropertyScope;
-import org.apache.streampipes.model.staticproperty.*;
+import org.apache.streampipes.model.staticproperty.CollectionStaticProperty;
+import org.apache.streampipes.model.staticproperty.FileStaticProperty;
+import org.apache.streampipes.model.staticproperty.FreeTextStaticProperty;
+import org.apache.streampipes.model.staticproperty.MappingPropertyUnary;
+import org.apache.streampipes.model.staticproperty.OneOfStaticProperty;
+import org.apache.streampipes.model.staticproperty.Option;
+import org.apache.streampipes.model.staticproperty.PropertyValueSpecification;
+import org.apache.streampipes.model.staticproperty.RuntimeResolvableAnyStaticProperty;
+import org.apache.streampipes.model.staticproperty.RuntimeResolvableOneOfStaticProperty;
+import org.apache.streampipes.model.staticproperty.RuntimeResolvableTreeInputStaticProperty;
+import org.apache.streampipes.model.staticproperty.SecretStaticProperty;
+import org.apache.streampipes.model.staticproperty.SelectionStaticProperty;
+import org.apache.streampipes.model.staticproperty.StaticProperty;
+import org.apache.streampipes.model.staticproperty.StaticPropertyAlternatives;
+import org.apache.streampipes.model.staticproperty.StaticPropertyGroup;
+import org.apache.streampipes.model.staticproperty.SupportedProperty;
import org.apache.streampipes.sdk.helpers.Filetypes;
import org.apache.streampipes.sdk.helpers.Label;
import org.apache.streampipes.sdk.helpers.RequirementsSelector;
@@ -32,11 +47,12 @@ import java.util.List;
public class StaticProperties {
- public static MappingPropertyUnary mappingPropertyUnary(Label label, RequirementsSelector requirementsSelector, PropertyScope propertyScope) {
+ public static MappingPropertyUnary mappingPropertyUnary(Label label, RequirementsSelector requirementsSelector,
+ PropertyScope propertyScope) {
MappingPropertyUnary mp = new MappingPropertyUnary(label.getInternalId(), label
- .getInternalId(),
- label.getLabel(),
- label.getDescription());
+ .getInternalId(),
+ label.getLabel(),
+ label.getDescription());
mp.setRequirementSelector(requirementsSelector.toSelector(label.getInternalId()));
mp.setPropertyScope(propertyScope.name());
@@ -64,14 +80,14 @@ public class StaticProperties {
public static FreeTextStaticProperty freeTextProperty(Label label, Datatypes datatype) {
FreeTextStaticProperty fsp = new FreeTextStaticProperty(label.getInternalId(), label.getLabel(),
- label.getDescription());
+ label.getDescription());
fsp.setRequiredDatatype(URI.create(datatype.toString()));
return fsp;
}
public static FileStaticProperty fileProperty(Label label) {
FileStaticProperty fp = new FileStaticProperty(label.getInternalId(), label.getLabel(), label
- .getDescription());
+ .getDescription());
return fp;
}
@@ -92,25 +108,26 @@ public class StaticProperties {
public static RuntimeResolvableOneOfStaticProperty singleValueSelectionFromContainer(Label label) {
return new RuntimeResolvableOneOfStaticProperty(label.getInternalId(), label
- .getLabel(), label.getDescription());
+ .getLabel(), label.getDescription());
}
- public static RuntimeResolvableOneOfStaticProperty singleValueSelectionFromContainer(Label label, List<String> dependsOn) {
+ public static RuntimeResolvableOneOfStaticProperty singleValueSelectionFromContainer(Label label,
+ List<String> dependsOn) {
RuntimeResolvableOneOfStaticProperty rsp = new RuntimeResolvableOneOfStaticProperty(label.getInternalId(), label
- .getLabel(), label.getDescription());
+ .getLabel(), label.getDescription());
rsp.setDependsOn(dependsOn);
return rsp;
}
public static RuntimeResolvableAnyStaticProperty multiValueSelectionFromContainer(Label label) {
return new RuntimeResolvableAnyStaticProperty(label.getInternalId(), label
- .getLabel(), label.getDescription());
+ .getLabel(), label.getDescription());
}
public static RuntimeResolvableAnyStaticProperty multiValueSelectionFromContainer(Label label,
- List<String> dependsOn) {
+ List<String> dependsOn) {
RuntimeResolvableAnyStaticProperty rsp =
- new RuntimeResolvableAnyStaticProperty(label.getInternalId(), label
+ new RuntimeResolvableAnyStaticProperty(label.getInternalId(), label
.getLabel(), label.getDescription());
rsp.setDependsOn(dependsOn);
return rsp;
@@ -119,9 +136,9 @@ public class StaticProperties {
public static RuntimeResolvableTreeInputStaticProperty runtimeResolvableTreeInput(Label label,
List<String> dependsOn) {
RuntimeResolvableTreeInputStaticProperty treeInput = new RuntimeResolvableTreeInputStaticProperty(
- label.getInternalId(),
- label.getLabel(),
- label.getDescription());
+ label.getInternalId(),
+ label.getLabel(),
+ label.getDescription());
treeInput.setDependsOn(dependsOn);
@@ -145,7 +162,7 @@ public class StaticProperties {
staticProperties.get(i).setIndex(i);
}
return new StaticPropertyGroup(label.getInternalId(), label.getLabel(),
- label.getDescription(), staticProperties);
+ label.getDescription(), staticProperties);
}
public static StaticPropertyGroup group(Label label, Boolean showLabels, StaticProperty... sp) {
@@ -157,7 +174,7 @@ public class StaticProperties {
public static OneOfStaticProperty singleValueSelection(Label label, List<Option> options) {
OneOfStaticProperty osp = new OneOfStaticProperty(label.getInternalId(), label.getLabel(),
- label.getDescription());
+ label.getDescription());
osp.setOptions(options);
return osp;
@@ -165,7 +182,7 @@ public class StaticProperties {
public static SecretStaticProperty secretValue(Label label) {
return new SecretStaticProperty(label.getInternalId(),
- label.getLabel(), label.getDescription());
+ label.getLabel(), label.getDescription());
}
public static CollectionStaticProperty collection(Label label, StaticProperty... sp) {
@@ -179,23 +196,23 @@ public class StaticProperties {
group.setStaticProperties(Arrays.asList(sp));
return new CollectionStaticProperty(label.getInternalId(), label.getLabel(),
- label.getDescription(), group);
+ label.getDescription(), group);
} else {
return new CollectionStaticProperty(label.getInternalId(), label.getLabel(),
- label.getDescription(), sp[0]);
+ label.getDescription(), sp[0]);
}
}
private static StaticProperty setHorizontalRendering(StaticProperty sp) {
- if (sp instanceof StaticPropertyGroup) {
+ if (sp instanceof StaticPropertyGroup) {
((StaticPropertyGroup) sp).setHorizontalRendering(true);
((StaticPropertyGroup) sp).getStaticProperties().stream()
- .forEach(property -> setHorizontalRendering(property));
+ .forEach(property -> setHorizontalRendering(property));
} else if (sp instanceof SelectionStaticProperty) {
((SelectionStaticProperty) sp).setHorizontalRendering(true);
} else if (sp instanceof StaticPropertyAlternatives) {
((StaticPropertyAlternatives) sp).getAlternatives().stream()
- .forEach(property -> setHorizontalRendering(property.getStaticProperty()));
+ .forEach(property -> setHorizontalRendering(property.getStaticProperty()));
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractConfigurablePipelineElementBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractConfigurablePipelineElementBuilder.java
index 5665fce75..c8aa306de 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractConfigurablePipelineElementBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractConfigurablePipelineElementBuilder.java
@@ -18,7 +18,22 @@
package org.apache.streampipes.sdk.builder;
import org.apache.streampipes.model.base.NamedStreamPipesEntity;
-import org.apache.streampipes.model.staticproperty.*;
+import org.apache.streampipes.model.staticproperty.AnyStaticProperty;
+import org.apache.streampipes.model.staticproperty.CodeInputStaticProperty;
+import org.apache.streampipes.model.staticproperty.CollectionStaticProperty;
+import org.apache.streampipes.model.staticproperty.ColorPickerStaticProperty;
+import org.apache.streampipes.model.staticproperty.DomainStaticProperty;
+import org.apache.streampipes.model.staticproperty.FileStaticProperty;
+import org.apache.streampipes.model.staticproperty.FreeTextStaticProperty;
+import org.apache.streampipes.model.staticproperty.OneOfStaticProperty;
+import org.apache.streampipes.model.staticproperty.Option;
+import org.apache.streampipes.model.staticproperty.PropertyValueSpecification;
+import org.apache.streampipes.model.staticproperty.SecretStaticProperty;
+import org.apache.streampipes.model.staticproperty.SlideToggleStaticProperty;
+import org.apache.streampipes.model.staticproperty.StaticProperty;
+import org.apache.streampipes.model.staticproperty.StaticPropertyAlternative;
+import org.apache.streampipes.model.staticproperty.StaticPropertyAlternatives;
+import org.apache.streampipes.model.staticproperty.SupportedProperty;
import org.apache.streampipes.sdk.StaticProperties;
import org.apache.streampipes.sdk.helpers.CodeLanguage;
import org.apache.streampipes.sdk.helpers.Filetypes;
@@ -31,41 +46,43 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
- AbstractConfigurablePipelineElementBuilder<BU, T>, T extends NamedStreamPipesEntity> extends
- AbstractPipelineElementBuilder<BU, T> {
+public abstract class AbstractConfigurablePipelineElementBuilder<K extends
+ AbstractConfigurablePipelineElementBuilder<K, V>, V extends NamedStreamPipesEntity> extends
+ AbstractPipelineElementBuilder<K, V> {
protected List<StaticProperty> staticProperties;
- protected AbstractConfigurablePipelineElementBuilder(String appId, String label, String description, T element) {
+ protected AbstractConfigurablePipelineElementBuilder(String appId, String label, String description, V element) {
super(appId, label, description, element);
this.staticProperties = new ArrayList<>();
}
- protected AbstractConfigurablePipelineElementBuilder(String appId, T element) {
+ protected AbstractConfigurablePipelineElementBuilder(String appId, V element) {
super(appId, element);
this.staticProperties = new ArrayList<>();
}
/**
*
- * @param staticProperty: The required static property (e.g., user input as shown in the StreamPipes UI
+ * @param staticProperty The required static property (e.g., user input as shown in the StreamPipes UI
* @return BU
*/
- public BU requiredStaticProperty(StaticProperty staticProperty) {
+ public K requiredStaticProperty(StaticProperty staticProperty) {
this.staticProperties.add(staticProperty);
return me();
}
/**
* Defines the requirement for an instance that is defined in the knowledge base.
- * @param label: A human-readable label that describes the required static property.
- * @param supportedOntologyProperties: All RDF properties any instance in the knowledge base must provide. Use
- * {@link org.apache.streampipes.sdk.helpers.OntologyProperties} to assign supported properties.
- * @return
+ *
+ * @param label A human-readable label that describes the required static property.
+ * @param supportedOntologyProperties All RDF properties any instance in the knowledge base must provide. Use
+ * {@link org.apache.streampipes.sdk.helpers.OntologyProperties}
+ * to assign supported properties.
+ *
*/
- public BU requiredOntologyConcept(Label label, SupportedProperty...
- supportedOntologyProperties) {
+ public K requiredOntologyConcept(Label label, SupportedProperty...
+ supportedOntologyProperties) {
DomainStaticProperty dsp = prepareStaticProperty(label, new DomainStaticProperty());
dsp.setSupportedProperties(Arrays.asList(supportedOntologyProperties));
this.staticProperties.add(dsp);
@@ -74,16 +91,16 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
}
/**
+ * @param label A human-readable label that describes the required static property.
+ * @param requiredConceptUri Limits the search for matching instance
+ * in the knowledge base to an instance of this concept.
+ * @param supportedOntologyProperties All RDF properties any instance of the provided concept must provide. Use
+ * {@link org.apache.streampipes.sdk.helpers.OntologyProperties}
+ * to assign supported properties.
*
- * @param label: A human-readable label that describes the required static property.
- * @param requiredConceptUri: Limits the search for matching instance in the knowledge base to an instance of this
- * concept.
- * @param supportedOntologyProperties: All RDF properties any instance of the provided concept must provide. Use
- * {@link org.apache.streampipes.sdk.helpers.OntologyProperties} to assign supported properties.
- * @return
*/
- public BU requiredOntologyConcept(Label label, String requiredConceptUri, SupportedProperty...
- supportedOntologyProperties) {
+ public K requiredOntologyConcept(Label label, String requiredConceptUri, SupportedProperty...
+ supportedOntologyProperties) {
DomainStaticProperty dsp = prepareStaticProperty(label, new DomainStaticProperty());
dsp.setSupportedProperties(Arrays.asList(supportedOntologyProperties));
dsp.setRequiredClass(requiredConceptUri);
@@ -93,14 +110,13 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
}
/**
- *
- * @param label: A human-readable label that describes the required static property.
+ * @param label A human-readable label that describes the required static property.
* @param staticProperty
* @return
*/
- public BU requiredParameterAsCollection(Label label, StaticProperty staticProperty) {
+ public K requiredParameterAsCollection(Label label, StaticProperty staticProperty) {
CollectionStaticProperty collection = prepareStaticProperty(label, new
- CollectionStaticProperty());
+ CollectionStaticProperty());
collection.setStaticPropertyTemplate(staticProperty);
this.staticProperties.add(collection);
@@ -114,11 +130,12 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
* @param description
* @return
*/
- public BU requiredTextParameter(String internalId, String label, String description) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredTextParameter(String internalId, String label, String description) {
this.staticProperties.add(prepareFreeTextStaticProperty(internalId,
- label,
- description,
- XSD._string.toString()));
+ label,
+ description,
+ XSD._string.toString()));
return me();
}
@@ -126,13 +143,14 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Assigns a new secret text-based configuration parameter (e.g., a password) which is required
* by the processing element.
+ *
* @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
* user-friendly manner.
* @return
*/
- public BU requiredSecret(Label label) {
+ public K requiredSecret(Label label) {
SecretStaticProperty secretStaticProperty = new SecretStaticProperty(label.getInternalId(),
- label.getLabel(), label.getDescription());
+ label.getLabel(), label.getDescription());
this.staticProperties.add(secretStaticProperty);
return me();
@@ -141,12 +159,14 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Assigns a new code block parameter which is required
* by the processing element.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
- * @param codeLanguage The {@link org.apache.streampipes.sdk.helpers.CodeLanguage} code language the code block is built for.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in an user-friendly manner.
+ * @param codeLanguage The {@link org.apache.streampipes.sdk.helpers.CodeLanguage}
+ * code language the code block is built for.
* @return this
*/
- public BU requiredCodeblock(Label label, CodeLanguage codeLanguage) {
+ public K requiredCodeblock(Label label, CodeLanguage codeLanguage) {
this.requiredCodeblock(label, codeLanguage, codeLanguage.getDefaultSkeleton());
return me();
@@ -155,15 +175,17 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Assigns a new code block parameter which is required
* by the processing element.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
- * @param codeLanguage The {@link org.apache.streampipes.sdk.helpers.CodeLanguage} code language the code block is built for.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in an user-friendly manner.
+ * @param codeLanguage The {@link org.apache.streampipes.sdk.helpers.CodeLanguage}
+ * code language the code block is built for.
* @param defaultSkeleton The code skeleton that is used as a default value.
* @return this
*/
- public BU requiredCodeblock(Label label, CodeLanguage codeLanguage, String defaultSkeleton) {
+ public K requiredCodeblock(Label label, CodeLanguage codeLanguage, String defaultSkeleton) {
CodeInputStaticProperty codeInputStaticProperty = new CodeInputStaticProperty(label.getInternalId(),
- label.getLabel(), label.getDescription());
+ label.getLabel(), label.getDescription());
codeInputStaticProperty.setLanguage(codeLanguage.name());
codeInputStaticProperty.setCodeTemplate(defaultSkeleton);
this.staticProperties.add(codeInputStaticProperty);
@@ -173,17 +195,18 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Assigns a new required slide toggle for a true/false selection
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in an user-friendly manner.
* @param defaultValue The toggle's default value
* @return this
*/
- public BU requiredSlideToggle(Label label, boolean defaultValue) {
+ public K requiredSlideToggle(Label label, boolean defaultValue) {
SlideToggleStaticProperty slideToggle = new SlideToggleStaticProperty(
- label.getInternalId(),
- label.getLabel(),
- label.getDescription(),
- defaultValue);
+ label.getInternalId(),
+ label.getLabel(),
+ label.getDescription(),
+ defaultValue);
slideToggle.setSelected(defaultValue);
@@ -195,34 +218,37 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Assigns a new code block parameter (without a specific language) which is required
* by the processing element.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
* @param defaultSkeleton The code skeleton that is used as a default value.
* @return this
*/
- public BU requiredCodeblock(Label label, String defaultSkeleton) {
+ public K requiredCodeblock(Label label, String defaultSkeleton) {
return requiredCodeblock(label, CodeLanguage.None, defaultSkeleton);
}
/**
* Assigns a new code block parameter (without a specific language) which is required
* by the processing element.
+ *
* @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
* user-friendly manner.
* @return this
*/
- public BU requiredCodeblock(Label label) {
+ public K requiredCodeblock(Label label) {
return requiredCodeblock(label, CodeLanguage.None);
}
/**
* Assigns a new text-based configuration parameter (a string) which is required by the pipeline
* element.
+ *
* @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
* user-friendly manner.
* @return
*/
- public BU requiredTextParameter(Label label) {
+ public K requiredTextParameter(Label label) {
this.staticProperties.add(prepareFreeTextStaticProperty(label, XSD._string.toString()));
return me();
@@ -231,13 +257,14 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Assigns a new color picker parameter which is required by the pipeline
* element.
+ *
* @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
* user-friendly manner.
- *
* @return
*/
- public BU requiredColorParameter(Label label) {
- ColorPickerStaticProperty csp = new ColorPickerStaticProperty(label.getInternalId(), label.getLabel(), label.getDescription());
+ public K requiredColorParameter(Label label) {
+ ColorPickerStaticProperty csp =
+ new ColorPickerStaticProperty(label.getInternalId(), label.getLabel(), label.getDescription());
this.staticProperties.add(csp);
return me();
@@ -246,13 +273,15 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Assigns a new color picker parameter which is required by the pipeline
* element.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
* @param defaultColor The default color, encoded as an HTML color code
* @return
*/
- public BU requiredColorParameter(Label label, String defaultColor) {
- ColorPickerStaticProperty csp = new ColorPickerStaticProperty(label.getInternalId(), label.getLabel(), label.getDescription());
+ public K requiredColorParameter(Label label, String defaultColor) {
+ ColorPickerStaticProperty csp =
+ new ColorPickerStaticProperty(label.getInternalId(), label.getLabel(), label.getDescription());
csp.setSelectedColor(defaultColor);
this.staticProperties.add(csp);
@@ -261,18 +290,20 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* @deprecated Use {@link #requiredTextParameterWithLink(Label, String)}
+ *
* @param internalId
* @param label
* @param description
* @param linkedMappingPropertyInternalName
* @return this
*/
- public BU requiredTextParameter(String internalId, String label, String description, String
- linkedMappingPropertyInternalName) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredTextParameter(String internalId, String label, String description, String
+ linkedMappingPropertyInternalName) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(internalId,
- label,
- description,
- XSD._string.toString());
+ label,
+ description,
+ XSD._string.toString());
fsp.setMapsTo(linkedMappingPropertyInternalName);
this.staticProperties.add(fsp);
@@ -282,13 +313,14 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Defines a text-based configuration parameter provided by pipeline developers at pipeline authoring time. The
* value range of the parameter is restricted to the value specification of a selected input event property.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in an user-friendly manner.
* @param defaultValue The default value is displayed to the user in the input field
* @return this
*/
- public BU requiredTextParameter(Label label,
- String defaultValue) {
+ public K requiredTextParameter(Label label,
+ String defaultValue) {
FreeTextStaticProperty fsp = StaticProperties.stringFreeTextProperty(label, defaultValue);
this.staticProperties.add(fsp);
@@ -299,13 +331,16 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Defines a text-based configuration parameter provided by pipeline developers at pipeline authoring time. The
* value range of the parameter is restricted to the value specification of a selected input event property.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
- * @param linkedMappingPropertyInternalName The inernalId of the {@link org.apache.streampipes.model.staticproperty.MappingProperty}
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a
+ * user-friendly manner.
+ * @param linkedMappingPropertyInternalName The inernalId of the
+ * {@link org.apache.streampipes.model.staticproperty.MappingProperty}
* @return this
*/
- public BU requiredTextParameterWithLink(Label label, String
- linkedMappingPropertyInternalName) {
+ public K requiredTextParameterWithLink(Label label, String
+ linkedMappingPropertyInternalName) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label, XSD._string.toString());
fsp.setMapsTo(linkedMappingPropertyInternalName);
@@ -317,12 +352,14 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
* Defines a text-based configuration parameter provided by pipeline developers at pipeline authoring time. The
* input field generated in the StreamPipes UI allows to enter HTML content (and an HTML Wysiwyg editor will be
* rendered).
+ *
* @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
* user-friendly manner.
* @return this
*/
- public BU requiredHtmlInputParameter(Label label) {
- FreeTextStaticProperty fsp = new FreeTextStaticProperty(label.getInternalId(), label.getLabel(), label.getDescription());
+ public K requiredHtmlInputParameter(Label label) {
+ FreeTextStaticProperty fsp =
+ new FreeTextStaticProperty(label.getInternalId(), label.getLabel(), label.getDescription());
fsp.setMultiLine(true);
fsp.setHtmlAllowed(true);
fsp.setPlaceholdersSupported(true);
@@ -333,14 +370,15 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Defines a text-based configuration parameter provided by pipeline developers at pipeline authoring time.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
- * @param multiLine Defines whether the input dialog allows multiple lines.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
+ * @param multiLine Defines whether the input dialog allows multiple lines.
* @param placeholdersSupported Defines whether placeholders are supported, i.e., event property field names that
* are replaced with the actual value at pipeline execution time.
* @return this
*/
- public BU requiredTextParameter(Label label, boolean multiLine, boolean placeholdersSupported) {
+ public K requiredTextParameter(Label label, boolean multiLine, boolean placeholdersSupported) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label, XSD._string.toString());
if (multiLine) {
fsp.setMultiLine(true);
@@ -355,15 +393,17 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Defines a text-based configuration parameter provided by pipeline developers at pipeline authoring time.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
- * @param multiLine Defines whether the input dialog allows multiple lines.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in an user-friendly manner.
+ * @param multiLine Defines whether the input dialog allows multiple lines.
* @param placeholdersSupported Defines whether placeholders are supported, i.e., event property field names that
* are replaced with the actual value at pipeline execution time.
- * @param htmlFontFormat Defines to only use bold, italic, striked in dialog.
+ * @param htmlFontFormat Defines to only use bold, italic, striked in dialog.
* @return this
*/
- public BU requiredTextParameter(Label label, boolean multiLine, boolean placeholdersSupported, boolean htmlFontFormat) {
+ public K requiredTextParameter(Label label, boolean multiLine, boolean placeholdersSupported,
+ boolean htmlFontFormat) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label, XSD._string.toString());
if (multiLine) {
fsp.setMultiLine(true);
@@ -382,16 +422,18 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* @deprecated Use {@link #requiredIntegerParameter(Label)} instead
+ *
* @param internalId
* @param label
* @param description
* @return
*/
- public BU requiredIntegerParameter(String internalId, String label, String description) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredIntegerParameter(String internalId, String label, String description) {
this.staticProperties.add(prepareFreeTextStaticProperty(internalId,
- label,
- description,
- XSD._integer.toString()));
+ label,
+ description,
+ XSD._integer.toString()));
return me();
}
@@ -399,11 +441,12 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Assigns a new number-based configuration parameter (an integer) which is required by the pipeline
* element.
+ *
* @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
* user-friendly manner.
* @return
*/
- public BU requiredIntegerParameter(Label label) {
+ public K requiredIntegerParameter(Label label) {
this.staticProperties.add(prepareFreeTextStaticProperty(label, XSD._integer.toString()));
return me();
@@ -411,18 +454,20 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* @deprecated use {@link #requiredIntegerParameter(Label, String)} instead
+ *
* @param internalId
* @param label
* @param description
* @param linkedMappingPropertyInternalName
* @return
*/
- public BU requiredIntegerParameter(String internalId, String label, String description, String
- linkedMappingPropertyInternalName) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredIntegerParameter(String internalId, String label, String description, String
+ linkedMappingPropertyInternalName) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(internalId,
- label,
- description,
- XSD._integer.toString());
+ label,
+ description,
+ XSD._integer.toString());
fsp.setMapsTo(linkedMappingPropertyInternalName);
this.staticProperties.add(fsp);
@@ -433,13 +478,15 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
* Defines a number-based configuration parameter of type integer provided by pipeline developers at pipeline
* authoring time. The
* value range of the parameter is restricted to the value specification of a selected input event property.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
- * @param linkedMappingPropertyInternalName The inernalId of the {@link org.apache.streampipes.model.staticproperty.MappingProperty}
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
+ * @param linkedMappingPropertyInternalName The inernalId of the
+ * {@link org.apache.streampipes.model.staticproperty.MappingProperty}
* @return this
*/
- public BU requiredIntegerParameter(Label label, String
- linkedMappingPropertyInternalName) {
+ public K requiredIntegerParameter(Label label, String
+ linkedMappingPropertyInternalName) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label, XSD._integer.toString());
fsp.setMapsTo(linkedMappingPropertyInternalName);
@@ -450,18 +497,20 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* @deprecated Use {@link #requiredIntegerParameter(Label, Integer)} instead
+ *
* @param internalId
* @param label
* @param description
* @param defaultValue
* @return
*/
- public BU requiredIntegerParameter(String internalId, String label, String description,
- Integer defaultValue) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredIntegerParameter(String internalId, String label, String description,
+ Integer defaultValue) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(internalId,
- label,
- description,
- XSD._integer.toString());
+ label,
+ description,
+ XSD._integer.toString());
fsp.setValue(String.valueOf(defaultValue));
this.staticProperties.add(fsp);
return me();
@@ -470,15 +519,16 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Defines a number-based configuration parameter of type integer provided by pipeline developers at pipeline
* authoring time and initializes the parameter with a default value.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
* @param defaultValue The default integer value.
* @return this
*/
- public BU requiredIntegerParameter(Label label,
- Integer defaultValue) {
+ public K requiredIntegerParameter(Label label,
+ Integer defaultValue) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label,
- XSD._integer.toString());
+ XSD._integer.toString());
fsp.setValue(String.valueOf(defaultValue));
this.staticProperties.add(fsp);
return me();
@@ -490,12 +540,14 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
* @param label
* @param description
* @return
+ *
*/
- public BU requiredFloatParameter(String internalId, String label, String description) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredFloatParameter(String internalId, String label, String description) {
this.staticProperties.add(prepareFreeTextStaticProperty(internalId,
- label,
- description,
- XSD._double.toString()));
+ label,
+ description,
+ XSD._double.toString()));
return me();
}
@@ -503,33 +555,39 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Assigns a new number-based configuration parameter (a float) which is required by the pipeline
* element.
+ *
* @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
* user-friendly manner.
* @return
*/
- public BU requiredFloatParameter(Label label) {
+ public K requiredFloatParameter(Label label) {
this.staticProperties.add(prepareFreeTextStaticProperty(label,
- XSD._double.toString()));
+ XSD._double.toString()));
return me();
}
/**
+ * @deprecated use {@link #requiredFloatParameter(Label, String)}
+ *
* Defines a number-based configuration parameter of type float provided by pipeline developers at pipeline
* authoring time. The
* value range of the parameter is restricted to the value specification of a selected input event property.
- * @deprecated use {@link #requiredFloatParameter(Label, String)}
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
- * @param linkedMappingPropertyInternalName The inernalId of the {@link org.apache.streampipes.model.staticproperty.MappingProperty}
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
+ * @param linkedMappingPropertyInternalName The inernalId of the
+ * {@link org.apache.streampipes.model.staticproperty.MappingProperty}
* @return this
+ *
*/
- public BU requiredFloatParameter(String internalId, String label, String description, String
- linkedMappingPropertyInternalName) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredFloatParameter(String internalId, String label, String description, String
+ linkedMappingPropertyInternalName) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(internalId,
- label,
- description,
- XSD._double.toString());
+ label,
+ description,
+ XSD._double.toString());
fsp.setMapsTo(linkedMappingPropertyInternalName);
this.staticProperties.add(fsp);
@@ -540,13 +598,15 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
* Defines a number-based configuration parameter of type float provided by pipeline developers at pipeline
* authoring time. The
* value range of the parameter is restricted to the value specification of a selected input event property.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
- * @param linkedMappingPropertyInternalName The inernalId of the {@link org.apache.streampipes.model.staticproperty.MappingProperty}
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
+ * @param linkedMappingPropertyInternalName The internalId of the
+ * {@link org.apache.streampipes.model.staticproperty.MappingProperty}
* @return this
*/
- public BU requiredFloatParameter(Label label, String
- linkedMappingPropertyInternalName) {
+ public K requiredFloatParameter(Label label, String
+ linkedMappingPropertyInternalName) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label, XSD._double.toString());
fsp.setMapsTo(linkedMappingPropertyInternalName);
@@ -556,18 +616,21 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* @deprecated Use {@link #requiredFloatParameter(Label, Float)} instead.
+ *
* @param internalId
* @param label
* @param description
* @param defaultValue
* @return this
+ *
*/
- public BU requiredFloatParameter(String internalId, String label, String description, Float
- defaultValue) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredFloatParameter(String internalId, String label, String description, Float
+ defaultValue) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(internalId,
- label,
- description,
- XSD._double.toString());
+ label,
+ description,
+ XSD._double.toString());
fsp.setValue(String.valueOf(defaultValue));
this.staticProperties.add(fsp);
return me();
@@ -576,13 +639,14 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Defines a number-based configuration parameter of type float provided by preprocessing developers at preprocessing
* authoring time and initializes the parameter with a default value.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
* @param defaultValue The default integer value.
* @return this
*/
- public BU requiredFloatParameter(Label label, Float
- defaultValue) {
+ public K requiredFloatParameter(Label label, Float
+ defaultValue) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label, XSD._double.toString());
fsp.setValue(String.valueOf(defaultValue));
this.staticProperties.add(fsp);
@@ -593,18 +657,21 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
* @deprecated Use {@link #requiredFloatParameter(Label, Float, Float, Float)} instead.
* Defines a number-based configuration parameter of type float provided by preprocessing developers at preprocessing
* authoring time. In addition, an allowed value range of the expected input can be assigned.
+ *
* @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
* user-friendly manner.
- * @param min The minimum value of the allowed value range.
- * @param max The maximum value of the allowed value range.
- * @param step The granularity
+ * @param min The minimum value of the allowed value range.
+ * @param max The maximum value of the allowed value range.
+ * @param step The granularity
* @return this
*/
- public BU requiredFloatParameter(String internalId, String label, String description, Float min, Float max, Float step) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredFloatParameter(String internalId, String label, String description, Float min, Float max,
+ Float step) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(internalId,
- label,
- description,
- XSD._double.toString());
+ label,
+ description,
+ XSD._double.toString());
PropertyValueSpecification valueSpecification = new PropertyValueSpecification(min, max, step);
fsp.setValueSpecification(valueSpecification);
@@ -616,14 +683,15 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Defines a number-based configuration parameter of type float provided by preprocessing developers at preprocessing
* authoring time. In addition, an allowed value range of the expected input can be assigned.
+ *
* @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
* user-friendly manner.
- * @param min The minimum value of the allowed value range.
- * @param max The maximum value of the allowed value range.
- * @param step The granularity
+ * @param min The minimum value of the allowed value range.
+ * @param max The maximum value of the allowed value range.
+ * @param step The granularity
* @return this
*/
- public BU requiredFloatParameter(Label label, Float min, Float max, Float step) {
+ public K requiredFloatParameter(Label label, Float min, Float max, Float step) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label, XSD._double.toString());
PropertyValueSpecification valueSpecification = new PropertyValueSpecification(min, max, step);
fsp.setValueSpecification(valueSpecification);
@@ -635,15 +703,16 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Defines a number-based configuration parameter of type float provided by preprocessing developers at preprocessing
* authoring time. In addition, an allowed value range of the expected input can be assigned.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
* @param defaultValue The default float value.
- * @param min The minimum value of the allowed value range.
- * @param max The maximum value of the allowed value range.
- * @param step The granularity
+ * @param min The minimum value of the allowed value range.
+ * @param max The maximum value of the allowed value range.
+ * @param step The granularity
* @return this
*/
- public BU requiredFloatParameter(Label label, Float defaultValue, Float min, Float max, Float step) {
+ public K requiredFloatParameter(Label label, Float defaultValue, Float min, Float max, Float step) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label, XSD._double.toString());
fsp.setValue(String.valueOf(defaultValue));
PropertyValueSpecification valueSpecification = new PropertyValueSpecification(min, max, step);
@@ -655,40 +724,49 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* @deprecated Use {@link #requiredSingleValueSelection(Label, Option...)} instead.
+ *
* @param options An arbitrary number of {@link org.apache.streampipes.model.staticproperty.Option} elements. Use
- * {@link org.apache.streampipes.sdk.helpers.Options} to create option elements from string values.
+ * {@link org.apache.streampipes.sdk.helpers.Options} to create option elements from string values.
* @return this
+ *
*/
- public BU requiredSingleValueSelection(String internalId, String label, String description,
- Option... options) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredSingleValueSelection(String internalId, String label, String description,
+ Option... options) {
return requiredSingleValueSelection(internalId, label, description, Arrays.asList(options));
}
/**
- * Defines a configuration parameter that lets preprocessing developers select from a list of pre-defined configuration
- * options. The parameter will be rendered as a RadioGroup in the StreamPipes UI.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ * Defines a configuration parameter that lets preprocessing developers
+ * select from a list of pre-defined configuration options.
+ * The parameter will be rendered as a RadioGroup in the StreamPipes UI.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes
+ * why this parameter is needed in a user-friendly manner.
* @param options An arbitrary number of {@link org.apache.streampipes.model.staticproperty.Option} elements. Use
- * {@link org.apache.streampipes.sdk.helpers.Options} to create option elements from string values.
+ * {@link org.apache.streampipes.sdk.helpers.Options} to create option elements from string values.
* @return this
*/
- public BU requiredSingleValueSelection(Label label,
- Option... options) {
- return requiredSingleValueSelection(label.getInternalId(), label.getLabel(), label.getDescription(), Arrays.asList(options));
+ public K requiredSingleValueSelection(Label label,
+ Option... options) {
+ return requiredSingleValueSelection(label.getInternalId(), label.getLabel(), label.getDescription(),
+ Arrays.asList(options));
}
/**
* @deprecated Use {@link #requiredSingleValueSelection(Label, List)} instead.
+ *
* @param internalId
* @param label
* @param description
* @param options
* @return
+ *
*/
- public BU requiredSingleValueSelection(String internalId, String label, String description,
- List<Option> options) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredSingleValueSelection(String internalId, String label, String description,
+ List<Option> options) {
OneOfStaticProperty osp = new OneOfStaticProperty(internalId, label, description);
osp.setOptions(options);
@@ -698,16 +776,18 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
}
/**
- * Defines a configuration parameter that lets preprocessing developers select from a list of pre-defined configuration
- * options. The parameter will be rendered as a RadioGroup in the StreamPipes UI.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ * Defines a configuration parameter that lets preprocessing developers
+ * select from a list of pre-defined configuration options.
+ * The parameter will be rendered as a RadioGroup in the StreamPipes UI.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes
+ * why this parameter is needed in a user-friendly manner.
* @param options A list of {@link org.apache.streampipes.model.staticproperty.Option} elements. Use
- * {@link org.apache.streampipes.sdk.helpers.Options} to create option elements from string values.
+ * {@link org.apache.streampipes.sdk.helpers.Options} to create option elements from string values.
* @return this
*/
- public BU requiredSingleValueSelection(Label label,
- List<Option> options) {
+ public K requiredSingleValueSelection(Label label,
+ List<Option> options) {
OneOfStaticProperty osp = new OneOfStaticProperty(label.getInternalId(), label.getLabel(), label.getDescription());
osp.setOptions(options);
@@ -716,19 +796,23 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
}
/**
- * Defines a configuration parameter that lets preprocessing developers select from a list of pre-defined configuration
- * options. The parameter will be rendered as a RadioGroup in the StreamPipes UI.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
- * @param options A list of {@link org.apache.streampipes.model.staticproperty.Option} elements. Use
+ * Defines a configuration parameter that lets preprocessing developers
+ * select from a list of pre-defined configuration options.
+ * The parameter will be rendered as a RadioGroup in the StreamPipes UI.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
+ * @param options A list of {@link org.apache.streampipes.model.staticproperty.Option} elements. Use
* @param horizontalRendering when set to true
- * {@link org.apache.streampipes.sdk.helpers.Options} to create option elements from string values.
+ * {@link org.apache.streampipes.sdk.helpers.Options}
+ * to create option elements from string values.
* @return this
*/
- public BU requiredSingleValueSelection(Label label,
- List<Option> options,
- boolean horizontalRendering) {
- OneOfStaticProperty osp = new OneOfStaticProperty(label.getInternalId(), label.getLabel(), label.getDescription(), horizontalRendering);
+ public K requiredSingleValueSelection(Label label,
+ List<Option> options,
+ boolean horizontalRendering) {
+ OneOfStaticProperty osp =
+ new OneOfStaticProperty(label.getInternalId(), label.getLabel(), label.getDescription(), horizontalRendering);
osp.setOptions(options);
this.staticProperties.add(osp);
@@ -738,42 +822,50 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* @deprecated Use {@link #requiredMultiValueSelection(Label, Option...)} instead.
+ *
* @param internalId
* @param label
* @param description
* @param options
* @return
+ *
*/
- public BU requiredMultiValueSelection(String internalId, String label, String description,
- Option... options) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredMultiValueSelection(String internalId, String label, String description,
+ Option... options) {
return requiredMultiValueSelection(internalId, label, description, Arrays.asList(options));
}
/**
- * Defines a configuration parameter that lets preprocessing developers select from a list of pre-defined configuration
- * options, but multiple selections are allowed. The parameter will be rendered as a Checkbox group in the StreamPipes
- * UI.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ * Defines a configuration parameter that lets preprocessing developers
+ * select from a list of pre-defined configuration options, but multiple selections are allowed.
+ * The parameter will be rendered as a Checkbox group in the StreamPipes UI.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
* @param options An arbitrary number of {@link org.apache.streampipes.model.staticproperty.Option} elements. Use
- * {@link org.apache.streampipes.sdk.helpers.Options} to create option elements from string values.
+ * {@link org.apache.streampipes.sdk.helpers.Options} to create option elements from string values.
* @return this
*/
- public BU requiredMultiValueSelection(Label label,
- Option... options) {
- return requiredMultiValueSelection(label.getInternalId(), label.getLabel(), label.getDescription(), Arrays.asList(options));
+ public K requiredMultiValueSelection(Label label,
+ Option... options) {
+ return requiredMultiValueSelection(label.getInternalId(), label.getLabel(), label.getDescription(),
+ Arrays.asList(options));
}
/**
* @deprecated Use {@link #requiredMultiValueSelection(Label, List)} instead.
+ *
* @param internalId
* @param label
* @param description
* @param options
* @return
+ *
*/
- public BU requiredMultiValueSelection(String internalId, String label, String description,
- List<Option> options) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K requiredMultiValueSelection(String internalId, String label, String description,
+ List<Option> options) {
AnyStaticProperty asp = new AnyStaticProperty(internalId, label, description);
asp.setOptions(options);
@@ -782,17 +874,18 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
}
/**
- * Defines a configuration parameter that lets preprocessing developers select from a list of pre-defined configuration
- * options, but multiple selections are allowed. The parameter will be rendered as a Checkbox group in the StreamPipes
- * UI.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ * Defines a configuration parameter that lets preprocessing developers
+ * select from a list of pre-defined configuration options, but multiple selections are allowed.
+ * The parameter will be rendered as a Checkbox group in the StreamPipes UI.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
* @param options A list of {@link org.apache.streampipes.model.staticproperty.Option} elements. Use
- * {@link org.apache.streampipes.sdk.helpers.Options} to create option elements from string values.
+ * {@link org.apache.streampipes.sdk.helpers.Options} to create option elements from string values.
* @return this
*/
- public BU requiredMultiValueSelection(Label label,
- List<Option> options) {
+ public K requiredMultiValueSelection(Label label,
+ List<Option> options) {
AnyStaticProperty asp = new AnyStaticProperty(label.getInternalId(), label.getLabel(), label.getDescription());
asp.setOptions(options);
@@ -800,11 +893,11 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
return me();
}
- public BU requiredIntegerParameter(Label label, Integer min, Integer max, Integer step) {
+ public K requiredIntegerParameter(Label label, Integer min, Integer max, Integer step) {
FreeTextStaticProperty fsp = prepareFreeTextStaticProperty(label.getInternalId(),
- label.getLabel(),
- label.getDescription(),
- XSD._integer.toString());
+ label.getLabel(),
+ label.getDescription(),
+ XSD._integer.toString());
PropertyValueSpecification valueSpecification = new PropertyValueSpecification(min, max, step);
fsp.setValueSpecification(valueSpecification);
@@ -812,19 +905,19 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
return me();
}
- public BU requiredIntegerParameter(String internalId, String label, String description, Integer min, Integer max, Integer step) {
+ public K requiredIntegerParameter(String internalId, String label, String description, Integer min, Integer max,
+ Integer step) {
return requiredIntegerParameter(Labels.from(internalId, label, description), min, max, step);
}
/**
- *
* @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ * user-friendly manner.
* @return this
*/
- public BU requiredFile(Label label) {
- FileStaticProperty fp = new FileStaticProperty(label.getInternalId(), label.getLabel(), label
- .getDescription());
+ public K requiredFile(Label label) {
+ FileStaticProperty fp = new FileStaticProperty(label.getInternalId(), label.getLabel(), label
+ .getDescription());
this.staticProperties.add(fp);
@@ -833,13 +926,13 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
}
/**
- *
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
- * @param requiredFiletypes A list of {@link org.apache.streampipes.sdk.helpers.Filetypes} required filetypes the element supports.
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
+ * @param requiredFiletypes A list of {@link org.apache.streampipes.sdk.helpers.Filetypes}
+ * required filetypes the element supports.
* @return this
*/
- public BU requiredFile(Label label, Filetypes... requiredFiletypes) {
+ public K requiredFile(Label label, Filetypes... requiredFiletypes) {
List<String> collectedFiletypes = new ArrayList<>();
Arrays.stream(requiredFiletypes).forEach(rf -> collectedFiletypes.addAll(rf.getFileExtensions()));
@@ -847,15 +940,14 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
}
/**
- *
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * user-friendly manner.
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
* @param requiredFiletypes A list of required filetypes (a string marking the file extension) the element supports.
* @return this
*/
- public BU requiredFile(Label label, String... requiredFiletypes) {
- FileStaticProperty fp = new FileStaticProperty(label.getInternalId(), label.getLabel(), label
- .getDescription());
+ public K requiredFile(Label label, String... requiredFiletypes) {
+ FileStaticProperty fp = new FileStaticProperty(label.getInternalId(), label.getLabel(), label
+ .getDescription());
List<String> collectedFiletypes = Arrays.asList(requiredFiletypes);
fp.setRequiredFiletypes(collectedFiletypes);
@@ -865,9 +957,9 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
}
- public BU requiredAlternatives(Label label, StaticPropertyAlternative... alternatives) {
+ public K requiredAlternatives(Label label, StaticPropertyAlternative... alternatives) {
StaticPropertyAlternatives alternativesContainer =
- new StaticPropertyAlternatives(label.getInternalId(), label.getLabel(), label.getDescription());
+ new StaticPropertyAlternatives(label.getInternalId(), label.getLabel(), label.getDescription());
for (int i = 0; i < alternatives.length; i++) {
alternatives[i].setIndex(i);
@@ -879,30 +971,30 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
return me();
}
- public BU requiredSingleValueSelectionFromContainer(Label label) {
+ public K requiredSingleValueSelectionFromContainer(Label label) {
this.staticProperties.add(StaticProperties.singleValueSelectionFromContainer(label));
return me();
}
- public BU requiredSingleValueSelectionFromContainer(Label label,
- List<String> dependsOn) {
+ public K requiredSingleValueSelectionFromContainer(Label label,
+ List<String> dependsOn) {
this.staticProperties.add(StaticProperties.singleValueSelectionFromContainer(label, dependsOn));
return me();
}
- public BU requiredMultiValueSelectionFromContainer(Label label) {
+ public K requiredMultiValueSelectionFromContainer(Label label) {
this.staticProperties.add(StaticProperties.multiValueSelectionFromContainer(label));
return me();
}
- public BU requiredMultiValueSelectionFromContainer(Label label,
- List<String> dependsOn) {
+ public K requiredMultiValueSelectionFromContainer(Label label,
+ List<String> dependsOn) {
this.staticProperties.add(StaticProperties.multiValueSelectionFromContainer(label, dependsOn));
return me();
}
- public BU requiredRuntimeResolvableTreeInput(Label label,
- List<String> dependsOn) {
+ public K requiredRuntimeResolvableTreeInput(Label label,
+ List<String> dependsOn) {
this.staticProperties.add(StaticProperties.runtimeResolvableTreeInput(label, dependsOn));
return me();
}
@@ -910,21 +1002,23 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
/**
* Defines a collection of configuration parameters of the specified staticProperties.
* The developer can fill the staticProperties multiply times.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that describes why this parameter is needed in a
- * * user-friendly manner.
+ *
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label}
+ * that describes why this parameter is needed in a user-friendly manner.
* @param staticProperties A list of {@link org.apache.streampipes.model.staticproperty} elements.
* @return this
*/
- public BU requiredCollection(Label label, StaticProperty... staticProperties) {
+ public K requiredCollection(Label label, StaticProperty... staticProperties) {
this.staticProperties.add(StaticProperties.collection(label, staticProperties));
return me();
}
- private FreeTextStaticProperty prepareFreeTextStaticProperty(String internalId, String label, String description, String type) {
+ private FreeTextStaticProperty prepareFreeTextStaticProperty(String internalId, String label, String description,
+ String type) {
return new FreeTextStaticProperty(internalId,
- label,
- description,
- URI.create(type));
+ label,
+ description,
+ URI.create(type));
}
private FreeTextStaticProperty prepareFreeTextStaticProperty(Label label, String type) {
@@ -932,7 +1026,7 @@ public abstract class AbstractConfigurablePipelineElementBuilder<BU extends
}
private List<StaticProperty> sortStaticProperties(List<StaticProperty> staticProperties) {
- for(int i = 0; i < staticProperties.size(); i++) {
+ for (int i = 0; i < staticProperties.size(); i++) {
staticProperties.get(i).setIndex(i);
}
return staticProperties;
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractPipelineElementBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractPipelineElementBuilder.java
index 6b4c4a0e0..46b689049 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractPipelineElementBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractPipelineElementBuilder.java
@@ -28,7 +28,8 @@ import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-public abstract class AbstractPipelineElementBuilder<BU extends AbstractPipelineElementBuilder<BU, T>, T extends NamedStreamPipesEntity> {
+public abstract class AbstractPipelineElementBuilder<X extends AbstractPipelineElementBuilder<X, T>,
+ T extends NamedStreamPipesEntity> {
protected T elementDescription;
@@ -48,7 +49,7 @@ public abstract class AbstractPipelineElementBuilder<BU extends AbstractPipeline
/**
* @deprecated: Use {@link #withAssets(String...)} instead
*/
- public BU iconUrl(String iconUrl) {
+ public X iconUrl(String iconUrl) {
elementDescription.setIconUrl(iconUrl);
return me();
}
@@ -57,27 +58,27 @@ public abstract class AbstractPipelineElementBuilder<BU extends AbstractPipeline
/**
* @deprecated: Use {@link #withAssets(String...)} instead
*/
- public BU providesAssets(String... assets) {
+ public X providesAssets(String... assets) {
return withAssets(assets);
}
- public BU withAssets(String... assets) {
+ public X withAssets(String... assets) {
this.elementDescription.setIncludesAssets(true);
this.elementDescription.setIncludedAssets(Arrays.asList(assets));
return me();
}
- public BU withLocales(Locales... locales) {
+ public X withLocales(Locales... locales) {
this.elementDescription.setIncludesLocales(true);
this.elementDescription.setIncludedLocales(Stream
- .of(locales)
- .map(Locales::toFilename)
- .collect(Collectors.toList()));
+ .of(locales)
+ .map(Locales::toFilename)
+ .collect(Collectors.toList()));
return me();
}
- protected <SP extends StaticProperty> SP prepareStaticProperty(Label label, SP element) {
+ protected <K extends StaticProperty> K prepareStaticProperty(Label label, K element) {
element.setInternalName(label.getInternalId());
element.setDescription(label.getDescription());
element.setLabel(label.getLabel());
@@ -85,7 +86,7 @@ public abstract class AbstractPipelineElementBuilder<BU extends AbstractPipeline
return element;
}
- protected abstract BU me();
+ protected abstract X me();
protected abstract void prepareBuild();
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractProcessingElementBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractProcessingElementBuilder.java
index 8b12102ea..2a91e74ae 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractProcessingElementBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/AbstractProcessingElementBuilder.java
@@ -37,9 +37,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-public abstract class AbstractProcessingElementBuilder<BU extends
- AbstractProcessingElementBuilder<BU, T>, T extends ConsumableStreamPipesEntity> extends
- AbstractConfigurablePipelineElementBuilder<BU, T> {
+public abstract class AbstractProcessingElementBuilder<K extends
+ AbstractProcessingElementBuilder<K, T>, T extends ConsumableStreamPipesEntity> extends
+ AbstractConfigurablePipelineElementBuilder<K, T> {
protected List<SpDataStream> streamRequirements;
@@ -72,7 +72,7 @@ public abstract class AbstractProcessingElementBuilder<BU extends
* @deprecated Use {@link #requiredStream(CollectedStreamRequirements)} instead
*/
@Deprecated
- public BU requiredStream(SpDataStream stream) {
+ public K requiredStream(SpDataStream stream) {
this.streamRequirements.add(stream);
return me();
}
@@ -81,55 +81,57 @@ public abstract class AbstractProcessingElementBuilder<BU extends
* Set a new stream requirement by adding restrictions on this stream. Use
* {@link StreamRequirementsBuilder} to create requirements for a single stream.
*
- * @param streamRequirements: A bundle of collected {@link CollectedStreamRequirements}
+ * @param streamRequirements A bundle of collected {@link CollectedStreamRequirements}
* @return this
*/
- public BU requiredStream(CollectedStreamRequirements streamRequirements) {
+ public K requiredStream(CollectedStreamRequirements streamRequirements) {
this.streamRequirements.add(streamRequirements.getStreamRequirements());
this.staticProperties.addAll(rewrite(streamRequirements.getMappingProperties(), this
- .streamRequirements.size()));
+ .streamRequirements.size()));
return me();
}
private List<MappingProperty> rewrite(List<MappingProperty> mappingProperties, int index) {
mappingProperties.forEach(mp -> mp.setRequirementSelector
- (getIndex(index) + PropertySelectorConstants.PROPERTY_DELIMITER + mp
- .getRequirementSelector()));
+ (getIndex(index) + PropertySelectorConstants.PROPERTY_DELIMITER + mp
+ .getRequirementSelector()));
return mappingProperties;
}
private String getIndex(int index) {
return index == 1 ? PropertySelectorConstants.FIRST_REQUIREMENT_PREFIX :
- PropertySelectorConstants.SECOND_REQUIREMENT_PREFIX;
+ PropertySelectorConstants.SECOND_REQUIREMENT_PREFIX;
}
/**
+ * @deprecated Use {@link #naryMappingPropertyWithoutRequirement(Label, PropertyScope)} instead.
* @param internalName
* @param label
* @param description
* @return
- * @deprecated Use {@link #naryMappingPropertyWithoutRequirement(Label, PropertyScope)} instead.
+ *
*/
- public BU naryMappingPropertyWithoutRequirement(String internalName, String label, String
- description) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K naryMappingPropertyWithoutRequirement(String internalName, String label, String
+ description) {
this.staticProperties.add(new MappingPropertyNary(internalName, label, description));
return me();
}
/**
- * Adds a new {@link org.apache.streampipes.model.staticproperty.MappingPropertyNary} to the pipeline element definition
- * which is not linked to a specific input property.
- * Use this method if you want to present users a selection (in form of a Checkbox Group) of all available input
- * event properties.
+ * Adds a new {@link org.apache.streampipes.model.staticproperty.MappingPropertyNary}
+ * to the pipeline element definition which is not linked to a specific input property.
+ * Use this method if you want to present users a selection (in form of a Checkbox Group)
+ * of all available input event properties.
*
* @param label A human-readable label that is displayed to users in the StreamPipes UI.
* @param propertyScope Only input event properties that match the
* {@link org.apache.streampipes.model.schema.PropertyScope} are displayed.
* @return
*/
- public BU naryMappingPropertyWithoutRequirement(Label label, PropertyScope propertyScope) {
+ public K naryMappingPropertyWithoutRequirement(Label label, PropertyScope propertyScope) {
MappingPropertyNary mp = new MappingPropertyNary(label.getInternalId(), label.getLabel(), label.getDescription());
mp.setPropertyScope(propertyScope.name());
this.staticProperties.add(mp);
@@ -137,38 +139,44 @@ public abstract class AbstractProcessingElementBuilder<BU extends
}
/**
- * Adds a new {@link org.apache.streampipes.model.staticproperty.MappingPropertyUnary} to the pipeline element definition
- * which is not linked to a specific input property.
- *
- * @param label A human-readable label
- * @return this
* @deprecated Use {@link #unaryMappingPropertyWithoutRequirement(Label)} instead.
* Use this method if you want to present users a single-value selection of all available input
* event properties.
+ *
+ * Adds a new {@link org.apache.streampipes.model.staticproperty.MappingPropertyUnary}
+ * to the pipeline element definition which is not linked to a specific input property.
+ *
+ * @param label A human-readable label
+ * @return this
*/
- public BU unaryMappingPropertyWithoutRequirement(String internalName, String label, String
- description) {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K unaryMappingPropertyWithoutRequirement(String internalName, String label, String
+ description) {
this.staticProperties.add(new MappingPropertyUnary(internalName, label, description));
return me();
}
/**
- * Adds a new {@link org.apache.streampipes.model.staticproperty.MappingPropertyUnary} to the pipeline element definition
- * which is not linked to a specific input property.
+ * @deprecated Use this method if you want to present users a single-value selection of all available input
+ * event properties.
+ *
+ * Adds a new {@link org.apache.streampipes.model.staticproperty.MappingPropertyUnary}
+ * to the pipeline element definition which is not linked to a specific input property.
*
* @param label
* @return this
- * @deprecated Use this method if you want to present users a single-value selection of all available input
- * event properties.
+ *
*/
- public BU unaryMappingPropertyWithoutRequirement(Label label) {
- this.staticProperties.add(new MappingPropertyUnary(label.getInternalId(), label.getLabel(), label.getDescription()));
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K unaryMappingPropertyWithoutRequirement(Label label) {
+ this.staticProperties.add(
+ new MappingPropertyUnary(label.getInternalId(), label.getLabel(), label.getDescription()));
return me();
}
/**
- * Adds a new {@link org.apache.streampipes.model.staticproperty.MappingPropertyUnary} to the pipeline element definition
- * which is not linked to a specific input property.
+ * Adds a new {@link org.apache.streampipes.model.staticproperty.MappingPropertyUnary}
+ * to the pipeline element definition which is not linked to a specific input property.
*
* @param label A human-readable label that is displayed to users in the StreamPipes UI.
* @param propertyScope Only input event properties that match the
@@ -177,7 +185,7 @@ public abstract class AbstractProcessingElementBuilder<BU extends
* Use this method if you want to present users a single-value selection of all available input
* event properties.
*/
- public BU unaryMappingPropertyWithoutRequirement(Label label, PropertyScope propertyScope) {
+ public K unaryMappingPropertyWithoutRequirement(Label label, PropertyScope propertyScope) {
MappingPropertyUnary mp = new MappingPropertyUnary(label.getInternalId(), label.getLabel(), label.getDescription());
mp.setPropertyScope(propertyScope.name());
this.staticProperties.add(mp);
@@ -193,7 +201,7 @@ public abstract class AbstractProcessingElementBuilder<BU extends
* ones or create your own by following the developer guide.
* @return this
*/
- public BU supportedFormats(TransportFormat... format) {
+ public K supportedFormats(TransportFormat... format) {
return supportedFormats(Arrays.asList(format));
}
@@ -206,7 +214,7 @@ public abstract class AbstractProcessingElementBuilder<BU extends
* ones or create your own by following the developer guide.
* @return this
*/
- public BU supportedFormats(List<TransportFormat> formats) {
+ public K supportedFormats(List<TransportFormat> formats) {
this.supportedGrounding.setTransportFormats(formats);
return me();
}
@@ -215,12 +223,13 @@ public abstract class AbstractProcessingElementBuilder<BU extends
* Assigns supported communication/transport protocols to the pipeline elements that can be handled at runtime (e.g.,
* Kafka or JMS).
*
- * @param protocol An arbitrary number of supported {@link org.apache.streampipes.model.grounding.TransportProtocol}s. Use
- * {@link org.apache.streampipes.sdk.helpers.SupportedProtocols} to assign protocols from some pre-defined
- * ones or create your own by following the developer guide.
+ * @param protocol An arbitrary number of supported
+ * {@link org.apache.streampipes.model.grounding.TransportProtocol}s.
+ * Use {@link org.apache.streampipes.sdk.helpers.SupportedProtocols} to assign protocols
+ * from some pre-defined ones or create your own by following the developer guide.
* @return this
*/
- public BU supportedProtocols(TransportProtocol... protocol) {
+ public K supportedProtocols(TransportProtocol... protocol) {
return supportedProtocols(Arrays.asList(protocol));
}
@@ -228,12 +237,12 @@ public abstract class AbstractProcessingElementBuilder<BU extends
* Assigns supported communication/transport protocols to the pipeline elements that can be handled at runtime (e.g.,
* Kafka or JMS).
*
- * @param protocols A list of supported {@link org.apache.streampipes.model.grounding.TransportProtocol}s. Use
- * {@link org.apache.streampipes.sdk.helpers.SupportedProtocols} to assign protocols from some pre-defined
- * ones or create your own by following the developer guide.
+ * @param protocols A list of supported {@link org.apache.streampipes.model.grounding.TransportProtocol}s.
+ * Use {@link org.apache.streampipes.sdk.helpers.SupportedProtocols} to assign protocols
+ * from some pre-defined ones or create your own by following the developer guide.
* @return this
*/
- public BU supportedProtocols(List<TransportProtocol> protocols) {
+ public K supportedProtocols(List<TransportProtocol> protocols) {
this.supportedGrounding.setTransportProtocols(protocols);
return me();
}
@@ -241,7 +250,8 @@ public abstract class AbstractProcessingElementBuilder<BU extends
/**
* @deprecated Use {@link #requiredStream(CollectedStreamRequirements)} instead
*/
- public BU setStream1() {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K setStream1() {
stream1 = true;
return me();
}
@@ -249,7 +259,8 @@ public abstract class AbstractProcessingElementBuilder<BU extends
/**
* @deprecated Use {@link #requiredStream(CollectedStreamRequirements)} instead
*/
- public BU setStream2() {
+ @Deprecated(since = "0.90.0", forRemoval = true)
+ public K setStream2() {
stream2 = true;
return me();
}
@@ -269,7 +280,7 @@ public abstract class AbstractProcessingElementBuilder<BU extends
this.elementDescription.setSupportedGrounding(supportedGrounding);
- for(int i = 0; i < streamRequirements.size(); i++) {
+ for (int i = 0; i < streamRequirements.size(); i++) {
streamRequirements.get(i).setIndex(i);
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/BoundPipelineElementBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/BoundPipelineElementBuilder.java
index 01b316a6d..698fd6335 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/BoundPipelineElementBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/BoundPipelineElementBuilder.java
@@ -39,13 +39,13 @@ public class BoundPipelineElementBuilder {
private BoundPipelineElementBuilder(InvocableStreamPipesEntity streamPipesEntity) {
this.streamPipesEntity = streamPipesEntity;
// TODO fix this hack
- this.streamPipesEntity.setElementId(this.streamPipesEntity.getBelongsTo() +":" + UUID.randomUUID().toString());
+ this.streamPipesEntity.setElementId(this.streamPipesEntity.getBelongsTo() + ":" + UUID.randomUUID().toString());
this.boundPipelineElement = new BoundPipelineElement();
this.connectedTo = new ArrayList<>();
}
public static BoundPipelineElementBuilder create(DataProcessorDescription dataProcessorDescription) {
- return new BoundPipelineElementBuilder(new DataProcessorInvocation(dataProcessorDescription));
+ return new BoundPipelineElementBuilder(new DataProcessorInvocation(dataProcessorDescription));
}
public static BoundPipelineElementBuilder create(DataSinkDescription dataSinkDescription) {
@@ -58,27 +58,30 @@ public class BoundPipelineElementBuilder {
}
public BoundPipelineElementBuilder withPredefinedFreeTextValue(String internalStaticPropertyId, String value) {
- this.streamPipesEntity.getStaticProperties().stream().filter(sp -> sp instanceof FreeTextStaticProperty).forEach(sp -> {
- if (sp.getInternalName().equals(internalStaticPropertyId)) {
- sp.setPredefined(true);
- ((FreeTextStaticProperty) sp).setValue(value);
- }
- });
+ this.streamPipesEntity.getStaticProperties().stream().filter(sp -> sp instanceof FreeTextStaticProperty)
+ .forEach(sp -> {
+ if (sp.getInternalName().equals(internalStaticPropertyId)) {
+ sp.setPredefined(true);
+ ((FreeTextStaticProperty) sp).setValue(value);
+ }
+ });
return this;
}
- public BoundPipelineElementBuilder withPredefinedSelection(String internalStaticPropertyId, List<String> selectedOptions) {
- this.streamPipesEntity.getStaticProperties().stream().filter(sp -> sp instanceof SelectionStaticProperty).forEach(sp -> {
- if (sp.getInternalName().equals(internalStaticPropertyId)) {
- sp.setPredefined(true);
- ((SelectionStaticProperty) sp).getOptions().forEach(o -> {
- if (selectedOptions.stream().anyMatch(so -> so.equals(o.getName()))) {
- o.setSelected(true);
+ public BoundPipelineElementBuilder withPredefinedSelection(String internalStaticPropertyId,
+ List<String> selectedOptions) {
+ this.streamPipesEntity.getStaticProperties().stream().filter(sp -> sp instanceof SelectionStaticProperty)
+ .forEach(sp -> {
+ if (sp.getInternalName().equals(internalStaticPropertyId)) {
+ sp.setPredefined(true);
+ ((SelectionStaticProperty) sp).getOptions().forEach(o -> {
+ if (selectedOptions.stream().anyMatch(so -> so.equals(o.getName()))) {
+ o.setSelected(true);
+ }
+ });
}
});
- }
- });
return this;
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataSetBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataSetBuilder.java
index 543bfd7ca..450df15e4 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataSetBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataSetBuilder.java
@@ -41,8 +41,10 @@ public class DataSetBuilder extends AbstractPipelineElementBuilder<DataSetBuilde
/**
* Creates a new data set using the builder pattern.
- * @param id A unique identifier of the new element, e.g., com.mycompany.set.mynewdataset
- * @param label A human-readable name of the element. Will later be shown as the element name in the StreamPipes UI.
+ *
+ * @param id A unique identifier of the new element, e.g., com.mycompany.set.mynewdataset
+ * @param label A human-readable name of the element.
+ * Will later be shown as the element name in the StreamPipes UI.
* @param description A human-readable description of the element.
* @return a new instance of {@link DataSetBuilder}
*/
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataSinkBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataSinkBuilder.java
index 56f504e31..7e2e252db 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataSinkBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataSinkBuilder.java
@@ -39,7 +39,8 @@ public class DataSinkBuilder extends AbstractProcessingElementBuilder<DataSinkBu
* Creates a new data sink using the builder pattern.
*
* @param id A unique identifier of the new element, e.g., com.mycompany.sink.mynewdatasink
- * @param label A human-readable name of the element. Will later be shown as the element name in the StreamPipes UI.
+ * @param label A human-readable name of the element.
+ * Will later be shown as the element name in the StreamPipes UI.
* @param description A human-readable description of the element.
*/
public static DataSinkBuilder create(String id, String label, String description) {
@@ -60,10 +61,10 @@ public class DataSinkBuilder extends AbstractProcessingElementBuilder<DataSinkBu
public DataSinkBuilder category(DataSinkType... categories) {
this.elementDescription
- .setCategory(Arrays
- .stream(categories)
- .map(Enum::name)
- .collect(Collectors.toList()));
+ .setCategory(Arrays
+ .stream(categories)
+ .map(Enum::name)
+ .collect(Collectors.toList()));
return me();
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataSourceBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataSourceBuilder.java
index e1a109997..12537762b 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataSourceBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataSourceBuilder.java
@@ -22,20 +22,22 @@ import org.apache.streampipes.model.graph.DataSourceDescription;
public class DataSourceBuilder extends AbstractPipelineElementBuilder<DataSourceBuilder, DataSourceDescription> {
- public static DataSourceBuilder create(String id, String label, String description) {
- return new DataSourceBuilder(id, label, description);
- }
-
/**
* Creates a new data source using the builder pattern.
- * @param id A unique identifier of the new element, e.g., com.mycompany.source.mynewdatasource
- * @param label A human-readable name of the element. Will later be shown as the element name in the StreamPipes UI.
+ *
+ * @param id A unique identifier of the new element, e.g., com.mycompany.source.mynewdatasource
+ * @param label A human-readable name of the element.
+ * Will later be shown as the element name in the StreamPipes UI.
* @param description A human-readable description of the element.
*/
protected DataSourceBuilder(String id, String label, String description) {
super(id, label, description, new DataSourceDescription());
}
+ public static DataSourceBuilder create(String id, String label, String description) {
+ return new DataSourceBuilder(id, label, description);
+ }
+
@Override
protected DataSourceBuilder me() {
return this;
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataStreamBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataStreamBuilder.java
index ab8d14ff2..a5c83251c 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataStreamBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/DataStreamBuilder.java
@@ -31,100 +31,108 @@ import java.util.List;
public class DataStreamBuilder extends AbstractPipelineElementBuilder<DataStreamBuilder, SpDataStream> {
- private List<EventProperty> eventProperties;
- private EventGrounding eventGrounding;
-
- protected DataStreamBuilder(String id, String label, String description) {
- super(id, label, description, new SpDataStream());
- this.eventProperties = new ArrayList<>();
- this.eventGrounding = new EventGrounding();
- }
-
- protected DataStreamBuilder(String id) {
- super(id, new SpDataStream());
- this.eventProperties = new ArrayList<>();
- this.eventGrounding = new EventGrounding();
- }
-
- /**
- * Creates a new data stream using the builder pattern.
- * @param id A unique identifier of the new element, e.g., com.mycompany.stream.mynewdatastream
- * @param label A human-readable name of the element. Will later be shown as the element name in the StreamPipes UI.
- * @param description A human-readable description of the element.
- * @return a new instance of {@link DataStreamBuilder}
- */
- public static DataStreamBuilder create(String id, String label, String description) {
- return new DataStreamBuilder(id, label, description);
- }
-
- /**
- * Creates a new data stream using the builder pattern.
- * @param id A unique identifier of the new element, e.g., com.mycompany.stream.mynewdatastream
- * @return a new instance of {@link DataStreamBuilder}
- */
- public static DataStreamBuilder create(String id) {
- return new DataStreamBuilder(id);
- }
-
- /**
- * Assigns a new event property to the stream's schema.
- * @param property The event property that should be added. Use {@link org.apache.streampipes.sdk.helpers.EpProperties}
- * for defining simple property definitions or
- * {@link org.apache.streampipes.sdk.builder.PrimitivePropertyBuilder} for defining more complex
- * definitions.
- * @return this
- */
- public DataStreamBuilder property(EventProperty property) {
- this.eventProperties.add(property);
- return me();
- }
-
- /**
- * Assigns a list of new event properties to the stream's schema.
- * @param properties The event properties that should be added.
- * @return this
- */
- public DataStreamBuilder properties(List<EventProperty> properties) {
- this.eventProperties.addAll(properties);
- return me();
- }
-
- /**
- * Assigns a new {@link org.apache.streampipes.model.grounding.TransportProtocol} to the stream definition.
- * @param protocol The transport protocol of the stream at runtime (e.g., Kafka or MQTT). Use
- * {@link org.apache.streampipes.sdk.helpers.Protocols} to use some pre-defined protocols (or create a new protocol as
- * described in the developer guide).
- * @return this
- */
- public DataStreamBuilder protocol(TransportProtocol protocol) {
- this.eventGrounding.setTransportProtocol(protocol);
- return this;
- }
-
- /**
- * Assigns a new {@link org.apache.streampipes.model.grounding.TransportFormat} to the stream definition.
- * @param format The transport format of the stream at runtime (e.g., JSON or Thrift). Use
- * {@link org.apache.streampipes.sdk.helpers.Formats} to use some pre-defined formats (or create a new format as
- * described in the developer guide).
- * @return this
- */
- public DataStreamBuilder format(TransportFormat format) {
- this.eventGrounding.setTransportFormats(Collections.singletonList(format));
- return this;
- }
-
- @Override
- protected DataStreamBuilder me() {
- return this;
- }
-
- @Override
- protected void prepareBuild() {
- this.elementDescription.setEventGrounding(eventGrounding);
-
- for (int i = 0; i < eventProperties.size(); i++) {
- eventProperties.get(i).setIndex(i);
- }
- this.elementDescription.setEventSchema(new EventSchema(eventProperties));
+ private List<EventProperty> eventProperties;
+ private EventGrounding eventGrounding;
+
+ protected DataStreamBuilder(String id, String label, String description) {
+ super(id, label, description, new SpDataStream());
+ this.eventProperties = new ArrayList<>();
+ this.eventGrounding = new EventGrounding();
+ }
+
+ protected DataStreamBuilder(String id) {
+ super(id, new SpDataStream());
+ this.eventProperties = new ArrayList<>();
+ this.eventGrounding = new EventGrounding();
+ }
+
+ /**
+ * Creates a new data stream using the builder pattern.
+ *
+ * @param id A unique identifier of the new element, e.g., com.mycompany.stream.mynewdatastream
+ * @param label A human-readable name of the element.
+ * Will later be shown as the element name in the StreamPipes UI.
+ * @param description A human-readable description of the element.
+ * @return a new instance of {@link DataStreamBuilder}
+ */
+ public static DataStreamBuilder create(String id, String label, String description) {
+ return new DataStreamBuilder(id, label, description);
+ }
+
+ /**
+ * Creates a new data stream using the builder pattern.
+ *
+ * @param id A unique identifier of the new element, e.g., com.mycompany.stream.mynewdatastream
+ * @return a new instance of {@link DataStreamBuilder}
+ */
+ public static DataStreamBuilder create(String id) {
+ return new DataStreamBuilder(id);
+ }
+
+ /**
+ * Assigns a new event property to the stream's schema.
+ *
+ * @param property The event property that should be added.
+ * Use {@link org.apache.streampipes.sdk.helpers.EpProperties}
+ * for defining simple property definitions or
+ * {@link org.apache.streampipes.sdk.builder.PrimitivePropertyBuilder}
+ * for defining more complex definitions.
+ * @return this
+ */
+ public DataStreamBuilder property(EventProperty property) {
+ this.eventProperties.add(property);
+ return me();
+ }
+
+ /**
+ * Assigns a list of new event properties to the stream's schema.
+ *
+ * @param properties The event properties that should be added.
+ * @return this
+ */
+ public DataStreamBuilder properties(List<EventProperty> properties) {
+ this.eventProperties.addAll(properties);
+ return me();
+ }
+
+ /**
+ * Assigns a new {@link org.apache.streampipes.model.grounding.TransportProtocol} to the stream definition.
+ *
+ * @param protocol The transport protocol of the stream at runtime (e.g., Kafka or MQTT).
+ * Use {@link org.apache.streampipes.sdk.helpers.Protocols} to use some pre-defined protocols
+ * (or create a new protocol as described in the developer guide).
+ * @return this
+ */
+ public DataStreamBuilder protocol(TransportProtocol protocol) {
+ this.eventGrounding.setTransportProtocol(protocol);
+ return this;
+ }
+
+ /**
+ * Assigns a new {@link org.apache.streampipes.model.grounding.TransportFormat} to the stream definition.
+ *
+ * @param format The transport format of the stream at runtime (e.g., JSON or Thrift).
+ * Use {@link org.apache.streampipes.sdk.helpers.Formats} to use some pre-defined formats
+ * (or create a new format as described in the developer guide).
+ * @return this
+ */
+ public DataStreamBuilder format(TransportFormat format) {
+ this.eventGrounding.setTransportFormats(Collections.singletonList(format));
+ return this;
+ }
+
+ @Override
+ protected DataStreamBuilder me() {
+ return this;
+ }
+
+ @Override
+ protected void prepareBuild() {
+ this.elementDescription.setEventGrounding(eventGrounding);
+
+ for (int i = 0; i < eventProperties.size(); i++) {
+ eventProperties.get(i).setIndex(i);
}
+ this.elementDescription.setEventSchema(new EventSchema(eventProperties));
+ }
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/PipelineTemplateBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/PipelineTemplateBuilder.java
index 8a8e1f086..432e2fd5c 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/PipelineTemplateBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/PipelineTemplateBuilder.java
@@ -37,7 +37,8 @@ public class PipelineTemplateBuilder {
this.boundPipelineElements = new ArrayList<>();
}
- public static PipelineTemplateBuilder create(String internalId, String pipelineTemplateName, String pipelineTemplateDescription) {
+ public static PipelineTemplateBuilder create(String internalId, String pipelineTemplateName,
+ String pipelineTemplateDescription) {
return new PipelineTemplateBuilder(internalId, pipelineTemplateName, pipelineTemplateDescription);
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/PrimitivePropertyBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/PrimitivePropertyBuilder.java
index e4dc47ccd..ea880e76b 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/PrimitivePropertyBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/PrimitivePropertyBuilder.java
@@ -34,123 +34,131 @@ import java.util.List;
public class PrimitivePropertyBuilder {
- private EventPropertyPrimitive eventProperty;
- private List<EventPropertyQualityDefinition> qualityDefinitions;
-
- private PrimitivePropertyBuilder(Datatypes datatype, String runtimeName) {
- this.eventProperty = new EventPropertyPrimitive();
- this.qualityDefinitions = new ArrayList<>();
- this.eventProperty.setRuntimeType(datatype.toString());
- this.eventProperty.setRuntimeName(runtimeName);
- }
-
- /**
- * A builder class helping to define advanced primitive properties. For simple property definitions, you can also
- * use {@link org.apache.streampipes.sdk.helpers.EpProperties}.
- * @param datatype The primitive {@link org.apache.streampipes.sdk.utils.Datatypes} definition of the new property.
- * @param runtimeName The name of the property at runtime (e.g., the field name of the JSON primitive.
- * @return this
- */
- public static PrimitivePropertyBuilder create(Datatypes datatype, String runtimeName) {
- return new PrimitivePropertyBuilder(datatype, runtimeName);
- }
-
- /**
- * Specifies the semantics of the property (e.g., whether a double value stands for a latitude coordinate).
- * @param domainProperty The domain property as a String. The domain property should reflect an URI. Use some
- * existing vocabulary from {@link org.apache.streampipes.vocabulary} or create your own.
- * @return
- */
- public PrimitivePropertyBuilder domainProperty(String domainProperty) {
- this.eventProperty.setDomainProperties(Collections.singletonList(URI.create(domainProperty)));
- return this;
- }
-
- /**
- * Defines the measurement unit (e.g., tons) of the event property.
- * @param measurementUnit The measurement unit as a URI from a vocabulary (e.g., QUDT).
- * @return
- */
- public PrimitivePropertyBuilder measurementUnit(URI measurementUnit) {
- this.eventProperty.setMeasurementUnit(measurementUnit);
- return this;
- }
-
- /**
- * Defines the value range. The data type of the event property must be a number.
- * @param min The minimum value the property can have at runtime.
- * @param max The maximum value the property can have at runtime.
- * @param step The expected granularity the property has at runtime.
- * @return this
- */
- public PrimitivePropertyBuilder valueSpecification(Float min, Float max, Float step) {
- this.eventProperty.setValueSpecification(new QuantitativeValue(min, max, step));
- return this;
- }
-
- /**
- * Defines the value range in form of an enumeration. The data type of the event property must be of type String
- * or Number.
- * @param label A human-readable label describing this enumeration.
- * @param description A human-readable description of the enumeration.
- * @param allowedValues A list of allowed values of the event property at runtime.
- * @return this
- */
- public PrimitivePropertyBuilder valueSpecification(String label, String description, List<String> allowedValues) {
- this.eventProperty.setValueSpecification(new Enumeration(label, description, allowedValues));
- return this;
- }
-
- /**
- * Assigns a human-readable label to the event property. The label is used in the StreamPipes UI for better
- * explaining users the meaning of the property.
- * @param label
- * @return this
- */
- public PrimitivePropertyBuilder label(String label) {
- this.eventProperty.setLabel(label);
- return this;
- }
-
- /**
- * Assigns a human-readable description to the event property. The description is used in the StreamPipes UI for
- * better explaining users the meaning of the property.
- * @param description
- * @return this
- */
- public PrimitivePropertyBuilder description(String description) {
- this.eventProperty.setDescription(description);
- return this;
- }
-
- public PrimitivePropertyBuilder accuracy(Float accuracy, URI measurementUnit) {
- // TODO extend event property
- this.qualityDefinitions.add(new Accuracy(accuracy));
- return this;
- }
-
- public PrimitivePropertyBuilder resolution(Float resolution, URI measurementUnit) {
- // TODO extend event property
- this.qualityDefinitions.add(new Resolution(resolution));
- return this;
- }
-
- /**
- * Assigns a property scope to the event property.
- * @param propertyScope The {@link org.apache.streampipes.model.schema.PropertyScope}.
- * @return this
- */
- public PrimitivePropertyBuilder scope(PropertyScope propertyScope) {
- this.eventProperty.setPropertyScope(propertyScope.name());
- return this;
- }
-
-
- public EventPropertyPrimitive build() {
- if (qualityDefinitions.size() > 0) {
- this.eventProperty.setEventPropertyQualities(qualityDefinitions);
- }
- return this.eventProperty;
+ private EventPropertyPrimitive eventProperty;
+ private List<EventPropertyQualityDefinition> qualityDefinitions;
+
+ private PrimitivePropertyBuilder(Datatypes datatype, String runtimeName) {
+ this.eventProperty = new EventPropertyPrimitive();
+ this.qualityDefinitions = new ArrayList<>();
+ this.eventProperty.setRuntimeType(datatype.toString());
+ this.eventProperty.setRuntimeName(runtimeName);
+ }
+
+ /**
+ * A builder class helping to define advanced primitive properties. For simple property definitions, you can also
+ * use {@link org.apache.streampipes.sdk.helpers.EpProperties}.
+ *
+ * @param datatype The primitive {@link org.apache.streampipes.sdk.utils.Datatypes} definition of the new property.
+ * @param runtimeName The name of the property at runtime (e.g., the field name of the JSON primitive.
+ * @return this
+ */
+ public static PrimitivePropertyBuilder create(Datatypes datatype, String runtimeName) {
+ return new PrimitivePropertyBuilder(datatype, runtimeName);
+ }
+
+ /**
+ * Specifies the semantics of the property (e.g., whether a double value stands for a latitude coordinate).
+ *
+ * @param domainProperty The domain property as a String. The domain property should reflect an URI. Use some
+ * existing vocabulary from {@link org.apache.streampipes.vocabulary} or create your own.
+ * @return
+ */
+ public PrimitivePropertyBuilder domainProperty(String domainProperty) {
+ this.eventProperty.setDomainProperties(Collections.singletonList(URI.create(domainProperty)));
+ return this;
+ }
+
+ /**
+ * Defines the measurement unit (e.g., tons) of the event property.
+ *
+ * @param measurementUnit The measurement unit as a URI from a vocabulary (e.g., QUDT).
+ * @return
+ */
+ public PrimitivePropertyBuilder measurementUnit(URI measurementUnit) {
+ this.eventProperty.setMeasurementUnit(measurementUnit);
+ return this;
+ }
+
+ /**
+ * Defines the value range. The data type of the event property must be a number.
+ *
+ * @param min The minimum value the property can have at runtime.
+ * @param max The maximum value the property can have at runtime.
+ * @param step The expected granularity the property has at runtime.
+ * @return this
+ */
+ public PrimitivePropertyBuilder valueSpecification(Float min, Float max, Float step) {
+ this.eventProperty.setValueSpecification(new QuantitativeValue(min, max, step));
+ return this;
+ }
+
+ /**
+ * Defines the value range in form of an enumeration. The data type of the event property must be of type String
+ * or Number.
+ *
+ * @param label A human-readable label describing this enumeration.
+ * @param description A human-readable description of the enumeration.
+ * @param allowedValues A list of allowed values of the event property at runtime.
+ * @return this
+ */
+ public PrimitivePropertyBuilder valueSpecification(String label, String description, List<String> allowedValues) {
+ this.eventProperty.setValueSpecification(new Enumeration(label, description, allowedValues));
+ return this;
+ }
+
+ /**
+ * Assigns a human-readable label to the event property. The label is used in the StreamPipes UI for better
+ * explaining users the meaning of the property.
+ *
+ * @param label
+ * @return this
+ */
+ public PrimitivePropertyBuilder label(String label) {
+ this.eventProperty.setLabel(label);
+ return this;
+ }
+
+ /**
+ * Assigns a human-readable description to the event property. The description is used in the StreamPipes UI for
+ * better explaining users the meaning of the property.
+ *
+ * @param description
+ * @return this
+ */
+ public PrimitivePropertyBuilder description(String description) {
+ this.eventProperty.setDescription(description);
+ return this;
+ }
+
+ public PrimitivePropertyBuilder accuracy(Float accuracy, URI measurementUnit) {
+ // TODO extend event property
+ this.qualityDefinitions.add(new Accuracy(accuracy));
+ return this;
+ }
+
+ public PrimitivePropertyBuilder resolution(Float resolution, URI measurementUnit) {
+ // TODO extend event property
+ this.qualityDefinitions.add(new Resolution(resolution));
+ return this;
+ }
+
+ /**
+ * Assigns a property scope to the event property.
+ *
+ * @param propertyScope The {@link org.apache.streampipes.model.schema.PropertyScope}.
+ * @return this
+ */
+ public PrimitivePropertyBuilder scope(PropertyScope propertyScope) {
+ this.eventProperty.setPropertyScope(propertyScope.name());
+ return this;
+ }
+
+
+ public EventPropertyPrimitive build() {
+ if (qualityDefinitions.size() > 0) {
+ this.eventProperty.setEventPropertyQualities(qualityDefinitions);
}
+ return this.eventProperty;
+ }
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/ProcessingElementBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/ProcessingElementBuilder.java
index 9a1dbbf98..057820a47 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/ProcessingElementBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/ProcessingElementBuilder.java
@@ -29,7 +29,8 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
-public class ProcessingElementBuilder extends AbstractProcessingElementBuilder<ProcessingElementBuilder, DataProcessorDescription> {
+public class ProcessingElementBuilder
+ extends AbstractProcessingElementBuilder<ProcessingElementBuilder, DataProcessorDescription> {
private List<OutputStrategy> outputStrategies;
@@ -48,7 +49,8 @@ public class ProcessingElementBuilder extends AbstractProcessingElementBuilder<P
* Creates a new processing element using the builder pattern.
*
* @param id A unique identifier of the new element, e.g., com.mycompany.processor.mynewdataprocessor
- * @param label A human-readable name of the element. Will later be shown as the element name in the StreamPipes UI.
+ * @param label A human-readable name of the element.
+ * Will later be shown as the element name in the StreamPipes UI.
* @param description A human-readable description of the element.
*/
public static ProcessingElementBuilder create(String id, String label, String description) {
@@ -92,9 +94,9 @@ public class ProcessingElementBuilder extends AbstractProcessingElementBuilder<P
*/
public ProcessingElementBuilder category(DataProcessorType... epaCategory) {
this.elementDescription.setCategory(Arrays
- .stream(epaCategory)
- .map(Enum::name)
- .collect(Collectors.toList()));
+ .stream(epaCategory)
+ .map(Enum::name)
+ .collect(Collectors.toList()));
return me();
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/PropertyRequirementsBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/PropertyRequirementsBuilder.java
index 607ea943d..fed9a70db 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/PropertyRequirementsBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/PropertyRequirementsBuilder.java
@@ -29,9 +29,19 @@ public class PropertyRequirementsBuilder {
private EventPropertyPrimitive propertyReq;
+ private PropertyRequirementsBuilder() {
+ this.propertyReq = new EventPropertyPrimitive();
+ }
+
+ private PropertyRequirementsBuilder(Datatypes propertyDatatype) {
+ this.propertyReq = new EventPropertyPrimitive();
+ this.propertyReq.setRuntimeType(propertyDatatype.toString());
+ }
+
/**
* Creates new requirements for a data processor or a data sink at a property level. A matching event property
* needs to provide all requirements assigned by this class.
+ *
* @return {@link PropertyRequirementsBuilder}
*/
public static PropertyRequirementsBuilder create(Datatypes propertyDatatype) {
@@ -42,15 +52,6 @@ public class PropertyRequirementsBuilder {
return new PropertyRequirementsBuilder();
}
- private PropertyRequirementsBuilder() {
- this.propertyReq = new EventPropertyPrimitive();
- }
-
- private PropertyRequirementsBuilder(Datatypes propertyDatatype) {
- this.propertyReq = new EventPropertyPrimitive();
- this.propertyReq.setRuntimeType(propertyDatatype.toString());
- }
-
public PropertyRequirementsBuilder datatype(Datatypes propertyDatatype) {
this.propertyReq.setRuntimeType(propertyDatatype.toString());
return this;
@@ -58,9 +59,9 @@ public class PropertyRequirementsBuilder {
public PropertyRequirementsBuilder domainPropertyReq(String... domainProperties) {
this.propertyReq.setDomainProperties(Arrays
- .stream(domainProperties)
- .map(URI::create)
- .collect(Collectors.toList()));
+ .stream(domainProperties)
+ .map(URI::create)
+ .collect(Collectors.toList()));
return this;
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/StreamRequirementsBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/StreamRequirementsBuilder.java
index b5eec91dd..af385fb88 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/StreamRequirementsBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/StreamRequirementsBuilder.java
@@ -36,8 +36,14 @@ public class StreamRequirementsBuilder {
private List<EventProperty> eventProperties;
private List<MappingProperty> mappingProperties;
+ private StreamRequirementsBuilder() {
+ this.eventProperties = new ArrayList<>();
+ this.mappingProperties = new ArrayList<>();
+ }
+
/**
* Creates a new stream requirement without any further property requirements.
+ *
* @return {@link CollectedStreamRequirements}
*/
public static CollectedStreamRequirements any() {
@@ -46,21 +52,19 @@ public class StreamRequirementsBuilder {
/**
* Creates new requirements for a data processor or a data sink.
+ *
* @return {@link StreamRequirementsBuilder}
*/
public static StreamRequirementsBuilder create() {
return new StreamRequirementsBuilder();
}
- private StreamRequirementsBuilder() {
- this.eventProperties = new ArrayList<>();
- this.mappingProperties = new ArrayList<>();
- }
-
/**
* Sets a new property requirement, e.g., a property of a specific data type or with specific semantics
* a data stream that is connected to this pipeline element must provide.
- * @param propertyRequirement The property requirement. Use {@link org.apache.streampipes.sdk.helpers.EpRequirements} to
+ *
+ * @param propertyRequirement The property requirement.
+ * Use {@link org.apache.streampipes.sdk.helpers.EpRequirements} to
* create a new requirement.
* @return this
*/
@@ -74,10 +78,12 @@ public class StreamRequirementsBuilder {
* Sets a new property requirement and, in addition, adds a
* {@link org.apache.streampipes.model.staticproperty.MappingPropertyUnary} static property to the pipeline element
* definition.
- * @param propertyRequirement The property requirement. Use {@link org.apache.streampipes.sdk.helpers.EpRequirements} to
+ *
+ * @param propertyRequirement The property requirement.
+ * Use {@link org.apache.streampipes.sdk.helpers.EpRequirements} to
* create a new requirement.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that defines the mapping property.
- * @param propertyScope The {@link org.apache.streampipes.model.schema.PropertyScope} of the requirement.
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that defines the mapping property.
+ * @param propertyScope The {@link org.apache.streampipes.model.schema.PropertyScope} of the requirement.
* @return this
*/
public StreamRequirementsBuilder requiredPropertyWithUnaryMapping(EventProperty propertyRequirement, Label label,
@@ -85,9 +91,9 @@ public class StreamRequirementsBuilder {
propertyRequirement.setRuntimeName(label.getInternalId());
this.eventProperties.add(propertyRequirement);
MappingPropertyUnary mp = new MappingPropertyUnary(label.getInternalId(), label
- .getInternalId(),
- label.getLabel(),
- label.getDescription());
+ .getInternalId(),
+ label.getLabel(),
+ label.getDescription());
mp.setPropertyScope(propertyScope.name());
@@ -99,18 +105,20 @@ public class StreamRequirementsBuilder {
* Sets a new property requirement and, in addition, adds a
* {@link org.apache.streampipes.model.staticproperty.MappingPropertyNary} static property to the pipeline element
* definition.
- * @param propertyRequirement The property requirement. Use {@link org.apache.streampipes.sdk.helpers.EpRequirements} to
+ *
+ * @param propertyRequirement The property requirement.
+ * Use {@link org.apache.streampipes.sdk.helpers.EpRequirements} to
* create a new requirement.
- * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that defines the mapping property.
- * @param propertyScope The {@link org.apache.streampipes.model.schema.PropertyScope} of the requirement.
+ * @param label The {@link org.apache.streampipes.sdk.helpers.Label} that defines the mapping property.
+ * @param propertyScope The {@link org.apache.streampipes.model.schema.PropertyScope} of the requirement.
* @return this
*/
- public StreamRequirementsBuilder requiredPropertyWithNaryMapping(EventProperty propertyRequirement, Label label, PropertyScope
- propertyScope) {
+ public StreamRequirementsBuilder requiredPropertyWithNaryMapping(EventProperty propertyRequirement, Label label,
+ PropertyScope propertyScope) {
propertyRequirement.setRuntimeName(label.getInternalId());
this.eventProperties.add(propertyRequirement);
MappingPropertyNary mp = new MappingPropertyNary(label.getInternalId(), label
- .getInternalId(), label.getLabel(), label.getDescription());
+ .getInternalId(), label.getLabel(), label.getDescription());
mp.setPropertyScope(propertyScope.name());
this.mappingProperties.add(mp);
return this;
@@ -119,8 +127,9 @@ public class StreamRequirementsBuilder {
/**
* Finishes the stream requirements definition.
- * @return an object of type {@link org.apache.streampipes.sdk.helpers.CollectedStreamRequirements} that contains all defined
- * property requirements and static properties.
+ *
+ * @return an object of type {@link org.apache.streampipes.sdk.helpers.CollectedStreamRequirements}
+ * that contains all defined property requirements and static properties.
*/
public CollectedStreamRequirements build() {
SpDataStream stream = new SpDataStream();
@@ -130,5 +139,4 @@ public class StreamRequirementsBuilder {
}
-
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/WildcardTopicBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/WildcardTopicBuilder.java
index fcd688c2d..0b7aaf7af 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/WildcardTopicBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/WildcardTopicBuilder.java
@@ -42,7 +42,7 @@ public class WildcardTopicBuilder {
public WildcardTopicBuilder addSimpleMapping(TopicParameterType topicParameterType, String runtimeName) {
this.wildcardTopicDefinition.getWildcardTopicMappings().add(new WildcardTopicMapping(topicParameterType.name(),
- runtimeName, runtimeName));
+ runtimeName, runtimeName));
return this;
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/AdapterDescriptionBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/AdapterDescriptionBuilder.java
index 0843a755a..bc170cb40 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/AdapterDescriptionBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/AdapterDescriptionBuilder.java
@@ -24,29 +24,29 @@ import org.apache.streampipes.sdk.builder.AbstractConfigurablePipelineElementBui
import java.util.Arrays;
import java.util.stream.Collectors;
-public abstract class AdapterDescriptionBuilder<BU extends
- AdapterDescriptionBuilder<BU, T>, T extends AdapterDescription> extends
- AbstractConfigurablePipelineElementBuilder<BU, T> {
+public abstract class AdapterDescriptionBuilder<V extends
+ AdapterDescriptionBuilder<V, T>, T extends AdapterDescription> extends
+ AbstractConfigurablePipelineElementBuilder<V, T> {
protected AdapterDescriptionBuilder(String id, T element) {
super(id, element);
}
protected AdapterDescriptionBuilder(String id, String label, String description,
- T adapterTypeInstance) {
+ T adapterTypeInstance) {
super(id, label, description, adapterTypeInstance);
}
- public BU category(AdapterType... categories) {
+ public V category(AdapterType... categories) {
this.elementDescription
- .setCategory(Arrays
- .stream(categories)
- .map(Enum::name)
- .collect(Collectors.toList()));
+ .setCategory(Arrays
+ .stream(categories)
+ .map(Enum::name)
+ .collect(Collectors.toList()));
return me();
}
- public AdapterDescriptionBuilder<BU, T> elementId(String elementId) {
+ public AdapterDescriptionBuilder<V, T> elementId(String elementId) {
this.elementDescription.setElementId(elementId);
return me();
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/FormatDescriptionBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/FormatDescriptionBuilder.java
index cfa5706ae..7ceea0185 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/FormatDescriptionBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/FormatDescriptionBuilder.java
@@ -22,7 +22,7 @@ import org.apache.streampipes.model.connect.grounding.FormatDescription;
import org.apache.streampipes.sdk.builder.AbstractConfigurablePipelineElementBuilder;
public class FormatDescriptionBuilder extends
- AbstractConfigurablePipelineElementBuilder<FormatDescriptionBuilder, FormatDescription> {
+ AbstractConfigurablePipelineElementBuilder<FormatDescriptionBuilder, FormatDescription> {
protected FormatDescriptionBuilder(String appId, String label, String description) {
super(appId, label, description, new FormatDescription());
@@ -30,8 +30,10 @@ public class FormatDescriptionBuilder extends
/**
* Creates a new format description using the builder pattern.
- * @param id A unique identifier of the new element, e.g., com.mycompany.sink.mynewdatasink
- * @param label A human-readable name of the element. Will later be shown as the element name in the StreamPipes UI.
+ *
+ * @param id A unique identifier of the new element, e.g., com.mycompany.sink.mynewdatasink
+ * @param label A human-readable name of the element.
+ * Will later be shown as the element name in the StreamPipes UI.
* @param description A human-readable description of the element.
*/
public static FormatDescriptionBuilder create(String id, String label, String description) {
@@ -40,6 +42,7 @@ public class FormatDescriptionBuilder extends
/**
* Add a format type to the format description, e.g. json
+ *
* @param formatType
* @return
*/
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/GuessSchemaBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/GuessSchemaBuilder.java
index 8f88a54eb..7c3148540 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/GuessSchemaBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/GuessSchemaBuilder.java
@@ -22,7 +22,10 @@ import org.apache.streampipes.model.connect.guess.GuessTypeInfo;
import org.apache.streampipes.model.schema.EventProperty;
import org.apache.streampipes.model.schema.EventSchema;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
public class GuessSchemaBuilder {
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/ProtocolDescriptionBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/ProtocolDescriptionBuilder.java
index c84a42937..98afc9fc5 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/ProtocolDescriptionBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/ProtocolDescriptionBuilder.java
@@ -26,7 +26,7 @@ import java.util.Arrays;
import java.util.stream.Collectors;
public class ProtocolDescriptionBuilder extends
- AbstractConfigurablePipelineElementBuilder<ProtocolDescriptionBuilder, ProtocolDescription> {
+ AbstractConfigurablePipelineElementBuilder<ProtocolDescriptionBuilder, ProtocolDescription> {
protected ProtocolDescriptionBuilder(String appId, String label, String description) {
super(appId, label, description, new ProtocolDescription());
@@ -38,8 +38,10 @@ public class ProtocolDescriptionBuilder extends
/**
* Creates a new protocol description using the builder pattern.
- * @param id A unique identifier of the new element, e.g., com.mycompany.protocol.mynewprotocol
- * @param label A human-readable name of the element. Will later be shown as the element name in the StreamPipes UI.
+ *
+ * @param id A unique identifier of the new element, e.g., com.mycompany.protocol.mynewprotocol
+ * @param label A human-readable name of the element.
+ * Will later be shown as the element name in the StreamPipes UI.
* @param description A human-readable description of the element.
*/
public static ProtocolDescriptionBuilder create(String id, String label, String description) {
@@ -48,6 +50,7 @@ public class ProtocolDescriptionBuilder extends
/**
* Creates a new protocol description using the builder pattern.
+ *
* @param id A unique identifier of the new element, e.g., com.mycompany.protocol.mynewprotocol
*/
public static ProtocolDescriptionBuilder create(String id) {
@@ -61,10 +64,10 @@ public class ProtocolDescriptionBuilder extends
public ProtocolDescriptionBuilder category(AdapterType... categories) {
this.elementDescription
- .setCategory(Arrays
- .stream(categories)
- .map(Enum::name)
- .collect(Collectors.toList()));
+ .setCategory(Arrays
+ .stream(categories)
+ .map(Enum::name)
+ .collect(Collectors.toList()));
return me();
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/SpecificDataSetAdapterBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/SpecificDataSetAdapterBuilder.java
index 1010ee440..a8d21dbed 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/SpecificDataSetAdapterBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/SpecificDataSetAdapterBuilder.java
@@ -21,7 +21,7 @@ import org.apache.streampipes.model.connect.adapter.SpecificAdapterSetDescriptio
import org.apache.streampipes.sdk.builder.DataSetBuilder;
public class SpecificDataSetAdapterBuilder extends
- AdapterDescriptionBuilder<SpecificDataSetAdapterBuilder, SpecificAdapterSetDescription> {
+ AdapterDescriptionBuilder<SpecificDataSetAdapterBuilder, SpecificAdapterSetDescription> {
private SpecificDataSetAdapterBuilder(String id, String label, String description) {
@@ -34,18 +34,21 @@ public class SpecificDataSetAdapterBuilder extends
/**
* Creates a new specific data set adapter using the builder pattern.
- * @param appId A unique identifier of the new element, e.g., com.mycompany.set.mynewdataset
- * @param label A human-readable name of the element. Will later be shown as the element name in the StreamPipes UI.
+ *
+ * @param appId A unique identifier of the new element, e.g., com.mycompany.set.mynewdataset
+ * @param label A human-readable name of the element.
+ * Will later be shown as the element name in the StreamPipes UI.
* @param description A human-readable description of the element.
* @return a new instance of {@link DataSetBuilder}
*/
public static SpecificDataSetAdapterBuilder create(String appId, String label, String
- description) {
+ description) {
return new SpecificDataSetAdapterBuilder(appId, label, description);
}
/**
* Creates a new specific data set adapter using the builder pattern.
+ *
* @param appId A unique identifier of the new element, e.g., com.mycompany.set.mynewdataset
* @return a new instance of {@link DataSetBuilder}
*/
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/SpecificDataStreamAdapterBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/SpecificDataStreamAdapterBuilder.java
index e24433d10..6fb61d61e 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/SpecificDataStreamAdapterBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/builder/adapter/SpecificDataStreamAdapterBuilder.java
@@ -21,7 +21,7 @@ import org.apache.streampipes.model.connect.adapter.SpecificAdapterStreamDescrip
import org.apache.streampipes.sdk.builder.DataSetBuilder;
public class SpecificDataStreamAdapterBuilder extends
- AdapterDescriptionBuilder<SpecificDataStreamAdapterBuilder, SpecificAdapterStreamDescription> {
+ AdapterDescriptionBuilder<SpecificDataStreamAdapterBuilder, SpecificAdapterStreamDescription> {
private SpecificDataStreamAdapterBuilder(String id, String label, String description) {
super(id, label, description, new SpecificAdapterStreamDescription());
@@ -33,18 +33,21 @@ public class SpecificDataStreamAdapterBuilder extends
/**
* Creates a new specific data stream adapter using the builder pattern.
- * @param appId A unique identifier of the new element, e.g., com.mycompany.set.mynewdataset
- * @param label A human-readable name of the element. Will later be shown as the element name in the StreamPipes UI.
+ *
+ * @param appId A unique identifier of the new element, e.g., com.mycompany.set.mynewdataset
+ * @param label A human-readable name of the element.
+ * Will later be shown as the element name in the StreamPipes UI.
* @param description A human-readable description of the element.
* @return a new instance of {@link DataSetBuilder}
*/
public static SpecificDataStreamAdapterBuilder create(String appId, String label, String
- description) {
+ description) {
return new SpecificDataStreamAdapterBuilder(appId, label, description);
}
/**
* Creates a new specific data stream adapter using the builder pattern.
+ *
* @param appId A unique identifier of the new element, e.g., com.mycompany.set.mynewdataset
* @return a new instance of {@link DataSetBuilder}
*/
@@ -53,7 +56,6 @@ public class SpecificDataStreamAdapterBuilder extends
}
-
@Override
protected SpecificDataStreamAdapterBuilder me() {
return this;
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/AbstractParameterExtractor.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/AbstractParameterExtractor.java
index eedd0a872..88cf2c616 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/AbstractParameterExtractor.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/AbstractParameterExtractor.java
@@ -18,18 +18,48 @@
package org.apache.streampipes.sdk.extractor;
-import com.github.drapostolos.typeparser.TypeParser;
import org.apache.streampipes.commons.exceptions.SpRuntimeException;
import org.apache.streampipes.model.SpDataStream;
import org.apache.streampipes.model.base.InvocableStreamPipesEntity;
import org.apache.streampipes.model.constants.PropertySelectorConstants;
-import org.apache.streampipes.model.schema.*;
-import org.apache.streampipes.model.staticproperty.*;
+import org.apache.streampipes.model.schema.EventProperty;
+import org.apache.streampipes.model.schema.EventPropertyList;
+import org.apache.streampipes.model.schema.EventPropertyNested;
+import org.apache.streampipes.model.schema.EventPropertyPrimitive;
+import org.apache.streampipes.model.schema.PropertyScope;
+import org.apache.streampipes.model.staticproperty.AnyStaticProperty;
+import org.apache.streampipes.model.staticproperty.CodeInputStaticProperty;
+import org.apache.streampipes.model.staticproperty.CollectionStaticProperty;
+import org.apache.streampipes.model.staticproperty.ColorPickerStaticProperty;
+import org.apache.streampipes.model.staticproperty.DomainStaticProperty;
+import org.apache.streampipes.model.staticproperty.FileStaticProperty;
+import org.apache.streampipes.model.staticproperty.FreeTextStaticProperty;
+import org.apache.streampipes.model.staticproperty.MappingPropertyNary;
+import org.apache.streampipes.model.staticproperty.MappingPropertyUnary;
+import org.apache.streampipes.model.staticproperty.OneOfStaticProperty;
+import org.apache.streampipes.model.staticproperty.Option;
+import org.apache.streampipes.model.staticproperty.RuntimeResolvableTreeInputStaticProperty;
+import org.apache.streampipes.model.staticproperty.SecretStaticProperty;
+import org.apache.streampipes.model.staticproperty.SelectionStaticProperty;
+import org.apache.streampipes.model.staticproperty.SlideToggleStaticProperty;
+import org.apache.streampipes.model.staticproperty.StaticProperty;
+import org.apache.streampipes.model.staticproperty.StaticPropertyAlternative;
+import org.apache.streampipes.model.staticproperty.StaticPropertyAlternatives;
+import org.apache.streampipes.model.staticproperty.StaticPropertyGroup;
+import org.apache.streampipes.model.staticproperty.StaticPropertyType;
+import org.apache.streampipes.model.staticproperty.SupportedProperty;
+import org.apache.streampipes.model.staticproperty.TreeInputNode;
import org.apache.streampipes.sdk.utils.Datatypes;
+import com.github.drapostolos.typeparser.TypeParser;
+
import java.io.IOException;
import java.io.InputStream;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Optional;
import java.util.stream.Collectors;
public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesEntity> {
@@ -44,27 +74,27 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
public String measurementUnit(String runtimeName, Integer streamIndex) {
return sepaElement
- .getInputStreams()
- .get(streamIndex)
- .getEventSchema()
- .getEventProperties()
- .stream()
- .filter(ep -> ep.getRuntimeName().equals(runtimeName))
- .map(ep -> (EventPropertyPrimitive) ep)
- .findFirst()
- .get()
- .getMeasurementUnit()
- .toString();
+ .getInputStreams()
+ .get(streamIndex)
+ .getEventSchema()
+ .getEventProperties()
+ .stream()
+ .filter(ep -> ep.getRuntimeName().equals(runtimeName))
+ .map(ep -> (EventPropertyPrimitive) ep)
+ .findFirst()
+ .get()
+ .getMeasurementUnit()
+ .toString();
}
public String inputTopic(Integer streamIndex) {
return sepaElement
- .getInputStreams()
- .get(streamIndex)
- .getEventGrounding()
- .getTransportProtocol()
- .getTopicDefinition()
- .getActualTopicName();
+ .getInputStreams()
+ .get(streamIndex)
+ .getEventGrounding()
+ .getTransportProtocol()
+ .getTopicDefinition()
+ .getActualTopicName();
}
public Object singleValueParameter(EventPropertyPrimitive targetType, String internalName) {
@@ -85,7 +115,7 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
public <V> V singleValueParameter(String internalName, Class<V> targetClass) {
return typeParser.parse(getStaticPropertyByName(internalName, FreeTextStaticProperty.class)
- .getValue(), targetClass);
+ .getValue(), targetClass);
}
public String textParameter(String internalName) {
@@ -94,7 +124,7 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
public String secretValue(String internalName) {
return (getStaticPropertyByName(internalName, SecretStaticProperty.class)
- .getValue());
+ .getValue());
}
public boolean slideToggleValue(String internalName) {
@@ -113,25 +143,30 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
* @deprecated This won't work after release 0.69.0 as all API requests against the core need to be authenticated.
* Use the StreamPipes Client File API instead (e.g., StreamPipesClientResolver.makeStreamPipesClientInstance()).
**/
- @Deprecated
+ @Deprecated(since = "0.90.0", forRemoval = true)
public String fileContentsAsString(String internalName) throws IOException {
- throw new IllegalArgumentException("Deprecated as API requests need to be authenticated - use the StreamPipes Client file API instead.");
+ throw new IllegalArgumentException(
+ "Deprecated as API requests need to be authenticated - use the StreamPipes Client file API instead.");
}
/**
* @deprecated This won't work after release 0.69.0 as all API requests against the core need to be authenticated.
* Use the StreamPipes Client File API instead (e.g., StreamPipesClientResolver.makeStreamPipesClientInstance()).
**/
+ @Deprecated(since = "0.90.0", forRemoval = true)
public byte[] fileContentsAsByteArray(String internalName) throws IOException {
- throw new IllegalArgumentException("Deprecated as API requests need to be authenticated - use the StreamPipes Client file API instead.");
+ throw new IllegalArgumentException(
+ "Deprecated as API requests need to be authenticated - use the StreamPipes Client file API instead.");
}
/**
* @deprecated This won't work after release 0.69.0 as all API requests against the core need to be authenticated.
* Use the StreamPipes Client File API instead (e.g., StreamPipesClientResolver.makeStreamPipesClientInstance()).
**/
+ @Deprecated(since = "0.90.0", forRemoval = true)
public InputStream fileContentsAsStream(String internalName) throws IOException {
- throw new IllegalArgumentException("Deprecated as API requests need to be authenticated - use the StreamPipes Client file API instead.");
+ throw new IllegalArgumentException(
+ "Deprecated as API requests need to be authenticated - use the StreamPipes Client file API instead.");
}
public String selectedFilename(String internalName) {
@@ -142,18 +177,21 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
* @deprecated This won't work after release 0.69.0 as all API requests against the core need to be authenticated.
* Use the StreamPipes Client File API instead (e.g., StreamPipesClientResolver.makeStreamPipesClientInstance()).
**/
+ @Deprecated(since = "0.90.0", forRemoval = true)
public String selectedFileFetchUrl(String internalName) {
- throw new IllegalArgumentException("Deprecated as API requests need to be authenticated - use the StreamPipes Client file API instead.");
+ throw new IllegalArgumentException(
+ "Deprecated as API requests need to be authenticated - use the StreamPipes Client file API instead.");
}
- private <V, T extends SelectionStaticProperty> V selectedSingleValue(String internalName, Class<V> targetClass, Class<T> oneOfStaticProperty) {
+ private <V, T extends SelectionStaticProperty> V selectedSingleValue(String internalName, Class<V> targetClass,
+ Class<T> oneOfStaticProperty) {
return typeParser.parse(getStaticPropertyByName(internalName, oneOfStaticProperty)
- .getOptions()
- .stream()
- .filter(Option::isSelected)
- .findFirst()
- .get()
- .getName(), targetClass);
+ .getOptions()
+ .stream()
+ .filter(Option::isSelected)
+ .findFirst()
+ .get()
+ .getName(), targetClass);
}
@@ -171,21 +209,21 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
public <V> V selectedSingleValueInternalName(String internalName, Class<V> targetClass) {
return typeParser.parse(getStaticPropertyByName(internalName, OneOfStaticProperty.class)
- .getOptions()
- .stream()
- .filter(Option::isSelected)
- .findFirst()
- .get()
- .getInternalName(), targetClass);
+ .getOptions()
+ .stream()
+ .filter(Option::isSelected)
+ .findFirst()
+ .get()
+ .getInternalName(), targetClass);
}
public List<StaticPropertyGroup> collectionMembersAsGroup(String internalName) {
return getStaticPropertyByName(internalName, CollectionStaticProperty.class)
- .getMembers()
- .stream()
- .map(sp -> (StaticPropertyGroup) sp)
- .sorted(Comparator.comparingInt(StaticProperty::getIndex))
- .collect(Collectors.toList());
+ .getMembers()
+ .stream()
+ .map(sp -> (StaticPropertyGroup) sp)
+ .sorted(Comparator.comparingInt(StaticProperty::getIndex))
+ .collect(Collectors.toList());
}
public Boolean comparePropertyRuntimeType(EventProperty eventProperty,
@@ -217,47 +255,48 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
public <V> List<V> singleValueParameterFromCollection(String internalName, Class<V> targetClass) {
CollectionStaticProperty collection = getStaticPropertyByName(internalName, CollectionStaticProperty.class);
return collection
- .getMembers()
- .stream()
- .sorted(Comparator.comparingInt(StaticProperty::getIndex))
- .map(sp -> (FreeTextStaticProperty) sp)
- .map(FreeTextStaticProperty::getValue)
- .map(v -> typeParser.parse(v, targetClass))
- .collect(Collectors.toList());
+ .getMembers()
+ .stream()
+ .sorted(Comparator.comparingInt(StaticProperty::getIndex))
+ .map(sp -> (FreeTextStaticProperty) sp)
+ .map(FreeTextStaticProperty::getValue)
+ .map(v -> typeParser.parse(v, targetClass))
+ .collect(Collectors.toList());
}
public <V> List<V> selectedMultiValues(String internalName, Class<V> targetClass) {
return getStaticPropertyByName(internalName, AnyStaticProperty.class)
- .getOptions()
- .stream()
- .filter(Option::isSelected)
- .map(Option::getName)
- .map(o -> typeParser.parse(o, targetClass))
- .collect(Collectors.toList());
+ .getOptions()
+ .stream()
+ .filter(Option::isSelected)
+ .map(Option::getName)
+ .map(o -> typeParser.parse(o, targetClass))
+ .collect(Collectors.toList());
}
public <V> List<V> selectedTreeNodesInternalNames(String internalName,
Class<V> targetClass,
boolean onlyDataNodes) {
List<TreeInputNode> allNodes = new ArrayList<>();
- RuntimeResolvableTreeInputStaticProperty sp = getStaticPropertyByName(internalName, RuntimeResolvableTreeInputStaticProperty.class);
+ RuntimeResolvableTreeInputStaticProperty sp =
+ getStaticPropertyByName(internalName, RuntimeResolvableTreeInputStaticProperty.class);
if (sp.getNodes().size() > 0) {
sp.getNodes().forEach(node -> buildFlatTree(node, allNodes));
}
if (allNodes.size() > 0) {
return allNodes
- .stream()
- .filter(node -> {
- if (!onlyDataNodes) {
- return true;
- } else {
- return node.isDataNode();
- }
- })
- .filter(TreeInputNode::isSelected)
- .map(node -> typeParser.parse(node.getInternalNodeName(), targetClass))
- .collect(Collectors.toList());
+ .stream()
+ .filter(node -> {
+ if (!onlyDataNodes) {
+ return true;
+ } else {
+ return node.isDataNode();
+ }
+ })
+ .filter(TreeInputNode::isSelected)
+ .map(node -> typeParser.parse(node.getInternalNodeName(), targetClass))
+ .collect(Collectors.toList());
} else {
return new ArrayList<>();
}
@@ -270,8 +309,8 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
}
}
- public <S extends StaticProperty> S getStaticPropertyByName(String internalName, Class<S>
- spType) {
+ public <W extends StaticProperty> W getStaticPropertyByName(String internalName, Class<W>
+ spType) {
return spType.cast(getStaticPropertyByName(internalName));
}
@@ -301,11 +340,11 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
private StaticProperty getStaticPropertyFromSelectedAlternative(StaticPropertyAlternatives sp) {
return sp.getAlternatives()
- .stream()
- .filter(StaticPropertyAlternative::getSelected)
- .findFirst()
- .get()
- .getStaticProperty();
+ .stream()
+ .filter(StaticPropertyAlternative::getSelected)
+ .findFirst()
+ .get()
+ .getStaticProperty();
}
public String mappingPropertyValue(String staticPropertyName) {
@@ -313,14 +352,15 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
}
public List<String> getUnaryMappingsFromCollection(String collectionStaticPropertyName) {
- CollectionStaticProperty collection = getStaticPropertyByName(collectionStaticPropertyName, CollectionStaticProperty.class);
+ CollectionStaticProperty collection =
+ getStaticPropertyByName(collectionStaticPropertyName, CollectionStaticProperty.class);
return collection
- .getMembers()
- .stream()
- .sorted(Comparator.comparingInt(StaticProperty::getIndex))
- .map(sp -> (MappingPropertyUnary) sp)
- .map(MappingPropertyUnary::getSelectedProperty)
- .collect(Collectors.toList());
+ .getMembers()
+ .stream()
+ .sorted(Comparator.comparingInt(StaticProperty::getIndex))
+ .map(sp -> (MappingPropertyUnary) sp)
+ .map(MappingPropertyUnary::getSelectedProperty)
+ .collect(Collectors.toList());
}
public List<String> mappingPropertyValues(String staticPropertyName) {
@@ -334,10 +374,10 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
}
Optional<EventProperty> matchedProperty = eventProperties
- .stream()
- .filter(ep -> ep.getRuntimeName().equals
- (runtimeName))
- .findFirst();
+ .stream()
+ .filter(ep -> ep.getRuntimeName().equals
+ (runtimeName))
+ .findFirst();
if (matchedProperty.isPresent()) {
EventProperty p = matchedProperty.get();
@@ -355,22 +395,22 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
}
public <V> V supportedOntologyPropertyValue(String domainPropertyInternalId, String
- propertyId, Class<V> targetClass) {
+ propertyId, Class<V> targetClass) {
DomainStaticProperty dsp = getStaticPropertyByName(domainPropertyInternalId,
- DomainStaticProperty.class);
+ DomainStaticProperty.class);
return typeParser.parse(dsp
- .getSupportedProperties()
- .stream()
- .filter(sp -> sp.getPropertyId().equals(propertyId))
- .findFirst()
- .map(SupportedProperty::getValue)
- .get(), targetClass);
+ .getSupportedProperties()
+ .stream()
+ .filter(sp -> sp.getPropertyId().equals(propertyId))
+ .findFirst()
+ .map(SupportedProperty::getValue)
+ .get(), targetClass);
}
public List<EventProperty> getEventPropertiesBySelector(List<String> selectors) throws
- SpRuntimeException {
+ SpRuntimeException {
List<EventProperty> properties = new ArrayList<>();
for (String selector : selectors) {
properties.add(getEventPropertyBySelector(selector));
@@ -382,7 +422,7 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
SpDataStream input = getStreamBySelector(selector);
List<EventProperty> matchedProperties = getEventProperty(selector, getStreamSelector
- (selector), input.getEventSchema().getEventProperties());
+ (selector), input.getEventSchema().getEventProperties());
if (matchedProperties.size() > 0) {
return matchedProperties.get(0);
@@ -409,7 +449,7 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
return Collections.singletonList(property);
} else if (EventPropertyNested.class.isInstance(property)) {
return getEventProperty(selector, makePropertyWithSelector(currentPointer, property
- .getRuntimeName()), ((EventPropertyNested) property).getEventProperties());
+ .getRuntimeName()), ((EventPropertyNested) property).getEventProperties());
}
}
@@ -432,44 +472,47 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
public List<EventProperty> getNoneInputStreamEventPropertySubset(List<String> propertySelectors) {
List<EventProperty> properties = new ArrayList<>();
for (SpDataStream stream : sepaElement.getInputStreams()) {
- properties.addAll(getNoneInputStreamEventPropertySubset(propertySelectors, sepaElement.getInputStreams().indexOf(stream)));
+ properties.addAll(
+ getNoneInputStreamEventPropertySubset(propertySelectors, sepaElement.getInputStreams().indexOf(stream)));
}
return properties;
}
- private List<EventProperty> getNoneInputStreamEventPropertySubset(List<String> propertySelectors, Integer streamIndex) {
+ private List<EventProperty> getNoneInputStreamEventPropertySubset(List<String> propertySelectors,
+ Integer streamIndex) {
return sepaElement
- .getInputStreams()
- .get(streamIndex)
- .getEventSchema()
- .getEventProperties()
+ .getInputStreams()
+ .get(streamIndex)
+ .getEventSchema()
+ .getEventProperties()
+ .stream()
+ .filter(ep -> propertySelectors
.stream()
- .filter(ep -> propertySelectors
- .stream()
- .noneMatch(ps -> getBySelector(ep.getRuntimeName(), streamIndex).equals(ps)))
- .collect(Collectors.toList());
+ .noneMatch(ps -> getBySelector(ep.getRuntimeName(), streamIndex).equals(ps)))
+ .collect(Collectors.toList());
}
public List<EventProperty> getInputStreamEventPropertySubset(List<String> propertySelectors) {
List<EventProperty> properties = new ArrayList<>();
for (SpDataStream stream : sepaElement.getInputStreams()) {
- properties.addAll(getInputStreamEventPropertySubset(propertySelectors, sepaElement.getInputStreams().indexOf(stream)));
+ properties.addAll(
+ getInputStreamEventPropertySubset(propertySelectors, sepaElement.getInputStreams().indexOf(stream)));
}
return properties;
}
private List<EventProperty> getInputStreamEventPropertySubset(List<String> propertySelectors, Integer streamIndex) {
return sepaElement
- .getInputStreams()
- .get(streamIndex)
- .getEventSchema()
- .getEventProperties()
+ .getInputStreams()
+ .get(streamIndex)
+ .getEventSchema()
+ .getEventProperties()
+ .stream()
+ .filter(ep -> propertySelectors
.stream()
- .filter(ep -> propertySelectors
- .stream()
- .anyMatch(ps -> getBySelector(ep.getRuntimeName(), streamIndex).equals(ps)))
- .collect(Collectors.toList());
+ .anyMatch(ps -> getBySelector(ep.getRuntimeName(), streamIndex).equals(ps)))
+ .collect(Collectors.toList());
}
private String getBySelector(String runtimeName, Integer streamIndex) {
@@ -482,34 +525,34 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
private String getPropertySelectorFromUnaryMapping(String staticPropertyName) {
Optional<MappingPropertyUnary> property = sepaElement.getStaticProperties().stream()
- .filter(p -> p instanceof MappingPropertyUnary)
- .map((p -> (MappingPropertyUnary) p))
- .filter(p -> p.getInternalName().equals(staticPropertyName))
- .findFirst();
+ .filter(p -> p instanceof MappingPropertyUnary)
+ .map((p -> (MappingPropertyUnary) p))
+ .filter(p -> p.getInternalName().equals(staticPropertyName))
+ .findFirst();
return property.map(MappingPropertyUnary::getSelectedProperty).orElse(null);
}
private List<String> getPropertySelectorsFromNaryMapping(String staticPropertyName) {
Optional<MappingPropertyNary> property = sepaElement.getStaticProperties().stream()
- .filter(p -> p instanceof MappingPropertyNary)
- .map((p -> (MappingPropertyNary) p))
- .filter(p -> p.getInternalName().equals(staticPropertyName))
- .findFirst();
+ .filter(p -> p instanceof MappingPropertyNary)
+ .map((p -> (MappingPropertyNary) p))
+ .filter(p -> p.getInternalName().equals(staticPropertyName))
+ .findFirst();
return property.map(MappingPropertyNary::getSelectedProperties).orElse(new ArrayList<>());
}
public String selectedAlternativeInternalId(String alternativesInternalId) {
StaticPropertyAlternatives alternatives = getStaticPropertyByName(alternativesInternalId,
- StaticPropertyAlternatives.class);
+ StaticPropertyAlternatives.class);
return alternatives
- .getAlternatives()
- .stream()
- .filter(StaticPropertyAlternative::getSelected)
- .map(StaticProperty::getInternalName)
- .findFirst().get();
+ .getAlternatives()
+ .stream()
+ .filter(StaticPropertyAlternative::getSelected)
+ .map(StaticProperty::getInternalName)
+ .findFirst().get();
}
public List<String> getEventPropertiesRuntimeNamesByScope(PropertyScope scope) {
@@ -519,8 +562,8 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
for (SpDataStream stream : sepaElement.getInputStreams()) {
int streamIndex = sepaElement.getInputStreams().indexOf(stream);
getEventPropertiesByScope(scope, streamIndex)
- .stream()
- .forEach(ep -> propertiesSelector.add(ep.getRuntimeName()));
+ .stream()
+ .forEach(ep -> propertiesSelector.add(ep.getRuntimeName()));
properties.addAll(getEventPropertiesByScope(scope, sepaElement.getInputStreams().indexOf(stream)));
}
@@ -534,8 +577,8 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
for (SpDataStream stream : sepaElement.getInputStreams()) {
int streamIndex = sepaElement.getInputStreams().indexOf(stream);
getEventPropertiesByScope(scope, streamIndex)
- .stream()
- .forEach(ep -> propertiesSelector.add(getBySelector(ep.getRuntimeName(), streamIndex)));
+ .stream()
+ .forEach(ep -> propertiesSelector.add(getBySelector(ep.getRuntimeName(), streamIndex)));
properties.addAll(getEventPropertiesByScope(scope, sepaElement.getInputStreams().indexOf(stream)));
}
@@ -552,13 +595,13 @@ public abstract class AbstractParameterExtractor<T extends InvocableStreamPipesE
private List<EventProperty> getEventPropertiesByScope(PropertyScope scope, Integer streamIndex) {
return sepaElement
- .getInputStreams()
- .get(streamIndex)
- .getEventSchema()
- .getEventProperties()
- .stream()
- .filter(ep ->
- ep.getPropertyScope() != null && ep.getPropertyScope().equals(scope.name()))
- .collect(Collectors.toList());
+ .getInputStreams()
+ .get(streamIndex)
+ .getEventSchema()
+ .getEventProperties()
+ .stream()
+ .filter(ep ->
+ ep.getPropertyScope() != null && ep.getPropertyScope().equals(scope.name()))
+ .collect(Collectors.toList());
}
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/DataSinkParameterExtractor.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/DataSinkParameterExtractor.java
index 4b91fe0ac..5624aaea4 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/DataSinkParameterExtractor.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/DataSinkParameterExtractor.java
@@ -22,11 +22,11 @@ import org.apache.streampipes.model.graph.DataSinkInvocation;
public class DataSinkParameterExtractor extends AbstractParameterExtractor<DataSinkInvocation> {
- public static DataSinkParameterExtractor from(DataSinkInvocation pipelineElement) {
- return new DataSinkParameterExtractor(pipelineElement);
- }
-
public DataSinkParameterExtractor(DataSinkInvocation pipelineElement) {
super(pipelineElement);
}
+
+ public static DataSinkParameterExtractor from(DataSinkInvocation pipelineElement) {
+ return new DataSinkParameterExtractor(pipelineElement);
+ }
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/ProcessingElementParameterExtractor.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/ProcessingElementParameterExtractor.java
index 3518c78bb..1a3cafb70 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/ProcessingElementParameterExtractor.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/ProcessingElementParameterExtractor.java
@@ -26,32 +26,32 @@ import java.util.List;
public class ProcessingElementParameterExtractor extends AbstractParameterExtractor<DataProcessorInvocation> {
- public static ProcessingElementParameterExtractor from(DataProcessorInvocation sepaElement) {
- return new ProcessingElementParameterExtractor(sepaElement);
- }
-
public ProcessingElementParameterExtractor(DataProcessorInvocation sepaElement) {
super(sepaElement);
}
+ public static ProcessingElementParameterExtractor from(DataProcessorInvocation sepaElement) {
+ return new ProcessingElementParameterExtractor(sepaElement);
+ }
+
public String outputTopic() {
return sepaElement
- .getOutputStream()
- .getEventGrounding()
- .getTransportProtocol()
- .getTopicDefinition()
- .getActualTopicName();
+ .getOutputStream()
+ .getEventGrounding()
+ .getTransportProtocol()
+ .getTopicDefinition()
+ .getActualTopicName();
}
public List<String> outputKeySelectors() {
return sepaElement
- .getOutputStrategies()
- .stream()
- .filter(CustomOutputStrategy.class::isInstance)
- .map(o -> (CustomOutputStrategy) o)
- .findFirst()
- .map(CustomOutputStrategy::getSelectedPropertyKeys)
- .orElse(new ArrayList<>());
+ .getOutputStrategies()
+ .stream()
+ .filter(CustomOutputStrategy.class::isInstance)
+ .map(o -> (CustomOutputStrategy) o)
+ .findFirst()
+ .map(CustomOutputStrategy::getSelectedPropertyKeys)
+ .orElse(new ArrayList<>());
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/StaticPropertyExtractor.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/StaticPropertyExtractor.java
index c6413e59a..c9030feee 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/StaticPropertyExtractor.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/extractor/StaticPropertyExtractor.java
@@ -31,7 +31,7 @@ public class StaticPropertyExtractor extends AbstractParameterExtractor<DataSink
}
public static StaticPropertyExtractor from(List<StaticProperty> staticProperties,
- List<SpDataStream> inputStreams, String appId) {
+ List<SpDataStream> inputStreams, String appId) {
DataSinkInvocation dataSinkInvocation = makeGraph(staticProperties, inputStreams);
dataSinkInvocation.setAppId(appId);
return new StaticPropertyExtractor(dataSinkInvocation);
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Alternatives.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Alternatives.java
index 9c6fd4bcc..85f31abfa 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Alternatives.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Alternatives.java
@@ -19,7 +19,6 @@ package org.apache.streampipes.sdk.helpers;
import org.apache.streampipes.model.staticproperty.StaticProperty;
import org.apache.streampipes.model.staticproperty.StaticPropertyAlternative;
-import org.apache.streampipes.model.staticproperty.StaticPropertyGroup;
public class Alternatives {
@@ -31,20 +30,20 @@ public class Alternatives {
public static StaticPropertyAlternative from(Label label, StaticProperty staticProperty, boolean selected) {
StaticPropertyAlternative alternative = from(label, selected);
- alternative.setStaticProperty(staticProperty);;
+ alternative.setStaticProperty(staticProperty);
return alternative;
}
public static StaticPropertyAlternative from(Label label) {
StaticPropertyAlternative alternative = new StaticPropertyAlternative(label.getInternalId(),
- label.getLabel(), label.getInternalId());
+ label.getLabel(), label.getInternalId());
alternative.setIndex(0);
return alternative;
}
public static StaticPropertyAlternative from(Label label, boolean selected) {
StaticPropertyAlternative alternative = new StaticPropertyAlternative(label.getInternalId(),
- label.getLabel(), label.getInternalId());
+ label.getLabel(), label.getInternalId());
alternative.setIndex(0);
alternative.setSelected(selected);
return alternative;
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/CodeLanguage.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/CodeLanguage.java
index 4a4120602..75f532935 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/CodeLanguage.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/CodeLanguage.java
@@ -20,16 +20,15 @@ package org.apache.streampipes.sdk.helpers;
public enum CodeLanguage {
None("Write your custom logic here"),
- Python("# Enter your python code here\n" +
- "\n" +
- "print('Hello, StreamPipes!')"),
- Javascript("function process(event) {\n" +
- " // do processing here.\n" +
- " // return processed event.\n" +
- " // Type 'event' and press Ctrl+Space to see available fields.\n" +
- " // Example: \n" +
- " return {timestamp: event.timestamp, tempInCelsius: (event.tempInKelvin - 273.15)};\n" +
- "}");
+ Python("# Enter your python code here\n\n"
+ + "print('Hello, StreamPipes!')"),
+ Javascript("function process(event) {\n"
+ + " // do processing here.\n"
+ + " // return processed event.\n"
+ + " // Type 'event' and press Ctrl+Space to see available fields.\n"
+ + " // Example: \n"
+ + " return {timestamp: event.timestamp, tempInCelsius: (event.tempInKelvin - 273.15)};\n"
+ + "}");
private String defaultSkeleton;
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/CollectedStreamRequirements.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/CollectedStreamRequirements.java
index 3eae4f607..2cd4a762d 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/CollectedStreamRequirements.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/CollectedStreamRequirements.java
@@ -31,8 +31,9 @@ public class CollectedStreamRequirements {
/**
* Collects stream requirements and mapping properties
+ *
* @param streamRequirements All stream requirements represented as an abstract data stream.
- * @param mappingProperties All mapping properties
+ * @param mappingProperties All mapping properties
*/
public CollectedStreamRequirements(SpDataStream streamRequirements, List<MappingProperty> mappingProperties) {
this.streamRequirements = streamRequirements;
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/EpProperties.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/EpProperties.java
index 49ad77b38..7f09b220d 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/EpProperties.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/EpProperties.java
@@ -38,7 +38,7 @@ import java.util.List;
public class EpProperties {
public static EventPropertyNested nestedEp(Label label, String runtimeName, EventProperty...
- eventProperties) {
+ eventProperties) {
EventPropertyNested nestedProperty = getPreparedProperty(label, new EventPropertyNested(runtimeName));
nestedProperty.setEventProperties(new ArrayList<>(Arrays.asList(eventProperties)));
return nestedProperty;
@@ -57,7 +57,7 @@ public class EpProperties {
}
public static EventPropertyList listNestedEp(Label label, String runtimeName, String
- domainProperty, List<EventProperty> listItemProperties) {
+ domainProperty, List<EventProperty> listItemProperties) {
EventPropertyList list = listNestedEp(label, runtimeName, listItemProperties);
list.setDomainProperties(Arrays.asList(URI.create(domainProperty)));
return list;
@@ -72,7 +72,7 @@ public class EpProperties {
public static EventPropertyPrimitive timestampProperty(String runtimeName) {
// TODO we need a real timestamp property!
EventPropertyPrimitive ep = ep(Labels.from("", "Timestamp", "The current timestamp value"),
- XSD._long.toString(), runtimeName, "http://schema.org/DateTime");
+ XSD._long.toString(), runtimeName, "http://schema.org/DateTime");
ep.setPropertyScope(PropertyScope.HEADER_PROPERTY.name());
return ep;
}
@@ -85,7 +85,7 @@ public class EpProperties {
*/
public static EventPropertyPrimitive imageProperty(String runtimeName) {
EventPropertyPrimitive ep = ep(Labels.from("", "Image", ""),
- XSD._string.toString(), runtimeName, SPSensor.IMAGE);
+ XSD._string.toString(), runtimeName, SPSensor.IMAGE);
ep.setPropertyScope(PropertyScope.MEASUREMENT_PROPERTY.name());
return ep;
}
@@ -161,11 +161,11 @@ public class EpProperties {
}
public static EventPropertyList listEp(Label label, String runtimeName, Datatypes runtimeType, String
- domainProperty) {
+ domainProperty) {
return getPreparedProperty(label, new EventPropertyList(runtimeName, ep(Labels.empty(), runtimeType
- .toString(),
- runtimeName,
- domainProperty)));
+ .toString(),
+ runtimeName,
+ domainProperty)));
}
/**
@@ -188,9 +188,10 @@ public class EpProperties {
* @param eventProperty The complex type of data in the list
* @return {@link org.apache.streampipes.model.schema.EventPropertyList}
*/
- public static EventPropertyList listEp(Label label, String runtimeName, EventProperty eventProperty, String domainProperty) {
+ public static EventPropertyList listEp(Label label, String runtimeName, EventProperty eventProperty,
+ String domainProperty) {
return getPreparedProperty(label, new EventPropertyList(runtimeName, eventProperty, Utils.createURI
- (domainProperty)));
+ (domainProperty)));
}
/**
@@ -242,7 +243,8 @@ public class EpProperties {
* @param propertyScope The scope for the property, whether it is a HEADER, MEASUREMENT, od DIMENSION property
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
- public static EventPropertyPrimitive stringEp(Label label, String runtimeName, String domainProperty, PropertyScope propertyScope) {
+ public static EventPropertyPrimitive stringEp(Label label, String runtimeName, String domainProperty,
+ PropertyScope propertyScope) {
EventPropertyPrimitive ep = ep(label, XSD._string.toString(), runtimeName, domainProperty);
ep.setPropertyScope(propertyScope.name());
return ep;
@@ -260,7 +262,7 @@ public class EpProperties {
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyPrimitive stringEp(Label label, String runtimeName, String domainProperty, Enumeration
- enumeration) {
+ enumeration) {
EventPropertyPrimitive ep = ep(label, XSD._string.toString(), runtimeName, domainProperty);
ep.setValueSpecification(enumeration);
return ep;
@@ -310,8 +312,8 @@ public class EpProperties {
/**
* Creates a new primitive property of type integer and the provided domain property.
*
- * @param label A human-readable identifier of the property presented to users in the StreamPipes UI. If you do not
- * want to have a label besides the runtime name, use
+ * @param label A human-readable identifier of the property presented to users in the StreamPipes UI.
+ * If you do not want to have a label besides the runtime name, use
* {@link org.apache.streampipes.sdk.helpers.Labels}
* @param runtimeName The field identifier of the event property at runtime.
* @param domainProperty The semantics of the list property as a String. The string should correspond to a URI
@@ -328,7 +330,7 @@ public class EpProperties {
}
public static EventPropertyPrimitive integerEp(Label label, String runtimeName, String domainProperty, Float
- minValue, Float maxValue, Float step) {
+ minValue, Float maxValue, Float step) {
return integerEp(label, runtimeName, domainProperty, new QuantitativeValue(minValue, maxValue, step));
}
@@ -352,11 +354,11 @@ public class EpProperties {
public static EventPropertyPrimitive ep(Label label, String runtimeType, String runtimeName, String domainProperty) {
return getPreparedProperty(label, new EventPropertyPrimitive(runtimeType, runtimeName, "", Utils.createURI
- (domainProperty)));
+ (domainProperty)));
}
private static EventPropertyPrimitive ep(Label label, String runtimeType, String runtimeName, List<URI>
- domainProperties) {
+ domainProperties) {
return getPreparedProperty(label, new EventPropertyPrimitive(runtimeType, runtimeName, "", domainProperties));
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/EpRequirements.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/EpRequirements.java
index adbd1e5c3..0ce9efea8 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/EpRequirements.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/EpRequirements.java
@@ -124,7 +124,8 @@ public class EpRequirements {
return appendDomainProperty(datatypeReq(SO.Number), domainProperty);
}
- private static <T extends EventProperty> EventProperty domainPropertyReq(String domainProperty, Class<T> eventProperty) {
+ private static <T extends EventProperty> EventProperty domainPropertyReq(String domainProperty,
+ Class<T> eventProperty) {
EventProperty ep = null;
try {
ep = eventProperty.newInstance();
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Formats.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Formats.java
index c9cf468cb..cbe4636fd 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Formats.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Formats.java
@@ -25,6 +25,7 @@ public class Formats {
/**
* Defines the transport format JSON used by a data stream at runtime.
+ *
* @return The {@link org.apache.streampipes.model.grounding.TransportFormat} of type JSON.
*/
public static TransportFormat jsonFormat() {
@@ -33,6 +34,7 @@ public class Formats {
/**
* Defines the transport format CBOR used by a data stream at runtime.
+ *
* @return The {@link org.apache.streampipes.model.grounding.TransportFormat} of type CBOR.
*/
public static TransportFormat cborFormat() {
@@ -41,6 +43,7 @@ public class Formats {
/**
* Defines the transport format Fast-Serializer used by a data stream at runtime.
+ *
* @return The {@link org.apache.streampipes.model.grounding.TransportFormat} of type FST.
*/
public static TransportFormat fstFormat() {
@@ -49,6 +52,7 @@ public class Formats {
/**
* Defines the transport format SMILE used by a data stream at runtime.
+ *
* @return The {@link org.apache.streampipes.model.grounding.TransportFormat} of type SMILE.
*/
public static TransportFormat smileFormat() {
@@ -57,6 +61,7 @@ public class Formats {
/**
* Defines the transport format Apache Thrift used by a data stream at runtime.
+ *
* @return The {@link org.apache.streampipes.model.grounding.TransportFormat} of type Thrift.
*/
public static TransportFormat thriftFormat() {
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Groundings.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Groundings.java
index 44bc40bd1..5f54c207f 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Groundings.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Groundings.java
@@ -25,19 +25,19 @@ import org.apache.streampipes.model.grounding.TransportFormat;
@Deprecated
public class Groundings {
- public static KafkaTransportProtocol kafkaGrounding(String kafkaHost, Integer kafkaPort, String topic) {
- return Protocols.kafka(kafkaHost, kafkaPort, topic);
- }
+ public static KafkaTransportProtocol kafkaGrounding(String kafkaHost, Integer kafkaPort, String topic) {
+ return Protocols.kafka(kafkaHost, kafkaPort, topic);
+ }
- public static JmsTransportProtocol jmsGrounding(String jmsHost, Integer jmsPort, String topic) {
- return Protocols.jms(jmsHost, jmsPort, topic);
- }
+ public static JmsTransportProtocol jmsGrounding(String jmsHost, Integer jmsPort, String topic) {
+ return Protocols.jms(jmsHost, jmsPort, topic);
+ }
- public static TransportFormat jsonFormat() {
- return Formats.jsonFormat();
- }
+ public static TransportFormat jsonFormat() {
+ return Formats.jsonFormat();
+ }
- public static TransportFormat thriftFormat() {
- return Formats.thriftFormat();
- }
+ public static TransportFormat thriftFormat() {
+ return Formats.thriftFormat();
+ }
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Labels.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Labels.java
index bd039eda1..fb8524eff 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Labels.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Labels.java
@@ -33,6 +33,10 @@ public class Labels {
private static final Logger LOG = LoggerFactory.getLogger(Labels.class);
/**
+ * @deprecated Externalize labels by using
+ * {@link org.apache.streampipes.sdk.builder.AbstractProcessingElementBuilder#withLocales(Locales...)}
+ * to ease future support for multiple languages.
+ *
* Creates a new label with internalId, label and description. Fully-configured labels are required by static
* properties and are mandatory for event properties.
*
@@ -40,23 +44,21 @@ public class Labels {
* @param label A human-readable title
* @param description A human-readable brief summary of the element.
* @return
- * @deprecated Externalize labels by using
- * {@link org.apache.streampipes.sdk.builder.AbstractProcessingElementBuilder#withLocales(Locales...)}
- * to ease future support for multiple languages.
*/
+ @Deprecated(since = "0.90.0", forRemoval = true)
public static Label from(String internalId, String label, String description) {
return new Label(internalId, label, description);
}
-
- @Deprecated
/**
- * @deprecated Externalize labels by using
- * {@link org.apache.streampipes.sdk.builder.AbstractProcessingElementBuilder#withLocales(Locales...)}
- * to ease future support for multiple languages.
- */
+ * @deprecated Externalize labels by using
+ * {@link org.apache.streampipes.sdk.builder.AbstractProcessingElementBuilder#withLocales(Locales...)}
+ * to ease future support for multiple languages.
+ */
+ @Deprecated(since = "0.90.0", forRemoval = true)
public static Label fromResources(String resourceIdentifier, String resourceName) {
try {
- return new Label(resourceName, findTitleLabel(resourceIdentifier, resourceName), findDescriptionLabel(resourceIdentifier, resourceName));
+ return new Label(resourceName, findTitleLabel(resourceIdentifier, resourceName),
+ findDescriptionLabel(resourceIdentifier, resourceName));
} catch (Exception e) {
LOG.error("Could not find resource " + resourceIdentifier);
return new Label(resourceName, "", "");
@@ -64,7 +66,8 @@ public class Labels {
}
/**
- * Creates a new label only with an internal id. Static properties require a fully-specified label, see {@link #from(String, String, String)}
+ * Creates a new label only with an internal id.
+ * Static properties require a fully-specified label, see {@link #from(String, String, String)}
*
* @param internalId The internal identifier of the element, e.g., "latitude-field-mapping"
* @return
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Locales.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Locales.java
index f2b59e3ae..94d7538d5 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Locales.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Locales.java
@@ -22,7 +22,7 @@ public enum Locales {
EN("en"),
DE("de");
- private final String Filename = "strings";
+ private final String filename = "strings";
private String code;
@@ -31,6 +31,6 @@ public enum Locales {
}
public String toFilename() {
- return this.Filename + "." + code;
+ return this.filename + "." + code;
}
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Options.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Options.java
index aceb1d899..646bfed63 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Options.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Options.java
@@ -28,6 +28,7 @@ public class Options {
/**
* Creates a new list of options by using the provided string values.
+ *
* @param optionLabel An arbitrary number of option labels.
* @return
*/
@@ -37,6 +38,6 @@ public class Options {
@SafeVarargs
public static List<Option> from(Tuple2<String, String>... options) {
- return Arrays.stream(options).map(o -> new Option(o.a, o.b)).collect(Collectors.toList());
+ return Arrays.stream(options).map(o -> new Option(o.k, o.v)).collect(Collectors.toList());
}
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/OutputStrategies.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/OutputStrategies.java
index e58e6b224..cb253fbfb 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/OutputStrategies.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/OutputStrategies.java
@@ -18,7 +18,15 @@
package org.apache.streampipes.sdk.helpers;
-import org.apache.streampipes.model.output.*;
+import org.apache.streampipes.model.output.AppendOutputStrategy;
+import org.apache.streampipes.model.output.CustomOutputStrategy;
+import org.apache.streampipes.model.output.CustomTransformOutputStrategy;
+import org.apache.streampipes.model.output.FixedOutputStrategy;
+import org.apache.streampipes.model.output.KeepOutputStrategy;
+import org.apache.streampipes.model.output.ListOutputStrategy;
+import org.apache.streampipes.model.output.TransformOperation;
+import org.apache.streampipes.model.output.TransformOutputStrategy;
+import org.apache.streampipes.model.output.UserDefinedOutputStrategy;
import org.apache.streampipes.model.schema.EventProperty;
import java.util.Arrays;
@@ -26,88 +34,94 @@ import java.util.List;
public class OutputStrategies {
- /**
- * Creates a {@link org.apache.streampipes.model.output.CustomOutputStrategy}. Custom output strategies let pipeline
- * developers decide which events are produced by the corresponding pipeline element.
- * @return CustomOutputStrategy
- */
- public static CustomOutputStrategy custom() {
- return new CustomOutputStrategy();
- }
-
- /**
- * Creates a {@link org.apache.streampipes.model.output.CustomOutputStrategy}.
- * @param outputBoth If two input streams are expected by a pipeline element, you can use outputBoth to indicate
- * whether the properties of both input streams should be available to the pipeline developer for
- * selection.
- * @return CustomOutputStrategy
- */
- public static CustomOutputStrategy custom(boolean outputBoth) {
- return new CustomOutputStrategy(outputBoth);
- }
-
-
- /**
- * Creates a {@link org.apache.streampipes.model.output.AppendOutputStrategy}. Append output strategies add additional
- * properties to an input event stream.
- * @param appendProperties An arbitrary number of event properties that are appended to any input stream.
- * @return AppendOutputStrategy
- */
- public static AppendOutputStrategy append(EventProperty... appendProperties) {
- return new AppendOutputStrategy(Arrays.asList(appendProperties));
- }
-
- public static AppendOutputStrategy append(List<EventProperty> appendProperties) {
- return new AppendOutputStrategy(appendProperties);
- }
-
- /**
- * Creates a {@link org.apache.streampipes.model.output.FixedOutputStrategy}. Fixed output strategies always output the
- * schema defined by the pipeline element itself.
- * @param fixedProperties An arbitrary number of event properties that form the output event schema
- * @return FixedOutputStrategy
- */
- public static FixedOutputStrategy fixed(EventProperty... fixedProperties) {
- return new FixedOutputStrategy(Arrays.asList(fixedProperties));
- }
-
- public static FixedOutputStrategy fixed(List<EventProperty> appendProperties) {
- return new FixedOutputStrategy(appendProperties);
- }
-
- /**
- * Creates a {@link org.apache.streampipes.model.output.KeepOutputStrategy}. Keep output strategies do not change the
- * schema of an input event, i.e., the output schema matches the input schema.
- * @return KeepOutputStrategy
- */
- public static KeepOutputStrategy keep() {
- return new KeepOutputStrategy();
- }
-
- /**
- * Creates a {@link org.apache.streampipes.model.output.UserDefinedOutputStrategy}. User-defined output strategies are
- * fully flexible output strategies which are created by users at pipeline development time.
- * @return UserDefinedOutputStrategy
- */
- public static UserDefinedOutputStrategy userDefined() {
- return new UserDefinedOutputStrategy();
- }
-
- public static KeepOutputStrategy keep(boolean mergeInputStreams) {
- return new KeepOutputStrategy("Rename", mergeInputStreams);
- }
-
- public static ListOutputStrategy list(String propertyRuntimeName) {
- return new ListOutputStrategy(propertyRuntimeName);
- }
-
- public static TransformOutputStrategy transform(TransformOperation... transformOperations) {
- TransformOutputStrategy tos = new TransformOutputStrategy();
- tos.setTransformOperations(Arrays.asList(transformOperations));
- return tos;
- }
-
- public static CustomTransformOutputStrategy customTransformation() {
- return new CustomTransformOutputStrategy();
- }
+ /**
+ * Creates a {@link org.apache.streampipes.model.output.CustomOutputStrategy}. Custom output strategies let pipeline
+ * developers decide which events are produced by the corresponding pipeline element.
+ *
+ * @return CustomOutputStrategy
+ */
+ public static CustomOutputStrategy custom() {
+ return new CustomOutputStrategy();
+ }
+
+ /**
+ * Creates a {@link org.apache.streampipes.model.output.CustomOutputStrategy}.
+ *
+ * @param outputBoth If two input streams are expected by a pipeline element, you can use outputBoth to indicate
+ * whether the properties of both input streams should be available to the pipeline developer for
+ * selection.
+ * @return CustomOutputStrategy
+ */
+ public static CustomOutputStrategy custom(boolean outputBoth) {
+ return new CustomOutputStrategy(outputBoth);
+ }
+
+
+ /**
+ * Creates a {@link org.apache.streampipes.model.output.AppendOutputStrategy}. Append output strategies add additional
+ * properties to an input event stream.
+ *
+ * @param appendProperties An arbitrary number of event properties that are appended to any input stream.
+ * @return AppendOutputStrategy
+ */
+ public static AppendOutputStrategy append(EventProperty... appendProperties) {
+ return new AppendOutputStrategy(Arrays.asList(appendProperties));
+ }
+
+ public static AppendOutputStrategy append(List<EventProperty> appendProperties) {
+ return new AppendOutputStrategy(appendProperties);
+ }
+
+ /**
+ * Creates a {@link org.apache.streampipes.model.output.FixedOutputStrategy}.
+ * Fixed output strategies always output the schema defined by the pipeline element itself.
+ *
+ * @param fixedProperties An arbitrary number of event properties that form the output event schema
+ * @return FixedOutputStrategy
+ */
+ public static FixedOutputStrategy fixed(EventProperty... fixedProperties) {
+ return new FixedOutputStrategy(Arrays.asList(fixedProperties));
+ }
+
+ public static FixedOutputStrategy fixed(List<EventProperty> appendProperties) {
+ return new FixedOutputStrategy(appendProperties);
+ }
+
+ /**
+ * Creates a {@link org.apache.streampipes.model.output.KeepOutputStrategy}. Keep output strategies do not change the
+ * schema of an input event, i.e., the output schema matches the input schema.
+ *
+ * @return KeepOutputStrategy
+ */
+ public static KeepOutputStrategy keep() {
+ return new KeepOutputStrategy();
+ }
+
+ /**
+ * Creates a {@link org.apache.streampipes.model.output.UserDefinedOutputStrategy}. User-defined output strategies are
+ * fully flexible output strategies which are created by users at pipeline development time.
+ *
+ * @return UserDefinedOutputStrategy
+ */
+ public static UserDefinedOutputStrategy userDefined() {
+ return new UserDefinedOutputStrategy();
+ }
+
+ public static KeepOutputStrategy keep(boolean mergeInputStreams) {
+ return new KeepOutputStrategy("Rename", mergeInputStreams);
+ }
+
+ public static ListOutputStrategy list(String propertyRuntimeName) {
+ return new ListOutputStrategy(propertyRuntimeName);
+ }
+
+ public static TransformOutputStrategy transform(TransformOperation... transformOperations) {
+ TransformOutputStrategy tos = new TransformOutputStrategy();
+ tos.setTransformOperations(Arrays.asList(transformOperations));
+ return tos;
+ }
+
+ public static CustomTransformOutputStrategy customTransformation() {
+ return new CustomTransformOutputStrategy();
+ }
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Protocols.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Protocols.java
index 98a265584..f9c25f11c 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Protocols.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Protocols.java
@@ -17,18 +17,23 @@
*/
package org.apache.streampipes.sdk.helpers;
-import org.apache.streampipes.model.grounding.*;
+
+import org.apache.streampipes.model.grounding.JmsTransportProtocol;
+import org.apache.streampipes.model.grounding.KafkaTransportProtocol;
+import org.apache.streampipes.model.grounding.MqttTransportProtocol;
+import org.apache.streampipes.model.grounding.WildcardTopicDefinition;
public class Protocols {
/**
* Defines the transport protocol Kafka used by a data stream at runtime using a
* {@link org.apache.streampipes.model.grounding.SimpleTopicDefinition}.
+ *
* @param kafkaHost The hostname of any Kafka broker
* @param kafkaPort The port of any Kafka broker
- * @param topic The topic identifier
- * @return The {@link org.apache.streampipes.model.grounding.KafkaTransportProtocol} containing URL and topic where data
- * arrives.
+ * @param topic The topic identifier
+ * @return The {@link org.apache.streampipes.model.grounding.KafkaTransportProtocol}
+ * containing URL and topic where data arrives.
*/
public static KafkaTransportProtocol kafka(String kafkaHost, Integer kafkaPort, String topic) {
return new KafkaTransportProtocol(kafkaHost, kafkaPort, topic, kafkaHost, kafkaPort);
@@ -37,23 +42,25 @@ public class Protocols {
/**
* Defines the transport protocol Kafka used by a data stream at runtime using a
* {@link org.apache.streampipes.model.grounding.WildcardTopicDefinition}
- * @param kafkaHost The hostname of any Kafka broker
- * @param kafkaPort The port of any Kafka broker
+ *
+ * @param kafkaHost The hostname of any Kafka broker
+ * @param kafkaPort The port of any Kafka broker
* @param wildcardTopicDefinition The wildcard topic definition.
- * @return The {@link org.apache.streampipes.model.grounding.KafkaTransportProtocol} containing URL and topic where data
- * arrives.
+ * @return The {@link org.apache.streampipes.model.grounding.KafkaTransportProtocol}
+ * containing URL and topic where data arrives.
*/
public static KafkaTransportProtocol kafka(String kafkaHost, Integer kafkaPort, WildcardTopicDefinition
- wildcardTopicDefinition) {
+ wildcardTopicDefinition) {
return new KafkaTransportProtocol(kafkaHost, kafkaPort, wildcardTopicDefinition);
}
/**
* Defines the transport protocol JMS used by a data stream at runtime.
+ *
* @param jmsHost The hostname of any JMS broker
* @param jmsPort The port of any JMS broker
- * @param topic The topic identifier
+ * @param topic The topic identifier
* @return The {@link org.apache.streampipes.model.grounding.JmsTransportProtocol} containing URL and topic where data
* arrives.
*/
@@ -63,11 +70,12 @@ public class Protocols {
/**
* Defines the transport protocol MQTT used by a data stream at runtime.
+ *
* @param mqttHost The hostname of any MQTT broker
* @param mqttPort The port of any MQTT broker
- * @param topic The topic identifier
- * @return The {@link org.apache.streampipes.model.grounding.MqttTransportProtocol} containing URL and topic where data
- * arrives.
+ * @param topic The topic identifier
+ * @return The {@link org.apache.streampipes.model.grounding.MqttTransportProtocol}
+ * containing URL and topic where data arrives.
*/
public static MqttTransportProtocol mqtt(String mqttHost, Integer mqttPort, String topic) {
return new MqttTransportProtocol(mqttHost, mqttPort, topic);
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/StreamIdentifier.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/StreamIdentifier.java
index d429ad678..912252a2f 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/StreamIdentifier.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/StreamIdentifier.java
@@ -29,9 +29,12 @@ public enum StreamIdentifier {
}
/**
- * @deprecated Use {@link org.apache.streampipes.sdk.builder.AbstractProcessingElementBuilder} to add stream requirements.
+ * @deprecated Use {@link org.apache.streampipes.sdk.builder.AbstractProcessingElementBuilder}
+ * to add stream requirements.
+ *
* @return the stream ID
*/
+ @Deprecated(since = "0.90.0", forRemoval = true)
public Integer getStreamId() {
return streamId;
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/SupportedFormats.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/SupportedFormats.java
index 26e0d4624..786557193 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/SupportedFormats.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/SupportedFormats.java
@@ -25,6 +25,7 @@ public class SupportedFormats {
/**
* Defines that a pipeline element (data processor or data sink) supports processing messaging arriving in JSON format
+ *
* @return The resulting {@link org.apache.streampipes.model.grounding.TransportFormat}.
*/
public static TransportFormat jsonFormat() {
@@ -34,6 +35,7 @@ public class SupportedFormats {
/**
* Defines that a pipeline element (data processor or data sink) supports processing messaging arriving in Thrift
* format
+ *
* @return The resulting {@link org.apache.streampipes.model.grounding.TransportFormat}.
*/
public static TransportFormat thriftFormat() {
@@ -43,6 +45,7 @@ public class SupportedFormats {
/**
* Defines that a pipeline element (data processor or data sink) supports processing messaging
* arriving in Cbor format
+ *
* @return The resulting {@link org.apache.streampipes.model.grounding.TransportFormat}.
*/
public static TransportFormat cborFormat() {
@@ -52,6 +55,7 @@ public class SupportedFormats {
/**
* Defines that a pipeline element (data processor or data sink) supports processing messaging
* arriving in fast-serialization format
+ *
* @return The resulting {@link org.apache.streampipes.model.grounding.TransportFormat}.
*/
public static TransportFormat fstFormat() {
@@ -61,6 +65,7 @@ public class SupportedFormats {
/**
* Defines that a pipeline element (data processor or data sink) supports processing messaging
* arriving in smile format
+ *
* @return The resulting {@link org.apache.streampipes.model.grounding.TransportFormat}.
*/
public static TransportFormat smileFormat() {
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/SupportedProtocols.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/SupportedProtocols.java
index 5df5acd07..fe4936917 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/SupportedProtocols.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/SupportedProtocols.java
@@ -27,6 +27,7 @@ public class SupportedProtocols {
/**
* Defines that a pipeline element (data processor or data sink) supports processing messages arriving from a
* Kafka broker.
+ *
* @return The {@link org.apache.streampipes.model.grounding.KafkaTransportProtocol}.
*/
public static KafkaTransportProtocol kafka() {
@@ -36,6 +37,7 @@ public class SupportedProtocols {
/**
* Defines that a pipeline element (data processor or data sink) supports processing messages arriving from a
* JMS broker.
+ *
* @return The {@link org.apache.streampipes.model.grounding.JmsTransportProtocol}.
*/
public static JmsTransportProtocol jms() {
@@ -45,6 +47,7 @@ public class SupportedProtocols {
/**
* Defines that a pipeline element (data processor or data sink) supports processing messages arriving from a
* Mqtt broker.
+ *
* @return The {@link org.apache.streampipes.model.grounding.MqttTransportProtocol}.
*/
public static MqttTransportProtocol mqtt() {
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/TransformOperations.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/TransformOperations.java
index 91bb4fa87..3acdf33f3 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/TransformOperations.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/TransformOperations.java
@@ -23,72 +23,74 @@ import org.apache.streampipes.sdk.utils.Datatypes;
public class TransformOperations {
- public static TransformOperation staticDatatypeTransformation(String mappingPropertyInternalName, Datatypes targetDatatype) {
+ public static TransformOperation staticDatatypeTransformation(String mappingPropertyInternalName,
+ Datatypes targetDatatype) {
return staticTransformOperation(TransformOperationType.DATATYPE_TRANSFORMATION, mappingPropertyInternalName,
- targetDatatype.toString());
+ targetDatatype.toString());
}
public static TransformOperation dynamicDatatypeTransformation(String mappingPropertyInternalName, String
- linkedStaticProperty) {
+ linkedStaticProperty) {
return dynamicTransformOperation(TransformOperationType.DATATYPE_TRANSFORMATION, mappingPropertyInternalName,
- linkedStaticProperty);
+ linkedStaticProperty);
}
public static TransformOperation staticDomainPropertyTransformation(String mappingPropertyInternalName, String
- targetValue) {
+ targetValue) {
return staticTransformOperation(TransformOperationType.DOMAIN_PROPERTY_TRANSFORMATION, mappingPropertyInternalName,
- targetValue);
+ targetValue);
}
public static TransformOperation dynamicDomainPropertyTransformation(String mappingPropertyInternalName, String
- linkedStaticProperty) {
+ linkedStaticProperty) {
return dynamicTransformOperation(TransformOperationType.DOMAIN_PROPERTY_TRANSFORMATION, mappingPropertyInternalName,
- linkedStaticProperty);
+ linkedStaticProperty);
}
public static TransformOperation staticRuntimeNameTransformation(String mappingPropertyInternalName, String
- targetValue) {
+ targetValue) {
return staticTransformOperation(TransformOperationType.RUNTIME_NAME_TRANSFORMATION, mappingPropertyInternalName,
- targetValue);
+ targetValue);
}
public static TransformOperation dynamicRuntimeNameTransformation(String mappingPropertyInternalName, String
- linkedStaticProperty) {
+ linkedStaticProperty) {
return dynamicTransformOperation(TransformOperationType.RUNTIME_NAME_TRANSFORMATION, mappingPropertyInternalName,
- linkedStaticProperty);
+ linkedStaticProperty);
}
public static TransformOperation staticMeasurementUnitTransformation(String mappingPropertyInternalName, String
- targetValue) {
+ targetValue) {
return staticTransformOperation(TransformOperationType.MEASUREMENT_UNIT_TRANSFORMATION
- , mappingPropertyInternalName, targetValue);
+ , mappingPropertyInternalName, targetValue);
}
public static TransformOperation dynamicMeasurementUnitTransformation(String
- mappingPropertyInternalName, String sourceStaticPropertyInternalName) {
+ mappingPropertyInternalName,
+ String sourceStaticPropertyInternalName) {
return dynamicTransformOperation(TransformOperationType.MEASUREMENT_UNIT_TRANSFORMATION,
- mappingPropertyInternalName, sourceStaticPropertyInternalName);
+ mappingPropertyInternalName, sourceStaticPropertyInternalName);
}
private static TransformOperation staticTransformOperation(TransformOperationType transformationScope, String
- mappingPropertyInternalName, String targetValue) {
+ mappingPropertyInternalName, String targetValue) {
TransformOperation to = prepareTransformOperation(transformationScope.name()
- , mappingPropertyInternalName);
+ , mappingPropertyInternalName);
to.setTargetValue(targetValue);
return to;
}
private static TransformOperation dynamicTransformOperation(TransformOperationType transformationScope, String
- mappingPropertyInternalName, String sourceStaticPropertyInternalName) {
+ mappingPropertyInternalName, String sourceStaticPropertyInternalName) {
TransformOperation to = prepareTransformOperation(transformationScope.name()
- , mappingPropertyInternalName);
+ , mappingPropertyInternalName);
to.setSourceStaticProperty(sourceStaticPropertyInternalName);
return to;
}
private static TransformOperation prepareTransformOperation(String transformationScope, String
- mappingPropertyInternalName) {
+ mappingPropertyInternalName) {
return new TransformOperation(transformationScope, mappingPropertyInternalName);
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Tuple2.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Tuple2.java
index f77c0f9f7..b48d29705 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Tuple2.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Tuple2.java
@@ -17,30 +17,36 @@
*/
package org.apache.streampipes.sdk.helpers;
-public class Tuple2<A, B> {
+public class Tuple2<K, V> {
- public final A a;
- public final B b;
+ public final K k;
+ public final V v;
- public Tuple2(A a, B b) {
- this.a = a;
- this.b = b;
+ public Tuple2(K k, V v) {
+ this.k = k;
+ this.v = v;
}
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
Tuple2<?, ?> tuple = (Tuple2<?, ?>) o;
- if (!a.equals(tuple.a)) return false;
- return b.equals(tuple.b);
+ if (!k.equals(tuple.k)) {
+ return false;
+ }
+ return v.equals(tuple.v);
}
@Override
public int hashCode() {
- int result = a.hashCode();
- result = 31 * result + b.hashCode();
+ int result = k.hashCode();
+ result = 31 * result + v.hashCode();
return result;
}
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Tuple3.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Tuple3.java
index f461a85cf..edb58aa81 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Tuple3.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/Tuple3.java
@@ -17,31 +17,39 @@
*/
package org.apache.streampipes.sdk.helpers;
-public class Tuple3<A, B, C> extends Tuple2<A, B> {
+public class Tuple3<V, W, X> extends Tuple2<V, W> {
- public final C c;
+ public final X x;
- public Tuple3(A a, B b, C c) {
- super(a, b);
- this.c = c;
+ public Tuple3(V v, W w, X x) {
+ super(v, w);
+ this.x = x;
}
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
Tuple3<?, ?, ?> tuple = (Tuple3<?, ?, ?>) o;
- if (!a.equals(tuple.a)) return false;
- if (!b.equals(tuple.b)) return false;
- return c.equals(tuple.c);
+ if (!k.equals(tuple.k)) {
+ return false;
+ }
+ if (!v.equals(tuple.v)) {
+ return false;
+ }
+ return x.equals(tuple.x);
}
@Override
public int hashCode() {
- int result = a != null ? a.hashCode() : 0;
- result = 31 * result + (b != null ? b.hashCode() : 0);
- result = 31 * result + (c != null ? c.hashCode() : 0);
+ int result = k != null ? k.hashCode() : 0;
+ result = 31 * result + (v != null ? v.hashCode() : 0);
+ result = 31 * result + (x != null ? x.hashCode() : 0);
return result;
}
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/stream/SchemaBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/stream/SchemaBuilder.java
index 08b661f6e..9f0e7a9af 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/stream/SchemaBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/stream/SchemaBuilder.java
@@ -19,9 +19,9 @@
package org.apache.streampipes.sdk.stream;
import org.apache.streampipes.commons.Utils;
-import org.apache.streampipes.model.schema.EventSchema;
import org.apache.streampipes.model.schema.EventProperty;
import org.apache.streampipes.model.schema.EventPropertyPrimitive;
+import org.apache.streampipes.model.schema.EventSchema;
import java.util.ArrayList;
import java.util.List;
@@ -29,40 +29,37 @@ import java.util.List;
@Deprecated
public class SchemaBuilder {
- private EventSchema schema;
- private List<EventProperty> properties;
+ private EventSchema schema;
+ private List<EventProperty> properties;
- private SchemaBuilder()
- {
- this.schema = new EventSchema();
- this.properties = new ArrayList<>();
- }
+ private SchemaBuilder() {
+ this.schema = new EventSchema();
+ this.properties = new ArrayList<>();
+ }
- public static SchemaBuilder create()
- {
- return new SchemaBuilder();
- }
+ public static SchemaBuilder create() {
+ return new SchemaBuilder();
+ }
- public SchemaBuilder simpleProperty(String label, String description, String runtimeName, String subPropertyOf, String dataType)
- {
- EventPropertyPrimitive primitive = new EventPropertyPrimitive(dataType, runtimeName, "", Utils.createURI(subPropertyOf));
- primitive.setDescription(description);
- primitive.setLabel(label);
- properties.add(primitive);
- return this;
- }
+ public SchemaBuilder simpleProperty(String label, String description, String runtimeName, String subPropertyOf,
+ String dataType) {
+ EventPropertyPrimitive primitive =
+ new EventPropertyPrimitive(dataType, runtimeName, "", Utils.createURI(subPropertyOf));
+ primitive.setDescription(description);
+ primitive.setLabel(label);
+ properties.add(primitive);
+ return this;
+ }
- public SchemaBuilder properties(List<EventProperty> properties)
- {
- this.properties.addAll(properties);
- return this;
- }
+ public SchemaBuilder properties(List<EventProperty> properties) {
+ this.properties.addAll(properties);
+ return this;
+ }
- public EventSchema build()
- {
- schema.setEventProperties(properties);
- return schema;
- }
+ public EventSchema build() {
+ schema.setEventProperties(properties);
+ return schema;
+ }
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/stream/StreamBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/stream/StreamBuilder.java
index 00a0f9458..9462a0daa 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/stream/StreamBuilder.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/stream/StreamBuilder.java
@@ -19,71 +19,63 @@
package org.apache.streampipes.sdk.stream;
import org.apache.streampipes.commons.Utils;
-import org.apache.streampipes.model.grounding.EventGrounding;
-import org.apache.streampipes.model.schema.EventSchema;
import org.apache.streampipes.model.SpDataStream;
+import org.apache.streampipes.model.grounding.EventGrounding;
import org.apache.streampipes.model.schema.EventPropertyPrimitive;
+import org.apache.streampipes.model.schema.EventSchema;
import java.net.URI;
@Deprecated
public class StreamBuilder {
- private SpDataStream stream;
- private EventSchema schema;
+ private SpDataStream stream;
+ private EventSchema schema;
- private StreamBuilder(String name, String description, String uri)
- {
- stream = new SpDataStream();
- stream.setName(name);
- stream.setDescription(description);
- stream.setUri(uri);
- }
+ private StreamBuilder(String name, String description, String uri) {
+ stream = new SpDataStream();
+ stream.setName(name);
+ stream.setDescription(description);
+ stream.setUri(uri);
+ }
- private StreamBuilder(String uri)
- {
- stream = new SpDataStream();
- stream.setUri(uri);
- schema = new EventSchema();
- }
+ private StreamBuilder(String uri) {
+ stream = new SpDataStream();
+ stream.setUri(uri);
+ schema = new EventSchema();
+ }
- public static StreamBuilder createStream(String name, String description, String uri)
- {
- return new StreamBuilder(name, description, uri);
- }
+ public static StreamBuilder createStream(String name, String description, String uri) {
+ return new StreamBuilder(name, description, uri);
+ }
- public static StreamBuilder createStreamRestriction(String uri)
- {
- return new StreamBuilder(uri);
- }
+ public static StreamBuilder createStreamRestriction(String uri) {
+ return new StreamBuilder(uri);
+ }
- public StreamBuilder property(String propertyName, URI propertyType, URI subclassOf)
- {
- schema.addEventProperty(new EventPropertyPrimitive(propertyType.toString(), propertyName, "", Utils.createURI(subclassOf.toString())));
- return this;
- }
+ public StreamBuilder property(String propertyName, URI propertyType, URI subclassOf) {
+ schema.addEventProperty(
+ new EventPropertyPrimitive(propertyType.toString(), propertyName, "", Utils.createURI(subclassOf.toString())));
+ return this;
+ }
- public StreamBuilder icon(String iconUrl)
- {
- stream.setIconUrl(iconUrl);
- return this;
- }
+ public StreamBuilder icon(String iconUrl) {
+ stream.setIconUrl(iconUrl);
+ return this;
+ }
- public StreamBuilder schema(EventSchema eventSchema)
- {
- stream.setEventSchema(eventSchema);
- return this;
- }
+ public StreamBuilder schema(EventSchema eventSchema) {
+ stream.setEventSchema(eventSchema);
+ return this;
+ }
- public StreamBuilder grounding(EventGrounding eventGrounding)
- {
- stream.setEventGrounding(eventGrounding);
- return this;
- }
+ public StreamBuilder grounding(EventGrounding eventGrounding) {
+ stream.setEventGrounding(eventGrounding);
+ return this;
+ }
- public SpDataStream build()
- {
- return stream;
- }
+ public SpDataStream build() {
+ return stream;
+ }
}
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/utils/Datatypes.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/utils/Datatypes.java
index e3bea4500..6a7dfbe78 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/utils/Datatypes.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/utils/Datatypes.java
@@ -26,29 +26,29 @@ import java.util.Arrays;
public enum Datatypes {
- Integer(XSD._integer),
- Long(XSD._long),
- Float(XSD._float),
- Boolean(XSD._boolean),
- String(XSD._string),
- Double(XSD._double),
- Number(URI.create(SO.Number)),
- Sequence(XSD._sequence);
-
- private URI uri;
-
- Datatypes(URI uri) {
- this.uri = uri;
- }
-
- public String toString() {
- return uri.toString();
- }
-
- public static Datatypes fromDatatypeString(String datatype) {
- return Arrays.stream(Datatypes.values())
- .filter(d -> d.uri.toString().equals(datatype))
- .findFirst()
- .orElseThrow(() -> new RuntimeException("Could not find datatype with URI " +datatype));
- }
+ Integer(XSD._integer),
+ Long(XSD._long),
+ Float(XSD._float),
+ Boolean(XSD._boolean),
+ String(XSD._string),
+ Double(XSD._double),
+ Number(URI.create(SO.Number)),
+ Sequence(XSD._sequence);
+
+ private URI uri;
+
+ Datatypes(URI uri) {
+ this.uri = uri;
+ }
+
+ public static Datatypes fromDatatypeString(String datatype) {
+ return Arrays.stream(Datatypes.values())
+ .filter(d -> d.uri.toString().equals(datatype))
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("Could not find datatype with URI " + datatype));
+ }
+
+ public String toString() {
+ return uri.toString();
+ }
}
diff --git a/streampipes-sdk/src/test/java/org/apache/streampipes/sdk/builder/adapter/GenericDataStreamAdapterBuilderTest.java b/streampipes-sdk/src/test/java/org/apache/streampipes/sdk/builder/adapter/GenericDataStreamAdapterBuilderTest.java
index 5168ecefe..6f68b47c6 100644
--- a/streampipes-sdk/src/test/java/org/apache/streampipes/sdk/builder/adapter/GenericDataStreamAdapterBuilderTest.java
+++ b/streampipes-sdk/src/test/java/org/apache/streampipes/sdk/builder/adapter/GenericDataStreamAdapterBuilderTest.java
@@ -24,6 +24,7 @@ import org.apache.streampipes.model.connect.grounding.ProtocolDescription;
import org.apache.streampipes.model.connect.rules.value.AddTimestampRuleDescription;
import org.apache.streampipes.sdk.helpers.Locales;
import org.apache.streampipes.sdk.utils.Assets;
+
import org.junit.Test;
import java.util.List;