You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2018/01/29 10:15:33 UTC
[incubator-plc4x] 02/02: - Renamed "applications" to "examples" -
Added a dummy-protocol driver to examples - Added a starting point for the
raw-socket netty channel - Temporarily disabled SonarQube for the
"dummy-protocol" and "raw-socket" module
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit 9588686bb843d63657d58d9032049df7ff3a2533
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Jan 29 11:15:26 2018 +0100
- Renamed "applications" to "examples"
- Added a dummy-protocol driver to examples
- Added a starting point for the raw-socket netty channel
- Temporarily disabled SonarQube for the "dummy-protocol" and "raw-socket" module
---
.../iotree => examples/dummy-driver}/pom.xml | 54 ++++-----
.../java/examples/dummydriver/DummyDriver.java | 60 ++++++++++
.../dummydriver/connection/DummyConnection.java | 129 +++++++++++++++++++++
.../examples/dummydriver/model/DummyAddress.java | 35 ++++++
.../examples/dummydriver/netty/DummyProtocol.java | 67 +++++++++++
.../services/org.apache.plc4x.java.api.PlcDriver | 19 +++
{applications => examples}/iotree/pom.xml | 8 +-
.../apache/plc4x/java/examples}/iotree/IoTree.java | 2 +-
.../iotree}/src/main/resources/logback.xml | 0
{applications => examples}/plclogger/pom.xml | 8 +-
.../plc4x/java/examples}/plclogger/PlcLogger.java | 2 +-
.../plclogger}/src/main/resources/logback.xml | 0
{applications => examples}/pom.xml | 7 +-
plc4j/utils/raw-sockets/pom.xml | 13 ++-
.../utils/rawsockets/netty/RawSocketAddress.java | 35 ++++++
.../utils/rawsockets/netty/RawSocketChannel.java | 100 ++++++++++++++++
pom.xml | 4 +-
17 files changed, 495 insertions(+), 48 deletions(-)
diff --git a/applications/iotree/pom.xml b/examples/dummy-driver/pom.xml
similarity index 57%
copy from applications/iotree/pom.xml
copy to examples/dummy-driver/pom.xml
index a17038e..fd38c10 100644
--- a/applications/iotree/pom.xml
+++ b/examples/dummy-driver/pom.xml
@@ -23,60 +23,52 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.plc4x.applications</groupId>
- <artifactId>applications</artifactId>
+ <groupId>org.apache.plc4x.examples</groupId>
+ <artifactId>examples</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
- <artifactId>iotree</artifactId>
- <name>Applications: IoTree (The IoT Christmas Tree)</name>
- <description>An example Application for the IoT Frankfurt meetup on 14.12.2017.</description>
-
- <properties>
- <app.main.class>org.apache.plc4x.java.applications.iotree.IoTree</app.main.class>
- </properties>
+ <artifactId>dummy-driver</artifactId>
+ <name>Examples: Protocol: Dummy</name>
+ <description>
+ Implementation of a PLC4X driver able to speak a non existent dummy protocol.
+ This module should be used as inspiration for implementing own drivers.
+ </description>
<dependencies>
<dependency>
<groupId>org.apache.plc4x</groupId>
- <artifactId>apache-edgent</artifactId>
+ <artifactId>plc4j-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
-
<dependency>
- <groupId>org.apache.edgent</groupId>
- <artifactId>edgent-api-function</artifactId>
- <version>1.2.0</version>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-utils-raw-sockets</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
+
<dependency>
- <groupId>org.apache.edgent</groupId>
- <artifactId>edgent-api-topology</artifactId>
- <version>1.2.0</version>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-buffer</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.edgent</groupId>
- <artifactId>edgent-providers-direct</artifactId>
- <version>1.2.0</version>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-codec</artifactId>
</dependency>
-
- <!-- Required driver implementation -->
<dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-protocol-s7</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <scope>runtime</scope>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-transport</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
+ <!-- This is currently a work in progress ... skip this till it reaches a slightly more mature state -->
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
+ <groupId>org.sonarsource.scanner.maven</groupId>
+ <artifactId>sonar-maven-plugin</artifactId>
<configuration>
- <usedDependencies>
- <usedDependency>org.apache.plc4x:plc4j-protocol-s7</usedDependency>
- </usedDependencies>
+ <skip>true</skip>
</configuration>
</plugin>
</plugins>
diff --git a/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/DummyDriver.java b/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/DummyDriver.java
new file mode 100644
index 0000000..0e62561
--- /dev/null
+++ b/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/DummyDriver.java
@@ -0,0 +1,60 @@
+/*
+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.examples.dummydriver;
+
+import org.apache.plc4x.java.api.PlcDriver;
+import org.apache.plc4x.java.api.authentication.PlcAuthentication;
+import org.apache.plc4x.java.api.connection.PlcConnection;
+import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
+import org.apache.plc4x.java.examples.dummydriver.connection.DummyConnection;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class DummyDriver implements PlcDriver {
+
+ private static final Pattern RAW_URI_PATTERN = Pattern.compile("^raw://(?<host>.*)");
+
+ @Override
+ public String getProtocolCode() {
+ return "raw";
+ }
+
+ @Override
+ public String getProtocolName() {
+ return "RAW";
+ }
+
+ @Override
+ public PlcConnection connect(String url) throws PlcConnectionException {
+ Matcher matcher = RAW_URI_PATTERN.matcher(url);
+ if (!matcher.matches()) {
+ throw new PlcConnectionException(
+ "Connection url doesn't match the format 'raw://{host|ip}'");
+ }
+ String host = matcher.group("host");
+ return new DummyConnection(host);
+ }
+
+ @Override
+ public PlcConnection connect(String url, PlcAuthentication authentication) throws PlcConnectionException {
+ throw new PlcConnectionException("RAW connections don't support authentication.");
+ }
+
+}
diff --git a/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java b/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java
new file mode 100644
index 0000000..4edf6c0
--- /dev/null
+++ b/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java
@@ -0,0 +1,129 @@
+/*
+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.examples.dummydriver.connection;
+
+import io.netty.bootstrap.Bootstrap;
+import io.netty.channel.*;
+import org.apache.plc4x.java.api.connection.AbstractPlcConnection;
+import org.apache.plc4x.java.api.connection.PlcReader;
+import org.apache.plc4x.java.api.connection.PlcWriter;
+import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
+import org.apache.plc4x.java.api.messages.*;
+import org.apache.plc4x.java.api.model.Address;
+import org.apache.plc4x.java.examples.dummydriver.model.DummyAddress;
+import org.apache.plc4x.java.examples.dummydriver.netty.DummyProtocol;
+import org.apache.plc4x.java.utils.rawsockets.netty.RawSocketAddress;
+import org.apache.plc4x.java.utils.rawsockets.netty.RawSocketChannel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+
+public class DummyConnection extends AbstractPlcConnection implements PlcReader, PlcWriter {
+
+ private static final Logger logger = LoggerFactory.getLogger(DummyConnection.class);
+
+ private final String hostName;
+
+ private EventLoopGroup workerGroup;
+ private Channel channel;
+
+ public DummyConnection(String hostName) {
+ this.hostName = hostName;
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ @Override
+ public void connect() throws PlcConnectionException {
+ workerGroup = new DefaultEventLoopGroup() {
+ };
+
+ try {
+ // As we don't just want to wait till the connection is established,
+ // define a future we can use to signal back that the s7 session is
+ // finished initializing.
+ CompletableFuture<Void> sessionSetupCompleteFuture = new CompletableFuture<>();
+
+ RawSocketAddress serverSocketAddress = new RawSocketAddress(hostName);
+
+ Bootstrap bootstrap = new Bootstrap();
+ bootstrap.group(workerGroup);
+ bootstrap.channel(RawSocketChannel.class);
+ bootstrap.handler(new ChannelInitializer() {
+ @Override
+ protected void initChannel(Channel channel) throws Exception {
+ ChannelPipeline pipeline = channel.pipeline();
+ pipeline.addLast(new DummyProtocol());
+ }
+ });
+ // Start the client.
+ ChannelFuture f = bootstrap.connect(serverSocketAddress).sync();
+ f.awaitUninterruptibly();
+ // Wait till the session is finished initializing.
+ channel = f.channel();
+
+ sessionSetupCompleteFuture.get();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new PlcConnectionException(e);
+ }
+ catch (ExecutionException e) {
+ throw new PlcConnectionException(e);
+ }
+ }
+
+ @Override
+ public void close() throws Exception {
+ if((channel != null) && channel.isOpen()) {
+ channel.closeFuture().await();
+ }
+
+ if (workerGroup != null) {
+ workerGroup.shutdownGracefully();
+ }
+ }
+
+ @Override
+ public Address parseAddress(String addressString) {
+ return new DummyAddress(Integer.parseInt(addressString));
+ }
+
+ @Override
+ public CompletableFuture<PlcReadResponse> read(PlcReadRequest readRequest) {
+ CompletableFuture<PlcReadResponse> readFuture = new CompletableFuture<>();
+ PlcRequestContainer<PlcReadRequest, PlcReadResponse> container =
+ new PlcRequestContainer<>(readRequest, readFuture);
+ channel.writeAndFlush(container);
+ return readFuture;
+ }
+
+ @Override
+ public CompletableFuture<PlcWriteResponse> write(PlcWriteRequest writeRequest) {
+ CompletableFuture<PlcWriteResponse> writeFuture = new CompletableFuture<>();
+ PlcRequestContainer<PlcWriteRequest, PlcWriteResponse> container =
+ new PlcRequestContainer<>(writeRequest, writeFuture);
+ channel.writeAndFlush(container);
+ return writeFuture;
+ }
+
+}
diff --git a/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/model/DummyAddress.java b/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/model/DummyAddress.java
new file mode 100644
index 0000000..9ada925
--- /dev/null
+++ b/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/model/DummyAddress.java
@@ -0,0 +1,35 @@
+/*
+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.examples.dummydriver.model;
+
+import org.apache.plc4x.java.api.model.Address;
+
+public class DummyAddress implements Address {
+
+ private final int address;
+
+ public DummyAddress(int address) {
+ this.address = address;
+ }
+
+ public int getAddress() {
+ return address;
+ }
+
+}
diff --git a/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/netty/DummyProtocol.java b/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/netty/DummyProtocol.java
new file mode 100644
index 0000000..458074d
--- /dev/null
+++ b/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/netty/DummyProtocol.java
@@ -0,0 +1,67 @@
+/*
+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.examples.dummydriver.netty;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufUtil;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.MessageToMessageCodec;
+import org.apache.plc4x.java.api.exceptions.PlcException;
+import org.apache.plc4x.java.api.messages.PlcReadRequest;
+import org.apache.plc4x.java.api.messages.PlcRequest;
+import org.apache.plc4x.java.api.messages.PlcRequestContainer;
+import org.apache.plc4x.java.api.messages.PlcWriteRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+public class DummyProtocol extends MessageToMessageCodec<ByteBuf, PlcRequestContainer> {
+
+ private static final Logger logger = LoggerFactory.getLogger(DummyProtocol.class);
+
+ @Override
+ protected void encode(ChannelHandlerContext ctx, PlcRequestContainer in, List<Object> out) throws Exception {
+ PlcRequest request = in.getRequest();
+ if (request instanceof PlcReadRequest) {
+ encodeReadRequest(in, out);
+ } else if (request instanceof PlcWriteRequest) {
+ encodeWriteRequest(in, out);
+ }
+ }
+
+ private void encodeWriteRequest(PlcRequestContainer msg, List<Object> out) throws PlcException {
+ }
+
+ private void encodeReadRequest(PlcRequestContainer msg, List<Object> out) throws PlcException {
+ }
+
+ @Override
+ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
+ if(logger.isTraceEnabled()) {
+ logger.trace("Got Data: {}", ByteBufUtil.hexDump(in));
+ }
+ // If at least 4 bytes are readable, peek into them (without changing the read position)
+ // and get the packet length. Only if the available amount of readable bytes is larger or
+ // equal to this, continue processing the rest.
+ if(in.readableBytes() >= 4) {
+ }
+ }
+
+}
diff --git a/examples/dummy-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver b/examples/dummy-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver
new file mode 100644
index 0000000..b8ccc4d
--- /dev/null
+++ b/examples/dummy-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+org.apache.plc4x.java.examples.dummydriver.DummyDriver
diff --git a/applications/iotree/pom.xml b/examples/iotree/pom.xml
similarity index 91%
rename from applications/iotree/pom.xml
rename to examples/iotree/pom.xml
index a17038e..c8ba414 100644
--- a/applications/iotree/pom.xml
+++ b/examples/iotree/pom.xml
@@ -23,17 +23,17 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.plc4x.applications</groupId>
- <artifactId>applications</artifactId>
+ <groupId>org.apache.plc4x.examples</groupId>
+ <artifactId>examples</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>iotree</artifactId>
- <name>Applications: IoTree (The IoT Christmas Tree)</name>
+ <name>Examples: IoTree (The IoT Christmas Tree)</name>
<description>An example Application for the IoT Frankfurt meetup on 14.12.2017.</description>
<properties>
- <app.main.class>org.apache.plc4x.java.applications.iotree.IoTree</app.main.class>
+ <app.main.class>org.apache.plc4x.java.examples.iotree.IoTree</app.main.class>
</properties>
<dependencies>
diff --git a/applications/iotree/src/main/java/org/apache/plc4x/java/applications/iotree/IoTree.java b/examples/iotree/src/main/java/org/apache/plc4x/java/examples/iotree/IoTree.java
similarity index 98%
rename from applications/iotree/src/main/java/org/apache/plc4x/java/applications/iotree/IoTree.java
rename to examples/iotree/src/main/java/org/apache/plc4x/java/examples/iotree/IoTree.java
index d3591f6..e94eb38 100644
--- a/applications/iotree/src/main/java/org/apache/plc4x/java/applications/iotree/IoTree.java
+++ b/examples/iotree/src/main/java/org/apache/plc4x/java/examples/iotree/IoTree.java
@@ -16,7 +16,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.java.applications.iotree;
+package org.apache.plc4x.java.examples.iotree;
import org.apache.edgent.function.Consumer;
import org.apache.edgent.providers.direct.DirectProvider;
diff --git a/applications/plclogger/src/main/resources/logback.xml b/examples/iotree/src/main/resources/logback.xml
similarity index 100%
rename from applications/plclogger/src/main/resources/logback.xml
rename to examples/iotree/src/main/resources/logback.xml
diff --git a/applications/plclogger/pom.xml b/examples/plclogger/pom.xml
similarity index 91%
rename from applications/plclogger/pom.xml
rename to examples/plclogger/pom.xml
index b33fa83..a01f28b 100644
--- a/applications/plclogger/pom.xml
+++ b/examples/plclogger/pom.xml
@@ -23,17 +23,17 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.plc4x.applications</groupId>
- <artifactId>applications</artifactId>
+ <groupId>org.apache.plc4x.examples</groupId>
+ <artifactId>examples</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>plclogger</artifactId>
- <name>Applications: PLC Data Logger</name>
+ <name>Examples: PLC Data Logger</name>
<description>Application using Edgent and Elastic-Search to implement a PLC data logger.</description>
<properties>
- <app.main.class>org.apache.plc4x.java.applications.plclogger.PlcLogger</app.main.class>
+ <app.main.class>org.apache.plc4x.java.examples.plclogger.PlcLogger</app.main.class>
</properties>
<dependencies>
diff --git a/applications/plclogger/src/main/java/org/apache/plc4x/java/applications/plclogger/PlcLogger.java b/examples/plclogger/src/main/java/org/apache/plc4x/java/examples/plclogger/PlcLogger.java
similarity index 98%
rename from applications/plclogger/src/main/java/org/apache/plc4x/java/applications/plclogger/PlcLogger.java
rename to examples/plclogger/src/main/java/org/apache/plc4x/java/examples/plclogger/PlcLogger.java
index 6d97297..466bcdc 100644
--- a/applications/plclogger/src/main/java/org/apache/plc4x/java/applications/plclogger/PlcLogger.java
+++ b/examples/plclogger/src/main/java/org/apache/plc4x/java/examples/plclogger/PlcLogger.java
@@ -16,7 +16,7 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.java.applications.plclogger;
+package org.apache.plc4x.java.examples.plclogger;
import java.util.Calendar;
import java.util.concurrent.TimeUnit;
diff --git a/applications/iotree/src/main/resources/logback.xml b/examples/plclogger/src/main/resources/logback.xml
similarity index 100%
rename from applications/iotree/src/main/resources/logback.xml
rename to examples/plclogger/src/main/resources/logback.xml
diff --git a/applications/pom.xml b/examples/pom.xml
similarity index 95%
rename from applications/pom.xml
rename to examples/pom.xml
index 6abbd67..f6c6721 100644
--- a/applications/pom.xml
+++ b/examples/pom.xml
@@ -28,14 +28,15 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
- <groupId>org.apache.plc4x.applications</groupId>
- <artifactId>applications</artifactId>
+ <groupId>org.apache.plc4x.examples</groupId>
+ <artifactId>examples</artifactId>
<packaging>pom</packaging>
- <name>Applications</name>
+ <name>Examples</name>
<description>Parent of all application example modules.</description>
<modules>
+ <module>dummy-driver</module>
<module>iotree</module>
<module>plclogger</module>
</modules>
diff --git a/plc4j/utils/raw-sockets/pom.xml b/plc4j/utils/raw-sockets/pom.xml
index 0dc85f7..01966ec 100644
--- a/plc4j/utils/raw-sockets/pom.xml
+++ b/plc4j/utils/raw-sockets/pom.xml
@@ -39,10 +39,10 @@
</properties>
<dependencies>
- <!--dependency>
+ <dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
- </dependency-->
+ </dependency>
<dependency>
<groupId>org.pcap4j</groupId>
@@ -73,6 +73,15 @@
</usedDependencies>
</configuration>
</plugin>
+
+ <!-- This is currently a work in progress ... skip this till it reaches a slightly more mature state -->
+ <plugin>
+ <groupId>org.sonarsource.scanner.maven</groupId>
+ <artifactId>sonar-maven-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
</plugins>
</build>
diff --git a/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketAddress.java b/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketAddress.java
new file mode 100644
index 0000000..7e60337
--- /dev/null
+++ b/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketAddress.java
@@ -0,0 +1,35 @@
+/*
+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.rawsockets.netty;
+
+import java.net.SocketAddress;
+
+public class RawSocketAddress extends SocketAddress {
+
+ private String hostName;
+
+ public RawSocketAddress(String hostName) {
+ this.hostName = hostName;
+ }
+
+ String getHostName() {
+ return hostName;
+ }
+
+}
diff --git a/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannel.java b/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannel.java
new file mode 100644
index 0000000..e304418
--- /dev/null
+++ b/plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/netty/RawSocketChannel.java
@@ -0,0 +1,100 @@
+/*
+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.rawsockets.netty;
+
+import io.netty.channel.*;
+
+import java.net.SocketAddress;
+
+public class RawSocketChannel extends AbstractChannel {
+
+ public RawSocketChannel(Channel parent) {
+ super(parent);
+ }
+
+ public RawSocketChannel(Channel parent, ChannelId id) {
+ super(parent, id);
+ }
+
+ @Override
+ protected AbstractUnsafe newUnsafe() {
+ return null;
+ }
+
+ @Override
+ protected boolean isCompatible(EventLoop loop) {
+ return true;
+ }
+
+ @Override
+ protected SocketAddress localAddress0() {
+ return null;
+ }
+
+ @Override
+ protected SocketAddress remoteAddress0() {
+ return null;
+ }
+
+ @Override
+ protected void doBind(SocketAddress localAddress) throws Exception {
+
+ }
+
+ @Override
+ protected void doDisconnect() throws Exception {
+
+ }
+
+ @Override
+ protected void doClose() throws Exception {
+
+ }
+
+ @Override
+ protected void doBeginRead() throws Exception {
+
+ }
+
+ @Override
+ protected void doWrite(ChannelOutboundBuffer in) throws Exception {
+
+ }
+
+ @Override
+ public ChannelConfig config() {
+ return null;
+ }
+
+ @Override
+ public boolean isOpen() {
+ return false;
+ }
+
+ @Override
+ public boolean isActive() {
+ return false;
+ }
+
+ @Override
+ public ChannelMetadata metadata() {
+ return null;
+ }
+
+}
diff --git a/pom.xml b/pom.xml
index d1a955a..0bb28b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -111,8 +111,8 @@
<!-- Integration modules for other frameworks -->
<module>integrations</module>
- <!-- Example applications -->
- <module>applications</module>
+ <!-- Examples -->
+ <module>examples</module>
</modules>
<prerequisites>
--
To stop receiving notification emails like this one, please contact
cdutz@apache.org.