You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2018/06/21 09:46:42 UTC
[incubator-plc4x] branch master updated (971acb2 -> 6a564cf)
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git.
from 971acb2 added serial testing to ManualPlc4AdsTest
new 97245e2 BUGFIX: receive behaves differently on receive without a timeout
new ffc1680 fixed small warning
new 6a564cf added a basic type converter to the camel component
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../java/org/apache/plc4x/camel/Plc4XConsumer.java | 2 +-
.../apache/plc4x/camel/Plc4XPollingConsumer.java | 2 +-
.../plc4x/camel/ResponseItemTypeConverter.java} | 37 ++++++----------------
.../services/org/apache/camel/TypeConverter | 1 +
4 files changed, 12 insertions(+), 30 deletions(-)
copy integrations/apache-camel/src/{test/java/org/apache/plc4x/camel/Plc4XConsumerTest.java => main/java/org/apache/plc4x/camel/ResponseItemTypeConverter.java} (66%)
create mode 100644 integrations/apache-camel/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
[incubator-plc4x] 03/03: added a basic type converter to the camel
component
Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit 6a564cf105ca7112206c1cb27f56d803127dd8ba
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Jun 21 11:16:41 2018 +0200
added a basic type converter to the camel component
---
.../plc4x/camel/ResponseItemTypeConverter.java | 34 ++++++++++++++++++++++
.../services/org/apache/camel/TypeConverter | 1 +
2 files changed, 35 insertions(+)
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/ResponseItemTypeConverter.java b/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/ResponseItemTypeConverter.java
new file mode 100644
index 0000000..e99d0c1
--- /dev/null
+++ b/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/ResponseItemTypeConverter.java
@@ -0,0 +1,34 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+package org.apache.plc4x.camel;
+
+import org.apache.camel.Converter;
+import org.apache.plc4x.java.api.messages.items.ReadResponseItem;
+
+import java.util.stream.Collectors;
+
+@Converter
+public class ResponseItemTypeConverter {
+
+ @Converter
+ public static String toString(ReadResponseItem<?> responseItem) {
+ return responseItem.getValues().stream().map(String::valueOf).collect(Collectors.joining(","));
+ }
+
+}
diff --git a/integrations/apache-camel/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/integrations/apache-camel/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
new file mode 100644
index 0000000..ad8d2e5
--- /dev/null
+++ b/integrations/apache-camel/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
@@ -0,0 +1 @@
+org.apache.plc4x.camel.ResponseItemTypeConverter
\ No newline at end of file
[incubator-plc4x] 02/03: fixed small warning
Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit ffc16807010e234b6b8e107f30b54467dab87b64
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Jun 21 11:16:19 2018 +0200
fixed small warning
---
.../src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java b/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java
index 0cb7a57..08891e7 100644
--- a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java
+++ b/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java
@@ -41,7 +41,7 @@ public class Plc4XConsumer extends ServiceSupport implements Consumer, java.util
private ExceptionHandler exceptionHandler;
private PlcConnection plcConnection;
private Address address;
- private Class dataType;
+ private Class<?> dataType;
public Plc4XConsumer(Plc4XEndpoint endpoint, Processor processor) throws PlcException {
[incubator-plc4x] 01/03: BUGFIX: receive behaves differently on
receive without a timeout
Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit 97245e2c5d17f2157f3ca256fa6cd59c5617708b
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Jun 21 10:55:45 2018 +0200
BUGFIX: receive behaves differently on receive without a timeout
---
.../src/main/java/org/apache/plc4x/camel/Plc4XPollingConsumer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XPollingConsumer.java b/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XPollingConsumer.java
index e9c5406..603f76e 100644
--- a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XPollingConsumer.java
+++ b/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XPollingConsumer.java
@@ -82,7 +82,7 @@ public class Plc4XPollingConsumer extends ServiceSupport implements PollingConsu
CompletableFuture<? extends PlcReadResponse> read = getReader().read(new PlcReadRequest(dataType, address));
try {
PlcReadResponse plcReadResponse = read.get();
- exchange.getIn().setBody(plcReadResponse.getResponseItems());
+ exchange.getIn().setBody(unwrapIfSingle(plcReadResponse.getResponseItems()));
} catch (InterruptedException | ExecutionException e) {
exchange.setException(e);
}