[incubator-plc4x] branch master updated: [Modbus] re-enable basic modbus support [General] added byte[] and BigDecimal support in FieldHandlers [General] added abstract field handler which throws exce
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 The following commit(s) were added to refs/heads/master by this push: new 7a92960 [Modbus] re-enable basic modbus support [General] added byte[] and BigDecimal support in FieldHandlers [General] added abstract field handler which throws exceptions by default [Test] added hex util for tests to convert byte[] to hex 7a92960 is described below commit 7a92960d7fe53e29b393fabce9f584ea3cc9bb86 Author: Sebastian Rühl AuthorDate: Wed Sep 26 11:49:02 2018 +0200 [Modbus] re-enable basic modbus support [General] added byte[] and BigDecimal support in FieldHandlers [General] added abstract field handler which throws exceptions by default [Test] added hex util for tests to convert byte[] to hex --- .../apache/plc4x/edgent/mock/MockFieldHandler.java | 10 ++ .../plc4x/java/api/messages/PlcReadResponse.java | 12 +- .../plc4x/java/api/messages/PlcWriteRequest.java | 7 + .../plc4x/java/ads/model/AdsPlcFieldHandler.java | 4 +- .../base/connection/DefaultPlcFieldHandler.java} | 63 +++ .../java/base/connection/PlcFieldHandler.java | 4 + .../java/base/messages/DefaultPlcReadRequest.java | 2 +- .../java/base/messages/DefaultPlcReadResponse.java | 55 -- .../base/messages/DefaultPlcSubscriptionEvent.java | 30 +++- .../messages/DefaultPlcSubscriptionRequest.java| 2 +- .../messages/DefaultPlcUnsubscriptionRequest.java | 2 +- .../java/base/messages/DefaultPlcWriteRequest.java | 21 ++- .../messages/items/DefaultByteArrayFieldItem.java | 42 + .../plc4x/java/base/messages/items/FieldItem.java | 8 + .../org/apache/plc4x/java/base/util/HexUtil.java | 43 + .../ethernetip/netty/util/EnipPlcFieldHandler.java | 6 +- plc4j/protocols/modbus/pom.xml | 14 +- .../java/modbus/netty/Plc4XModbusProtocol.java | 186 - .../java/modbus/util/ModbusPlcFieldHandler.java| 126 +++--- .../plc4x/java/modbus/ManualPlc4XModbusTest.java | 40 ++--- .../connection/BaseModbusPlcConnectionTest.java| 20 +-- .../connection/ModbusSerialPlcConnectionTest.java | 75 + .../connection/ModbusTcpPlcConnectionTests.java| 76 - .../java/modbus/netty/Plc4XModbusProtocolTest.java | 132 +++ plc4j/protocols/pom.xml| 2 +- .../java/s7/netty/util/S7PlcFieldHandler.java | 6 +- .../apache/plc4x/java/test/TestFieldHandler.java | 23 +++ 27 files changed, 459 insertions(+), 552 deletions(-) diff --git a/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockFieldHandler.java b/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockFieldHandler.java index 3d2c1ad..437cafe 100644 --- a/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockFieldHandler.java +++ b/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockFieldHandler.java @@ -67,6 +67,11 @@ public class MockFieldHandler implements PlcFieldHandler { } @Override +public FieldItem encodeBigDecimal(PlcField field, Object[] values) { +return new MockFieldItem(values); +} + +@Override public FieldItem encodeDouble(PlcField field, Object[] values) { return new MockFieldItem(values); } @@ -91,4 +96,9 @@ public class MockFieldHandler implements PlcFieldHandler { return new MockFieldItem(values); } +@Override +public FieldItem encodeByteArray(PlcField field, Object[] values) { +return new MockFieldItem(values); +} + } diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcReadResponse.java b/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcReadResponse.java index c52de88..101a6ad 100644 --- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcReadResponse.java +++ b/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcReadResponse.java @@ -58,8 +58,6 @@ public interface PlcReadResponse extends PlcFieldRespo Collection getAllBytes(String name); -byte[] getByteArray(String name); - boolean isValidShort(String name); boolean isValidShort(String name, int index); @@ -170,4 +168,14 @@ public interface PlcReadResponse extends PlcFieldRespo Collection getAllDateTimes(String name); +boolean isValidByteArray(String name); + +boolean isValidByteArray(String name, int index); + +byte[] getByteArray(String name); + +byte[] getByteArray(String name, int index); + +Collection getAllByteArrays(String name); + } diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcWriteRequest.java b/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcWriteRequest.java index 1dfa4aa..69ac6bf 100644 --- a/plc4j/api/src/main/jav
[incubator-plc4x] 01/02: [General] fixed broken getAllByteArrays implementation
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 865fc9e73f6f3f227a0b99776c1ad46b03af29a3 Author: Sebastian Rühl AuthorDate: Wed Sep 26 11:56:51 2018 +0200 [General] fixed broken getAllByteArrays implementation --- .../apache/plc4x/java/base/messages/DefaultPlcReadResponse.java | 9 + 1 file changed, 9 insertions(+) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java index bc379e8..5cbaf0c 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java @@ -679,6 +679,15 @@ public class DefaultPlcReadResponse implements InternalPlcReadResponse { @Override public Collection getAllByteArrays(String name) { +FieldItem fieldInternal = getFieldInternal(name); +if (fieldInternal != null) { +int num = fieldInternal.getNumberOfValues(); +List values = new ArrayList<>(num); +for (int i = 0; i < num; i++) { +values.add(fieldInternal.getByteArray(i)); +} +return values; +} return null; }
[incubator-plc4x] 02/02: [Modbus] added possibility to add a quantity to addresses to read multiple values.
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 f74c7bf69efd515dd948d6a8c48388cb80a0c618 Author: Sebastian Rühl AuthorDate: Wed Sep 26 12:19:29 2018 +0200 [Modbus] added possibility to add a quantity to addresses to read multiple values. --- .../plc4x/java/modbus/model/CoilModbusField.java | 9 --- .../modbus/model/MaskWriteRegisterModbusField.java | 9 --- .../plc4x/java/modbus/model/ModbusField.java | 16 +--- .../model/ReadDiscreteInputsModbusField.java | 9 --- .../model/ReadHoldingRegistersModbusField.java | 9 --- .../model/ReadInputRegistersModbusField.java | 9 --- .../java/modbus/model/RegisterModbusField.java | 9 --- .../java/modbus/netty/Plc4XModbusProtocol.java | 29 ++ .../plc4x/java/modbus/ManualPlc4XModbusTest.java | 13 +- 9 files changed, 73 insertions(+), 39 deletions(-) diff --git a/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/model/CoilModbusField.java b/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/model/CoilModbusField.java index 731e699..adb7600 100644 --- a/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/model/CoilModbusField.java +++ b/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/model/CoilModbusField.java @@ -27,8 +27,8 @@ public class CoilModbusField extends ModbusField { public static final Pattern ADDRESS_PATTERN = Pattern.compile("coil:" + ModbusField.ADDRESS_PATTERN); -protected CoilModbusField(int address) { -super(address); +public CoilModbusField(int address, Integer quantity) { +super(address, quantity); } public static CoilModbusField of(String addressString) throws PlcInvalidFieldException { @@ -37,6 +37,9 @@ public class CoilModbusField extends ModbusField { throw new PlcInvalidFieldException(addressString, ADDRESS_PATTERN); } int address = Integer.parseInt(matcher.group("address")); -return new CoilModbusField(address); + +String quantityString = matcher.group("quantity"); +Integer quantity = quantityString != null ? Integer.valueOf(quantityString) : null; +return new CoilModbusField(address, quantity); } } diff --git a/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/model/MaskWriteRegisterModbusField.java b/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/model/MaskWriteRegisterModbusField.java index 4f33f8b..2d4870d 100644 --- a/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/model/MaskWriteRegisterModbusField.java +++ b/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/model/MaskWriteRegisterModbusField.java @@ -31,8 +31,8 @@ public class MaskWriteRegisterModbusField extends ModbusField { private final int andMask; private final int orMask; -protected MaskWriteRegisterModbusField(int address, int andMask, int orMask) { -super(address); +protected MaskWriteRegisterModbusField(int address, int andMask, int orMask, Integer quantity) { +super(address, quantity); this.andMask = andMask; this.orMask = orMask; } @@ -45,7 +45,10 @@ public class MaskWriteRegisterModbusField extends ModbusField { int address = Integer.parseInt(matcher.group("address")); int andMask = Integer.parseInt(matcher.group("andMask")); int orMask = Integer.parseInt(matcher.group("orMask")); -return new MaskWriteRegisterModbusField(address, andMask, orMask); + +String quantityString = matcher.group("quantity"); +Integer quantity = quantityString != null ? Integer.valueOf(quantityString) : null; +return new MaskWriteRegisterModbusField(address, andMask, orMask, quantity); } public int getAndMask() { diff --git a/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/model/ModbusField.java b/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/model/ModbusField.java index b3ad29a..3254e02 100644 --- a/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/model/ModbusField.java +++ b/plc4j/protocols/modbus/src/main/java/org/apache/plc4x/java/modbus/model/ModbusField.java @@ -25,18 +25,28 @@ import java.util.regex.Pattern; public abstract class ModbusField implements PlcField { -public static final Pattern ADDRESS_PATTERN = Pattern.compile("(?\\d+)"); +public static final Pattern ADDRESS_PATTERN = Pattern.compile("(?\\d+)(\\[(?\\d)])?"); private final int address; -protected ModbusField(int address) { +private final int quantity; + +protected ModbusField(int address, Integer quantity) { this.address = address; +this.quantity = quantity != null ? quantity : 1; +
[incubator-plc4x] branch master updated (7a92960 -> f74c7bf)
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 7a92960 [Modbus] re-enable basic modbus support [General] added byte[] and BigDecimal support in FieldHandlers [General] added abstract field handler which throws exceptions by default [Test] added hex util for tests to convert byte[] to hex new 865fc9e [General] fixed broken getAllByteArrays implementation new f74c7bf [Modbus] added possibility to add a quantity to addresses to read multiple values. The 2 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/base/messages/DefaultPlcReadResponse.java | 9 +++ .../plc4x/java/modbus/model/CoilModbusField.java | 9 --- .../modbus/model/MaskWriteRegisterModbusField.java | 9 --- .../plc4x/java/modbus/model/ModbusField.java | 16 +--- .../model/ReadDiscreteInputsModbusField.java | 9 --- .../model/ReadHoldingRegistersModbusField.java | 9 --- .../model/ReadInputRegistersModbusField.java | 9 --- .../java/modbus/model/RegisterModbusField.java | 9 --- .../java/modbus/netty/Plc4XModbusProtocol.java | 29 ++ .../plc4x/java/modbus/ManualPlc4XModbusTest.java | 13 +- 10 files changed, 82 insertions(+), 39 deletions(-)
[incubator-plc4x] branch master updated: [Modbus] added example to read an int from 2 registers [General] changed byte[] to Byte[] to avoid recurring boxing problems
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 The following commit(s) were added to refs/heads/master by this push: new 34bac1f [Modbus] added example to read an int from 2 registers [General] changed byte[] to Byte[] to avoid recurring boxing problems 34bac1f is described below commit 34bac1fc9684eb7d88b935962fea46d097e28e5c Author: Sebastian Rühl AuthorDate: Wed Sep 26 12:58:57 2018 +0200 [Modbus] added example to read an int from 2 registers [General] changed byte[] to Byte[] to avoid recurring boxing problems --- .../plc4x/java/api/messages/PlcReadResponse.java | 6 ++--- .../java/base/messages/DefaultPlcReadResponse.java | 8 +++--- .../base/messages/DefaultPlcSubscriptionEvent.java | 10 .../messages/items/DefaultByteArrayFieldItem.java | 8 +++--- .../plc4x/java/base/messages/items/FieldItem.java | 2 +- .../org/apache/plc4x/java/base/util/HexUtil.java | 5 .../java/modbus/netty/Plc4XModbusProtocol.java | 6 ++--- .../java/modbus/util/ModbusPlcFieldHandler.java| 8 +++--- .../plc4x/java/modbus/ManualPlc4XModbusTest.java | 29 ++ .../apache/plc4x/java/test/TestFieldHandler.java | 5 ++-- 10 files changed, 60 insertions(+), 27 deletions(-) diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcReadResponse.java b/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcReadResponse.java index 101a6ad..bf5900b 100644 --- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcReadResponse.java +++ b/plc4j/api/src/main/java/org/apache/plc4x/java/api/messages/PlcReadResponse.java @@ -172,10 +172,10 @@ public interface PlcReadResponse extends PlcFieldRespo boolean isValidByteArray(String name, int index); -byte[] getByteArray(String name); +Byte[] getByteArray(String name); -byte[] getByteArray(String name, int index); +Byte[] getByteArray(String name, int index); -Collection getAllByteArrays(String name); +Collection getAllByteArrays(String name); } diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java index 5cbaf0c..cd2dc47 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java @@ -660,7 +660,7 @@ public class DefaultPlcReadResponse implements InternalPlcReadResponse { } @Override -public byte[] getByteArray(String name) { +public Byte[] getByteArray(String name) { FieldItem fieldInternal = getFieldInternal(name); if (fieldInternal != null) { return fieldInternal.getByteArray(0); @@ -669,7 +669,7 @@ public class DefaultPlcReadResponse implements InternalPlcReadResponse { } @Override -public byte[] getByteArray(String name, int index) { +public Byte[] getByteArray(String name, int index) { FieldItem fieldInternal = getFieldInternal(name); if (fieldInternal != null) { return fieldInternal.getByteArray(index); @@ -678,11 +678,11 @@ public class DefaultPlcReadResponse implements InternalPlcReadResponse { } @Override -public Collection getAllByteArrays(String name) { +public Collection getAllByteArrays(String name) { FieldItem fieldInternal = getFieldInternal(name); if (fieldInternal != null) { int num = fieldInternal.getNumberOfValues(); -List values = new ArrayList<>(num); +List values = new ArrayList<>(num); for (int i = 0; i < num; i++) { values.add(fieldInternal.getByteArray(i)); } diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionEvent.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionEvent.java index beb0ef9..7451e00 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionEvent.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionEvent.java @@ -394,17 +394,17 @@ public class DefaultPlcSubscriptionEvent implements InternalPlcSubscriptionEvent } @Override -public byte[] getByteArray(String name) { -return new byte[0]; +public Byte[] getByteArray(String name) { +return new Byte[0]; } @Override -public byte[] getByteArray(String name, int index) { -return new byte[0]; +public Byte[] getByteArray(String na
[incubator-plc4x] branch feature/TopLevelItemSpliting updated (33ab0ab -> e955366)
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a change to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git. omit 33ab0ab Introduced protocol layer to split requestItems to several requests. add f95d70f Introduced TcpHexDumper to driver-bases/test add 492ed4a added test for modbus PlcDriver add 1c65826 moved Assert and Junit5Backport to driver-bases/test add c326e36 added modbus connection tests add 036e394 fixed build problems add 22d5106 added Test for Plc4XModbusProtocol and fixed several Bugs. add a66f66d Refactored the way the maps the enums are built up. add 7a2b14b Added some EtherNet/IP related documentation. add 735431e PLC4X-38 - Implement the Ethernet/IP Protocol add 44627a3 PLC4X-38 - Implement the Ethernet/IP Protocol add 748a39d PLC4X-40 - Refactor the PlcSubscriber to be more aligned with the PlcReader and PlcWriter add 7079cad Changed the pom to use a variable instead of having it hard coded for every modbus driver dependency. add e413887 refined test for modbus protocol add 917c7fb added sanity checks for produced values and cleaned up type checks add c4a35b3 added tests for double data type in ads add be1703c create a blacklist of not yet supported types on modbus add 234c121 refactored common used test code into driver-bases-test add 6adebdf fixed calender tests and simplified assertions while at it add 5f3d7ab removed unsused method (cleanup for 6adebdf) add 14d5585 added BigInteger support on modbus and ads add 9efd47c fixed documentation of test class javadoc add 18bb3f3 modbus: fixed coil parsing add 9e05e64 modbus protocol test: increased readability by extracting duplicate code add 11db5b9 added byte[] and Byte[] to supported data types test add 9221ed5 small fix in supported data types regarding byte[] and Byte[] mixup add 5d06aa7 supported data type tests: increase readability by introducing typed class add 947579f added support for float and double in modbus add dbc6812 fixed upper bounds for registers. add bd291ae added type generator function to Plc4XS7ProtocolTest add c0b3745 added double support to S7 add d7159aa added PlcNotImplementedException to mark not yet implemented code parts. add 810d649 fixed double implementation in S7 add d6a498e Made Jenkins use a ".repository" as local repo directory for deployment instead of the default one in an attempt to solve deployment problems on jenkins. add 4bec0c1 Exclude the Ubuntu node H32 from the nodes used for deploying as this seems to have issues with using GIT add f567718 Added an enforcer rule, that fails the build if any dependencies (direct and transitive) are used for which known vulnerabilities exist. add 44c0d68 Added an enforcer rule, that fails the build if any dependencies (direct and transitive) are used for which known vulnerabilities exist. add a372307 Merge branches 'feature/ethernet-ip' and 'master' of https://gitbox.apache.org/repos/asf/incubator-plc4x into feature/ethernet-ip add 75bf337 Added some javadoc to S7 communication path and several todos that may be helpful. add a919e94 Added javadoc on S7PlcConnection. add b1c4c86 Merge branch 's7-communication-documentation' of https://github.com/JulianFeinauer/incubator-plc4x into JulianFeinauer-s7-communication-documentation add 4caff3c Removed the TODOs add 8639d34 Merge branch 'JulianFeinauer-s7-communication-documentation' add 5363805 Avoid some exceptions when disconnecting from S7 PLCs add 972c532 Added byte[] and Byte[] implementation to modbus. add f80c9ef Made the disconnect for S7 respect the ISO TP protocol. add 5f3bf64 Merge branches 'feature/ethernet-ip' and 'master' of https://gitbox.apache.org/repos/asf/incubator-plc4x into feature/ethernet-ip add e035944 Added the repo for the enip snapshots add 428b144 Added the EnipClient class from the enip projects client module add 9a299c8 Added missing dependency add 8c87fca Added byte[] and Byte[] implementation to ads. add 4f38a3f fixed some sonar bugs add 7a38a36 fixed some sonar bugs add 4d5bf28 manage commons-collections dependency add 07b6007 removed obsolete supported datatype checking code add 093de00 added missing toString()/hashCode()/equals() add 68b0388 Fixed a typo add e986509 - Did some cleaning up in the sites protocols section - Added some initial documentation on the DeltaV protocol add 001c092 Some super-minor textual changes add 43dca59 Fine tuned the generated diagrams add fa3d375 Added some information on how we did the reverse-engineering add d54464b Increased the timeout of this test as it was randomly faili
[incubator-plc4x] 01/01: Introduced protocol layer to split requestItems to several requests.
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git commit e9553660c6d79c4251205dc5a2f8c87094f7ec94 Author: Sebastian Rühl AuthorDate: Thu Jul 5 13:20:43 2018 +0200 Introduced protocol layer to split requestItems to several requests. --- .../base/messages/item/CorrelatedRequestItem.java | 81 + .../base/messages/item/CorrelatedResponseItem.java | 70 .../SingleItemToSingleRequestProtocol.java | 193 + 3 files changed, 344 insertions(+) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedRequestItem.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedRequestItem.java new file mode 100644 index 000..5212618 --- /dev/null +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedRequestItem.java @@ -0,0 +1,81 @@ +/* + 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.java.base.messages.item; + +import org.apache.plc4x.java.api.messages.PlcRequestContainer; +import org.apache.plc4x.java.api.messages.PlcResponse; +import org.apache.plc4x.java.api.messages.items.RequestItem; + +import java.util.Objects; + +public class CorrelatedRequestItem> { + +private final int correlationId; + +private final REQUEST_ITEM requestItem; + +private final PlcRequestContainer> plcRequestContainer; + +public CorrelatedRequestItem(int correlationId, REQUEST_ITEM requestItem, PlcRequestContainer> plcRequestContainer) { +this.correlationId = correlationId; +this.requestItem = requestItem; +this.plcRequestContainer = plcRequestContainer; +} + +public int getCorrelationId() { +return correlationId; +} + +public REQUEST_ITEM getRequestItem() { +return requestItem; +} + +public PlcRequestContainer> getPlcRequestContainer() { +return plcRequestContainer; +} + +@Override +public boolean equals(Object o) { +if (this == o) { +return true; +} +if (!(o instanceof CorrelatedRequestItem)) { +return false; +} +CorrelatedRequestItem that = (CorrelatedRequestItem) o; +return correlationId == that.correlationId && +Objects.equals(requestItem, that.requestItem) && +Objects.equals(plcRequestContainer, that.plcRequestContainer); +} + +@Override +public int hashCode() { + +return Objects.hash(correlationId, requestItem, plcRequestContainer); +} + +@Override +public String toString() { +return "CorrelatedRequestItem{" + +"correlationId=" + correlationId + +", requestItem=" + requestItem + +", plcRequestContainer=" + plcRequestContainer + +'}'; +} +} diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedResponseItem.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedResponseItem.java new file mode 100644 index 000..38a9032 --- /dev/null +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedResponseItem.java @@ -0,0 +1,70 @@ +/* + 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 + und
[incubator-plc4x] branch feature/TopLevelItemSpliting updated: [General] some progress on the SingleItemToSingleRequestProtocol
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git The following commit(s) were added to refs/heads/feature/TopLevelItemSpliting by this push: new 0cd7f6b [General] some progress on the SingleItemToSingleRequestProtocol 0cd7f6b is described below commit 0cd7f6b14c18146131665c91046b8829e1dd4c34 Author: Sebastian Rühl AuthorDate: Wed Sep 26 18:01:46 2018 +0200 [General] some progress on the SingleItemToSingleRequestProtocol --- .../java/base/messages/DefaultPlcReadRequest.java | 12 +- .../java/base/messages/DefaultPlcReadResponse.java | 5 + .../messages/DefaultPlcSubscriptionRequest.java| 15 +- .../messages/DefaultPlcUnsubscriptionRequest.java | 6 + .../java/base/messages/DefaultPlcWriteRequest.java | 28 ++- .../base/messages/DefaultPlcWriteResponse.java | 5 + .../base/messages/InternalPlcFieldRequest.java | 6 + .../java/base/messages/InternalPlcReadRequest.java | 2 +- .../base/messages/InternalPlcReadResponse.java | 6 + .../base/messages/InternalPlcWriteRequest.java | 4 + .../base/messages/InternalPlcWriteResponse.java| 5 +- .../base/messages/item/CorrelatedRequestItem.java | 81 .../base/messages/item/CorrelatedResponseItem.java | 70 --- .../SingleItemToSingleRequestProtocol.java | 217 +++-- 14 files changed, 238 insertions(+), 224 deletions(-) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadRequest.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadRequest.java index ef9d7ba..9b60fe4 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadRequest.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadRequest.java @@ -18,18 +18,20 @@ under the License. */ package org.apache.plc4x.java.base.messages; +import org.apache.commons.lang3.tuple.Pair; import org.apache.plc4x.java.api.exceptions.PlcRuntimeException; import org.apache.plc4x.java.api.messages.PlcReadRequest; import org.apache.plc4x.java.api.model.PlcField; import org.apache.plc4x.java.base.connection.PlcFieldHandler; import java.util.*; +import java.util.stream.Collectors; public class DefaultPlcReadRequest implements InternalPlcReadRequest, InternalPlcFieldRequest { private LinkedHashMap fields; -private DefaultPlcReadRequest(LinkedHashMap fields) { +protected DefaultPlcReadRequest(LinkedHashMap fields) { this.fields = fields; } @@ -54,6 +56,14 @@ public class DefaultPlcReadRequest implements InternalPlcReadRequest, InternalPl return new LinkedList<>(fields.values()); } +@Override +public LinkedList> getNamedFields() { +return fields.entrySet() +.stream() +.map(stringPlcFieldEntry -> Pair.of(stringPlcFieldEntry.getKey(), stringPlcFieldEntry.getValue())) +.collect(Collectors.toCollection(LinkedList::new)); +} + public static class Builder implements PlcReadRequest.Builder { private final PlcFieldHandler fieldHandler; diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java index cd2dc47..73cad97 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java @@ -76,6 +76,11 @@ public class DefaultPlcReadResponse implements InternalPlcReadResponse { } @Override +public Map> getValues() { +return values; +} + +@Override public Object getObject(String name) { return getObject(name, 0); } diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionRequest.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionRequest.java index f50f0ad..9f59cb3 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionRequest.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionRequest.java @@ -34,27 +34,32 @@ public class DefaultPlcSubscriptionRequest implements InternalPlcSubscriptionReq @Override public int getNumberOfFields() { -return 0; +throw new IllegalStateException("not available"); } @Override public LinkedHashSet getFieldNames() { -
[incubator-plc4x] branch master updated (34bac1f -> d64c3e2)
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 34bac1f [Modbus] added example to read an int from 2 registers [General] changed byte[] to Byte[] to avoid recurring boxing problems add ff580e7 Added note for Service Loader. add d64c3e2 Merge pull request #23 from JulianFeinauer/master No new revisions were added by this update. Summary of changes: .../google/iotcore/S7PlcToGoogleIoTCoreSample.java | 24 +-- .../org/apache/plc4x/edgent/PlcFunctionsTest.java | 223 ++--- .../java/org/apache/plc4x/java/api/PlcDriver.java | 4 + 3 files changed, 124 insertions(+), 127 deletions(-)
[incubator-plc4x] branch feature/TopLevelItemSpliting updated: [General] SingleItemToSingleRequestProtocol implemented ErrorHandler
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git The following commit(s) were added to refs/heads/feature/TopLevelItemSpliting by this push: new 9bcf6c1 [General] SingleItemToSingleRequestProtocol implemented ErrorHandler 9bcf6c1 is described below commit 9bcf6c18b8cb332915dc3ec8b6e5ee45d018bcd1 Author: Sebastian Rühl AuthorDate: Wed Sep 26 18:07:56 2018 +0200 [General] SingleItemToSingleRequestProtocol implemented ErrorHandler --- .../plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java index 267f9a8..0fdebf5 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java @@ -118,7 +118,11 @@ public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler { } private void errored(int correlationId, Throwable throwable) { - +PlcRequestContainer> plcRequestContainer = sentButUnacknowledgedRequestItems.remove(correlationId); +if (plcRequestContainer == null) { +throw new PlcRuntimeException("Unrelated error received ", throwable); +} + plcRequestContainer.getResponseFuture().completeExceptionally(throwable); }
[incubator-plc4x] branch master updated (34bac1f -> d64c3e2)
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 34bac1f [Modbus] added example to read an int from 2 registers [General] changed byte[] to Byte[] to avoid recurring boxing problems add ff580e7 Added note for Service Loader. add d64c3e2 Merge pull request #23 from JulianFeinauer/master No new revisions were added by this update. Summary of changes: .../google/iotcore/S7PlcToGoogleIoTCoreSample.java | 24 +-- .../org/apache/plc4x/edgent/PlcFunctionsTest.java | 223 ++--- .../java/org/apache/plc4x/java/api/PlcDriver.java | 4 + 3 files changed, 124 insertions(+), 127 deletions(-)
[incubator-plc4x] 03/03: [General] SingleItemToSingleRequestProtocol implemented ErrorHandler
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git commit a0c36076a545dd3d03c31ba27c8de9d6d2af Author: Sebastian Rühl AuthorDate: Wed Sep 26 18:07:56 2018 +0200 [General] SingleItemToSingleRequestProtocol implemented ErrorHandler --- .../plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java index 267f9a8..0fdebf5 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java @@ -118,7 +118,11 @@ public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler { } private void errored(int correlationId, Throwable throwable) { - +PlcRequestContainer> plcRequestContainer = sentButUnacknowledgedRequestItems.remove(correlationId); +if (plcRequestContainer == null) { +throw new PlcRuntimeException("Unrelated error received ", throwable); +} + plcRequestContainer.getResponseFuture().completeExceptionally(throwable); }
[incubator-plc4x] 01/03: Introduced protocol layer to split requestItems to several requests.
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git commit 7e8dd94a2f1615d8af9c0eda8e54981c71fd418f Author: Sebastian Rühl AuthorDate: Thu Jul 5 13:20:43 2018 +0200 Introduced protocol layer to split requestItems to several requests. --- .../base/messages/item/CorrelatedRequestItem.java | 81 + .../base/messages/item/CorrelatedResponseItem.java | 70 .../SingleItemToSingleRequestProtocol.java | 193 + 3 files changed, 344 insertions(+) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedRequestItem.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedRequestItem.java new file mode 100644 index 000..5212618 --- /dev/null +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedRequestItem.java @@ -0,0 +1,81 @@ +/* + 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.java.base.messages.item; + +import org.apache.plc4x.java.api.messages.PlcRequestContainer; +import org.apache.plc4x.java.api.messages.PlcResponse; +import org.apache.plc4x.java.api.messages.items.RequestItem; + +import java.util.Objects; + +public class CorrelatedRequestItem> { + +private final int correlationId; + +private final REQUEST_ITEM requestItem; + +private final PlcRequestContainer> plcRequestContainer; + +public CorrelatedRequestItem(int correlationId, REQUEST_ITEM requestItem, PlcRequestContainer> plcRequestContainer) { +this.correlationId = correlationId; +this.requestItem = requestItem; +this.plcRequestContainer = plcRequestContainer; +} + +public int getCorrelationId() { +return correlationId; +} + +public REQUEST_ITEM getRequestItem() { +return requestItem; +} + +public PlcRequestContainer> getPlcRequestContainer() { +return plcRequestContainer; +} + +@Override +public boolean equals(Object o) { +if (this == o) { +return true; +} +if (!(o instanceof CorrelatedRequestItem)) { +return false; +} +CorrelatedRequestItem that = (CorrelatedRequestItem) o; +return correlationId == that.correlationId && +Objects.equals(requestItem, that.requestItem) && +Objects.equals(plcRequestContainer, that.plcRequestContainer); +} + +@Override +public int hashCode() { + +return Objects.hash(correlationId, requestItem, plcRequestContainer); +} + +@Override +public String toString() { +return "CorrelatedRequestItem{" + +"correlationId=" + correlationId + +", requestItem=" + requestItem + +", plcRequestContainer=" + plcRequestContainer + +'}'; +} +} diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedResponseItem.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedResponseItem.java new file mode 100644 index 000..38a9032 --- /dev/null +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedResponseItem.java @@ -0,0 +1,70 @@ +/* + 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 + und
[incubator-plc4x] 02/03: [General] some progress on the SingleItemToSingleRequestProtocol
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git commit 31e2acba2d748ae7d5d9197be9057b707f943151 Author: Sebastian Rühl AuthorDate: Wed Sep 26 18:01:46 2018 +0200 [General] some progress on the SingleItemToSingleRequestProtocol --- .../java/base/messages/DefaultPlcReadRequest.java | 12 +- .../java/base/messages/DefaultPlcReadResponse.java | 5 + .../messages/DefaultPlcSubscriptionRequest.java| 15 +- .../messages/DefaultPlcUnsubscriptionRequest.java | 6 + .../java/base/messages/DefaultPlcWriteRequest.java | 28 ++- .../base/messages/DefaultPlcWriteResponse.java | 5 + .../base/messages/InternalPlcFieldRequest.java | 6 + .../java/base/messages/InternalPlcReadRequest.java | 2 +- .../base/messages/InternalPlcReadResponse.java | 6 + .../base/messages/InternalPlcWriteRequest.java | 4 + .../base/messages/InternalPlcWriteResponse.java| 5 +- .../base/messages/item/CorrelatedRequestItem.java | 81 .../base/messages/item/CorrelatedResponseItem.java | 70 --- .../SingleItemToSingleRequestProtocol.java | 217 +++-- 14 files changed, 238 insertions(+), 224 deletions(-) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadRequest.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadRequest.java index ef9d7ba..9b60fe4 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadRequest.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadRequest.java @@ -18,18 +18,20 @@ under the License. */ package org.apache.plc4x.java.base.messages; +import org.apache.commons.lang3.tuple.Pair; import org.apache.plc4x.java.api.exceptions.PlcRuntimeException; import org.apache.plc4x.java.api.messages.PlcReadRequest; import org.apache.plc4x.java.api.model.PlcField; import org.apache.plc4x.java.base.connection.PlcFieldHandler; import java.util.*; +import java.util.stream.Collectors; public class DefaultPlcReadRequest implements InternalPlcReadRequest, InternalPlcFieldRequest { private LinkedHashMap fields; -private DefaultPlcReadRequest(LinkedHashMap fields) { +protected DefaultPlcReadRequest(LinkedHashMap fields) { this.fields = fields; } @@ -54,6 +56,14 @@ public class DefaultPlcReadRequest implements InternalPlcReadRequest, InternalPl return new LinkedList<>(fields.values()); } +@Override +public LinkedList> getNamedFields() { +return fields.entrySet() +.stream() +.map(stringPlcFieldEntry -> Pair.of(stringPlcFieldEntry.getKey(), stringPlcFieldEntry.getValue())) +.collect(Collectors.toCollection(LinkedList::new)); +} + public static class Builder implements PlcReadRequest.Builder { private final PlcFieldHandler fieldHandler; diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java index cd2dc47..73cad97 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java @@ -76,6 +76,11 @@ public class DefaultPlcReadResponse implements InternalPlcReadResponse { } @Override +public Map> getValues() { +return values; +} + +@Override public Object getObject(String name) { return getObject(name, 0); } diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionRequest.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionRequest.java index f50f0ad..9f59cb3 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionRequest.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionRequest.java @@ -34,27 +34,32 @@ public class DefaultPlcSubscriptionRequest implements InternalPlcSubscriptionReq @Override public int getNumberOfFields() { -return 0; +throw new IllegalStateException("not available"); } @Override public LinkedHashSet getFieldNames() { -return null; +throw new IllegalStateException("not available"); } @Override public PlcField getField(String name) { -return null; +throw new IllegalStateException
[incubator-plc4x] branch feature/TopLevelItemSpliting updated (9bcf6c1 -> a0c3607)
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a change to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git. discard 9bcf6c1 [General] SingleItemToSingleRequestProtocol implemented ErrorHandler omit 0cd7f6b [General] some progress on the SingleItemToSingleRequestProtocol omit e955366 Introduced protocol layer to split requestItems to several requests. add ff580e7 Added note for Service Loader. add d64c3e2 Merge pull request #23 from JulianFeinauer/master new 7e8dd94 Introduced protocol layer to split requestItems to several requests. new 31e2acb [General] some progress on the SingleItemToSingleRequestProtocol new a0c3607 [General] SingleItemToSingleRequestProtocol implemented ErrorHandler This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (9bcf6c1) \ N -- N -- N refs/heads/feature/TopLevelItemSpliting (a0c3607) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. 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: .../google/iotcore/S7PlcToGoogleIoTCoreSample.java | 24 +-- .../org/apache/plc4x/edgent/PlcFunctionsTest.java | 223 ++--- .../java/org/apache/plc4x/java/api/PlcDriver.java | 4 + 3 files changed, 124 insertions(+), 127 deletions(-)
[incubator-plc4x] branch master updated: [General] added some utility methods to requests and responses.
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 The following commit(s) were added to refs/heads/master by this push: new 523ada0 [General] added some utility methods to requests and responses. 523ada0 is described below commit 523ada0cc52095b373a33ee998663c823b029a10 Author: Sebastian Rühl AuthorDate: Wed Sep 26 18:18:04 2018 +0200 [General] added some utility methods to requests and responses. --- .../java/base/messages/DefaultPlcReadRequest.java | 12 +- .../java/base/messages/DefaultPlcReadResponse.java | 5 .../messages/DefaultPlcSubscriptionRequest.java| 15 .../messages/DefaultPlcUnsubscriptionRequest.java | 6 + .../java/base/messages/DefaultPlcWriteRequest.java | 28 +- .../base/messages/DefaultPlcWriteResponse.java | 5 .../base/messages/InternalPlcFieldRequest.java | 6 + .../java/base/messages/InternalPlcReadRequest.java | 2 +- .../base/messages/InternalPlcReadResponse.java | 6 + .../base/messages/InternalPlcWriteRequest.java | 4 .../base/messages/InternalPlcWriteResponse.java| 5 +++- 11 files changed, 85 insertions(+), 9 deletions(-) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadRequest.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadRequest.java index ef9d7ba..9b60fe4 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadRequest.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadRequest.java @@ -18,18 +18,20 @@ under the License. */ package org.apache.plc4x.java.base.messages; +import org.apache.commons.lang3.tuple.Pair; import org.apache.plc4x.java.api.exceptions.PlcRuntimeException; import org.apache.plc4x.java.api.messages.PlcReadRequest; import org.apache.plc4x.java.api.model.PlcField; import org.apache.plc4x.java.base.connection.PlcFieldHandler; import java.util.*; +import java.util.stream.Collectors; public class DefaultPlcReadRequest implements InternalPlcReadRequest, InternalPlcFieldRequest { private LinkedHashMap fields; -private DefaultPlcReadRequest(LinkedHashMap fields) { +protected DefaultPlcReadRequest(LinkedHashMap fields) { this.fields = fields; } @@ -54,6 +56,14 @@ public class DefaultPlcReadRequest implements InternalPlcReadRequest, InternalPl return new LinkedList<>(fields.values()); } +@Override +public LinkedList> getNamedFields() { +return fields.entrySet() +.stream() +.map(stringPlcFieldEntry -> Pair.of(stringPlcFieldEntry.getKey(), stringPlcFieldEntry.getValue())) +.collect(Collectors.toCollection(LinkedList::new)); +} + public static class Builder implements PlcReadRequest.Builder { private final PlcFieldHandler fieldHandler; diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java index cd2dc47..73cad97 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcReadResponse.java @@ -76,6 +76,11 @@ public class DefaultPlcReadResponse implements InternalPlcReadResponse { } @Override +public Map> getValues() { +return values; +} + +@Override public Object getObject(String name) { return getObject(name, 0); } diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionRequest.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionRequest.java index f50f0ad..9f59cb3 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionRequest.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/DefaultPlcSubscriptionRequest.java @@ -34,27 +34,32 @@ public class DefaultPlcSubscriptionRequest implements InternalPlcSubscriptionReq @Override public int getNumberOfFields() { -return 0; +throw new IllegalStateException("not available"); } @Override public LinkedHashSet getFieldNames() { -return null; +throw new IllegalStateException("not available"); } @Override public PlcField getField(String name) { -return null; +throw new IllegalStateException("not av
[incubator-plc4x] branch feature/TopLevelItemSpliting updated (a0c3607 -> 9e25460)
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a change to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git. discard a0c3607 [General] SingleItemToSingleRequestProtocol implemented ErrorHandler discard 31e2acb [General] some progress on the SingleItemToSingleRequestProtocol discard 7e8dd94 Introduced protocol layer to split requestItems to several requests. add 523ada0 [General] added some utility methods to requests and responses. new 10cf16a Introduced protocol layer to split requestItems to several requests. new be82ba7 [General] some progress on the SingleItemToSingleRequestProtocol new 9e25460 [General] SingleItemToSingleRequestProtocol implemented ErrorHandler This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (a0c3607) \ N -- N -- N refs/heads/feature/TopLevelItemSpliting (9e25460) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. 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:
[incubator-plc4x] 02/03: [General] some progress on the SingleItemToSingleRequestProtocol
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git commit be82ba7ca4d7d569cc50e532a567b258df32120c Author: Sebastian Rühl AuthorDate: Wed Sep 26 18:01:46 2018 +0200 [General] some progress on the SingleItemToSingleRequestProtocol --- .../base/messages/item/CorrelatedRequestItem.java | 81 .../base/messages/item/CorrelatedResponseItem.java | 70 --- .../SingleItemToSingleRequestProtocol.java | 217 +++-- 3 files changed, 153 insertions(+), 215 deletions(-) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedRequestItem.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedRequestItem.java deleted file mode 100644 index 5212618..000 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedRequestItem.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - */ -package org.apache.plc4x.java.base.messages.item; - -import org.apache.plc4x.java.api.messages.PlcRequestContainer; -import org.apache.plc4x.java.api.messages.PlcResponse; -import org.apache.plc4x.java.api.messages.items.RequestItem; - -import java.util.Objects; - -public class CorrelatedRequestItem> { - -private final int correlationId; - -private final REQUEST_ITEM requestItem; - -private final PlcRequestContainer> plcRequestContainer; - -public CorrelatedRequestItem(int correlationId, REQUEST_ITEM requestItem, PlcRequestContainer> plcRequestContainer) { -this.correlationId = correlationId; -this.requestItem = requestItem; -this.plcRequestContainer = plcRequestContainer; -} - -public int getCorrelationId() { -return correlationId; -} - -public REQUEST_ITEM getRequestItem() { -return requestItem; -} - -public PlcRequestContainer> getPlcRequestContainer() { -return plcRequestContainer; -} - -@Override -public boolean equals(Object o) { -if (this == o) { -return true; -} -if (!(o instanceof CorrelatedRequestItem)) { -return false; -} -CorrelatedRequestItem that = (CorrelatedRequestItem) o; -return correlationId == that.correlationId && -Objects.equals(requestItem, that.requestItem) && -Objects.equals(plcRequestContainer, that.plcRequestContainer); -} - -@Override -public int hashCode() { - -return Objects.hash(correlationId, requestItem, plcRequestContainer); -} - -@Override -public String toString() { -return "CorrelatedRequestItem{" + -"correlationId=" + correlationId + -", requestItem=" + requestItem + -", plcRequestContainer=" + plcRequestContainer + -'}'; -} -} diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedResponseItem.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedResponseItem.java deleted file mode 100644 index 38a9032..000 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedResponseItem.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions
[incubator-plc4x] 01/03: Introduced protocol layer to split requestItems to several requests.
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git commit 10cf16a7c47d113d88f5d19ada479475442bd0fc Author: Sebastian Rühl AuthorDate: Thu Jul 5 13:20:43 2018 +0200 Introduced protocol layer to split requestItems to several requests. --- .../base/messages/item/CorrelatedRequestItem.java | 81 + .../base/messages/item/CorrelatedResponseItem.java | 70 .../SingleItemToSingleRequestProtocol.java | 193 + 3 files changed, 344 insertions(+) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedRequestItem.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedRequestItem.java new file mode 100644 index 000..5212618 --- /dev/null +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedRequestItem.java @@ -0,0 +1,81 @@ +/* + 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.java.base.messages.item; + +import org.apache.plc4x.java.api.messages.PlcRequestContainer; +import org.apache.plc4x.java.api.messages.PlcResponse; +import org.apache.plc4x.java.api.messages.items.RequestItem; + +import java.util.Objects; + +public class CorrelatedRequestItem> { + +private final int correlationId; + +private final REQUEST_ITEM requestItem; + +private final PlcRequestContainer> plcRequestContainer; + +public CorrelatedRequestItem(int correlationId, REQUEST_ITEM requestItem, PlcRequestContainer> plcRequestContainer) { +this.correlationId = correlationId; +this.requestItem = requestItem; +this.plcRequestContainer = plcRequestContainer; +} + +public int getCorrelationId() { +return correlationId; +} + +public REQUEST_ITEM getRequestItem() { +return requestItem; +} + +public PlcRequestContainer> getPlcRequestContainer() { +return plcRequestContainer; +} + +@Override +public boolean equals(Object o) { +if (this == o) { +return true; +} +if (!(o instanceof CorrelatedRequestItem)) { +return false; +} +CorrelatedRequestItem that = (CorrelatedRequestItem) o; +return correlationId == that.correlationId && +Objects.equals(requestItem, that.requestItem) && +Objects.equals(plcRequestContainer, that.plcRequestContainer); +} + +@Override +public int hashCode() { + +return Objects.hash(correlationId, requestItem, plcRequestContainer); +} + +@Override +public String toString() { +return "CorrelatedRequestItem{" + +"correlationId=" + correlationId + +", requestItem=" + requestItem + +", plcRequestContainer=" + plcRequestContainer + +'}'; +} +} diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedResponseItem.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedResponseItem.java new file mode 100644 index 000..38a9032 --- /dev/null +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/messages/item/CorrelatedResponseItem.java @@ -0,0 +1,70 @@ +/* + 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 + und
[incubator-plc4x] 03/03: [General] SingleItemToSingleRequestProtocol implemented ErrorHandler
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git commit 9e25460948d2769638d79dc792ff4b157f5e1789 Author: Sebastian Rühl AuthorDate: Wed Sep 26 18:07:56 2018 +0200 [General] SingleItemToSingleRequestProtocol implemented ErrorHandler --- .../plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java index 267f9a8..0fdebf5 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java @@ -118,7 +118,11 @@ public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler { } private void errored(int correlationId, Throwable throwable) { - +PlcRequestContainer> plcRequestContainer = sentButUnacknowledgedRequestItems.remove(correlationId); +if (plcRequestContainer == null) { +throw new PlcRuntimeException("Unrelated error received ", throwable); +} + plcRequestContainer.getResponseFuture().completeExceptionally(throwable); }
[incubator-plc4x] branch feature/TopLevelItemSpliting updated: [General] SingleItemToSingleRequestProtocol small Bugfixes
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git The following commit(s) were added to refs/heads/feature/TopLevelItemSpliting by this push: new d3844ed [General] SingleItemToSingleRequestProtocol small Bugfixes d3844ed is described below commit d3844ed2668cea212093ad32709ab437c285042d Author: Sebastian Rühl AuthorDate: Wed Sep 26 18:23:42 2018 +0200 [General] SingleItemToSingleRequestProtocol small Bugfixes --- .../java/base/protocol/SingleItemToSingleRequestProtocol.java| 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java index 0fdebf5..717b4dc 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java @@ -48,7 +48,7 @@ public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler { private ConcurrentMap, Set> containerCorrelationIdMap; -private ConcurrentMap, List>> responsesToBeDevliered; +private ConcurrentMap, List>> responsesToBeDelivered; private AtomicInteger correlationId; @@ -57,6 +57,7 @@ public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler { this.queue = new PendingWriteQueue(ctx); this.sentButUnacknowledgedRequestItems = new ConcurrentHashMap<>(); this.containerCorrelationIdMap = new ConcurrentHashMap<>(); +this.responsesToBeDelivered = new ConcurrentHashMap<>(); this.correlationId = new AtomicInteger(); super.channelRegistered(ctx); } @@ -83,7 +84,7 @@ public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler { if (plcRequestContainer == null) { throw new PlcRuntimeException("Unrelated package received " + msg); } -List> correlatedResponseItems = responsesToBeDevliered.computeIfAbsent(plcRequestContainer, ignore -> new LinkedList<>()); +List> correlatedResponseItems = responsesToBeDelivered.computeIfAbsent(plcRequestContainer, ignore -> new LinkedList<>()); correlatedResponseItems.add(msg); Set integers = containerCorrelationIdMap.get(plcRequestContainer); integers.remove(correlationId); @@ -113,7 +114,7 @@ public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler { throw new PlcRuntimeException("Unknown type detected " + plcRequestContainer.getRequest()); } plcRequestContainer.getResponseFuture().complete(plcResponse); -responsesToBeDevliered.remove(plcRequestContainer); +responsesToBeDelivered.remove(plcRequestContainer); } } @@ -144,7 +145,6 @@ public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler { if (internalPlcFieldRequest instanceof InternalPlcReadRequest) { InternalPlcReadRequest internalPlcReadRequest = (InternalPlcReadRequest) internalPlcFieldRequest; -// TODO: repackage internalPlcReadRequest.getNamedFields().forEach(field -> { ChannelPromise subPromise = new DefaultChannelPromise(promise.channel()); @@ -167,7 +167,6 @@ public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler { } if (internalPlcFieldRequest instanceof InternalPlcWriteRequest) { InternalPlcWriteRequest internalPlcWriteRequest = (InternalPlcWriteRequest) internalPlcFieldRequest; -// TODO: repackage internalPlcWriteRequest.getNamedFieldTriples().forEach(fieldItemTriple -> { ChannelPromise subPromise = new DefaultChannelPromise(promise.channel());
[incubator-plc4x] branch feature/TopLevelItemSpliting updated: [General] SingleItemToSingleRequestProtocol added abstract javadoc
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git The following commit(s) were added to refs/heads/feature/TopLevelItemSpliting by this push: new bd66350 [General] SingleItemToSingleRequestProtocol added abstract javadoc bd66350 is described below commit bd66350e2141d955327efa26052ececb40e42cb5 Author: Sebastian Rühl AuthorDate: Wed Sep 26 18:25:14 2018 +0200 [General] SingleItemToSingleRequestProtocol added abstract javadoc --- .../plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java| 3 +++ 1 file changed, 3 insertions(+) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java index 717b4dc..2ab0937 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java @@ -37,6 +37,9 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicInteger; +/** + * This layer can be used to split a {@link org.apache.plc4x.java.api.messages.PlcRequest} which addresses multiple {@link PlcField}s into multiple subsequent {@link org.apache.plc4x.java.api.messages.PlcRequest}s. + */ // TODO: write test public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler {
[incubator-plc4x] branch feature/TopLevelItemSpliting updated: [General] SingleItemToSingleRequestProtocol replace throwing of RuntimeExceptions with log statements.
This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch feature/TopLevelItemSpliting in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git The following commit(s) were added to refs/heads/feature/TopLevelItemSpliting by this push: new 86041d3 [General] SingleItemToSingleRequestProtocol replace throwing of RuntimeExceptions with log statements. 86041d3 is described below commit 86041d397d49d6e46f2b6745882fbf6f8b8c6630 Author: Sebastian Rühl AuthorDate: Wed Sep 26 18:30:57 2018 +0200 [General] SingleItemToSingleRequestProtocol replace throwing of RuntimeExceptions with log statements. --- .../plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java index 2ab0937..fa578f2 100644 --- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java +++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java @@ -85,7 +85,8 @@ public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler { private void tryFinish(int correlationId, InternalPlcResponse msg) { PlcRequestContainer> plcRequestContainer = sentButUnacknowledgedRequestItems.remove(correlationId); if (plcRequestContainer == null) { -throw new PlcRuntimeException("Unrelated package received " + msg); +LOGGER.warn("Unrelated package received {}", msg); +return; } List> correlatedResponseItems = responsesToBeDelivered.computeIfAbsent(plcRequestContainer, ignore -> new LinkedList<>()); correlatedResponseItems.add(msg); @@ -124,7 +125,8 @@ public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler { private void errored(int correlationId, Throwable throwable) { PlcRequestContainer> plcRequestContainer = sentButUnacknowledgedRequestItems.remove(correlationId); if (plcRequestContainer == null) { -throw new PlcRuntimeException("Unrelated error received ", throwable); +LOGGER.warn("Unrelated error received ", throwable); +return; } plcRequestContainer.getResponseFuture().completeExceptionally(throwable); }
[incubator-plc4x] annotated tag plc4x-parent-0.1.0 deleted (was 40b8dba)
This is an automated email from the ASF dual-hosted git repository. cdutz pushed a change to annotated tag plc4x-parent-0.1.0 in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git. *** WARNING: tag plc4x-parent-0.1.0 was deleted! *** tag was 40b8dba The revisions that were on this annotated tag are still contained in other references; therefore, this change does not discard any commits from the repository.
[incubator-plc4x] annotated tag plc4x-parent-0.1.0-rc2 deleted (was 12d5ae8)
This is an automated email from the ASF dual-hosted git repository. cdutz pushed a change to annotated tag plc4x-parent-0.1.0-rc2 in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git. *** WARNING: tag plc4x-parent-0.1.0-rc2 was deleted! *** tag was 12d5ae8 The revisions that were on this annotated tag are still contained in other references; therefore, this change does not discard any commits from the repository.
[incubator-plc4x] annotated tag rel/0.1.0 created (now 12d5ae8)
This is an automated email from the ASF dual-hosted git repository. cdutz pushed a change to annotated tag rel/0.1.0 in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git. at 12d5ae8 (tag) tagging 8c1e0c1b85ce15814f2c08e0eec5d593951d168d (commit) replaces Last-Mina-Version by Christofer Dutz on Fri Sep 21 19:31:29 2018 +0200 - Log - [maven-release-plugin] copy for tag plc4x-parent-0.1.0-rc2 --- No new revisions were added by this update.
[incubator-plc4x] branch master updated: PLC4X-60 - Fix findings by the last release
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 The following commit(s) were added to refs/heads/master by this push: new f9707df PLC4X-60 - Fix findings by the last release f9707df is described below commit f9707df504a8ef9f8c5c7f555bc185792f38b287 Author: Christofer Dutz AuthorDate: Wed Sep 26 13:15:17 2018 -0400 PLC4X-60 - Fix findings by the last release - Removed the generation of the MD5 hash - Removed the MD5 hash from the documentation - Added the release.html to the site menu --- pom.xml | 1 - src/site/asciidoc/developers/release.adoc | 79 ++- src/site/site.xml | 1 + 3 files changed, 78 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index c491e51..77c80a3 100644 --- a/pom.xml +++ b/pom.xml @@ -1233,7 +1233,6 @@ -MD5 SHA-512 diff --git a/src/site/asciidoc/developers/release.adoc b/src/site/asciidoc/developers/release.adoc index 056a28c..a6e4c4d 100644 --- a/src/site/asciidoc/developers/release.adoc +++ b/src/site/asciidoc/developers/release.adoc @@ -127,7 +127,7 @@ A release build also produces a so-called `source-assembly` zip. This contains all sources of the project and will be what's actually the release from an Apache point of view and will be the thing we will be voting on. -This file will also be signed and `MD5` and `SHA512`will be created. +This file will also be signed and `SHA512` hashes will be created. === Staging a release @@ -144,7 +144,6 @@ The directory structure of this directory is as follows: ./0.1.0-incubating/rc1/RELEASE_NOTES ./0.1.0-incubating/rc1/apache-plc4x-incubating-0.1.0-source-release.zip ./0.1.0-incubating/rc1/apache-plc4x-incubating-0.1.0-source-release.zip.asc - ./0.1.0-incubating/rc1/apache-plc4x-incubating-0.1.0-source-release.zip.md5 ./0.1.0-incubating/rc1/apache-plc4x-incubating-0.1.0-source-release.zip.sha512 The `KEYS` file contains the PGP public key which belongs to the private key used to sign the release artifacts. @@ -219,6 +218,21 @@ This is an Apache policy to make it possible for anyone to participate in the vo The vote passes, if at least 3 `+1` votes are received and more `+1` are received than `-1`. +After the 72 hour minimum wait period is over and we have fulfilled the requirement of at least 3 +1 votes and more +1 than -1, a final reply is sent to the vote thread with a prefix of `[RESULT]` in the title in which the summary of the vote is presented in an aggregated form. + +``` +E-Mail Topic: +[RESULT] [DISCUSS] Apache PLC4X (Incubating) 0.1.0 RC1 + +Message: +So, the vote passes with 3 +1 votes by PPMC members and one +1 vote by a non PPMC member. + +I’ll forward this to the incubator for approval. Also I'll update the GIT tag as suggested. + +Chris + +``` + == An extra step for incubator podlings If the vote passes in the project, for a top-level project the formal process would be finished. @@ -229,6 +243,67 @@ Now our mentors and any member of the Incubator PMC have the chance to review ou Only if this second vote passes, are we allowed to finally announce the release and release the artifacts. +``` +To: +gene...@incubator.apache.org + +E-Mail Topic: +[VOTE] Release Apache PLC4X (Incubating) 0.1.0 [RC2] + +Message: +Hello all, + +This is a call for vote to release Apache PLC4X (Incubating) version 0.1.0. + +The Apache PLC4X community has voted on and approved a proposal to release +Apache PLC4X (Incubating) version 0.1.0. + +We now kindly request the Incubator PMC members review and vote on this +incubator release. + +Apache PLC4X (incubating) is a set of libraries for communicating with +industrial programmable logic controllers (PLCs) using a variety of +protocols but with a shared API. + +PLC4X community vote and result thread: +Result: https://lists.apache.org/thread.html/31ca1bd96eb3dddc30ea1f08e968ece0c04b18fef3fa3bf3707c6e8f@%3Cdev.plc4x.apache.org%3E +Vote: https://lists.apache.org/thread.html/1d4ac299a46934f639987df04d6d19be325572a88decb5c564de89c8@%3Cdev.plc4x.apache.org%3E +A minor issue also can be found in the above thread, which we will be addressing in the next release. +Jira Issue for tracking this can be found here: +https://issues.apache.org/jira/projects/PLC4X/issues/PLC4X-60 + +The release candidates (RC2): +https://dist.apache.org/repos/dist/dev/incubator/plc4x/0.1.0 + +Git tag for the release (RC2): +https://github.com/apache/incubator-plc4x/tree/rel/0.1.0 + +Hash for the release tag: +8c1e0c1b85ce15814f2c08e0eec5d593951d168d + +Release Notes: +https://github.com/apache/incubator-plc4x/blob/rel/0.1.0/RELEASE_NOTES + +The artifacts have been signed with
[incubator-plc4x] branch master updated: PLC4X-60 - Fix findings by the last release
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 The following commit(s) were added to refs/heads/master by this push: new ee88f24 PLC4X-60 - Fix findings by the last release ee88f24 is described below commit ee88f24642ca465194d7ae33a3cbf14ae3bc9aa4 Author: Christofer Dutz AuthorDate: Wed Sep 26 15:42:53 2018 -0400 PLC4X-60 - Fix findings by the last release - Handled appending things to the NOTICE files as required. --- .../google/src/remote-resources/META-INF/NOTICE|5 + .../rawsockets/netty/AbstractRawSocketChannel.java | 740 -- .../netty/AbstractRawSocketStreamChannel.java | 1042 .../utils/rawsockets/netty/RawSocketChannel.java | 133 --- .../rawsockets/netty/RawSocketChannelConfig.java | 187 .../rawsockets/netty/RawSocketChannelSav.java | 186 .../rawsockets/netty/RawSocketEventArray.java | 104 -- .../utils/rawsockets/netty/RawSocketEventLoop.java | 449 - .../src/remote-resources/META-INF/NOTICE |7 + pom.xml|5 + 10 files changed, 17 insertions(+), 2841 deletions(-) diff --git a/examples/google/src/remote-resources/META-INF/NOTICE b/examples/google/src/remote-resources/META-INF/NOTICE new file mode 100644 index 000..942dc88 --- /dev/null +++ b/examples/google/src/remote-resources/META-INF/NOTICE @@ -0,0 +1,5 @@ +=== + +The File: +src/main/java/org/apache/plc4x/java/examples/google/iotcore/MqttExampleOptions.java +Is copyright by Google and is distributed under the Apache 2.0 License \ No newline at end of file diff --git a/plc4j/utils/raw-sockets/src/main/java-sav/org/apache/plc4x/java/utils/rawsockets/netty/AbstractRawSocketChannel.java b/plc4j/utils/raw-sockets/src/main/java-sav/org/apache/plc4x/java/utils/rawsockets/netty/AbstractRawSocketChannel.java deleted file mode 100644 index a8762ad..000 --- a/plc4j/utils/raw-sockets/src/main/java-sav/org/apache/plc4x/java/utils/rawsockets/netty/AbstractRawSocketChannel.java +++ /dev/null @@ -1,740 +0,0 @@ -/* - * Copyright 2014 The Netty Project - * - * The Netty Project 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.java.utils.rawsockets.netty; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.Unpooled; -import io.netty.channel.*; -import io.netty.channel.Channel; -import io.netty.channel.socket.ChannelInputShutdownEvent; -import io.netty.channel.socket.ChannelInputShutdownReadComplete; -import io.netty.channel.unix.FileDescriptor; -import io.netty.channel.unix.Socket; -import io.netty.channel.unix.UnixChannel; -import io.netty.util.ReferenceCountUtil; -import io.netty.util.internal.ThrowableUtil; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.nio.ByteBuffer; -import java.nio.channels.*; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - -import static io.netty.channel.internal.ChannelUtils.WRITE_STATUS_SNDBUF_FULL; -import static io.netty.channel.unix.UnixChannelUtil.computeRemoteAddr; -import static io.netty.util.internal.ObjectUtil.checkNotNull; - -abstract class AbstractRawSocketChannel extends AbstractChannel implements Channel { -private static final ClosedChannelException DO_CLOSE_CLOSED_CHANNEL_EXCEPTION = ThrowableUtil.unknownStackTrace( -new ClosedChannelException(), AbstractRawSocketChannel.class, "doClose()"); -private static final ChannelMetadata METADATA = new ChannelMetadata(false); -private final int readFlag; -final LinuxSocket socket; -/** - * The future of the current connection attempt. If not null, subsequent - * connection attempts will fail. - */ -private ChannelPromise connectPromise; -private ScheduledFuture connectTimeoutFuture; -private SocketAddress requestedRemoteAddress; - -private volatile SocketAddress local; -private volatile SocketAddress remote; - -protected int flags = Native.EPOLLET; -boolean inputClosedSeenErrorOnRead; -boolean epollInReadyRunnablePending; - -protected volatile boolean active; - -AbstractRawSocketChannel(Li
svn commit: r29714 - /dev/incubator/plc4x/0.1.0-incubating/rc2/apache-plc4x-incubating-0.1.0-source-release.zip.md5
Author: cdutz Date: Wed Sep 26 19:52:31 2018 New Revision: 29714 Log: removed the MD5 Removed: dev/incubator/plc4x/0.1.0-incubating/rc2/apache-plc4x-incubating-0.1.0-source-release.zip.md5
svn commit: r29715 - /dev/incubator/plc4x/0.1.0-incubating/rc1/
Author: cdutz Date: Wed Sep 26 19:53:26 2018 New Revision: 29715 Log: removed the rc1 Removed: dev/incubator/plc4x/0.1.0-incubating/rc1/
[incubator-plc4x] branch master updated: PLC4X-60 - Fix findings by the last release
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 The following commit(s) were added to refs/heads/master by this push: new b482930 PLC4X-60 - Fix findings by the last release b482930 is described below commit b48293074c14c5ff9acf12544347494bc77ed057 Author: Christofer Dutz AuthorDate: Wed Sep 26 16:03:15 2018 -0400 PLC4X-60 - Fix findings by the last release - Handled appending things to the NOTICE and LICENSE files as required. - Added a Downloads page --- .../remote-resources/META-INF/{NOTICE => LICENSE} | 0 .../remote-resources/META-INF/{NOTICE => LICENSE} | 1 + .../src/remote-resources/META-INF/NOTICE | 11 +++- src/site/asciidoc/users/download.adoc | 30 ++ src/site/site.xml | 1 + 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/examples/google/src/remote-resources/META-INF/NOTICE b/examples/google/src/remote-resources/META-INF/LICENSE similarity index 100% rename from examples/google/src/remote-resources/META-INF/NOTICE rename to examples/google/src/remote-resources/META-INF/LICENSE diff --git a/plc4j/utils/raw-sockets/src/remote-resources/META-INF/NOTICE b/plc4j/utils/raw-sockets/src/remote-resources/META-INF/LICENSE similarity index 93% copy from plc4j/utils/raw-sockets/src/remote-resources/META-INF/NOTICE copy to plc4j/utils/raw-sockets/src/remote-resources/META-INF/LICENSE index ae40e6e..9d9d033 100644 --- a/plc4j/utils/raw-sockets/src/remote-resources/META-INF/NOTICE +++ b/plc4j/utils/raw-sockets/src/remote-resources/META-INF/LICENSE @@ -1,4 +1,5 @@ === + The Files: src/main/java/org/apache/plc4x/java/utils/rawsockets/RawSocketListener.java src/main/java/org/apache/plc4x/java/utils/rawsockets/RawIpSocket.java diff --git a/plc4j/utils/raw-sockets/src/remote-resources/META-INF/NOTICE b/plc4j/utils/raw-sockets/src/remote-resources/META-INF/NOTICE index ae40e6e..ccad4c4 100644 --- a/plc4j/utils/raw-sockets/src/remote-resources/META-INF/NOTICE +++ b/plc4j/utils/raw-sockets/src/remote-resources/META-INF/NOTICE @@ -1,7 +1,4 @@ -=== -The Files: -src/main/java/org/apache/plc4x/java/utils/rawsockets/RawSocketListener.java -src/main/java/org/apache/plc4x/java/utils/rawsockets/RawIpSocket.java -src/main/java/org/apache/plc4x/java/utils/rawsockets/RawSocketException.java -src/main/java/org/apache/plc4x/java/utils/rawsockets/RawSocketListener.java -Are copyrighted by the The Netty Project which is distributed under the Apache 2.0 license. \ No newline at end of file +-- + +This product includes software developed at +The Netty project (https://netty.io/). diff --git a/src/site/asciidoc/users/download.adoc b/src/site/asciidoc/users/download.adoc new file mode 100644 index 000..c48b443 --- /dev/null +++ b/src/site/asciidoc/users/download.adoc @@ -0,0 +1,30 @@ +// +// 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. +// + +== Download + +Be sure to verify your downloads by these https://www.apache.org/info/verification[procedures] using these https://www.apache.org/dist/incubator/plc4x/KEYS[KEYS] for any Apache release. + +=== Current Releases + +The first release still has to be performed. + +// Template for a release: +//0.1.0 +//Official https://www.apache.org/dyn/closer.lua/incubator/plc4x/apache-plc4x-incubating-0.1.0/apache-plc4x-incubating-sources-0.1.0.zip[source release] [ https://www.apache.org/dist/incubator/plc4x/apache-plc4x-incubating-0.1.0/apache-plc4x-incubating-sources-0.1.0.zip.sha512[SHA512] ] [ https://www.apache.org/dist/incubator/plc4x/apache-plc4x-incubating-0.1.0/apache-plc4x-incubating-sources-0.1.0.zip.asc[ASC] ] +// +//https://github.com/apache/incubator-plc4x/blob/release-0.1.0/CHANGELOG.md[CHANGELOG] \ No newline at end of file diff --git a/src/site/site.xml b/src/site/site.xml index 3bae883..cff7a60 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -100,6 +100,7 @@
svn commit: r29717 - /release/incubator/plc4x/
Author: cdutz Date: Wed Sep 26 20:24:11 2018 New Revision: 29717 Log: Added plc4x directroy Added: release/incubator/plc4x/
svn commit: r29718 - /release/incubator/plc4x/KEYS
Author: cdutz Date: Wed Sep 26 20:24:15 2018 New Revision: 29718 Log: Added PLC KEYS file Added: release/incubator/plc4x/KEYS - copied unchanged from r29717, dev/incubator/plc4x/KEYS
[incubator-plc4x] branch master updated: PLC4X-60 - Fix findings by the last release
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 The following commit(s) were added to refs/heads/master by this push: new e292f32 PLC4X-60 - Fix findings by the last release e292f32 is described below commit e292f3297b27c369a69425452729c121a60862a0 Author: Christofer Dutz AuthorDate: Wed Sep 26 16:33:34 2018 -0400 PLC4X-60 - Fix findings by the last release - Beautified the output a little. --- plc4j/utils/raw-sockets/src/remote-resources/META-INF/LICENSE | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plc4j/utils/raw-sockets/src/remote-resources/META-INF/LICENSE b/plc4j/utils/raw-sockets/src/remote-resources/META-INF/LICENSE index 9d9d033..1a8a165 100644 --- a/plc4j/utils/raw-sockets/src/remote-resources/META-INF/LICENSE +++ b/plc4j/utils/raw-sockets/src/remote-resources/META-INF/LICENSE @@ -1,4 +1,5 @@ -=== + +-- The Files: src/main/java/org/apache/plc4x/java/utils/rawsockets/RawSocketListener.java
[incubator-plc4x] branch master updated: PLC4X-56 - [S7] S7Field does not recognize addresses with numElements present
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 The following commit(s) were added to refs/heads/master by this push: new e31e741 PLC4X-56 - [S7] S7Field does not recognize addresses with numElements present e31e741 is described below commit e31e741616c8b771b3b35d6dac8507287f69525b Author: Christofer Dutz AuthorDate: Wed Sep 26 16:48:54 2018 -0400 PLC4X-56 - [S7] S7Field does not recognize addresses with numElements present - Fixed an error in the regular expression for parsing the number of elements. Old version could only read a 0-9 items ... is now fixed. --- .../s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java index 8d48c78..1b83374 100644 --- a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java +++ b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java @@ -29,9 +29,9 @@ import java.util.regex.Pattern; public class S7Field implements PlcField { private static final Pattern ADDRESS_PATTERN = - Pattern.compile("^%(?.)(?[XBWD]?)(?\\d{1,4})(.(?[0-7]))?:(?.+)(\\[(?\\d)])?"); + Pattern.compile("^%(?.)(?[XBWD]?)(?\\d{1,4})(.(?[0-7]))?:(?[a-z,A-Z]+)(\\[(?\\d+)])?"); private static final Pattern DATA_BLOCK_ADDRESS_PATTERN = - Pattern.compile("^%DB(?\\d{1,4}).DB(?[XBWD]?)(?\\d{1,4})(.(?[0-7]))?:(?.+)(\\[(?\\d)])?"); + Pattern.compile("^%DB(?\\d{1,4}).DB(?[XBWD]?)(?\\d{1,4})(.(?[0-7]))?:(?[a-z,A-Z]+)(\\[(?\\d+)])?"); public static boolean matches(String fieldString) { return DATA_BLOCK_ADDRESS_PATTERN.matcher(fieldString).matches() ||
[incubator-plc4x] branch master updated: PLC4X-56 - [S7] S7Field does not recognize addresses with numElements present
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 The following commit(s) were added to refs/heads/master by this push: new 374fd74 PLC4X-56 - [S7] S7Field does not recognize addresses with numElements present 374fd74 is described below commit 374fd746a67815668c9bc46fcfc0606a08420685 Author: Christofer Dutz AuthorDate: Wed Sep 26 16:56:04 2018 -0400 PLC4X-56 - [S7] S7Field does not recognize addresses with numElements present - Added a testcase to confirm the fix. --- .../java/org/apache/plc4x/java/issues/PLC4X56.java | 43 ++ 1 file changed, 43 insertions(+) diff --git a/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/issues/PLC4X56.java b/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/issues/PLC4X56.java new file mode 100644 index 000..d5de122 --- /dev/null +++ b/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/issues/PLC4X56.java @@ -0,0 +1,43 @@ +/* + 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.java.issues; + +import org.apache.plc4x.java.s7.model.S7Field; +import org.apache.plc4x.java.s7.netty.model.types.MemoryArea; +import org.apache.plc4x.java.s7.netty.model.types.TransportSize; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.assertThat; + +public class PLC4X56 { + +@Test +void name() { +S7Field field = S7Field.of("%DB56.DBB100:SINT[25]"); +assertThat(field.getMemoryArea(), equalTo(MemoryArea.DATA_BLOCKS)); +assertThat(field.getBlockNumber(), equalTo((short) 56)); +assertThat(field.getByteOffset(), equalTo((short) 100)); +assertThat(field.getBitOffset(), equalTo((short) 0)); +assertThat(field.getDataType(), equalTo(TransportSize.SINT)); +assertThat(field.getNumElements(), equalTo(25)); +} + +}
[incubator-plc4x] branch master updated: PLC4X-54 - Installation Process isn't working SSL Errors
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 The following commit(s) were added to refs/heads/master by this push: new d57e7ea PLC4X-54 - Installation Process isn't working SSL Errors d57e7ea is described below commit d57e7eae361112f4ae2f8042b51c9be9197864c8 Author: Christofer Dutz AuthorDate: Wed Sep 26 17:03:46 2018 -0400 PLC4X-54 - Installation Process isn't working SSL Errors - Applied the patch reported by Bjoern Haverland --- mvnw.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mvnw.cmd b/mvnw.cmd index 898fb06..3e92332 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -135,7 +135,7 @@ if exist %WRAPPER_JAR% ( ) @REM End of extension -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% -Dhttps.protocols=TLSv1.1,TLSv1.2 "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* if ERRORLEVEL 1 goto error goto end
[incubator-plc4x] branch master updated: PLC4X-56 - [S7] S7Field does not recognize addresses with numElements present
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 The following commit(s) were added to refs/heads/master by this push: new 776f2b7 PLC4X-56 - [S7] S7Field does not recognize addresses with numElements present 776f2b7 is described below commit 776f2b7d95dace33880907462e05df04e38f4998 Author: Christofer Dutz AuthorDate: Wed Sep 26 17:15:38 2018 -0400 PLC4X-56 - [S7] S7Field does not recognize addresses with numElements present - Fixed something I broke with my previous change. --- .../s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java index 1b83374..303c449 100644 --- a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java +++ b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java @@ -29,9 +29,9 @@ import java.util.regex.Pattern; public class S7Field implements PlcField { private static final Pattern ADDRESS_PATTERN = - Pattern.compile("^%(?.)(?[XBWD]?)(?\\d{1,4})(.(?[0-7]))?:(?[a-z,A-Z]+)(\\[(?\\d+)])?"); + Pattern.compile("^%(?.)(?[XBWD]?)(?\\d{1,4})(.(?[0-7]))?:(?[a-z,A-Z,_]+)(\\[(?\\d+)])?"); private static final Pattern DATA_BLOCK_ADDRESS_PATTERN = - Pattern.compile("^%DB(?\\d{1,4}).DB(?[XBWD]?)(?\\d{1,4})(.(?[0-7]))?:(?[a-z,A-Z]+)(\\[(?\\d+)])?"); + Pattern.compile("^%DB(?\\d{1,4}).DB(?[XBWD]?)(?\\d{1,4})(.(?[0-7]))?:(?[a-z,A-Z,_]+)(\\[(?\\d+)])?"); public static boolean matches(String fieldString) { return DATA_BLOCK_ADDRESS_PATTERN.matcher(fieldString).matches() ||