You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jf...@apache.org on 2019/12/23 12:32:37 UTC
[plc4x] branch next-gen-core updated: Refactoring towards Generic
Connections: - Merged "Generation" Classes from Module
'plc4j-utils-driver-base-java' to 'plc4j-spi' into
'org.apache.plc4x.java.spi.generation' (was 'org.apache.plc4x.java.utils'
before) - Introduced new Class GenericNettyPlcConnection where new Drivers
can be based on (contains ChannelHandler already and should be used in the
Future, then NettyPlcConnection will be deprecated) - Removed module
'plc4j-utils-driver-base-java' everywhere - Changed Code Generatio [...]
This is an automated email from the ASF dual-hosted git repository.
jfeinauer pushed a commit to branch next-gen-core
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/next-gen-core by this push:
new 32e023b Refactoring towards Generic Connections: - Merged "Generation" Classes from Module 'plc4j-utils-driver-base-java' to 'plc4j-spi' into 'org.apache.plc4x.java.spi.generation' (was 'org.apache.plc4x.java.utils' before) - Introduced new Class GenericNettyPlcConnection where new Drivers can be based on (contains ChannelHandler already and should be used in the Future, then NettyPlcConnection will be deprecated) - Removed module 'plc4j-utils-driver-base-java' everywhere - Cha [...]
32e023b is described below
commit 32e023b7a588506bd542ea12839efe1ec1e372c6
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Mon Dec 23 13:32:18 2019 +0100
Refactoring towards Generic Connections:
- Merged "Generation" Classes from Module 'plc4j-utils-driver-base-java' to 'plc4j-spi' into 'org.apache.plc4x.java.spi.generation' (was 'org.apache.plc4x.java.utils' before)
- Introduced new Class GenericNettyPlcConnection where new Drivers can be based on (contains ChannelHandler already and should be used in the Future, then NettyPlcConnection will be deprecated)
- Removed module 'plc4j-utils-driver-base-java' everywhere
- Changed Code Generation to have the right imports after namespace change (see above)
- Changed Karaf feature (as 'plc4j-utils-driver-base-java' is no longer necessary)
---
.../resources/templates/java/enum-template.ftlh | 115 +++++++++++----------
.../main/resources/templates/java/io-template.ftlh | 4 +-
.../resources/templates/java/pojo-template.ftlh | 4 +-
plc4j/drivers/ab-eth/pom.xml | 10 +-
.../java/abeth/connection/AbEthPlcConnection.java | 31 ------
.../plc4x/java/abeth/protocol/AbEthProtocol.java | 8 +-
.../ads/connection/AdsAbstractPlcConnection.java | 35 ++++++-
.../karaf-features/s7/src/main/feature/feature.xml | 1 -
plc4j/spi/pom.xml | 9 ++
.../github/jinahya/bit/io/MyDefaultBitInput.java | 0
.../spi/GeneratedDriverByteToMessageCodec.java | 8 +-
...nection.java => GenericNettyPlcConnection.java} | 72 +++++++++++--
.../java/spi/connection/NettyPlcConnection.java | 19 +++-
.../java/spi/generation}/EvaluationHelper.java | 34 +++---
.../apache/plc4x/java/spi/generation/Message.java | 26 +++++
.../plc4x/java/spi/generation/MessageIO.java | 23 +++++
.../plc4x/java/spi/generation/MessageInput.java | 25 +++++
.../plc4x/java/spi/generation/MessageOutput.java | 25 +++++
.../plc4x/java/spi/generation/ParseException.java | 32 ++++++
.../plc4x/java/spi/generation}/ReadBuffer.java | 34 +++---
.../plc4x/java/spi/generation/StaticHelper.java | 48 +++++++++
.../plc4x/java/spi/generation}/WriteBuffer.java | 34 +++---
plc4j/utils/driver-base-java/pom.xml | 60 -----------
.../java/org/apache/plc4x/java/utils/Message.java | 26 -----
.../org/apache/plc4x/java/utils/MessageIO.java | 23 -----
.../org/apache/plc4x/java/utils/MessageInput.java | 25 -----
.../org/apache/plc4x/java/utils/MessageOutput.java | 25 -----
.../apache/plc4x/java/utils/ParseException.java | 32 ------
.../org/apache/plc4x/java/utils/StaticHelper.java | 48 ---------
plc4j/utils/pom.xml | 2 -
plc4j/utils/protocol-test-utils/pom.xml | 3 +-
.../protocol/test/ProtocolTestsuiteRunner.java | 6 +-
sandbox/plc-simulator/pom.xml | 10 +-
.../server/s7/protocol/S7Step7Protocol.java | 8 +-
sandbox/test-java-amsads-driver/pom.xml | 10 +-
.../connection/AdsAbstractPlcConnection.java | 3 +-
.../amsads/connection/AdsSerialPlcConnection.java | 29 +++---
.../amsads/connection/AdsTcpPlcConnection.java | 29 +++---
.../java/amsads/protocol/Ads2PayloadProtocol.java | 6 +-
.../amsads/protocol/Payload2SerialProtocol.java | 14 +--
.../java/amsads/protocol/Payload2TcpProtocol.java | 6 +-
.../protocol/amsads/BenchmarkGeneratedDf1.java | 4 -
.../org/apache/plc4x/protocol/amsads/IOTest.java | 6 --
sandbox/test-java-bacnetip-driver/pom.xml | 5 -
.../java/bacnetip/protocol/BacNetIpProtocol.java | 8 +-
.../plc4x/java/bacnetip/ManualBacNetDecoder.java | 2 +-
sandbox/test-java-df1-driver/pom.xml | 5 -
.../plc4x/java/df1/protocol/Df1Protocol.java | 8 +-
.../org/apache/plc4x/java/df1/util/DF1Utils.java | 6 +-
.../plc4x/protocol/df1/BenchmarkGeneratedDf1.java | 5 -
.../java/org/apache/plc4x/protocol/df1/IOTest.java | 2 +-
sandbox/test-java-knxnetip-driver-passive/pom.xml | 5 -
.../knxnetip/protocol/KnxNetIpProtocolMessage.java | 8 +-
.../org/apache/plc4x/java/knxnetip/IOTest.java | 7 +-
sandbox/test-java-knxnetip-driver/pom.xml | 2 +-
.../knxnetip/protocol/KnxNetIpProtocolLogic.java | 2 +-
.../knxnetip/protocol/KnxNetIpProtocolMessage.java | 8 +-
.../org/apache/plc4x/java/knxnetip/IOTest.java | 8 +-
.../java/knxnetip/ManualKnxNetIpWithEts5.java | 9 --
sandbox/test-java-knxnetip-shared/pom.xml | 12 +--
.../plc4x/java/knxnetip/ets5/Ets5Parser.java | 4 +-
sandbox/test-java-s7-driver-passive/pom.xml | 5 -
.../javapassive/s7/protocol/PassiveS7Protocol.java | 4 +-
.../src/test/java/BenchmarkGeneratedPassiveS7.java | 4 +-
sandbox/test-java-s7-driver/pom.xml | 5 -
.../apache/plc4x/java/s7/readwrite/S7Driver.java | 3 +-
.../java/s7/readwrite/connection/S7Connection.java | 70 ++-----------
.../s7/readwrite/protocol/S7ProtocolLogic.java | 6 +-
.../s7/readwrite/protocol/S7ProtocolMessage.java | 8 +-
.../java/s7/readwrite/utils/StaticHelper.java | 6 +-
.../src/test/java/BenchmarkGeneratedS7.java | 8 +-
.../enrich/knxnetip/ets5/Ets5DataEnrichment.java | 6 +-
72 files changed, 549 insertions(+), 654 deletions(-)
diff --git a/build-utils/language-java/src/main/resources/templates/java/enum-template.ftlh b/build-utils/language-java/src/main/resources/templates/java/enum-template.ftlh
index 62c4f34..8ab5ce2 100644
--- a/build-utils/language-java/src/main/resources/templates/java/enum-template.ftlh
+++ b/build-utils/language-java/src/main/resources/templates/java/enum-template.ftlh
@@ -1,4 +1,5 @@
<#--
+<#--
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
@@ -18,27 +19,27 @@
-->
${helper.packageName(protocolName, languageName, outputFlavor)?replace(".", "/")}/types/${typeName}.java
/*
- 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.
+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 ${helper.packageName(protocolName, languageName, outputFlavor)}.types;
-import org.apache.plc4x.java.utils.Message;
+import org.apache.plc4x.java.spi.generation.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,52 +49,52 @@ import java.util.Map;
public enum ${typeName} {
<#list type.enumValues as enumValue>
- ${enumValue.name}((${helper.getLanguageTypeName(type.type, true)}) ${enumValue.value}<#if type.constantNames?has_content>, <#list type.constantNames as constantName>(${helper.getLanguageTypeName(type.getConstantType(constantName), true)}) ${helper.escapeValue(type.getConstantType(constantName), enumValue.getConstant(constantName))?no_esc}<#sep>, </#sep></#list></#if>)<#sep>,
+${enumValue.name}((${helper.getLanguageTypeName(type.type, true)}) ${enumValue.value}<#if type.constantNames?has_content>, <#list type.constantNames as constantName>(${helper.getLanguageTypeName(type.getConstantType(constantName), true)}) ${helper.escapeValue(type.getConstantType(constantName), enumValue.getConstant(constantName))?no_esc}<#sep>, </#sep></#list></#if>)<#sep>,
</#sep></#list>;
- private static final Logger logger = LoggerFactory.getLogger(${typeName}.class);
-
- private static final Map<${helper.getLanguageTypeName(type.type, false)}, ${typeName}> map;
- static {
- map = new HashMap<>();
- for (${typeName} value : ${typeName}.values()) {
- map.put((${helper.getLanguageTypeName(type.type, true)}) value.getValue(), value);
- }
- }
-
- private ${helper.getLanguageTypeName(type.type, true)} value;
- <#if type.constantNames?has_content>
- <#list type.constantNames as constantName>
- private ${helper.getLanguageTypeName(type.getConstantType(constantName), true)} ${constantName};
- </#list>
- </#if>
-
- ${typeName}(${helper.getLanguageTypeName(type.type, true)} value<#if type.constantNames?has_content>, <#list type.constantNames as constantName>${helper.getLanguageTypeName(type.getConstantType(constantName), true)} ${constantName}<#sep>, </#sep></#list></#if>) {
- this.value = value;
- <#if type.constantNames?has_content>
- <#list type.constantNames as constantName>
+private static final Logger logger = LoggerFactory.getLogger(${typeName}.class);
+
+private static final Map<${helper.getLanguageTypeName(type.type, false)}, ${typeName}> map;
+static {
+map = new HashMap<>();
+for (${typeName} value : ${typeName}.values()) {
+map.put((${helper.getLanguageTypeName(type.type, true)}) value.getValue(), value);
+}
+}
+
+private ${helper.getLanguageTypeName(type.type, true)} value;
+<#if type.constantNames?has_content>
+ <#list type.constantNames as constantName>
+ private ${helper.getLanguageTypeName(type.getConstantType(constantName), true)} ${constantName};
+ </#list>
+</#if>
+
+${typeName}(${helper.getLanguageTypeName(type.type, true)} value<#if type.constantNames?has_content>, <#list type.constantNames as constantName>${helper.getLanguageTypeName(type.getConstantType(constantName), true)} ${constantName}<#sep>, </#sep></#list></#if>) {
+this.value = value;
+<#if type.constantNames?has_content>
+ <#list type.constantNames as constantName>
this.${constantName} = ${constantName};
- </#list>
- </#if>
- }
+ </#list>
+</#if>
+}
- public ${helper.getLanguageTypeName(type.type, true)} getValue() {
- return value;
- }
+public ${helper.getLanguageTypeName(type.type, true)} getValue() {
+return value;
+}
- <#if type.constantNames?has_content>
- <#list type.constantNames as constantName>
- public ${helper.getLanguageTypeName(type.getConstantType(constantName), true)} get${constantName?cap_first}() {
+<#if type.constantNames?has_content>
+ <#list type.constantNames as constantName>
+ public ${helper.getLanguageTypeName(type.getConstantType(constantName), true)} get${constantName?cap_first}() {
return ${constantName};
- }
-
- </#list>
- </#if>
- public static ${typeName} valueOf(${helper.getLanguageTypeName(type.type, true)} value) {
- if (!map.containsKey(value)) {
- logger.error("No ${typeName} for value {}", value);
}
- return map.get(value);
- }
+
+ </#list>
+</#if>
+public static ${typeName} valueOf(${helper.getLanguageTypeName(type.type, true)} value) {
+if (!map.containsKey(value)) {
+logger.error("No ${typeName} for value {}", value);
+}
+return map.get(value);
+}
}
\ No newline at end of file
diff --git a/build-utils/language-java/src/main/resources/templates/java/io-template.ftlh b/build-utils/language-java/src/main/resources/templates/java/io-template.ftlh
index 4c89fa1..fb06dfe 100644
--- a/build-utils/language-java/src/main/resources/templates/java/io-template.ftlh
+++ b/build-utils/language-java/src/main/resources/templates/java/io-template.ftlh
@@ -38,12 +38,12 @@ ${helper.packageName(protocolName, languageName, outputFlavor)?replace(".", "/")
package ${helper.packageName(protocolName, languageName, outputFlavor)}.io;
-import static org.apache.plc4x.java.utils.StaticHelper.*;
+import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
import ${helper.packageName(protocolName, languageName, outputFlavor)}.*;
<#if helper.getComplexTypes(type)?has_content>import ${helper.packageName(protocolName, languageName, outputFlavor)}.io.*;</#if>
import ${helper.packageName(protocolName, languageName, outputFlavor)}.types.*;
-import org.apache.plc4x.java.utils.*;
+import org.apache.plc4x.java.spi.generation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/build-utils/language-java/src/main/resources/templates/java/pojo-template.ftlh b/build-utils/language-java/src/main/resources/templates/java/pojo-template.ftlh
index 5460807..c548867 100644
--- a/build-utils/language-java/src/main/resources/templates/java/pojo-template.ftlh
+++ b/build-utils/language-java/src/main/resources/templates/java/pojo-template.ftlh
@@ -38,14 +38,14 @@ ${helper.packageName(protocolName, languageName, outputFlavor)?replace(".", "/")
package ${helper.packageName(protocolName, languageName, outputFlavor)};
-import static org.apache.plc4x.java.utils.StaticHelper.*;
+import static org.apache.plc4x.java.spi.generation.StaticHelper.*;
import ${helper.packageName(protocolName, languageName, outputFlavor)}.types.*;
import com.fasterxml.jackson.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.plc4x.java.utils.Message;
+import org.apache.plc4x.java.spi.generation.Message;
import java.time.*;
import java.util.Objects;
diff --git a/plc4j/drivers/ab-eth/pom.xml b/plc4j/drivers/ab-eth/pom.xml
index bed8e3d..101e0b4 100644
--- a/plc4j/drivers/ab-eth/pom.xml
+++ b/plc4j/drivers/ab-eth/pom.xml
@@ -74,11 +74,7 @@
<artifactId>plc4j-spi</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-driver-base-java</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </dependency>
+
<dependency>
<groupId>org.apache.plc4x</groupId>
@@ -98,10 +94,6 @@
<artifactId>netty-buffer</artifactId>
</dependency>
<dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-common</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
diff --git a/plc4j/drivers/ab-eth/src/main/java/org/apache/plc4x/java/abeth/connection/AbEthPlcConnection.java b/plc4j/drivers/ab-eth/src/main/java/org/apache/plc4x/java/abeth/connection/AbEthPlcConnection.java
index ebc3041..e0c1c6f 100644
--- a/plc4j/drivers/ab-eth/src/main/java/org/apache/plc4x/java/abeth/connection/AbEthPlcConnection.java
+++ b/plc4j/drivers/ab-eth/src/main/java/org/apache/plc4x/java/abeth/connection/AbEthPlcConnection.java
@@ -78,13 +78,6 @@ public class AbEthPlcConnection extends NettyPlcConnection implements PlcReader
}
@Override
- protected void sendChannelCreatedEvent() {
- logger.trace("Channel was created, firing ChannelCreated Event");
- // Send an event to the pipeline telling the Protocol filters what's going on.
- channel.pipeline().fireUserEventTriggered(new ConnectEvent());
- }
-
- @Override
public PlcField prepareField(String fieldQuery) throws PlcInvalidFieldException {
return AbEthField.of(fieldQuery);
}
@@ -113,16 +106,6 @@ public class AbEthPlcConnection extends NettyPlcConnection implements PlcReader
}
@Override
- public boolean canRead() {
- return true;
- }
-
- @Override
- public PlcReadRequest.Builder readRequestBuilder() {
- return new DefaultPlcReadRequest.Builder(this, new AbEthFieldHandler());
- }
-
- @Override
public void close() {
logger.debug("Closing PlcConnection...");
// Close the channel gracefully
@@ -145,18 +128,4 @@ public class AbEthPlcConnection extends NettyPlcConnection implements PlcReader
connected = false;
}
- @Override
- public CompletableFuture<PlcReadResponse> read(PlcReadRequest readRequest) {
- InternalPlcReadRequest internalReadRequest = checkInternal(readRequest, InternalPlcReadRequest.class);
- CompletableFuture<InternalPlcReadResponse> future = new CompletableFuture<>();
- PlcRequestContainer<InternalPlcReadRequest, InternalPlcReadResponse> container =
- new PlcRequestContainer<>(internalReadRequest, future);
- channel.writeAndFlush(container).addListener(f -> {
- if (!f.isSuccess()) {
- future.completeExceptionally(f.cause());
- }
- });
- return future
- .thenApply(PlcReadResponse.class::cast);
- }
}
\ No newline at end of file
diff --git a/plc4j/drivers/ab-eth/src/main/java/org/apache/plc4x/java/abeth/protocol/AbEthProtocol.java b/plc4j/drivers/ab-eth/src/main/java/org/apache/plc4x/java/abeth/protocol/AbEthProtocol.java
index b9d31f9..55cc499 100644
--- a/plc4j/drivers/ab-eth/src/main/java/org/apache/plc4x/java/abeth/protocol/AbEthProtocol.java
+++ b/plc4j/drivers/ab-eth/src/main/java/org/apache/plc4x/java/abeth/protocol/AbEthProtocol.java
@@ -22,10 +22,10 @@ import io.netty.buffer.ByteBuf;
import org.apache.plc4x.java.abeth.readwrite.CIPEncapsulationPacket;
import org.apache.plc4x.java.abeth.readwrite.io.CIPEncapsulationPacketIO;
import org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec;
-import org.apache.plc4x.java.utils.MessageIO;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.MessageIO;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsAbstractPlcConnection.java b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsAbstractPlcConnection.java
index d4bcac3..7c28c2f 100644
--- a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsAbstractPlcConnection.java
+++ b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsAbstractPlcConnection.java
@@ -24,7 +24,11 @@ import org.apache.commons.configuration2.SystemConfiguration;
import org.apache.plc4x.java.ads.api.commands.AdsReadWriteRequest;
import org.apache.plc4x.java.ads.api.commands.AdsReadWriteResponse;
import org.apache.plc4x.java.ads.api.commands.AdsWriteRequest;
-import org.apache.plc4x.java.ads.api.commands.types.*;
+import org.apache.plc4x.java.ads.api.commands.types.AdsReturnCode;
+import org.apache.plc4x.java.ads.api.commands.types.Data;
+import org.apache.plc4x.java.ads.api.commands.types.IndexGroup;
+import org.apache.plc4x.java.ads.api.commands.types.IndexOffset;
+import org.apache.plc4x.java.ads.api.commands.types.ReadLength;
import org.apache.plc4x.java.ads.api.generic.types.AmsNetId;
import org.apache.plc4x.java.ads.api.generic.types.AmsPort;
import org.apache.plc4x.java.ads.api.generic.types.Invoke;
@@ -33,14 +37,37 @@ import org.apache.plc4x.java.ads.model.DirectAdsField;
import org.apache.plc4x.java.ads.model.SymbolicAdsField;
import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
-import org.apache.plc4x.java.api.messages.*;
+import org.apache.plc4x.java.api.messages.PlcFieldRequest;
+import org.apache.plc4x.java.api.messages.PlcReadRequest;
+import org.apache.plc4x.java.api.messages.PlcReadResponse;
+import org.apache.plc4x.java.api.messages.PlcWriteRequest;
+import org.apache.plc4x.java.api.messages.PlcWriteResponse;
import org.apache.plc4x.java.spi.connection.ChannelFactory;
import org.apache.plc4x.java.spi.connection.NettyPlcConnection;
-import org.apache.plc4x.java.spi.messages.*;
+import org.apache.plc4x.java.spi.messages.DefaultPlcProprietaryRequest;
+import org.apache.plc4x.java.spi.messages.DefaultPlcReadRequest;
+import org.apache.plc4x.java.spi.messages.DefaultPlcWriteRequest;
+import org.apache.plc4x.java.spi.messages.InternalPlcProprietaryRequest;
+import org.apache.plc4x.java.spi.messages.InternalPlcProprietaryResponse;
+import org.apache.plc4x.java.spi.messages.InternalPlcReadRequest;
+import org.apache.plc4x.java.spi.messages.InternalPlcReadResponse;
+import org.apache.plc4x.java.spi.messages.InternalPlcWriteRequest;
+import org.apache.plc4x.java.spi.messages.InternalPlcWriteResponse;
+import org.apache.plc4x.java.spi.messages.PlcProprietaryRequest;
+import org.apache.plc4x.java.spi.messages.PlcProprietaryResponse;
+import org.apache.plc4x.java.spi.messages.PlcProprietarySender;
+import org.apache.plc4x.java.spi.messages.PlcReader;
+import org.apache.plc4x.java.spi.messages.PlcRequestContainer;
+import org.apache.plc4x.java.spi.messages.PlcWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.concurrent.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
public abstract class AdsAbstractPlcConnection extends NettyPlcConnection implements PlcReader, PlcWriter, PlcProprietarySender {
diff --git a/plc4j/karaf-features/s7/src/main/feature/feature.xml b/plc4j/karaf-features/s7/src/main/feature/feature.xml
index 30f865e..ec1aab8 100644
--- a/plc4j/karaf-features/s7/src/main/feature/feature.xml
+++ b/plc4j/karaf-features/s7/src/main/feature/feature.xml
@@ -30,7 +30,6 @@
<bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-tp/${project.version}</bundle>
<bundle>mvn:org.apache.plc4x/plc4j-protocol-s7/${project.version}</bundle>
<bundle>mvn:org.apache.plc4x/plc4j-spi/${project.version}</bundle>
- <bundle>mvn:org.apache.plc4x/plc4j-utils-driver-base-java/${project.version}</bundle>
<bundle>mvn:org.apache.plc4x/plc4j-transport-tcp/${project.version}</bundle>
<bundle>mvn:io.netty/netty-codec/4.1.39.Final</bundle>
<bundle>mvn:com.github.jinahya/bit-io/1.4.3</bundle>
diff --git a/plc4j/spi/pom.xml b/plc4j/spi/pom.xml
index 25edc11..f27bd21 100644
--- a/plc4j/spi/pom.xml
+++ b/plc4j/spi/pom.xml
@@ -67,6 +67,15 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>com.github.jinahya</groupId>
+ <artifactId>bit-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
diff --git a/plc4j/utils/driver-base-java/src/main/java/com/github/jinahya/bit/io/MyDefaultBitInput.java b/plc4j/spi/src/main/java/com/github/jinahya/bit/io/MyDefaultBitInput.java
similarity index 100%
rename from plc4j/utils/driver-base-java/src/main/java/com/github/jinahya/bit/io/MyDefaultBitInput.java
rename to plc4j/spi/src/main/java/com/github/jinahya/bit/io/MyDefaultBitInput.java
diff --git a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/spi/GeneratedDriverByteToMessageCodec.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/GeneratedDriverByteToMessageCodec.java
similarity index 93%
rename from plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/spi/GeneratedDriverByteToMessageCodec.java
rename to plc4j/spi/src/main/java/org/apache/plc4x/java/spi/GeneratedDriverByteToMessageCodec.java
index 37cf142..ebce592 100644
--- a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/spi/GeneratedDriverByteToMessageCodec.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/GeneratedDriverByteToMessageCodec.java
@@ -21,10 +21,10 @@ package org.apache.plc4x.java.spi;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import org.apache.commons.codec.binary.Hex;
-import org.apache.plc4x.java.utils.Message;
-import org.apache.plc4x.java.utils.MessageIO;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.Message;
+import org.apache.plc4x.java.spi.generation.MessageIO;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/NettyPlcConnection.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/GenericNettyPlcConnection.java
similarity index 55%
copy from plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/NettyPlcConnection.java
copy to plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/GenericNettyPlcConnection.java
index 747b725..fc3479a 100644
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/NettyPlcConnection.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/GenericNettyPlcConnection.java
@@ -20,49 +20,72 @@ package org.apache.plc4x.java.spi.connection;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandlerAdapter;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelPipeline;
import io.netty.util.HashedWheelTimer;
import io.netty.util.Timer;
import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
import org.apache.plc4x.java.api.exceptions.PlcException;
import org.apache.plc4x.java.api.exceptions.PlcIoException;
+import org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec;
+import org.apache.plc4x.java.spi.Plc4xNettyWrapper;
import org.apache.plc4x.java.spi.Plc4xProtocolBase;
+import org.apache.plc4x.java.spi.events.ConnectEvent;
+import org.apache.plc4x.java.spi.events.ConnectedEvent;
+import org.apache.plc4x.java.spi.generation.Message;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
-public abstract class NettyPlcConnection extends AbstractPlcConnection {
+public abstract class GenericNettyPlcConnection<BASE_PROTOCOL_CLASS extends Message> extends AbstractPlcConnection {
/**
* a {@link HashedWheelTimer} shall be only instantiated once.
*/
// TODO: maybe find a way to make this configurable per jvm
protected final static Timer timer = new HashedWheelTimer();
-
+ private static final Logger logger = LoggerFactory.getLogger(GenericNettyPlcConnection.class);
protected final ChannelFactory channelFactory;
protected final boolean awaitSessionSetupComplete;
-
protected Channel channel;
-
protected boolean connected;
+ private Class<BASE_PROTOCOL_CLASS> baseProtocolClass;
+ private GeneratedDriverByteToMessageCodec<BASE_PROTOCOL_CLASS> messageCodec;
+ private Plc4xProtocolBase<BASE_PROTOCOL_CLASS> protocolLogic;
- protected NettyPlcConnection(ChannelFactory channelFactory) {
+ protected GenericNettyPlcConnection(ChannelFactory channelFactory) {
this(channelFactory, false);
}
- protected NettyPlcConnection(ChannelFactory channelFactory, boolean awaitSessionSetupComplete) {
+ protected GenericNettyPlcConnection(ChannelFactory channelFactory, boolean awaitSessionSetupComplete) {
this.channelFactory = channelFactory;
this.awaitSessionSetupComplete = awaitSessionSetupComplete;
this.connected = false;
}
- protected NettyPlcConnection(ChannelFactory channelFactory, boolean awaitSessionSetupComplete, PlcFieldHandler handler) {
+ protected GenericNettyPlcConnection(ChannelFactory channelFactory, boolean awaitSessionSetupComplete, PlcFieldHandler handler) {
super(true, true, false, handler);
this.channelFactory = channelFactory;
this.awaitSessionSetupComplete = awaitSessionSetupComplete;
this.connected = false;
}
+ protected GenericNettyPlcConnection(ChannelFactory channelFactory, boolean awaitSessionSetupComplete, PlcFieldHandler handler,
+ Class<BASE_PROTOCOL_CLASS> baseProtocolClass,
+ GeneratedDriverByteToMessageCodec<BASE_PROTOCOL_CLASS> messageCodec,
+ Plc4xProtocolBase<BASE_PROTOCOL_CLASS> protocolLogic) {
+ this(channelFactory, awaitSessionSetupComplete, handler);
+ this.baseProtocolClass = baseProtocolClass;
+ this.messageCodec = messageCodec;
+ this.protocolLogic = protocolLogic;
+ }
+
+
@Override
public void connect() throws PlcConnectionException {
try {
@@ -105,7 +128,7 @@ public abstract class NettyPlcConnection extends AbstractPlcConnection {
channelFactory.ping();
// If we got here, the ping was successful.
future.complete(null);
- } catch(PlcException e) {
+ } catch (PlcException e) {
// If we got here, something went wrong.
future.completeExceptionally(e);
}
@@ -131,10 +154,37 @@ public abstract class NettyPlcConnection extends AbstractPlcConnection {
return channel;
}
- protected abstract ChannelHandler getChannelHandler(CompletableFuture<Void> sessionSetupCompleteFuture);
+ public ChannelHandler getChannelHandler(CompletableFuture<Void> sessionSetupCompleteFuture) {
+ if (messageCodec == null || protocolLogic == null || baseProtocolClass == null) {
+ throw new IllegalStateException("Codec Classes have to be set!");
+ }
+ return new ChannelInitializer<Channel>() {
+ @Override
+ protected void initChannel(Channel channel) {
+ // Build the protocol stack for communicating with the s7 protocol.
+ ChannelPipeline pipeline = channel.pipeline();
+ pipeline.addLast(new ChannelInboundHandlerAdapter() {
+ @Override
+ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
+ if (evt instanceof ConnectedEvent) {
+ sessionSetupCompleteFuture.complete(null);
+ } else {
+ super.userEventTriggered(ctx, evt);
+ }
+ }
+ });
+ pipeline.addLast(messageCodec);
+ Plc4xProtocolBase<BASE_PROTOCOL_CLASS> plc4xS7Protocol = protocolLogic;
+ setProtocol(plc4xS7Protocol);
+ Plc4xNettyWrapper<BASE_PROTOCOL_CLASS> context = new Plc4xNettyWrapper<>(pipeline, plc4xS7Protocol, baseProtocolClass);
+ pipeline.addLast(context);
+ }
+ };
+ }
protected void sendChannelCreatedEvent() {
- // Implemented in sub-classes, if needed.
+ logger.trace("Channel was created, firing ChannelCreated Event");
+ // Send an event to the pipeline telling the Protocol filters what's going on.
+ channel.pipeline().fireUserEventTriggered(new ConnectEvent());
}
-
}
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/NettyPlcConnection.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/NettyPlcConnection.java
index 747b725..812fbc1 100644
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/NettyPlcConnection.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/NettyPlcConnection.java
@@ -20,18 +20,32 @@ package org.apache.plc4x.java.spi.connection;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandlerAdapter;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelPipeline;
import io.netty.util.HashedWheelTimer;
import io.netty.util.Timer;
import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
import org.apache.plc4x.java.api.exceptions.PlcException;
import org.apache.plc4x.java.api.exceptions.PlcIoException;
+import org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec;
+import org.apache.plc4x.java.spi.Plc4xNettyWrapper;
import org.apache.plc4x.java.spi.Plc4xProtocolBase;
+import org.apache.plc4x.java.spi.events.ConnectEvent;
+import org.apache.plc4x.java.spi.events.ConnectedEvent;
+import org.apache.plc4x.java.spi.generation.Message;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
public abstract class NettyPlcConnection extends AbstractPlcConnection {
+ private static final Logger logger = LoggerFactory.getLogger(NettyPlcConnection.class);
+
/**
* a {@link HashedWheelTimer} shall be only instantiated once.
*/
@@ -134,7 +148,8 @@ public abstract class NettyPlcConnection extends AbstractPlcConnection {
protected abstract ChannelHandler getChannelHandler(CompletableFuture<Void> sessionSetupCompleteFuture);
protected void sendChannelCreatedEvent() {
- // Implemented in sub-classes, if needed.
+ logger.trace("Channel was created, firing ChannelCreated Event");
+ // Send an event to the pipeline telling the Protocol filters what's going on.
+ channel.pipeline().fireUserEventTriggered(new ConnectEvent());
}
-
}
diff --git a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/EvaluationHelper.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/EvaluationHelper.java
similarity index 55%
rename from plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/EvaluationHelper.java
rename to plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/EvaluationHelper.java
index c278c32..faef3ed 100644
--- a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/EvaluationHelper.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/EvaluationHelper.java
@@ -1,23 +1,23 @@
/*
- 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.
+ * 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.utils;
+package org.apache.plc4x.java.spi.generation;
public class EvaluationHelper {
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/Message.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/Message.java
new file mode 100644
index 0000000..25b9f16
--- /dev/null
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/Message.java
@@ -0,0 +1,26 @@
+/*
+ * 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.spi.generation;
+
+public interface Message {
+
+ int getLengthInBytes();
+
+}
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/MessageIO.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/MessageIO.java
new file mode 100644
index 0000000..1323320
--- /dev/null
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/MessageIO.java
@@ -0,0 +1,23 @@
+/*
+ * 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.spi.generation;
+
+public interface MessageIO<PARSER_TYPE extends Message, SERIALIZER_TYPE extends Message> extends MessageInput<PARSER_TYPE>, MessageOutput<SERIALIZER_TYPE> {
+
+}
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/MessageInput.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/MessageInput.java
new file mode 100644
index 0000000..995282d
--- /dev/null
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/MessageInput.java
@@ -0,0 +1,25 @@
+/*
+ * 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.spi.generation;
+
+public interface MessageInput<PARSER_TYPE> {
+
+ PARSER_TYPE parse(ReadBuffer io) throws ParseException;
+
+}
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/MessageOutput.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/MessageOutput.java
new file mode 100644
index 0000000..26ab0ab
--- /dev/null
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/MessageOutput.java
@@ -0,0 +1,25 @@
+/*
+ * 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.spi.generation;
+
+public interface MessageOutput<SERIALIZER_TYPE> {
+
+ void serialize(WriteBuffer io, SERIALIZER_TYPE value) throws ParseException;
+
+}
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ParseException.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ParseException.java
new file mode 100644
index 0000000..3f690b5
--- /dev/null
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ParseException.java
@@ -0,0 +1,32 @@
+/*
+ * 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.spi.generation;
+
+public class ParseException extends Exception {
+
+ public ParseException(String message) {
+ super(message);
+ }
+
+ public ParseException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/ReadBuffer.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ReadBuffer.java
similarity index 90%
rename from plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/ReadBuffer.java
rename to plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ReadBuffer.java
index 10db633..a61b20b 100644
--- a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/ReadBuffer.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/ReadBuffer.java
@@ -1,23 +1,23 @@
/*
- 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.
+ * 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.utils;
+package org.apache.plc4x.java.spi.generation;
import com.github.jinahya.bit.io.ArrayByteInput;
import com.github.jinahya.bit.io.MyDefaultBitInput;
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/StaticHelper.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/StaticHelper.java
new file mode 100644
index 0000000..ba4bc6f
--- /dev/null
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/StaticHelper.java
@@ -0,0 +1,48 @@
+/*
+ * 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.spi.generation;
+
+import java.util.Collection;
+
+public class StaticHelper {
+
+ public static int COUNT(Object obj) {
+ if (obj.getClass().isArray()) {
+ Object[] arr = (Object[]) obj;
+ return arr.length;
+ } else if (obj instanceof Collection) {
+ Collection col = (Collection) obj;
+ return col.size();
+ }
+ throw new RuntimeException("Unable to count object of type " + obj.getClass().getName());
+ }
+
+ public static <T> T CAST(Object obj, Class<T> clazz) {
+ try {
+ return clazz.cast(obj);
+ } catch (ClassCastException e) {
+ throw new RuntimeException("Unable to cast object of type " + obj.getClass().getName() + " to " + clazz.getName());
+ }
+ }
+
+ public static int CEIL(double value) {
+ return (int) Math.ceil(value);
+ }
+
+}
diff --git a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/WriteBuffer.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/WriteBuffer.java
similarity index 88%
rename from plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/WriteBuffer.java
rename to plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/WriteBuffer.java
index 8c14102..2c10848 100644
--- a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/WriteBuffer.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/WriteBuffer.java
@@ -1,23 +1,23 @@
/*
- 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.
+ * 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.utils;
+package org.apache.plc4x.java.spi.generation;
import com.github.jinahya.bit.io.BitOutput;
import com.github.jinahya.bit.io.BufferByteOutput;
diff --git a/plc4j/utils/driver-base-java/pom.xml b/plc4j/utils/driver-base-java/pom.xml
deleted file mode 100644
index e56413e..0000000
--- a/plc4j/utils/driver-base-java/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>plc4j-utils-driver-base-java</artifactId>
-
- <name>PLC4J: Utils: Driver Base: Java</name>
- <description>Base stuff containing shared base classes for java drivers.</description>
-
- <dependencies>
- <dependency>
- <groupId>com.github.jinahya</groupId>
- <artifactId>bit-io</artifactId>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-transport</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-spi</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-buffer</artifactId>
- </dependency>
- </dependencies>
-
-</project>
\ No newline at end of file
diff --git a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/Message.java b/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/Message.java
deleted file mode 100644
index e12a6bb..0000000
--- a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/Message.java
+++ /dev/null
@@ -1,26 +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.utils;
-
-public interface Message {
-
- int getLengthInBytes();
-
-}
diff --git a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/MessageIO.java b/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/MessageIO.java
deleted file mode 100644
index 34e5536..0000000
--- a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/MessageIO.java
+++ /dev/null
@@ -1,23 +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.utils;
-
-public interface MessageIO<PARSER_TYPE, SERIALIZER_TYPE> extends MessageInput<PARSER_TYPE>, MessageOutput<SERIALIZER_TYPE> {
-
-}
diff --git a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/MessageInput.java b/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/MessageInput.java
deleted file mode 100644
index 02ac2c8..0000000
--- a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/MessageInput.java
+++ /dev/null
@@ -1,25 +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.utils;
-
-public interface MessageInput<PARSER_TYPE> {
-
- PARSER_TYPE parse(ReadBuffer io) throws ParseException;
-
-}
diff --git a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/MessageOutput.java b/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/MessageOutput.java
deleted file mode 100644
index e15113c..0000000
--- a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/MessageOutput.java
+++ /dev/null
@@ -1,25 +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.utils;
-
-public interface MessageOutput<SERIALIZER_TYPE> {
-
- void serialize(WriteBuffer io, SERIALIZER_TYPE value) throws ParseException;
-
-}
diff --git a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/ParseException.java b/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/ParseException.java
deleted file mode 100644
index 04ab6a1..0000000
--- a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/ParseException.java
+++ /dev/null
@@ -1,32 +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.utils;
-
-public class ParseException extends Exception {
-
- public ParseException(String message) {
- super(message);
- }
-
- public ParseException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/StaticHelper.java b/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/StaticHelper.java
deleted file mode 100644
index 293acd3..0000000
--- a/plc4j/utils/driver-base-java/src/main/java/org/apache/plc4x/java/utils/StaticHelper.java
+++ /dev/null
@@ -1,48 +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.utils;
-
-import java.util.Collection;
-
-public class StaticHelper {
-
- public static int COUNT(Object obj) {
- if(obj.getClass().isArray()) {
- Object[] arr = (Object[]) obj;
- return arr.length;
- } else if(obj instanceof Collection) {
- Collection col = (Collection) obj;
- return col.size();
- }
- throw new RuntimeException("Unable to count object of type " + obj.getClass().getName());
- }
-
- public static <T> T CAST(Object obj, Class<T> clazz) {
- try {
- return clazz.cast(obj);
- } catch(ClassCastException e) {
- throw new RuntimeException("Unable to cast object of type " + obj.getClass().getName() + " to " + clazz.getName());
- }
- }
-
- public static int CEIL(double value) {
- return (int) Math.ceil(value);
- }
-
-}
diff --git a/plc4j/utils/pom.xml b/plc4j/utils/pom.xml
index c9fa370..b1f866c 100644
--- a/plc4j/utils/pom.xml
+++ b/plc4j/utils/pom.xml
@@ -34,8 +34,6 @@
<description>A collection of utilities used in multiple modules.</description>
<modules>
- <!-- Base module for all types of PLC4X drivers -->
- <module>driver-base-java</module>
<!-- Non-default input options -->
<module>raw-sockets</module>
<module>pcap-sockets</module>
diff --git a/plc4j/utils/protocol-test-utils/pom.xml b/plc4j/utils/protocol-test-utils/pom.xml
index 679bc5a..dc84c01 100644
--- a/plc4j/utils/protocol-test-utils/pom.xml
+++ b/plc4j/utils/protocol-test-utils/pom.xml
@@ -35,10 +35,9 @@
<dependencies>
<dependency>
<groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-driver-base-java</artifactId>
+ <artifactId>plc4j-spi</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
-
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
diff --git a/plc4j/utils/protocol-test-utils/src/main/java/org/apache/plc4x/protocol/test/ProtocolTestsuiteRunner.java b/plc4j/utils/protocol-test-utils/src/main/java/org/apache/plc4x/protocol/test/ProtocolTestsuiteRunner.java
index 8fbf7f7..e8ed7a7 100644
--- a/plc4j/utils/protocol-test-utils/src/main/java/org/apache/plc4x/protocol/test/ProtocolTestsuiteRunner.java
+++ b/plc4j/utils/protocol-test-utils/src/main/java/org/apache/plc4x/protocol/test/ProtocolTestsuiteRunner.java
@@ -24,7 +24,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
-import org.apache.plc4x.java.utils.*;
+import org.apache.plc4x.java.spi.generation.Message;
+import org.apache.plc4x.java.spi.generation.MessageIO;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
import org.apache.plc4x.protocol.test.exceptions.ProtocolTestsuiteException;
import org.apache.plc4x.protocol.test.model.ProtocolTestsuite;
import org.apache.plc4x.protocol.test.model.Testcase;
diff --git a/sandbox/plc-simulator/pom.xml b/sandbox/plc-simulator/pom.xml
index 5970976..5afaef3 100644
--- a/sandbox/plc-simulator/pom.xml
+++ b/sandbox/plc-simulator/pom.xml
@@ -77,11 +77,6 @@
</build>
<dependencies>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-driver-base-java</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>io.netty</groupId>
@@ -118,6 +113,11 @@
<!-- Scope is 'provided' as this way it's not shipped with the driver -->
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-spi</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
diff --git a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/protocol/S7Step7Protocol.java b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/protocol/S7Step7Protocol.java
index d2741cc..5b58dfa 100644
--- a/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/protocol/S7Step7Protocol.java
+++ b/sandbox/plc-simulator/src/main/java/org/apache/plc4x/simulator/server/s7/protocol/S7Step7Protocol.java
@@ -22,10 +22,10 @@ import io.netty.buffer.ByteBuf;
import org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec;
import org.apache.plc4x.java.s7.readwrite.TPKTPacket;
import org.apache.plc4x.java.s7.readwrite.io.TPKTPacketIO;
-import org.apache.plc4x.java.utils.MessageIO;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.MessageIO;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
public class S7Step7Protocol extends GeneratedDriverByteToMessageCodec<TPKTPacket> {
diff --git a/sandbox/test-java-amsads-driver/pom.xml b/sandbox/test-java-amsads-driver/pom.xml
index d408a43..631fbe0 100644
--- a/sandbox/test-java-amsads-driver/pom.xml
+++ b/sandbox/test-java-amsads-driver/pom.xml
@@ -72,11 +72,6 @@
<artifactId>plc4j-trannsport-serial</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-driver-base-java</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -134,6 +129,11 @@
<dependency>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-spi</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
<artifactId>plc4x-protocols-amsads</artifactId>
<version>0.6.0-SNAPSHOT</version>
<!-- Scope is 'provided' as this way it's not shipped with the driver -->
diff --git a/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/connection/AdsAbstractPlcConnection.java b/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/connection/AdsAbstractPlcConnection.java
index d3ea5b5..5bb766b 100644
--- a/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/connection/AdsAbstractPlcConnection.java
+++ b/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/connection/AdsAbstractPlcConnection.java
@@ -29,6 +29,7 @@ import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
import org.apache.plc4x.java.api.messages.*;
import org.apache.plc4x.java.spi.connection.ChannelFactory;
+import org.apache.plc4x.java.spi.connection.GenericNettyPlcConnection;
import org.apache.plc4x.java.spi.connection.NettyPlcConnection;
import org.apache.plc4x.java.spi.messages.*;
import org.slf4j.Logger;
@@ -38,7 +39,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.concurrent.*;
-public abstract class AdsAbstractPlcConnection extends NettyPlcConnection implements PlcReader, PlcWriter, PlcProprietarySender {
+public abstract class AdsAbstractPlcConnection extends GenericNettyPlcConnection implements PlcReader, PlcWriter, PlcProprietarySender {
private static final Logger LOGGER = LoggerFactory.getLogger(AdsAbstractPlcConnection.class);
diff --git a/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/connection/AdsSerialPlcConnection.java b/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/connection/AdsSerialPlcConnection.java
index 8eba3fc..87e0e90 100644
--- a/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/connection/AdsSerialPlcConnection.java
+++ b/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/connection/AdsSerialPlcConnection.java
@@ -49,19 +49,20 @@ public class AdsSerialPlcConnection extends AdsAbstractPlcConnection {
return new AdsSerialPlcConnection(serialPort, targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort);
}
- @Override
- protected ChannelHandler getChannelHandler(CompletableFuture<Void> sessionSetupCompleteFuture) {
- return new ChannelInitializer<Channel>() {
- @Override
- protected void initChannel(Channel channel) {
- // Build the protocol stack for communicating with the ads protocol.
- ChannelPipeline pipeline = channel.pipeline();
- pipeline.addLast(new Payload2SerialProtocol());
- pipeline.addLast(new Ads2PayloadProtocol());
- pipeline.addLast(new Plc4x2AdsProtocol(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, fieldMapping));
- pipeline.addLast(new SingleItemToSingleRequestProtocol(AdsSerialPlcConnection.this, AdsSerialPlcConnection.this, null, timer));
- }
- };
- }
+ // TODO fix this
+// @Override
+// protected ChannelHandler getChannelHandler(CompletableFuture<Void> sessionSetupCompleteFuture) {
+// return new ChannelInitializer<Channel>() {
+// @Override
+// protected void initChannel(Channel channel) {
+// // Build the protocol stack for communicating with the ads protocol.
+// ChannelPipeline pipeline = channel.pipeline();
+// pipeline.addLast(new Payload2SerialProtocol());
+// pipeline.addLast(new Ads2PayloadProtocol());
+// pipeline.addLast(new Plc4x2AdsProtocol(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, fieldMapping));
+// pipeline.addLast(new SingleItemToSingleRequestProtocol(AdsSerialPlcConnection.this, AdsSerialPlcConnection.this, null, timer));
+// }
+// };
+// }
}
diff --git a/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/connection/AdsTcpPlcConnection.java b/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/connection/AdsTcpPlcConnection.java
index b8333b7..0b2c489 100644
--- a/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/connection/AdsTcpPlcConnection.java
+++ b/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/connection/AdsTcpPlcConnection.java
@@ -108,20 +108,21 @@ public class AdsTcpPlcConnection extends AdsAbstractPlcConnection implements Plc
return new AdsTcpPlcConnection(address, port, targetAmsNetId, targetint, sourceAmsNetId, sourceint);
}
- @Override
- protected ChannelHandler getChannelHandler(CompletableFuture<Void> sessionSetupCompleteFuture) {
- return new ChannelInitializer<Channel>() {
- @Override
- protected void initChannel(Channel channel) {
- // Build the protocol stack for communicating with the ads protocol.
- ChannelPipeline pipeline = channel.pipeline();
- pipeline.addLast(new Payload2TcpProtocol());
- pipeline.addLast(new Ads2PayloadProtocol());
- pipeline.addLast(new Plc4x2AdsProtocol(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, fieldMapping));
- pipeline.addLast(new SingleItemToSingleRequestProtocol(AdsTcpPlcConnection.this, AdsTcpPlcConnection.this, AdsTcpPlcConnection.this, timer, SingleItemToSingleRequestProtocol.SplitConfig.builder().dontSplitSubscribe().dontSplitUnsubscribe().build(), false));
- }
- };
- }
+ // TODO fix that
+// @Override
+// protected ChannelHandler getChannelHandler(CompletableFuture<Void> sessionSetupCompleteFuture) {
+// return new ChannelInitializer<Channel>() {
+// @Override
+// protected void initChannel(Channel channel) {
+// // Build the protocol stack for communicating with the ads protocol.
+// ChannelPipeline pipeline = channel.pipeline();
+// pipeline.addLast(new Payload2TcpProtocol());
+// pipeline.addLast(new Ads2PayloadProtocol());
+// pipeline.addLast(new Plc4x2AdsProtocol(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, fieldMapping));
+// pipeline.addLast(new SingleItemToSingleRequestProtocol(AdsTcpPlcConnection.this, AdsTcpPlcConnection.this, AdsTcpPlcConnection.this, timer, SingleItemToSingleRequestProtocol.SplitConfig.builder().dontSplitSubscribe().dontSplitUnsubscribe().build(), false));
+// }
+// };
+// }
public InetAddress getRemoteAddress() {
return ((TcpSocketChannelFactory) channelFactory).getAddress();
diff --git a/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/protocol/Ads2PayloadProtocol.java b/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/protocol/Ads2PayloadProtocol.java
index 4926d17..41a8c92 100644
--- a/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/protocol/Ads2PayloadProtocol.java
+++ b/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/protocol/Ads2PayloadProtocol.java
@@ -25,9 +25,9 @@ import io.netty.handler.codec.MessageToMessageCodec;
import org.apache.plc4x.java.amsads.protocol.exception.AdsException;
import org.apache.plc4x.java.amsads.readwrite.AmsPacket;
import org.apache.plc4x.java.amsads.readwrite.io.AmsPacketIO;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/protocol/Payload2SerialProtocol.java b/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/protocol/Payload2SerialProtocol.java
index 939fa17..59c101c 100644
--- a/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/protocol/Payload2SerialProtocol.java
+++ b/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/protocol/Payload2SerialProtocol.java
@@ -20,33 +20,25 @@ package org.apache.plc4x.java.amsads.protocol;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageCodec;
-import io.netty.util.ReferenceCountUtil;
import io.netty.util.concurrent.ScheduledFuture;
import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.mutable.MutableInt;
import org.apache.plc4x.java.amsads.protocol.exception.AdsException;
import org.apache.plc4x.java.amsads.protocol.util.DigestUtil;
import org.apache.plc4x.java.amsads.readwrite.AmsPacket;
import org.apache.plc4x.java.amsads.readwrite.AmsSerialFrame;
import org.apache.plc4x.java.amsads.readwrite.AmsTCPPacket;
-import org.apache.plc4x.java.amsads.readwrite.AmsTcpHeader;
import org.apache.plc4x.java.amsads.readwrite.io.AmsPacketIO;
import org.apache.plc4x.java.amsads.readwrite.io.AmsSerialFrameIO;
import org.apache.plc4x.java.amsads.readwrite.io.AmsTCPPacketIO;
-import org.apache.plc4x.java.api.exceptions.PlcProtocolException;
-import org.apache.plc4x.java.api.exceptions.PlcProtocolPayloadTooBigException;
-import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
diff --git a/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/protocol/Payload2TcpProtocol.java b/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/protocol/Payload2TcpProtocol.java
index 7c95783..eafb8f3 100644
--- a/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/protocol/Payload2TcpProtocol.java
+++ b/sandbox/test-java-amsads-driver/src/main/java/org/apache/plc4x/java/amsads/protocol/Payload2TcpProtocol.java
@@ -28,9 +28,9 @@ import org.apache.plc4x.java.amsads.readwrite.AmsTCPPacket;
import org.apache.plc4x.java.amsads.readwrite.AmsTcpHeader;
import org.apache.plc4x.java.amsads.readwrite.io.AmsPacketIO;
import org.apache.plc4x.java.amsads.readwrite.io.AmsTCPPacketIO;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/sandbox/test-java-amsads-driver/src/test/java/org/apache/plc4x/protocol/amsads/BenchmarkGeneratedDf1.java b/sandbox/test-java-amsads-driver/src/test/java/org/apache/plc4x/protocol/amsads/BenchmarkGeneratedDf1.java
index f9e1561..696c9f8 100644
--- a/sandbox/test-java-amsads-driver/src/test/java/org/apache/plc4x/protocol/amsads/BenchmarkGeneratedDf1.java
+++ b/sandbox/test-java-amsads-driver/src/test/java/org/apache/plc4x/protocol/amsads/BenchmarkGeneratedDf1.java
@@ -19,10 +19,6 @@
package org.apache.plc4x.protocol.amsads;
-import com.fazecast.jSerialComm.SerialPort;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
-
public class BenchmarkGeneratedDf1 {
public static void main(String[] args) throws Exception {
diff --git a/sandbox/test-java-amsads-driver/src/test/java/org/apache/plc4x/protocol/amsads/IOTest.java b/sandbox/test-java-amsads-driver/src/test/java/org/apache/plc4x/protocol/amsads/IOTest.java
index 66d7d7d..e944d0b 100644
--- a/sandbox/test-java-amsads-driver/src/test/java/org/apache/plc4x/protocol/amsads/IOTest.java
+++ b/sandbox/test-java-amsads-driver/src/test/java/org/apache/plc4x/protocol/amsads/IOTest.java
@@ -19,12 +19,6 @@
package org.apache.plc4x.protocol.amsads;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.dataformat.xml.XmlMapper;
-import org.apache.commons.codec.binary.Hex;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.junit.jupiter.api.Test;
-
public class IOTest {
/* @Test
diff --git a/sandbox/test-java-bacnetip-driver/pom.xml b/sandbox/test-java-bacnetip-driver/pom.xml
index daffa9a..6fb2856 100644
--- a/sandbox/test-java-bacnetip-driver/pom.xml
+++ b/sandbox/test-java-bacnetip-driver/pom.xml
@@ -59,11 +59,6 @@
<artifactId>plc4j-api</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-driver-base-java</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>org.apache.plc4x</groupId>
diff --git a/sandbox/test-java-bacnetip-driver/src/main/java/org/apache/plc4x/java/bacnetip/protocol/BacNetIpProtocol.java b/sandbox/test-java-bacnetip-driver/src/main/java/org/apache/plc4x/java/bacnetip/protocol/BacNetIpProtocol.java
index 9f0a069..4c93d68 100644
--- a/sandbox/test-java-bacnetip-driver/src/main/java/org/apache/plc4x/java/bacnetip/protocol/BacNetIpProtocol.java
+++ b/sandbox/test-java-bacnetip-driver/src/main/java/org/apache/plc4x/java/bacnetip/protocol/BacNetIpProtocol.java
@@ -22,10 +22,10 @@ import io.netty.buffer.ByteBuf;
import org.apache.plc4x.java.bacnetip.readwrite.BVLC;
import org.apache.plc4x.java.bacnetip.readwrite.io.BVLCIO;
import org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec;
-import org.apache.plc4x.java.utils.MessageIO;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.MessageIO;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
public class BacNetIpProtocol extends GeneratedDriverByteToMessageCodec<BVLC> {
diff --git a/sandbox/test-java-bacnetip-driver/src/test/java/org/apache/plc4x/java/bacnetip/ManualBacNetDecoder.java b/sandbox/test-java-bacnetip-driver/src/test/java/org/apache/plc4x/java/bacnetip/ManualBacNetDecoder.java
index d7ca1c3..ddfd9b0 100644
--- a/sandbox/test-java-bacnetip-driver/src/test/java/org/apache/plc4x/java/bacnetip/ManualBacNetDecoder.java
+++ b/sandbox/test-java-bacnetip-driver/src/test/java/org/apache/plc4x/java/bacnetip/ManualBacNetDecoder.java
@@ -21,7 +21,7 @@ package org.apache.plc4x.java.bacnetip;
import org.apache.commons.codec.binary.Hex;
import org.apache.plc4x.java.bacnetip.readwrite.BVLC;
import org.apache.plc4x.java.bacnetip.readwrite.io.BVLCIO;
-import org.apache.plc4x.java.utils.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
public class ManualBacNetDecoder {
diff --git a/sandbox/test-java-df1-driver/pom.xml b/sandbox/test-java-df1-driver/pom.xml
index b5a5d27..005aa31 100644
--- a/sandbox/test-java-df1-driver/pom.xml
+++ b/sandbox/test-java-df1-driver/pom.xml
@@ -70,11 +70,6 @@
<artifactId>plc4j-trannsport-serial</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-driver-base-java</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>io.netty</groupId>
diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/protocol/Df1Protocol.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/protocol/Df1Protocol.java
index e7420b9..273d875 100644
--- a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/protocol/Df1Protocol.java
+++ b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/protocol/Df1Protocol.java
@@ -27,8 +27,8 @@ import org.apache.plc4x.java.df1.readwrite.DF1Command;
import org.apache.plc4x.java.df1.readwrite.DF1Symbol;
import org.apache.plc4x.java.df1.readwrite.DF1SymbolMessageFrame;
import org.apache.plc4x.java.df1.readwrite.io.DF1SymbolIO;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,7 +59,7 @@ public class Df1Protocol extends PlcByteToMessageCodec<DF1Command> {
// Serialize the message
WriteBuffer writeBuffer = new WriteBuffer(frame.getLengthInBytes(), false);
- df1SymbolIO.serialize(writeBuffer, frame);
+ DF1SymbolIO.serialize(writeBuffer, frame);
byte[] data = writeBuffer.getData();
// Send the serialized data
@@ -138,7 +138,7 @@ public class Df1Protocol extends PlcByteToMessageCodec<DF1Command> {
in.readBytes(data);
ReadBuffer readBuffer = new ReadBuffer(data, false);
- resp = df1SymbolIO.parse(readBuffer);
+ resp = DF1SymbolIO.parse(readBuffer);
// } while (readWasSucessfull);
// // TODO if unableto read
diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/util/DF1Utils.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/util/DF1Utils.java
index df5f009..023d0e5 100644
--- a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/util/DF1Utils.java
+++ b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/util/DF1Utils.java
@@ -21,9 +21,9 @@ package org.apache.plc4x.java.df1.util;
import org.apache.plc4x.java.df1.readwrite.DF1Command;
import org.apache.plc4x.java.df1.readwrite.DF1UnprotectedReadRequest;
import org.apache.plc4x.java.df1.readwrite.DF1UnprotectedReadResponse;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
public class DF1Utils {
diff --git a/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/BenchmarkGeneratedDf1.java b/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/BenchmarkGeneratedDf1.java
index 27c9be2..1f9d371 100644
--- a/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/BenchmarkGeneratedDf1.java
+++ b/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/BenchmarkGeneratedDf1.java
@@ -19,11 +19,6 @@
package org.apache.plc4x.protocol.df1;
-import com.fazecast.jSerialComm.SerialPort;
-import org.apache.plc4x.java.df1.*;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
-
public class BenchmarkGeneratedDf1 {
public static void main(String[] args) throws Exception {
diff --git a/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/IOTest.java b/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/IOTest.java
index 6179b7f..5f8a7b7 100644
--- a/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/IOTest.java
+++ b/sandbox/test-java-df1-driver/src/test/java/org/apache/plc4x/protocol/df1/IOTest.java
@@ -24,7 +24,7 @@ import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import org.apache.commons.codec.binary.Hex;
import org.apache.plc4x.java.df1.readwrite.DF1Symbol;
import org.apache.plc4x.java.df1.readwrite.io.DF1SymbolIO;
-import org.apache.plc4x.java.utils.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
import org.junit.jupiter.api.Test;
public class IOTest {
diff --git a/sandbox/test-java-knxnetip-driver-passive/pom.xml b/sandbox/test-java-knxnetip-driver-passive/pom.xml
index c051e45..8f08ef7 100644
--- a/sandbox/test-java-knxnetip-driver-passive/pom.xml
+++ b/sandbox/test-java-knxnetip-driver-passive/pom.xml
@@ -59,11 +59,6 @@
<artifactId>plc4j-api</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-driver-base-java</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>org.apache.plc4x</groupId>
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/protocol/KnxNetIpProtocolMessage.java b/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/protocol/KnxNetIpProtocolMessage.java
index d65e1c9..fec502f 100644
--- a/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/protocol/KnxNetIpProtocolMessage.java
+++ b/sandbox/test-java-knxnetip-driver-passive/src/main/java/org/apache/plc4x/java/passive/knxnetip/protocol/KnxNetIpProtocolMessage.java
@@ -22,10 +22,10 @@ import io.netty.buffer.ByteBuf;
import org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec;
import org.apache.plc4x.java.knxnetip.passive.KNXNetIPMessage;
import org.apache.plc4x.java.knxnetip.passive.io.KNXNetIPMessageIO;
-import org.apache.plc4x.java.utils.MessageIO;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.MessageIO;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
public class KnxNetIpProtocolMessage extends GeneratedDriverByteToMessageCodec<KNXNetIPMessage> {
diff --git a/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java b/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java
index 952ff89..231a929 100644
--- a/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java
+++ b/sandbox/test-java-knxnetip-driver-passive/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java
@@ -24,12 +24,9 @@ import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import org.apache.commons.codec.binary.Hex;
import org.apache.plc4x.java.knxnetip.passive.KNXNetIPMessage;
import org.apache.plc4x.java.knxnetip.passive.io.KNXNetIPMessageIO;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
-
public class IOTest {
@Test
@@ -68,7 +65,7 @@ public class IOTest {
KNXNetIPMessage packet = null;
for(int i = 0; i < numRunsParse; i++) {
ReadBuffer rBuf = new ReadBuffer(rData);
- packet = knxNetIPMessageIO.parse(rBuf);
+ packet = KNXNetIPMessageIO.parse(rBuf);
}
long endParsing = System.currentTimeMillis();
diff --git a/sandbox/test-java-knxnetip-driver/pom.xml b/sandbox/test-java-knxnetip-driver/pom.xml
index e11d274..799cd1f 100644
--- a/sandbox/test-java-knxnetip-driver/pom.xml
+++ b/sandbox/test-java-knxnetip-driver/pom.xml
@@ -61,7 +61,7 @@
</dependency>
<dependency>
<groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-driver-base-java</artifactId>
+ <artifactId>plc4j-spi</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
diff --git a/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/protocol/KnxNetIpProtocolLogic.java b/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/protocol/KnxNetIpProtocolLogic.java
index fe0dee9..914526b 100644
--- a/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/protocol/KnxNetIpProtocolLogic.java
+++ b/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/protocol/KnxNetIpProtocolLogic.java
@@ -34,7 +34,7 @@ import org.apache.plc4x.java.knxnetip.readwrite.*;
import org.apache.plc4x.java.knxnetip.readwrite.types.HostProtocolCode;
import org.apache.plc4x.java.knxnetip.readwrite.types.KnxLayer;
import org.apache.plc4x.java.knxnetip.readwrite.types.Status;
-import org.apache.plc4x.java.utils.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/protocol/KnxNetIpProtocolMessage.java b/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/protocol/KnxNetIpProtocolMessage.java
index 8078a3f..1c93ac0 100644
--- a/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/protocol/KnxNetIpProtocolMessage.java
+++ b/sandbox/test-java-knxnetip-driver/src/main/java/org/apache/plc4x/java/knxnetip/protocol/KnxNetIpProtocolMessage.java
@@ -22,10 +22,10 @@ import io.netty.buffer.ByteBuf;
import org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec;
import org.apache.plc4x.java.knxnetip.readwrite.KNXNetIPMessage;
import org.apache.plc4x.java.knxnetip.readwrite.io.KNXNetIPMessageIO;
-import org.apache.plc4x.java.utils.MessageIO;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.MessageIO;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
public class KnxNetIpProtocolMessage extends GeneratedDriverByteToMessageCodec<KNXNetIPMessage> {
diff --git a/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java b/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java
index 711c1ae..5a1c6a1 100644
--- a/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java
+++ b/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java
@@ -24,8 +24,8 @@ import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import org.apache.commons.codec.binary.Hex;
import org.apache.plc4x.java.knxnetip.readwrite.KNXNetIPMessage;
import org.apache.plc4x.java.knxnetip.readwrite.io.KNXNetIPMessageIO;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
@@ -68,7 +68,7 @@ public class IOTest {
KNXNetIPMessage packet = null;
for(int i = 0; i < numRunsParse; i++) {
ReadBuffer rBuf = new ReadBuffer(rData);
- packet = knxNetIPMessageIO.parse(rBuf);
+ packet = KNXNetIPMessageIO.parse(rBuf);
}
long endParsing = System.currentTimeMillis();
@@ -80,7 +80,7 @@ public class IOTest {
byte[] oData = null;
for(int i = 0; i < numRunsSerialize; i++) {
WriteBuffer wBuf = new WriteBuffer(packet.getLengthInBytes());
- knxNetIPMessageIO.serialize(wBuf, packet);
+ KNXNetIPMessageIO.serialize(wBuf, packet);
oData = wBuf.getData();
}
long endSerializing = System.currentTimeMillis();
diff --git a/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/ManualKnxNetIpWithEts5.java b/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/ManualKnxNetIpWithEts5.java
index f94fb1e..c055b78 100644
--- a/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/ManualKnxNetIpWithEts5.java
+++ b/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/ManualKnxNetIpWithEts5.java
@@ -18,30 +18,21 @@ under the License.
*/
package org.apache.plc4x.java.knxnetip;
-import io.netty.channel.ChannelHandlerContext;
-import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
import org.apache.plc4x.java.base.connection.UdpSocketChannelFactory;
-import org.apache.plc4x.java.spi.PlcMessageToMessageCodec;
import org.apache.plc4x.java.spi.connection.ChannelFactory;
import org.apache.plc4x.java.spi.connection.NettyPlcConnection;
-import org.apache.plc4x.java.spi.messages.PlcRequestContainer;
import org.apache.plc4x.java.ets5.passive.*;
-import org.apache.plc4x.java.ets5.passive.io.KNXGroupAddressIO;
-import org.apache.plc4x.java.ets5.passive.io.KnxDatapointIO;
import org.apache.plc4x.java.knxnetip.connection.KnxNetIpConnection;
import org.apache.plc4x.java.knxnetip.ets5.Ets5Parser;
import org.apache.plc4x.java.knxnetip.ets5.model.Ets5Model;
-import org.apache.plc4x.java.knxnetip.ets5.model.GroupAddress;
import org.apache.plc4x.java.knxnetip.readwrite.*;
-import org.apache.plc4x.java.utils.ReadBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.List;
import java.util.concurrent.TimeUnit;
public class ManualKnxNetIpWithEts5 {
diff --git a/sandbox/test-java-knxnetip-shared/pom.xml b/sandbox/test-java-knxnetip-shared/pom.xml
index 80b3f9b..6fc3859 100644
--- a/sandbox/test-java-knxnetip-shared/pom.xml
+++ b/sandbox/test-java-knxnetip-shared/pom.xml
@@ -55,12 +55,6 @@
<dependencies>
<dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-driver-base-java</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
@@ -80,6 +74,12 @@
<dependency>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-spi</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
<artifactId>plc4x-protocols-knxnetip</artifactId>
<version>0.6.0-SNAPSHOT</version>
<!-- Scope is 'provided' as this way it's not shipped with the driver -->
diff --git a/sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/Ets5Parser.java b/sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/Ets5Parser.java
index 09d4d31..b9e23bf 100644
--- a/sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/Ets5Parser.java
+++ b/sandbox/test-java-knxnetip-shared/src/main/java/org/apache/plc4x/java/knxnetip/ets5/Ets5Parser.java
@@ -26,8 +26,8 @@ import org.apache.plc4x.java.knxnetip.ets5.model.AddressType;
import org.apache.plc4x.java.knxnetip.ets5.model.Ets5Model;
import org.apache.plc4x.java.knxnetip.ets5.model.Function;
import org.apache.plc4x.java.knxnetip.ets5.model.GroupAddress;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
diff --git a/sandbox/test-java-s7-driver-passive/pom.xml b/sandbox/test-java-s7-driver-passive/pom.xml
index c3704fd..259972b 100644
--- a/sandbox/test-java-s7-driver-passive/pom.xml
+++ b/sandbox/test-java-s7-driver-passive/pom.xml
@@ -61,11 +61,6 @@
</dependency>
<dependency>
<groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-driver-base-java</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
<artifactId>plc4j-transport-raw-socket</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
diff --git a/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/protocol/PassiveS7Protocol.java b/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/protocol/PassiveS7Protocol.java
index 79d2077..00f3260 100644
--- a/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/protocol/PassiveS7Protocol.java
+++ b/sandbox/test-java-s7-driver-passive/src/main/java/org/apache/plc4x/javapassive/s7/protocol/PassiveS7Protocol.java
@@ -23,7 +23,7 @@ import io.netty.channel.ChannelHandlerContext;
import org.apache.plc4x.java.spi.PlcByteToMessageCodec;
import org.apache.plc4x.java.s7.passive.TPKTPacket;
import org.apache.plc4x.java.s7.passive.io.TPKTPacketIO;
-import org.apache.plc4x.java.utils.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,7 +51,7 @@ public class PassiveS7Protocol extends PlcByteToMessageCodec<TPKTPacket> {
ReadBuffer readBuffer = new ReadBuffer(bytes);
while(readBuffer.getPos() < bytes.length) {
try {
- TPKTPacket packet = io.parse(readBuffer);
+ TPKTPacket packet = TPKTPacketIO.parse(readBuffer);
out.add(packet);
} catch(Exception e) {
logger.warn("Error decoding package: " + e.getMessage());
diff --git a/sandbox/test-java-s7-driver-passive/src/test/java/BenchmarkGeneratedPassiveS7.java b/sandbox/test-java-s7-driver-passive/src/test/java/BenchmarkGeneratedPassiveS7.java
index a9ecd7a..58295b6 100644
--- a/sandbox/test-java-s7-driver-passive/src/test/java/BenchmarkGeneratedPassiveS7.java
+++ b/sandbox/test-java-s7-driver-passive/src/test/java/BenchmarkGeneratedPassiveS7.java
@@ -20,7 +20,7 @@
import org.apache.commons.codec.binary.Hex;
import org.apache.plc4x.java.s7.passive.TPKTPacket;
import org.apache.plc4x.java.s7.passive.io.TPKTPacketIO;
-import org.apache.plc4x.java.utils.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
public class BenchmarkGeneratedPassiveS7 {
@@ -34,7 +34,7 @@ public class BenchmarkGeneratedPassiveS7 {
TPKTPacket packet = null;
for(int i = 0; i < numRunsParse; i++) {
ReadBuffer rBuf = new ReadBuffer(rData);
- packet = tpktPacketIO.parse(rBuf);
+ packet = TPKTPacketIO.parse(rBuf);
}
long endParsing = System.currentTimeMillis();
diff --git a/sandbox/test-java-s7-driver/pom.xml b/sandbox/test-java-s7-driver/pom.xml
index 355fda6..222cca5 100644
--- a/sandbox/test-java-s7-driver/pom.xml
+++ b/sandbox/test-java-s7-driver/pom.xml
@@ -71,11 +71,6 @@
<artifactId>plc4j-api</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-utils-driver-base-java</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>org.apache.plc4x</groupId>
diff --git a/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/S7Driver.java b/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/S7Driver.java
index d61fc03..6869873 100644
--- a/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/S7Driver.java
+++ b/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/S7Driver.java
@@ -54,7 +54,8 @@ public class S7Driver implements PlcDriver {
}
String host = matcher.group("host");
- String params = matcher.group("params") != null ? matcher.group("params").substring(1) : null;
+ // String params = matcher.group("params") != null ? matcher.group("params").substring(1) : null;
+ String params = "";
try {
InetAddress serverInetAddress = InetAddress.getByName(host);
diff --git a/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/connection/S7Connection.java b/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/connection/S7Connection.java
index 5546d09..6522496 100644
--- a/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/connection/S7Connection.java
+++ b/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/connection/S7Connection.java
@@ -22,6 +22,7 @@ import io.netty.channel.*;
import org.apache.plc4x.java.api.messages.PlcReadRequest;
import org.apache.plc4x.java.api.messages.PlcWriteRequest;
import org.apache.plc4x.java.spi.connection.ChannelFactory;
+import org.apache.plc4x.java.spi.connection.GenericNettyPlcConnection;
import org.apache.plc4x.java.spi.connection.NettyPlcConnection;
import org.apache.plc4x.java.spi.events.ConnectEvent;
import org.apache.plc4x.java.spi.events.ConnectedEvent;
@@ -43,77 +44,24 @@ import org.slf4j.LoggerFactory;
import java.net.InetAddress;
import java.util.concurrent.CompletableFuture;
-public class S7Connection extends NettyPlcConnection implements PlcReader, PlcWriter {
+public class S7Connection extends GenericNettyPlcConnection<TPKTPacket> implements PlcReader, PlcWriter {
private static final int ISO_ON_TCP_PORT = 102;
private static final Logger logger = LoggerFactory.getLogger(S7Connection.class);
- private final S7Configuration configuration;
-
public S7Connection(InetAddress address, String params) {
this(new TcpSocketChannelFactory(address, ISO_ON_TCP_PORT), params);
}
public S7Connection(ChannelFactory channelFactory, String params) {
- super(channelFactory, true, new S7PlcFieldHandler());
-
- configuration = ConnectionParser.parse("a://1.1.1.1/" + params, S7Configuration.class);
-
- logger.info("Setting up S7 Connection with Configuration: {}", configuration);
- }
-
- @Override
- public boolean canRead() {
- return true;
- }
-
- @Override
- public boolean canWrite() {
- return true;
- }
-
- @Override
- protected ChannelHandler getChannelHandler(CompletableFuture<Void> sessionSetupCompleteFuture) {
- return new ChannelInitializer<Channel>() {
- @Override
- protected void initChannel(Channel channel) {
- // Build the protocol stack for communicating with the s7 protocol.
- ChannelPipeline pipeline = channel.pipeline();
- pipeline.addLast(new ChannelInboundHandlerAdapter() {
- @Override
- public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
- if (evt instanceof ConnectedEvent) {
- sessionSetupCompleteFuture.complete(null);
- } else {
- super.userEventTriggered(ctx, evt);
- }
- }
- });
- pipeline.addLast(new S7ProtocolMessage());
- Plc4xProtocolBase<TPKTPacket> plc4xS7Protocol = new S7ProtocolLogic(configuration);
- setProtocol(plc4xS7Protocol);
- Plc4xNettyWrapper<TPKTPacket> context = new Plc4xNettyWrapper<>(pipeline, plc4xS7Protocol, TPKTPacket.class);
- pipeline.addLast(context);
- }
- };
- }
-
- @Override
- public PlcReadRequest.Builder readRequestBuilder() {
- return new DefaultPlcReadRequest.Builder(this, new S7PlcFieldHandler());
- }
-
- @Override
- public PlcWriteRequest.Builder writeRequestBuilder() {
- return new DefaultPlcWriteRequest.Builder(this, new S7PlcFieldHandler());
- }
-
- @Override
- protected void sendChannelCreatedEvent() {
- logger.trace("Channel was created, firing ChannelCreated Event");
- // Send an event to the pipeline telling the Protocol filters what's going on.
- channel.pipeline().fireUserEventTriggered(new ConnectEvent());
+ super(channelFactory, true, new S7PlcFieldHandler(),
+ TPKTPacket.class,
+ new S7ProtocolMessage(),
+ new S7ProtocolLogic(
+ ConnectionParser.parse("a://1.1.1.1/" + params, S7Configuration.class)
+ )
+ );
}
}
diff --git a/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolLogic.java b/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolLogic.java
index f569c31..247fbad 100644
--- a/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolLogic.java
+++ b/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolLogic.java
@@ -46,9 +46,9 @@ import org.apache.plc4x.java.spi.ConversationContext;
import org.apache.plc4x.java.spi.Plc4xProtocolBase;
import org.apache.plc4x.java.spi.messages.*;
import org.apache.plc4x.java.spi.messages.items.*;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolMessage.java b/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolMessage.java
index 6bf373a..437229b 100644
--- a/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolMessage.java
+++ b/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolMessage.java
@@ -22,10 +22,10 @@ import io.netty.buffer.ByteBuf;
import org.apache.plc4x.java.s7.readwrite.TPKTPacket;
import org.apache.plc4x.java.s7.readwrite.io.TPKTPacketIO;
import org.apache.plc4x.java.spi.GeneratedDriverByteToMessageCodec;
-import org.apache.plc4x.java.utils.MessageIO;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.MessageIO;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/utils/StaticHelper.java b/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/utils/StaticHelper.java
index 2eb9fbd..60bf88a 100644
--- a/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/utils/StaticHelper.java
+++ b/sandbox/test-java-s7-driver/src/main/java/org/apache/plc4x/java/s7/readwrite/utils/StaticHelper.java
@@ -19,9 +19,9 @@ under the License.
package org.apache.plc4x.java.s7.readwrite.utils;
import org.apache.commons.lang3.NotImplementedException;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
import java.time.LocalDate;
import java.time.LocalDateTime;
diff --git a/sandbox/test-java-s7-driver/src/test/java/BenchmarkGeneratedS7.java b/sandbox/test-java-s7-driver/src/test/java/BenchmarkGeneratedS7.java
index 67cbe2f..1c22562 100644
--- a/sandbox/test-java-s7-driver/src/test/java/BenchmarkGeneratedS7.java
+++ b/sandbox/test-java-s7-driver/src/test/java/BenchmarkGeneratedS7.java
@@ -20,8 +20,8 @@
import org.apache.commons.codec.binary.Hex;
import org.apache.plc4x.java.s7.readwrite.TPKTPacket;
import org.apache.plc4x.java.s7.readwrite.io.TPKTPacketIO;
-import org.apache.plc4x.java.utils.ReadBuffer;
-import org.apache.plc4x.java.utils.WriteBuffer;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.WriteBuffer;
import java.util.Arrays;
@@ -37,7 +37,7 @@ public class BenchmarkGeneratedS7 {
TPKTPacket packet = null;
for(int i = 0; i < numRunsParse; i++) {
ReadBuffer rBuf = new ReadBuffer(rData);
- packet = tpktPacketIO.parse(rBuf);
+ packet = TPKTPacketIO.parse(rBuf);
}
long endParsing = System.currentTimeMillis();
@@ -49,7 +49,7 @@ public class BenchmarkGeneratedS7 {
byte[] oData = null;
for(int i = 0; i < numRunsSerialize; i++) {
WriteBuffer wBuf = new WriteBuffer(packet.getLengthInBytes());
- tpktPacketIO.serialize(wBuf, packet);
+ TPKTPacketIO.serialize(wBuf, packet);
oData = wBuf.getData();
}
long endSerializing = System.currentTimeMillis();
diff --git a/sandbox/test-streampipes-plc4x-processors/src/main/java/org/apache/plc4x/java/streampipes/processors/enrich/knxnetip/ets5/Ets5DataEnrichment.java b/sandbox/test-streampipes-plc4x-processors/src/main/java/org/apache/plc4x/java/streampipes/processors/enrich/knxnetip/ets5/Ets5DataEnrichment.java
index bc08b31..cfdc0ae 100644
--- a/sandbox/test-streampipes-plc4x-processors/src/main/java/org/apache/plc4x/java/streampipes/processors/enrich/knxnetip/ets5/Ets5DataEnrichment.java
+++ b/sandbox/test-streampipes-plc4x-processors/src/main/java/org/apache/plc4x/java/streampipes/processors/enrich/knxnetip/ets5/Ets5DataEnrichment.java
@@ -24,8 +24,8 @@ import org.apache.plc4x.java.ets5.passive.io.KnxDatapointIO;
import org.apache.plc4x.java.knxnetip.ets5.Ets5Parser;
import org.apache.plc4x.java.knxnetip.ets5.model.Ets5Model;
import org.apache.plc4x.java.knxnetip.ets5.model.GroupAddress;
-import org.apache.plc4x.java.utils.ParseException;
-import org.apache.plc4x.java.utils.ReadBuffer;
+import org.apache.plc4x.java.spi.generation.ParseException;
+import org.apache.plc4x.java.spi.generation.ReadBuffer;
import org.streampipes.model.runtime.Event;
import org.streampipes.wrapper.context.EventProcessorRuntimeContext;
import org.streampipes.wrapper.routing.SpOutputCollector;
@@ -38,7 +38,7 @@ public class Ets5DataEnrichment implements EventProcessor<Ets5DataEnrichmentPara
private String destinationIdFieldName;
private String payloadIdFieldName;
// TODO: Make this dynamic.
- private static final Ets5Model ets5Model = new Ets5Parser().parse(new File("/Users/christofer.dutz/Projects/Apache/PLC4X-Documents/KNX/Stettiner Str. 13/StettinerStr-Soll-Ist-Temperatur.knxproj"));;
+ private static final Ets5Model ets5Model = new Ets5Parser().parse(new File("/Users/christofer.dutz/Projects/Apache/PLC4X-Documents/KNX/Stettiner Str. 13/StettinerStr-Soll-Ist-Temperatur.knxproj"));
@Override
public void onInvocation(Ets5DataEnrichmentParameters params, SpOutputCollector spOutputCollector,