You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2019/12/09 14:26:59 UTC
[plc4x] 04/04: Updated to the latest StreamPipes version
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/knxnet-ip
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit ad5daf11a89a1bbab6a39228b5f96fb7779c6532
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Dec 9 15:26:46 2019 +0100
Updated to the latest StreamPipes version
---
pom.xml | 10 ++
.../env/development | 9 +-
sandbox/test-streampipes-plc4x-adapters/pom.xml | 102 +++++++--------------
.../adapters/source/knxnetip/KnxNetIpAdapter.java | 7 ++
.../env/development | 3 +-
sandbox/test-streampipes-plc4x-processors/pom.xml | 86 +++++++----------
.../enrich/knxnetip/ets5/Ets5DataEnrichment.java | 2 +
.../ets5/Ets5DataEnrichmentController.java | 14 ++-
.../strings.en | 3 +
9 files changed, 107 insertions(+), 129 deletions(-)
diff --git a/pom.xml b/pom.xml
index efb7a2e..a3e4e5e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -338,6 +338,16 @@
<version>${netty.version}</version>
</dependency>
<dependency>
+ <groupId>jakarta.annotation</groupId>
+ <artifactId>jakarta.annotation-api</artifactId>
+ <version>1.3.5</version>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.validation</groupId>
+ <artifactId>jakarta.validation-api</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+ <dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
diff --git a/sandbox/test-streampipes-plc4x-adapters/env/development b/sandbox/test-streampipes-plc4x-adapters/env/development
index 8e06237..1d1b919 100644
--- a/sandbox/test-streampipes-plc4x-adapters/env/development
+++ b/sandbox/test-streampipes-plc4x-adapters/env/development
@@ -18,10 +18,9 @@
# ----------------------------------------------------------------------------
# Redirect some parameters for local development.
-SP_KAFKA_HOST=host.docker.internal
-SP_CONNECT_CONTAINER_HOST=localhost
-SP_CONNECT_CONTAINER_MASTER_HOST=localhost
SP_CONNECT_CONTAINER_WORKER_HOST=host.docker.internal
-SP_CONNECT_CONTAINER_WORKER_PORT=8198
+SP_CONNECT_CONTAINER_HOST=host.docker.internal
+SP_CONNECT_CONTAINER_MASTER_HOST=localhost
SP_DATA_LOCATION=./test_data/
-
+SP_DEBUG=true
+SP_DEBUG_CONNECT=false
\ No newline at end of file
diff --git a/sandbox/test-streampipes-plc4x-adapters/pom.xml b/sandbox/test-streampipes-plc4x-adapters/pom.xml
index 05c5cf5..f9a03a8 100644
--- a/sandbox/test-streampipes-plc4x-adapters/pom.xml
+++ b/sandbox/test-streampipes-plc4x-adapters/pom.xml
@@ -33,7 +33,7 @@
<name>Sandbox: StreamPipes Adapters</name>
<properties>
- <streampipes.version>0.64.0</streampipes.version>
+ <streampipes.version>0.65.0</streampipes.version>
</properties>
<dependencies>
@@ -82,36 +82,40 @@
<version>${streampipes.version}</version>
<exclusions>
<exclusion>
- <groupId>org.jboss.spec.javax.annotation</groupId>
- <artifactId>jboss-annotations-api_1.2_spec</artifactId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <groupId>javax.ws.rs</groupId>
</exclusion>
<exclusion>
- <groupId>org.glassfish.hk2.external</groupId>
- <artifactId>javax.inject</artifactId>
+ <artifactId>javax.servlet-api</artifactId>
+ <groupId>javax.servlet</groupId>
</exclusion>
<exclusion>
- <groupId>org.glassfish.hk2.external</groupId>
- <artifactId>aopalliance-repackaged</artifactId>
+ <artifactId>javax.annotation-api</artifactId>
+ <groupId>javax.annotation</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>javax.inject</artifactId>
+ <groupId>javax.inject</groupId>
</exclusion>
<exclusion>
- <groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
+ <groupId>aopalliance</groupId>
</exclusion>
<exclusion>
- <groupId>org.glassfish</groupId>
- <artifactId>javax.el</artifactId>
+ <artifactId>aopalliance-repackaged</artifactId>
+ <groupId>org.glassfish.hk2.external</groupId>
</exclusion>
<exclusion>
- <groupId>org.ow2.spec.ee</groupId>
- <artifactId>ow2-jpa-1.0-spec</artifactId>
+ <artifactId>tomcat-embed-el</artifactId>
+ <groupId>org.apache.tomcat.embed</groupId>
</exclusion>
<exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
+ <artifactId>persistence-api</artifactId>
+ <groupId>javax.persistence</groupId>
</exclusion>
<exclusion>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>jsr305</artifactId>
+ <artifactId>jboss-annotations-api_1.2_spec</artifactId>
+ <groupId>org.jboss.spec.javax.annotation</groupId>
</exclusion>
</exclusions>
</dependency>
@@ -122,10 +126,6 @@
</dependency>
<dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- </dependency>
- <dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>compile</scope>
@@ -146,83 +146,51 @@
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.9.4</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.datatype</groupId>
- <artifactId>jackson-datatype-jdk8</artifactId>
- <version>2.9.9</version>
- </dependency>
-
- <dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
- <version>3.12.1</version>
+ <version>3.14.3</version>
</dependency>
-
<dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>fluent-hc</artifactId>
- <version>${httpclient.version}</version>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <version>5.2.1.RELEASE</version>
</dependency>
<dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>${httpclient.version}</version>
+ <groupId>com.fasterxml.jackson.datatype</groupId>
+ <artifactId>jackson-datatype-jdk8</artifactId>
+ <version>2.10.0</version>
</dependency>
-
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.25.0-GA</version>
</dependency>
-
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- <version>3.3.2.Final</version>
- </dependency>
-
- <dependency>
- <groupId>org.objenesis</groupId>
- <artifactId>objenesis</artifactId>
- <version>2.5.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- <version>5.1.9.RELEASE</version>
- </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
- <version>5.1.9.RELEASE</version>
+ <version>5.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
- <version>5.1.9.RELEASE</version>
+ <version>5.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
- <version>5.1.9.RELEASE</version>
+ <version>5.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
- <version>5.1.9.RELEASE</version>
+ <version>5.2.1.RELEASE</version>
</dependency>
-
<dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <version>2.0.1.Final</version>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging</artifactId>
+ <version>3.4.1.Final</version>
</dependency>
</dependencies>
</dependencyManagement>
+
</project>
\ No newline at end of file
diff --git a/sandbox/test-streampipes-plc4x-adapters/src/main/java/org/apache/plc4x/java/streampipes/adapters/source/knxnetip/KnxNetIpAdapter.java b/sandbox/test-streampipes-plc4x-adapters/src/main/java/org/apache/plc4x/java/streampipes/adapters/source/knxnetip/KnxNetIpAdapter.java
index 5580b5e..6f49822 100644
--- a/sandbox/test-streampipes-plc4x-adapters/src/main/java/org/apache/plc4x/java/streampipes/adapters/source/knxnetip/KnxNetIpAdapter.java
+++ b/sandbox/test-streampipes-plc4x-adapters/src/main/java/org/apache/plc4x/java/streampipes/adapters/source/knxnetip/KnxNetIpAdapter.java
@@ -46,6 +46,7 @@ import org.streampipes.sdk.builder.PrimitivePropertyBuilder;
import org.streampipes.sdk.builder.adapter.SpecificDataStreamAdapterBuilder;
import org.streampipes.sdk.helpers.Labels;
import org.streampipes.sdk.utils.Datatypes;
+import org.streampipes.vocabulary.SO;
import java.net.InetAddress;
import java.net.UnknownHostException;
@@ -92,6 +93,7 @@ public class KnxNetIpAdapter extends SpecificDataStreamAdapter {
allProperties.add(
PrimitivePropertyBuilder
.create(Datatypes.Long, MAPPING_FIELD_TIME)
+ .domainProperty(SO.DateTime)
.label("Time")
.description("The time the event was processed in the KNXnet/IP driver.")
.build());
@@ -129,6 +131,9 @@ public class KnxNetIpAdapter extends SpecificDataStreamAdapter {
@Override
public void startAdapter() throws AdapterException {
+ if((connection != null) && (connection.isConnected())) {
+ return;
+ }
try {
InetAddress inetAddress = InetAddress.getByName(gatewayIp);
ChannelFactory channelFactory = new UdpSocketChannelFactory(inetAddress, KnxNetIpConnection.KNXNET_IP_PORT);
@@ -184,6 +189,8 @@ public class KnxNetIpAdapter extends SpecificDataStreamAdapter {
} catch (UnknownHostException e) {
logger.error("Error connecting to host " + gatewayIp, e);
throw new AdapterException("Error connecting to host " + gatewayIp);
+ } catch (Exception e) {
+ logger.error("Something strange went wrong.", e);
}
}
diff --git a/sandbox/test-streampipes-plc4x-processors/env/development b/sandbox/test-streampipes-plc4x-processors/env/development
index cb9e079..f07810b 100644
--- a/sandbox/test-streampipes-plc4x-processors/env/development
+++ b/sandbox/test-streampipes-plc4x-processors/env/development
@@ -18,6 +18,7 @@
# ----------------------------------------------------------------------------
# Redirect some parameters for local development.
-SP_PORT=8005
+SP_PORT=8091
SP_HOST=host.docker.internal
+SP_DEBUG=true
diff --git a/sandbox/test-streampipes-plc4x-processors/pom.xml b/sandbox/test-streampipes-plc4x-processors/pom.xml
index f83ea65..8bf5c52 100644
--- a/sandbox/test-streampipes-plc4x-processors/pom.xml
+++ b/sandbox/test-streampipes-plc4x-processors/pom.xml
@@ -32,7 +32,7 @@
<name>Sandbox: StreamPipes Processors</name>
<properties>
- <streampipes.version>0.64.0</streampipes.version>
+ <streampipes.version>0.65.0</streampipes.version>
</properties>
<dependencies>
@@ -74,6 +74,10 @@
<artifactId>ow2-jpa-1.0-spec</artifactId>
<groupId>org.ow2.spec.ee</groupId>
</exclusion>
+ <exclusion>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <groupId>javax.ws.rs</groupId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -91,6 +95,20 @@
<groupId>org.streampipes</groupId>
<artifactId>streampipes-sdk</artifactId>
<version>${streampipes.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>aopalliance</artifactId>
+ <groupId>aopalliance</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>ow2-jpa-1.0-spec</artifactId>
+ <groupId>org.ow2.spec.ee</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>javax.inject</artifactId>
+ <groupId>javax.inject</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.streampipes</groupId>
@@ -134,10 +152,6 @@
<version>${streampipes.version}</version>
<exclusions>
<exclusion>
- <artifactId>jboss-annotations-api_1.2_spec</artifactId>
- <groupId>org.jboss.spec.javax.annotation</groupId>
- </exclusion>
- <exclusion>
<artifactId>aopalliance-repackaged</artifactId>
<groupId>org.glassfish.hk2.external</groupId>
</exclusion>
@@ -145,6 +159,10 @@
<artifactId>tomcat-embed-el</artifactId>
<groupId>org.apache.tomcat.embed</groupId>
</exclusion>
+ <exclusion>
+ <artifactId>jboss-annotations-api_1.2_spec</artifactId>
+ <groupId>org.jboss.spec.javax.annotation</groupId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -153,10 +171,6 @@
<version>0.6.0-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- </dependency>
- <dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>compile</scope>
@@ -177,85 +191,51 @@
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.9.4</version>
- </dependency>
-
- <dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
- <version>2.9.9</version>
+ <version>2.10.0</version>
</dependency>
-
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
- <version>3.12.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>fluent-hc</artifactId>
- <version>${httpclient.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>${httpclient.version}</version>
+ <version>3.14.3</version>
</dependency>
-
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.25.0-GA</version>
</dependency>
-
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- <version>3.3.2.Final</version>
- </dependency>
-
- <dependency>
- <groupId>org.objenesis</groupId>
- <artifactId>objenesis</artifactId>
- <version>2.5.1</version>
- </dependency>
-
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
- <version>5.1.9.RELEASE</version>
+ <version>5.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
- <version>5.1.9.RELEASE</version>
+ <version>5.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
- <version>5.1.9.RELEASE</version>
+ <version>5.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
- <version>5.1.9.RELEASE</version>
+ <version>5.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
- <version>5.1.9.RELEASE</version>
+ <version>5.2.1.RELEASE</version>
</dependency>
-
<dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <version>2.0.1.Final</version>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging</artifactId>
+ <version>3.4.1.Final</version>
</dependency>
</dependencies>
</dependencyManagement>
-
</project>
\ No newline at end of file
diff --git a/sandbox/test-streampipes-plc4x-processors/src/main/java/org/apache/plc4x/java/streampipes/processors/enrich/knxnetip/ets5/Ets5DataEnrichment.java b/sandbox/test-streampipes-plc4x-processors/src/main/java/org/apache/plc4x/java/streampipes/processors/enrich/knxnetip/ets5/Ets5DataEnrichment.java
index d9d1bf7..bc08b31 100644
--- a/sandbox/test-streampipes-plc4x-processors/src/main/java/org/apache/plc4x/java/streampipes/processors/enrich/knxnetip/ets5/Ets5DataEnrichment.java
+++ b/sandbox/test-streampipes-plc4x-processors/src/main/java/org/apache/plc4x/java/streampipes/processors/enrich/knxnetip/ets5/Ets5DataEnrichment.java
@@ -86,6 +86,8 @@ public class Ets5DataEnrichment implements EventProcessor<Ets5DataEnrichmentPara
event.addField(Ets5DataEnrichmentController.MAPPING_FIELD_DECODED_PROPERTY_VALUE,
jsonDatapoint);
+ System.out.println(hexEncodedRawData + " decoded to: " + jsonDatapoint + " " + groupAddress.getType().getMainType() + " " + groupAddress.getType().getSubType());
+
//Event enrichedEvent = new Event()
spOutputCollector.collect(event);
} else {
diff --git a/sandbox/test-streampipes-plc4x-processors/src/main/java/org/apache/plc4x/java/streampipes/processors/enrich/knxnetip/ets5/Ets5DataEnrichmentController.java b/sandbox/test-streampipes-plc4x-processors/src/main/java/org/apache/plc4x/java/streampipes/processors/enrich/knxnetip/ets5/Ets5DataEnrichmentController.java
index d5420aa..4389723 100644
--- a/sandbox/test-streampipes-plc4x-processors/src/main/java/org/apache/plc4x/java/streampipes/processors/enrich/knxnetip/ets5/Ets5DataEnrichmentController.java
+++ b/sandbox/test-streampipes-plc4x-processors/src/main/java/org/apache/plc4x/java/streampipes/processors/enrich/knxnetip/ets5/Ets5DataEnrichmentController.java
@@ -36,10 +36,13 @@ import org.streampipes.sdk.utils.Datatypes;
import org.streampipes.wrapper.standalone.ConfiguredEventProcessor;
import org.streampipes.wrapper.standalone.declarer.StandaloneEventProcessingDeclarer;
+import java.io.IOException;
+
public class Ets5DataEnrichmentController extends StandaloneEventProcessingDeclarer<Ets5DataEnrichmentParameters> {
public static final String ID = "org.apache.plc4x.streampipes.processors.enrich.knxnetip.ets5";
+ private static final String PROJECT_FILE_KEY = "project-fIle";
private static final String DESTINATION_ID_MAPPING = "destination-id-mapping";
private static final String PAYLOAD_ID_MAPPING = "payload-id-mapping";
@@ -55,7 +58,7 @@ public class Ets5DataEnrichmentController extends StandaloneEventProcessingDecla
return ProcessingElementBuilder
.create(ID, "ETS5", "Processor that interprets a data stream from a KXNnet/IP Datasource according to the settings in the ETS5 'knxproj' file")
.category(DataProcessorType.ENRICH)
- .withAssets(Assets.DOCUMENTATION, Assets.ICON)
+ //.withAssets(Assets.DOCUMENTATION, Assets.ICON)
.withLocales(Locales.EN)
.requiredStream(StreamRequirementsBuilder
.create()
@@ -70,7 +73,7 @@ public class Ets5DataEnrichmentController extends StandaloneEventProcessingDecla
PrimitivePropertyBuilder.create(Datatypes.String, MAPPING_FIELD_MEANING).build(),
PrimitivePropertyBuilder.create(Datatypes.String, MAPPING_FIELD_DECODED_PROPERTY_VALUE).build()
))
- .requiredFile(Labels.from("File", "ETS5 Project File", "ETS5 Project File (.knxproj)"))
+ .requiredFile(Labels.withId(PROJECT_FILE_KEY))
.build();
}
@@ -78,7 +81,12 @@ public class Ets5DataEnrichmentController extends StandaloneEventProcessingDecla
public ConfiguredEventProcessor<Ets5DataEnrichmentParameters> onInvocation(DataProcessorInvocation graph, ProcessingElementParameterExtractor extractor) {
String destinationIdFieldName = extractor.mappingPropertyValue(DESTINATION_ID_MAPPING);
String payloadIdFieldName = extractor.mappingPropertyValue(PAYLOAD_ID_MAPPING);
-
+ String fileContents = null;
+ try {
+ fileContents = extractor.fileContentsAsString(PROJECT_FILE_KEY);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
Ets5DataEnrichmentParameters params = new Ets5DataEnrichmentParameters(graph, destinationIdFieldName, payloadIdFieldName);
return new ConfiguredEventProcessor<>(params, Ets5DataEnrichment::new);
}
diff --git a/sandbox/test-streampipes-plc4x-processors/src/main/resources/org.apache.plc4x.streampipes.processors.enrich.knxnetip.ets5/strings.en b/sandbox/test-streampipes-plc4x-processors/src/main/resources/org.apache.plc4x.streampipes.processors.enrich.knxnetip.ets5/strings.en
index ed9a3d3..5f5c591 100644
--- a/sandbox/test-streampipes-plc4x-processors/src/main/resources/org.apache.plc4x.streampipes.processors.enrich.knxnetip.ets5/strings.en
+++ b/sandbox/test-streampipes-plc4x-processors/src/main/resources/org.apache.plc4x.streampipes.processors.enrich.knxnetip.ets5/strings.en
@@ -25,3 +25,6 @@ payload-id-mapping.description=
destination-id-mapping.title=Destination Id Field
destination-id-mapping.description=
+
+project-fIle.title=ETS5 Project File
+project-fIle.description=ETS5 Project File (.knxproj)
\ No newline at end of file