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 2018/10/17 16:48:15 UTC
[incubator-plc4x] 08/19: fixed examples to use the new api
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit 7375d040917b2de0391611d3aef8c4316b625950
Author: Andrey Skorikov <an...@codecentric.de>
AuthorDate: Thu Oct 4 12:03:28 2018 +0200
fixed examples to use the new api
---
.../plc4x/java/examples/azure/iothub/S7PlcToAzureIoTHubSample.java | 2 +-
.../plc4x/java/examples/dummydriver/connection/DummyConnection.java | 4 ++--
.../java/examples/google/iotcore/S7PlcToGoogleIoTCoreSample.java | 2 +-
.../java/org/apache/plc4x/java/examples/helloplc4x/HelloPlc4x.java | 6 +++---
.../org/apache/plc4x/java/examples/kafkabridge/KafkaBridge.java | 4 ++--
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/examples/azure/src/main/java/org/apache/plc4x/java/examples/azure/iothub/S7PlcToAzureIoTHubSample.java b/examples/azure/src/main/java/org/apache/plc4x/java/examples/azure/iothub/S7PlcToAzureIoTHubSample.java
index 728e502..7bb03ec 100644
--- a/examples/azure/src/main/java/org/apache/plc4x/java/examples/azure/iothub/S7PlcToAzureIoTHubSample.java
+++ b/examples/azure/src/main/java/org/apache/plc4x/java/examples/azure/iothub/S7PlcToAzureIoTHubSample.java
@@ -70,7 +70,7 @@ public class S7PlcToAzureIoTHubSample {
while (!Thread.currentThread().isInterrupted()) {
// Simulate telemetry.
- PlcReadResponse<?> response = plcReader.read(request).get();
+ PlcReadResponse response = plcReader.read(request).get();
response.getAllLongs(FIELD_NAME)
.forEach(longValue -> {
String result = Long.toBinaryString(longValue);
diff --git a/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java b/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java
index c448873..4b7c00a 100644
--- a/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java
+++ b/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java
@@ -64,7 +64,7 @@ public class DummyConnection extends AbstractPlcConnection implements PlcReader,
}
@Override
- public CompletableFuture<PlcReadResponse<?>> read(PlcReadRequest readRequest) {
+ public CompletableFuture<PlcReadResponse> read(PlcReadRequest readRequest) {
CompletableFuture<InternalPlcReadResponse> readFuture = new CompletableFuture<>();
PlcRequestContainer<InternalPlcReadRequest, InternalPlcReadResponse> container =
new PlcRequestContainer<>((InternalPlcReadRequest) readRequest, readFuture);
@@ -80,7 +80,7 @@ public class DummyConnection extends AbstractPlcConnection implements PlcReader,
}
@Override
- public CompletableFuture<PlcWriteResponse<?>> write(PlcWriteRequest writeRequest) {
+ public CompletableFuture<PlcWriteResponse> write(PlcWriteRequest writeRequest) {
CompletableFuture<InternalPlcWriteResponse> writeFuture = new CompletableFuture<>();
PlcRequestContainer<InternalPlcWriteRequest, InternalPlcWriteResponse> container =
new PlcRequestContainer<>((InternalPlcWriteRequest) writeRequest, writeFuture);
diff --git a/examples/google/src/main/java/org/apache/plc4x/java/examples/google/iotcore/S7PlcToGoogleIoTCoreSample.java b/examples/google/src/main/java/org/apache/plc4x/java/examples/google/iotcore/S7PlcToGoogleIoTCoreSample.java
index 48b2d6a..29d25a3 100644
--- a/examples/google/src/main/java/org/apache/plc4x/java/examples/google/iotcore/S7PlcToGoogleIoTCoreSample.java
+++ b/examples/google/src/main/java/org/apache/plc4x/java/examples/google/iotcore/S7PlcToGoogleIoTCoreSample.java
@@ -239,7 +239,7 @@ public class S7PlcToGoogleIoTCoreSample {
while (!Thread.currentThread().isInterrupted()) {
- PlcReadResponse<?> plcReadResponse = plcReader.read(readRequest).get();
+ PlcReadResponse plcReadResponse = plcReader.read(readRequest).get();
// Refresh the connection credentials before the JWT expires.
// [START iot_mqtt_jwt_refresh]
diff --git a/examples/hello-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/HelloPlc4x.java b/examples/hello-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/HelloPlc4x.java
index e078434..d149ba5 100644
--- a/examples/hello-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/HelloPlc4x.java
+++ b/examples/hello-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/HelloPlc4x.java
@@ -68,7 +68,7 @@ public class HelloPlc4x {
// NOTICE: the ".get()" immediately lets this thread pause till
// the response is processed and available.
System.out.println("\nSynchronous request ...");
- PlcReadResponse<?> syncResponse = plcReader.read(plcReadRequest).get();
+ PlcReadResponse syncResponse = plcReader.read(plcReadRequest).get();
// Simply iterating over the field names returned in the response.
printResponse(syncResponse);
@@ -76,7 +76,7 @@ public class HelloPlc4x {
// Read asynchronously ...
// Register a callback executed as soon as a response arives.
System.out.println("\n\nAsynchronous request ...");
- CompletableFuture<PlcReadResponse<?>> asyncResponse = plcReader.read(plcReadRequest);
+ CompletableFuture<PlcReadResponse> asyncResponse = plcReader.read(plcReadRequest);
asyncResponse.whenComplete((readResponse, throwable) -> {
if (readResponse != null) {
printResponse(syncResponse);
@@ -94,7 +94,7 @@ public class HelloPlc4x {
}
}
- private static void printResponse(PlcReadResponse<?> syncResponse) {
+ private static void printResponse(PlcReadResponse syncResponse) {
for (String fieldName : syncResponse.getFieldNames()) {
if(syncResponse.getResponseCode(fieldName) == PlcResponseCode.OK) {
int numValues = syncResponse.getNumberOfValues(fieldName);
diff --git a/examples/kafka-bridge/src/main/java/org/apache/plc4x/java/examples/kafkabridge/KafkaBridge.java b/examples/kafka-bridge/src/main/java/org/apache/plc4x/java/examples/kafkabridge/KafkaBridge.java
index 730fad4..b822aac 100644
--- a/examples/kafka-bridge/src/main/java/org/apache/plc4x/java/examples/kafkabridge/KafkaBridge.java
+++ b/examples/kafka-bridge/src/main/java/org/apache/plc4x/java/examples/kafkabridge/KafkaBridge.java
@@ -86,10 +86,10 @@ public class KafkaBridge {
PlcReadRequest readRequest = builder.build();
// Create a supplier that is able to read the batch we just created.
- Supplier<PlcReadResponse<?>> plcSupplier = PlcFunctions.batchSupplier(plcAdapter, readRequest);
+ Supplier<PlcReadResponse> plcSupplier = PlcFunctions.batchSupplier(plcAdapter, readRequest);
// Start polling our plc source in the given interval.
- TStream<PlcReadResponse<?>> source = top.poll(plcSupplier, config.getPollingInterval(), TimeUnit.MILLISECONDS);
+ TStream<PlcReadResponse> source = top.poll(plcSupplier, config.getPollingInterval(), TimeUnit.MILLISECONDS);
// Convert the byte into a string.
TStream<String> jsonSource = source.map(value -> {