You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2019/06/17 14:35:24 UTC
[plc4x] branch feature/code-gen updated: - Moved the code that
would be required for all Java drivers into a new driver-base-java module.
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/code-gen
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/feature/code-gen by this push:
new 52fe281 - Moved the code that would be required for all Java drivers into a new driver-base-java module.
52fe281 is described below
commit 52fe28143343282684b94109480a4f10edb6e4d7
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Jun 17 16:35:15 2019 +0200
- Moved the code that would be required for all Java drivers into a new driver-base-java module.
---
.../language-driver-base-java/pom.xml | 49 ++++++++++++++++++++++
.../github/jinahya/bit/io/MyDefaultBitInput.java | 0
.../apache/plc4x/java/utils/EvaluationHelper.java | 0
.../apache/plc4x/java/utils/ParseException.java | 0
.../org/apache/plc4x/java/utils/ReadBuffer.java | 3 +-
.../org/apache/plc4x/java/utils/SizeAware.java | 0
.../org/apache/plc4x/java/utils/WriteBuffer.java | 1 +
sandbox/code-generation/pom.xml | 1 +
.../code-generation/test-java-s7-driver/pom.xml | 6 +--
.../src/test/java/BenchmarkGeneratedS7.java | 10 ++---
10 files changed, 61 insertions(+), 9 deletions(-)
diff --git a/sandbox/code-generation/language-driver-base-java/pom.xml b/sandbox/code-generation/language-driver-base-java/pom.xml
new file mode 100644
index 0000000..2640089
--- /dev/null
+++ b/sandbox/code-generation/language-driver-base-java/pom.xml
@@ -0,0 +1,49 @@
+<?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.plugins</groupId>
+ <artifactId>plc4x-code-generaton</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>plc4x-code-generation-language-driver-base-java</artifactId>
+
+ <name>Sandbox: Code Generation: Language 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>
+ <version>1.4.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.12</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git a/sandbox/code-generation/test-java-s7-driver/src/main/java/com/github/jinahya/bit/io/MyDefaultBitInput.java b/sandbox/code-generation/language-driver-base-java/src/main/java/com/github/jinahya/bit/io/MyDefaultBitInput.java
similarity index 100%
rename from sandbox/code-generation/test-java-s7-driver/src/main/java/com/github/jinahya/bit/io/MyDefaultBitInput.java
rename to sandbox/code-generation/language-driver-base-java/src/main/java/com/github/jinahya/bit/io/MyDefaultBitInput.java
diff --git a/sandbox/code-generation/test-java-s7-driver/src/main/java/org/apache/plc4x/java/utils/EvaluationHelper.java b/sandbox/code-generation/language-driver-base-java/src/main/java/org/apache/plc4x/java/utils/EvaluationHelper.java
similarity index 100%
rename from sandbox/code-generation/test-java-s7-driver/src/main/java/org/apache/plc4x/java/utils/EvaluationHelper.java
rename to sandbox/code-generation/language-driver-base-java/src/main/java/org/apache/plc4x/java/utils/EvaluationHelper.java
diff --git a/sandbox/code-generation/test-java-s7-driver/src/main/java/org/apache/plc4x/java/utils/ParseException.java b/sandbox/code-generation/language-driver-base-java/src/main/java/org/apache/plc4x/java/utils/ParseException.java
similarity index 100%
rename from sandbox/code-generation/test-java-s7-driver/src/main/java/org/apache/plc4x/java/utils/ParseException.java
rename to sandbox/code-generation/language-driver-base-java/src/main/java/org/apache/plc4x/java/utils/ParseException.java
diff --git a/sandbox/code-generation/test-java-s7-driver/src/main/java/org/apache/plc4x/java/utils/ReadBuffer.java b/sandbox/code-generation/language-driver-base-java/src/main/java/org/apache/plc4x/java/utils/ReadBuffer.java
similarity index 98%
rename from sandbox/code-generation/test-java-s7-driver/src/main/java/org/apache/plc4x/java/utils/ReadBuffer.java
rename to sandbox/code-generation/language-driver-base-java/src/main/java/org/apache/plc4x/java/utils/ReadBuffer.java
index 17ac0c1..283e1b3 100644
--- a/sandbox/code-generation/test-java-s7-driver/src/main/java/org/apache/plc4x/java/utils/ReadBuffer.java
+++ b/sandbox/code-generation/language-driver-base-java/src/main/java/org/apache/plc4x/java/utils/ReadBuffer.java
@@ -19,7 +19,8 @@
package org.apache.plc4x.java.utils;
-import com.github.jinahya.bit.io.*;
+import com.github.jinahya.bit.io.ArrayByteInput;
+import com.github.jinahya.bit.io.MyDefaultBitInput;
import java.io.IOException;
import java.math.BigDecimal;
diff --git a/sandbox/code-generation/test-java-s7-driver/src/main/java/org/apache/plc4x/java/utils/SizeAware.java b/sandbox/code-generation/language-driver-base-java/src/main/java/org/apache/plc4x/java/utils/SizeAware.java
similarity index 100%
rename from sandbox/code-generation/test-java-s7-driver/src/main/java/org/apache/plc4x/java/utils/SizeAware.java
rename to sandbox/code-generation/language-driver-base-java/src/main/java/org/apache/plc4x/java/utils/SizeAware.java
diff --git a/sandbox/code-generation/test-java-s7-driver/src/main/java/org/apache/plc4x/java/utils/WriteBuffer.java b/sandbox/code-generation/language-driver-base-java/src/main/java/org/apache/plc4x/java/utils/WriteBuffer.java
similarity index 99%
rename from sandbox/code-generation/test-java-s7-driver/src/main/java/org/apache/plc4x/java/utils/WriteBuffer.java
rename to sandbox/code-generation/language-driver-base-java/src/main/java/org/apache/plc4x/java/utils/WriteBuffer.java
index bfe6de5..35283c5 100644
--- a/sandbox/code-generation/test-java-s7-driver/src/main/java/org/apache/plc4x/java/utils/WriteBuffer.java
+++ b/sandbox/code-generation/language-driver-base-java/src/main/java/org/apache/plc4x/java/utils/WriteBuffer.java
@@ -22,6 +22,7 @@ package org.apache.plc4x.java.utils;
import com.github.jinahya.bit.io.BitOutput;
import com.github.jinahya.bit.io.BufferByteOutput;
import com.github.jinahya.bit.io.DefaultBitOutput;
+
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
diff --git a/sandbox/code-generation/pom.xml b/sandbox/code-generation/pom.xml
index 588648e..74147ec 100644
--- a/sandbox/code-generation/pom.xml
+++ b/sandbox/code-generation/pom.xml
@@ -56,6 +56,7 @@
<module>plc4x-maven-plugin</module>
<module>language-template-java</module>
+ <module>language-driver-base-java</module>
<module>protocol-s7</module>
<module>test-java-s7-driver</module>
diff --git a/sandbox/code-generation/test-java-s7-driver/pom.xml b/sandbox/code-generation/test-java-s7-driver/pom.xml
index 615ce5c..ccebb09 100644
--- a/sandbox/code-generation/test-java-s7-driver/pom.xml
+++ b/sandbox/code-generation/test-java-s7-driver/pom.xml
@@ -57,9 +57,9 @@
<dependencies>
<dependency>
- <groupId>com.github.jinahya</groupId>
- <artifactId>bit-io</artifactId>
- <version>1.4.2</version>
+ <groupId>org.apache.plc4x.plugins</groupId>
+ <artifactId>plc4x-code-generation-language-driver-base-java</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
diff --git a/sandbox/code-generation/test-java-s7-driver/src/test/java/BenchmarkGeneratedS7.java b/sandbox/code-generation/test-java-s7-driver/src/test/java/BenchmarkGeneratedS7.java
index 1a17925..f1d95ff 100644
--- a/sandbox/code-generation/test-java-s7-driver/src/test/java/BenchmarkGeneratedS7.java
+++ b/sandbox/code-generation/test-java-s7-driver/src/test/java/BenchmarkGeneratedS7.java
@@ -31,7 +31,7 @@ public class BenchmarkGeneratedS7 {
// 00
byte[] rData = Hex.decodeHex("0300006702f080320100000001005600000407120a10060001032b84000160120a10020001032b840001a0120a10010001032b840001a9120a10050001032b84000150120a10020001032b84000198120a10040001032b84000140120a10020001032b84000190");
long start = System.currentTimeMillis();
- int numRunsParse = 2000000£;
+ int numRunsParse = 2000000;
// Benchmark the parsing code
TPKTPacket packet = null;
@@ -45,17 +45,17 @@ public class BenchmarkGeneratedS7 {
System.out.println("That's " + ((float) (endParsing - start) / numRunsParse) + "ms per packet");
// Benchmark the serializing code
- int numRunsSerailze = 2000000;
+ int numRunsSerialize = 2000000;
byte[] oData = null;
- for(int i = 0; i < numRunsSerailze; i++) {
+ for(int i = 0; i < numRunsSerialize; i++) {
WriteBuffer wBuf = new WriteBuffer(packet.getLengthInBytes());
TPKTPacketIO.serialize(wBuf, packet);
oData = wBuf.getData();
}
long endSerializing = System.currentTimeMillis();
- System.out.println("Serialized " + numRunsSerailze + " packets in " + (endSerializing - endParsing) + "ms");
- System.out.println("That's " + ((float) (endSerializing - endParsing) / numRunsSerailze) + "ms per packet");
+ System.out.println("Serialized " + numRunsSerialize + " packets in " + (endSerializing - endParsing) + "ms");
+ System.out.println("That's " + ((float) (endSerializing - endParsing) / numRunsSerialize) + "ms per packet");
if(!Arrays.equals(rData, oData)) {
for(int i = 0; i < rData.length; i++) {
if(rData[i] != oData[i]) {