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 2020/02/24 08:44:18 UTC

[plc4x] 02/06: - Added an option to customize the pipeline on a per-driver base

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch feature/luxtronik2-driver
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 7ac82fc8c6c9b7d825ddbd1a9ca67c496e36560f
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Feb 24 09:20:40 2020 +0100

    - Added an option to customize the pipeline on a per-driver base
---
 .../org/apache/plc4x/java/spi/connection/GeneratedDriverBase.java  | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/GeneratedDriverBase.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/GeneratedDriverBase.java
index 6d6416c..5ecae14 100644
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/GeneratedDriverBase.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/GeneratedDriverBase.java
@@ -68,6 +68,10 @@ public abstract class GeneratedDriverBase<BASE_PACKET extends Message> implement
 
     protected abstract ProtocolStackConfigurer<BASE_PACKET> getStackConfigurer();
 
+    protected void initializePipeline(ChannelFactory channelFactory) {
+        // Override in derived drivers.
+    }
+
     @Override
     public PlcConnection getConnection(String connectionString) throws PlcConnectionException {
         // Split up the connection string into it's individual segments.
@@ -119,6 +123,9 @@ public abstract class GeneratedDriverBase<BASE_PACKET extends Message> implement
             throw new PlcConnectionException("Unable to get channel factory from url " + transportConfig);
         }
 
+        // Give drivers the option to customize the channel.
+        initializePipeline(channelFactory);
+
         return new DefaultNettyPlcConnection(
             canRead(), canWrite(), canSubscribe(),
             getFieldHandler(),