You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by tm...@apache.org on 2019/03/10 15:18:51 UTC

[incubator-plc4x] branch extend-Field-with-type-information updated (39c9b47 -> 11d2b20)

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

tmitsch pushed a change to branch extend-Field-with-type-information
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git.


    omit 39c9b47  Added Implementation for S7 Driver.
    omit 19e4265  Necessary changes to make the (new) plc scraper driver agnostic: * The PlcField interface has a (default) method to return the expected java type (to know this upfront) * The PlcConnection interface has a new "parse()" method which allows to explicitly create a Field instance for a given type.
     add a89ecef  Minor changes on getting-involved.adoc
     add 9d113ee  Minor Changes
     add a89626c  Merge pull request #45 from cptblaubaer/develop
     add 527ae1b  PLC4X-88: - introduced TriggeredScraper and belonging classes - made classes of old scraper deprecated - added scheduled and S7-variable trigger (boolean and numeric) - java-docs - tests for regex pattern of trigger strategy added - added ToDos
     add ee46d30  Merge pull request #46 from timbo2k/scraper-extention
     add dc5b884  Add Class PlcDriver
     add dec6ec2  - Fixed some java comment which was causing the site generation to fail
     new 11d2b20  Necessary changes to make the (new) plc scraper driver agnostic: * The PlcField interface has a (default) method to return the expected java type (to know this upfront) * The PlcConnection interface has a new "parse()" method which allows to explicitly create a Field instance for a given type. * Integration of java-type into TriggeredScraper * Tested and added a TriggeredScraper for Modbus

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (39c9b47)
            \
             N -- N -- N   refs/heads/extend-Field-with-type-information (11d2b20)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/plc4x/Plc4xSchema.java    |   6 +-
 .../java/org/apache/plc4x/Plc4xSchemaFactory.java  |   8 +-
 .../java/org/apache/plc4x/DriverManagerTest.java   |   3 +-
 .../java/org/apache/plc4x/Plc4XBaseTableTest.java  |   4 +-
 .../{api/PlcConnection.cpp => spi/PlcDriver.cpp}   |   4 +-
 .../main/cpp/org/apache/plc4x/cpp/spi/PlcDriver.h  |  85 +++++
 .../org/apache/plc4x/java/s7/model/S7Field.java    |  12 +-
 plc4j/utils/scraper/pom.xml                        |  48 ++-
 .../org/apache/plc4x/java/scraper/ScrapeJob.java   |  35 +-
 .../scraper/{ScrapeJob.java => ScrapeJobImpl.java} |  27 +-
 .../org/apache/plc4x/java/scraper/Scraper.java     | 151 +--------
 .../scraper/{Scraper.java => ScraperImpl.java}     |  52 +--
 .../org/apache/plc4x/java/scraper/ScraperTask.java | 170 +---------
 .../{ScraperTask.java => ScraperTaskImpl.java}     |  30 +-
 .../java/scraper/config/JobConfiguration.java      |  47 +--
 ...onfiguration.java => JobConfigurationImpl.java} |  21 +-
 ...ilder.java => JobConfigurationImplBuilder.java} |  16 +-
 .../java/scraper/config/ScraperConfiguration.java  |  47 ++-
 .../config/ScraperConfigurationBuilder.java        |  12 +-
 .../TriggeredJobConfiguration.java}                |  29 +-
 .../TriggeredJobConfigurationBuilder.java}         |  34 +-
 .../TriggeredScraperConfiguration.java}            |  62 ++--
 .../TriggeredScraperConfigurationBuilder.java}     |  18 +-
 .../ScraperConfigurationException.java             |   2 +-
 .../ScraperException.java}                         |  25 +-
 .../triggeredscraper/TriggeredScrapeJobImpl.java   |  73 ++++
 .../TriggeredScraperImpl.java}                     |  91 ++---
 .../triggeredscraper/TriggeredScraperTask.java     | 225 +++++++++++++
 .../triggerhandler/TriggerConfiguration.java       | 374 +++++++++++++++++++++
 .../triggerhandler/TriggerHandler.java             | 130 +++++++
 .../java/scraper/ScraperConfigurationTest.java     |  10 +-
 .../apache/plc4x/java/scraper/ScraperRunner.java   |   5 +-
 .../apache/plc4x/java/scraper/ScraperTaskTest.java |   8 +-
 .../org/apache/plc4x/java/scraper/ScraperTest.java |  18 +-
 ...aperRunner.java => TriggeredScraperRunner.java} |  19 +-
 .../java/scraper/TriggeredScraperRunnerModbus.java |  60 ++++
 .../config/ScraperConfigurationBuilderTest.java    |  13 +-
 .../triggerhandler/TriggerConfigurationTest.java   | 118 +++++++
 ...h_strings.yml => example_triggered_scraper.yml} |  27 +-
 .../resources/example_triggered_scraper_modbus.yml |  14 +-
 src/site/asciidoc/community/getting-involved.adoc  |   4 +-
 41 files changed, 1520 insertions(+), 617 deletions(-)
 copy plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/{api/PlcConnection.cpp => spi/PlcDriver.cpp} (95%)
 mode change 100755 => 100644
 create mode 100644 plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/spi/PlcDriver.h
 copy plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/{ScrapeJob.java => ScrapeJobImpl.java} (65%)
 copy plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/{Scraper.java => ScraperImpl.java} (84%)
 copy plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/{ScraperTask.java => ScraperTaskImpl.java} (86%)
 copy plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/config/{JobConfiguration.java => JobConfigurationImpl.java} (66%)
 copy plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/config/{JobConfigurationBuilder.java => JobConfigurationImplBuilder.java} (69%)
 copy plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/config/{JobConfiguration.java => triggeredscraper/TriggeredJobConfiguration.java} (59%)
 rename plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/config/{JobConfigurationBuilder.java => triggeredscraper/TriggeredJobConfigurationBuilder.java} (51%)
 copy plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/config/{ScraperConfiguration.java => triggeredscraper/TriggeredScraperConfiguration.java} (58%)
 copy plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/config/{ScraperConfigurationBuilder.java => triggeredscraper/TriggeredScraperConfigurationBuilder.java} (62%)
 rename plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/{config => exception}/ScraperConfigurationException.java (96%)
 copy plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/{ResultHandler.java => exception/ScraperException.java} (60%)
 create mode 100644 plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/triggeredscraper/TriggeredScrapeJobImpl.java
 copy plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/{Scraper.java => triggeredscraper/TriggeredScraperImpl.java} (63%)
 create mode 100644 plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/triggeredscraper/TriggeredScraperTask.java
 create mode 100644 plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/triggeredscraper/triggerhandler/TriggerConfiguration.java
 create mode 100644 plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/triggeredscraper/triggerhandler/TriggerHandler.java
 copy plc4j/utils/scraper/src/test/java/org/apache/plc4x/java/scraper/{ScraperRunner.java => TriggeredScraperRunner.java} (57%)
 create mode 100644 plc4j/utils/scraper/src/test/java/org/apache/plc4x/java/scraper/TriggeredScraperRunnerModbus.java
 create mode 100644 plc4j/utils/scraper/src/test/java/org/apache/plc4x/java/scraper/triggeredscraper/triggerhandler/TriggerConfigurationTest.java
 copy plc4j/utils/scraper/src/test/resources/{example_with_strings.yml => example_triggered_scraper.yml} (74%)
 copy integrations/apache-calcite/src/test/resources/example.yml => plc4j/utils/scraper/src/test/resources/example_triggered_scraper_modbus.yml (84%)


[incubator-plc4x] 01/01: Necessary changes to make the (new) plc scraper driver agnostic: * The PlcField interface has a (default) method to return the expected java type (to know this upfront) * The PlcConnection interface has a new "parse()" method which allows to explicitly create a Field instance for a given type. * Integration of java-type into TriggeredScraper * Tested and added a TriggeredScraper for Modbus

Posted by tm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tmitsch pushed a commit to branch extend-Field-with-type-information
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git

commit 11d2b20c00d7510987c9f318affa60eba8e38608
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Thu Mar 7 10:20:12 2019 +0100

    Necessary changes to make the (new) plc scraper driver agnostic:
    * The PlcField interface has a (default) method to return the expected java type (to know this upfront)
    * The PlcConnection interface has a new "parse()" method which allows to explicitly create a Field instance for a given type.
    * Integration of java-type into TriggeredScraper
    * Tested and added a TriggeredScraper for Modbus
---
 .../org/apache/plc4x/java/api/PlcConnection.java   | 12 +++
 .../org/apache/plc4x/java/api/model/PlcField.java  | 16 ++++
 .../plc4x/java/s7/connection/S7PlcConnection.java  |  8 ++
 .../java/s7/connection/S7PlcConnectionTests.java   | 15 ++++
 .../org/apache/plc4x/java/s7/model/S7Field.java    | 31 ++++++++
 .../apache/plc4x/java/s7/model/S7FieldTests.java   |  8 ++
 plc4j/utils/scraper/pom.xml                        | 10 +++
 .../triggerhandler/TriggerConfiguration.java       | 90 +++++++++++++---------
 .../java/scraper/TriggeredScraperRunnerModbus.java | 60 +++++++++++++++
 .../triggerhandler/TriggerConfigurationTest.java   |  4 +-
 .../resources/example_triggered_scraper_modbus.yml | 30 ++++++++
 11 files changed, 246 insertions(+), 38 deletions(-)

diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/PlcConnection.java b/plc4j/api/src/main/java/org/apache/plc4x/java/api/PlcConnection.java
index a4732e1..e7d9a83 100644
--- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/PlcConnection.java
+++ b/plc4j/api/src/main/java/org/apache/plc4x/java/api/PlcConnection.java
@@ -19,12 +19,15 @@ under the License.
 package org.apache.plc4x.java.api;
 
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
+import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
+import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
 import org.apache.plc4x.java.api.exceptions.PlcUnsupportedOperationException;
 import org.apache.plc4x.java.api.messages.PlcReadRequest;
 import org.apache.plc4x.java.api.messages.PlcSubscriptionRequest;
 import org.apache.plc4x.java.api.messages.PlcUnsubscriptionRequest;
 import org.apache.plc4x.java.api.messages.PlcWriteRequest;
 import org.apache.plc4x.java.api.metadata.PlcConnectionMetadata;
+import org.apache.plc4x.java.api.model.PlcField;
 
 /**
  * Interface defining the most basic methods a PLC4X connection should support.
@@ -53,6 +56,15 @@ public interface PlcConnection extends AutoCloseable {
     void close() throws Exception;
 
     /**
+     * Parse a fieldQuery for the given connection type.
+     *
+     * @throws PlcRuntimeException If the string cannot be parsed
+     */
+    default PlcField parse(String fieldQuery) throws PlcInvalidFieldException {
+        throw new PlcRuntimeException("Parse method is not implemented for this connection / driver");
+    }
+
+    /**
      * Provides connection metadata.
      */
     PlcConnectionMetadata getMetadata();
diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/model/PlcField.java b/plc4j/api/src/main/java/org/apache/plc4x/java/api/model/PlcField.java
index 280e244..6851667 100644
--- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/model/PlcField.java
+++ b/plc4j/api/src/main/java/org/apache/plc4x/java/api/model/PlcField.java
@@ -32,4 +32,20 @@ package org.apache.plc4x.java.api.model;
  */
 public interface PlcField {
 
+    /**
+     * Returns the "default" type of the response one can expect from this field as java type.
+     * I.e., a call to getXXX for the ResponseItem should succeed.
+     *
+     * The contract is not to return the exact type which is internally hold by PLC4X but to
+     * return a "casteable" type, i.e., a type whiches getXXX method succeeds.
+     * So for example if a type is internally a short, but the getInt() method is implemented, it
+     * is allowed to return Integer.class by this method.
+     *
+     * <b>This method should always return the BOXED type for primitives. E.g. not bool.class but Boolean.class</b>
+     * @return Either specific type or Object.class if no specific type is known.
+     */
+    default Class<?> getDefaultJavaType() {
+        return Object.class;
+    }
+
 }
diff --git a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/connection/S7PlcConnection.java b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/connection/S7PlcConnection.java
index da65b9a..e3e9aec 100644
--- a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/connection/S7PlcConnection.java
+++ b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/connection/S7PlcConnection.java
@@ -24,10 +24,13 @@ import org.apache.commons.configuration2.Configuration;
 import org.apache.commons.configuration2.SystemConfiguration;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
+import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
+import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
 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.api.model.PlcField;
 import org.apache.plc4x.java.base.connection.ChannelFactory;
 import org.apache.plc4x.java.base.connection.NettyPlcConnection;
 import org.apache.plc4x.java.base.connection.TcpSocketChannelFactory;
@@ -40,6 +43,7 @@ import org.apache.plc4x.java.isotp.protocol.model.tpdus.DisconnectRequestTpdu;
 import org.apache.plc4x.java.isotp.protocol.model.types.DeviceGroup;
 import org.apache.plc4x.java.isotp.protocol.model.types.DisconnectReason;
 import org.apache.plc4x.java.isotp.protocol.model.types.TpduSize;
+import org.apache.plc4x.java.s7.model.S7Field;
 import org.apache.plc4x.java.s7.netty.Plc4XS7Protocol;
 import org.apache.plc4x.java.s7.netty.S7Protocol;
 import org.apache.plc4x.java.s7.netty.model.types.MemoryArea;
@@ -200,6 +204,10 @@ public class S7PlcConnection extends NettyPlcConnection implements PlcReader, Pl
         channel.pipeline().fireUserEventTriggered(new ConnectEvent());
     }
 
+    @Override public PlcField parse(String fieldQuery) throws PlcInvalidFieldException {
+        return S7Field.of(fieldQuery);
+    }
+
     public int getRack() {
         return rack;
     }
diff --git a/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcConnectionTests.java b/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcConnectionTests.java
index 65d37ba..c0d938d 100644
--- a/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcConnectionTests.java
+++ b/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcConnectionTests.java
@@ -19,7 +19,11 @@
 
 package org.apache.plc4x.java.s7.connection;
 
+import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
 import org.apache.plc4x.java.api.exceptions.PlcUnsupportedOperationException;
+import org.apache.plc4x.java.api.model.PlcField;
+import org.apache.plc4x.java.s7.model.S7Field;
+import org.apache.plc4x.java.s7.netty.model.types.TransportSize;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -75,4 +79,15 @@ public class S7PlcConnectionTests {
         assertThrows(PlcUnsupportedOperationException.class, () -> SUT.unsubscriptionRequestBuilder());
     }
 
+    @Test
+    public void parse() {
+        final PlcField field = SUT.parse("%DB1.DBX38.1:BOOL");
+        assertThat(field.getClass(), equalTo(S7Field.class));
+        assertThat(((S7Field) field).getDataType(), equalTo(TransportSize.BOOL));
+    }
+
+    @Test(expected = PlcInvalidFieldException.class)
+    public void parseFails() {
+        SUT.parse("this is a bad field query");
+    }
 }
\ No newline at end of file
diff --git a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java
index 8f7e555..7bced35 100644
--- a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java
+++ b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java
@@ -18,6 +18,7 @@ under the License.
 */
 package org.apache.plc4x.java.s7.model;
 
+import org.apache.commons.lang3.NotImplementedException;
 import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
 import org.apache.plc4x.java.api.model.PlcField;
 import org.apache.plc4x.java.s7.netty.model.types.MemoryArea;
@@ -89,6 +90,36 @@ public class S7Field implements PlcField {
             ADDRESS_PATTERN.matcher(fieldString).matches();
     }
 
+    /**
+     * @return Java type of expected response.
+     *
+     * TODO implement all Methods
+     */
+    @Override
+    public Class<?> getDefaultJavaType() {
+        switch (dataType){
+            case STRING:
+                return String.class;
+            case USINT:
+            case SINT:
+            case UINT:
+            case INT:
+            case DINT:
+                return Integer.class;
+            case UDINT:
+            case ULINT:
+            case LINT:
+                return Long.class;
+            case BOOL:
+                return Boolean.class;
+            case REAL:
+            case LREAL:
+                return Double.class;
+            default:
+                throw new NotImplementedException("The response type for datatype " + dataType + " is not yet implemented");
+        }
+    }
+
     public static S7Field of(String fieldString) {
         Matcher matcher = DATA_BLOCK_ADDRESS_PATTERN.matcher(fieldString);
         if(matcher.matches()) {
diff --git a/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/model/S7FieldTests.java b/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/model/S7FieldTests.java
index 015562d..a412b67 100644
--- a/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/model/S7FieldTests.java
+++ b/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/model/S7FieldTests.java
@@ -20,6 +20,7 @@ under the License.
 package org.apache.plc4x.java.s7.model;
 
 import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
+import org.apache.plc4x.java.api.model.PlcField;
 import org.apache.plc4x.java.s7.netty.model.types.MemoryArea;
 import org.apache.plc4x.java.s7.netty.model.types.TransportSize;
 import org.apache.plc4x.test.FastTests;
@@ -86,6 +87,13 @@ class S7FieldTests {
     }
 
     @Test
+    void getDefaultJavaType() {
+        final PlcField field = S7Field.of("%DB1.DBX38.1:BOOL");
+
+        assertThat(field.getDefaultJavaType(), equalTo(Boolean.class));
+    }
+
+    @Test
     void checkGreedyNumFieldsParsing() {
         S7Field field = S7Field.of("%DB56.DBB100:SINT[25]");
 
diff --git a/plc4j/utils/scraper/pom.xml b/plc4j/utils/scraper/pom.xml
index 69b4481..a0f7d7e 100644
--- a/plc4j/utils/scraper/pom.xml
+++ b/plc4j/utils/scraper/pom.xml
@@ -104,17 +104,27 @@
       <version>0.4.0-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
+
+
     <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
       <scope>test</scope>
     </dependency>
+
     <dependency>
       <groupId>org.apache.plc4x</groupId>
       <artifactId>plc4j-utils-test-utils</artifactId>
       <version>0.4.0-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-driver-modbus</artifactId>
+      <version>0.4.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+
 
   </dependencies>
 
diff --git a/plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/triggeredscraper/triggerhandler/TriggerConfiguration.java b/plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/triggeredscraper/triggerhandler/TriggerConfiguration.java
index b1da407..9d89b6c 100644
--- a/plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/triggeredscraper/triggerhandler/TriggerConfiguration.java
+++ b/plc4j/utils/scraper/src/main/java/org/apache/plc4x/java/scraper/triggeredscraper/triggerhandler/TriggerConfiguration.java
@@ -20,6 +20,7 @@
 package org.apache.plc4x.java.scraper.triggeredscraper.triggerhandler;
 
 import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
+import org.apache.plc4x.java.api.model.PlcField;
 import org.apache.plc4x.java.s7.model.S7Field;
 import org.apache.plc4x.java.scraper.exception.ScraperException;
 import org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScrapeJobImpl;
@@ -43,14 +44,16 @@ public class TriggerConfiguration{
         Pattern.compile("\\((?<strategy>[A-Z_0-9]+),(?<scheduledInterval>\\d+)(,(\\((?<triggerVar>\\S+)\\))((?<comp>[!=<>]{1,2}))(\\((?<compVar>[a-z0-9.\\-]+)\\)))?\\)");
 
     private final TriggerType triggerType;
-    private final long scrapeInterval;
+    private final Long scrapeInterval;
     private final String triggerVariable;
     private final String comparator;
     private Comparators comparatorType;
     private TriggeredScrapeJobImpl triggeredScrapeJobImpl;
 
     private final Object compareValue;
-    private final S7Field s7Field;
+    private final PlcField plcField;
+
+
 
     /**
      * default constructor when an S7Field should be used for triggering
@@ -66,18 +69,25 @@ public class TriggerConfiguration{
         this.triggerType = triggerType;
         this.triggeredScrapeJobImpl = triggeredScrapeJobImpl;
         this.scrapeInterval = parseScrapeInterval(scrapeInterval);
+        this.triggerVariable = triggerVariable;
+        this.comparator = comparator;
 
-        //test for valid field-connection string, on exception quit job and return message to user
-        try {
-            this.s7Field = S7Field.of(triggerVariable);
+        if(this.triggerType.equals(TriggerType.S7_TRIGGER_VAR)) {
+            //test for valid field-connection string, on exception quit job and return message to user
+            try {
+                this.plcField = S7Field.of(triggerVariable);
+            } catch (PlcInvalidFieldException e) {
+                logger.debug(e.getMessage(), e);
+                String exceptionMessage = String.format("Invalid trigger Field for Job %s: %s", triggeredScrapeJobImpl.getJobName(), triggerVariable);
+                throw new ScraperException(exceptionMessage);
+            }
+            //ToDo add more and other trigger
         }
-        catch (PlcInvalidFieldException e){
-            logger.debug(e.getMessage(),e);
-            String exceptionMessage = String.format("Invalid trigger Field for Job %s: %s",triggeredScrapeJobImpl.getJobName(), triggerVariable);
+        else{
+            String exceptionMessage = String.format("TriggerType %s is not yet implemented", this.triggerType);
             throw new ScraperException(exceptionMessage);
         }
-        this.triggerVariable = triggerVariable;
-        this.comparator = comparator;
+
 
         this.compareValue = convertCompareValue(compareValue);
         detectComparatorType();
@@ -97,8 +107,9 @@ public class TriggerConfiguration{
         this.triggerVariable = null;
         this.comparator = null;
         this.compareValue = null;
-        this.s7Field = null;
+        this.plcField = null;
         this.comparatorType = null;
+
     }
 
     /**
@@ -125,7 +136,7 @@ public class TriggerConfiguration{
      * @throws ScraperException when something goes wrong
      */
     boolean evaluateTrigger(Object value) throws ScraperException {
-        if(detectVariableType().equals(Boolean.class)){
+        if(validateDataType().equals(Boolean.class)){
             boolean currentValue;
             boolean refValue;
             try{
@@ -143,7 +154,7 @@ public class TriggerConfiguration{
                 return currentValue != refValue;
             }
         }
-        if(detectVariableType().equals(Double.class)) {
+        if(validateDataType().equals(Double.class)) {
             double currentValue;
             double refValue;
             try{
@@ -209,9 +220,9 @@ public class TriggerConfiguration{
      * @throws ScraperException when invalid combination is detected
      */
     private void matchTypeAndComparator() throws ScraperException {
-        if(detectVariableType().equals(Boolean.class)
+        if(validateDataType().equals(Boolean.class)
             && !(this.comparatorType.equals(Comparators.EQUAL) || this.comparatorType.equals(Comparators.UNEQUAL))){
-            String exceptionMessage = String.format("Trigger-Data-Type (%s) and Comparator (%s) do not match",this.s7Field.getDataType(),this.comparatorType);
+            String exceptionMessage = String.format("Trigger-Data-Type (%s) and Comparator (%s) do not match",this.plcField.getDefaultJavaType(),this.comparatorType);
             throw new ScraperException(exceptionMessage);
         }
         //all other combinations are valid
@@ -223,24 +234,24 @@ public class TriggerConfiguration{
      * @throws ScraperException when an unsupported S7-Type is choosen,which is not (yet) implemented for comparison
      * ToDo check how to handle time-variables if needed
      */
-    private Class detectVariableType() throws ScraperException {
-        switch (this.s7Field.getDataType()){
-            case BOOL:
-                return Boolean.class;
-            case INT:
-            case UINT:
-            case SINT:
-            case USINT:
-            case DINT:
-            case UDINT:
-            case LINT:
-            case ULINT:
-            case REAL:
-            case LREAL:
-                return Double.class;
-            default:
-                throw new ScraperException("Unsupported trigger data-type used: "+this.s7Field.getDataType());
+    private Class<?> validateDataType() throws ScraperException {
+        if(this.plcField!=null){
+            Class<?> javaDataType = this.plcField.getDefaultJavaType();
+            if(!javaDataType.equals(Boolean.class)
+                && !javaDataType.equals(Integer.class)
+                && !javaDataType.equals(Long.class)
+                && !javaDataType.equals(Double.class)
+            ){
+                String exceptionMessage = String.format("Unsupported plc-trigger variable %s with converted data-type %s used",this.plcField,this.plcField.getDefaultJavaType());
+                throw new ScraperException(exceptionMessage);
+            }
+            return javaDataType;
+        }
+        else{
+            String exceptionMessage = String.format("Unsupported plc-trigger variable %s with converted data-type %s used",this.plcField,this.plcField.getDefaultJavaType());
+            throw new ScraperException(exceptionMessage);
         }
+
     }
 
     /**
@@ -250,7 +261,8 @@ public class TriggerConfiguration{
      * @throws ScraperException when something does not match or parsing fails
      */
     private Object convertCompareValue(String compareValue) throws ScraperException {
-        if(detectVariableType().equals(Boolean.class)){
+        Class<?> javaDataType =validateDataType();
+        if(javaDataType.equals(Boolean.class)){
             switch (compareValue){
                 case "1":
                 case "true":
@@ -263,8 +275,12 @@ public class TriggerConfiguration{
                     throw new ScraperException(exceptionMessage);
             }
         }
-        if(detectVariableType().equals(Double.class)){
+        if(javaDataType.equals(Double.class)
+            || javaDataType.equals(Integer.class)
+            || javaDataType.equals(Long.class)){
             try {
+                //everything fits to Double for conversion ... so for first step use only double
+                //ToDo if different handling dependent on specific datatype is needed then differ
                 return Double.parseDouble(compareValue);
             }
             catch (Exception e){
@@ -272,7 +288,7 @@ public class TriggerConfiguration{
                 throw new ScraperException(exceptionMessage);
             }
         }
-        String exceptionMessage = "Invalid Datatype detected ... should not happen and be catched earlier - please report";
+        String exceptionMessage = "Invalid Datatype detected ... should not happen and be catcht earlier - please report";
         throw new ScraperException(exceptionMessage);
     }
 
@@ -333,11 +349,11 @@ public class TriggerConfiguration{
         return triggerVariable;
     }
 
-    public Comparators getComparatorType() {
+    Comparators getComparatorType() {
         return comparatorType;
     }
 
-    public Object getCompareValue() {
+    Object getCompareValue() {
         return compareValue;
     }
 
diff --git a/plc4j/utils/scraper/src/test/java/org/apache/plc4x/java/scraper/TriggeredScraperRunnerModbus.java b/plc4j/utils/scraper/src/test/java/org/apache/plc4x/java/scraper/TriggeredScraperRunnerModbus.java
new file mode 100644
index 0000000..3ed4fe3
--- /dev/null
+++ b/plc4j/utils/scraper/src/test/java/org/apache/plc4x/java/scraper/TriggeredScraperRunnerModbus.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.scraper;
+
+import org.apache.plc4x.java.modbus.connection.ModbusConnectionFactory;
+import org.apache.plc4x.java.scraper.config.triggeredscraper.TriggeredScraperConfiguration;
+import org.apache.plc4x.java.scraper.exception.ScraperException;
+import org.apache.plc4x.java.scraper.triggeredscraper.TriggeredScraperImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+public class TriggeredScraperRunnerModbus {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(TriggeredScraperRunnerModbus.class);
+
+    /**
+     * testing of TriggeredScraper vs real device (Modbus)
+     */
+    public static void main(String[] args) throws IOException, ScraperException {
+        TriggeredScraperConfiguration configuration = TriggeredScraperConfiguration.fromFile("plc4j/utils/scraper/src/test/resources/example_triggered_scraper_modbus.yml");
+        TriggeredScraperImpl scraper = new TriggeredScraperImpl(configuration, (j, a, m) -> {
+            LOGGER.info("Results from {}/{}: {}", j, a, m);
+            for(Map.Entry<String, Object> entry:m.entrySet()){
+                for(Object object:(List<Object>)entry.getValue()){
+                    LOGGER.info("{}",object);
+                }
+            }
+        });
+
+        scraper.start();
+    }
+
+    /**
+     * dummy function to have Modbus Driver available in DriverManager
+     */
+    private void dummy(){
+        ModbusConnectionFactory modbusConnectionFactory = new ModbusConnectionFactory();
+    }
+}
diff --git a/plc4j/utils/scraper/src/test/java/org/apache/plc4x/java/scraper/triggeredscraper/triggerhandler/TriggerConfigurationTest.java b/plc4j/utils/scraper/src/test/java/org/apache/plc4x/java/scraper/triggeredscraper/triggerhandler/TriggerConfigurationTest.java
index 513e445..3bd4d98 100644
--- a/plc4j/utils/scraper/src/test/java/org/apache/plc4x/java/scraper/triggeredscraper/triggerhandler/TriggerConfigurationTest.java
+++ b/plc4j/utils/scraper/src/test/java/org/apache/plc4x/java/scraper/triggeredscraper/triggerhandler/TriggerConfigurationTest.java
@@ -67,7 +67,9 @@ class TriggerConfigurationTest {
             Arguments.of("(S7_TRIGGER_VAR,50,(%DB111:DBX10:BOOL)==(33))"),
             Arguments.of("(S7_TRIGGER_VAR,50,(%DB111:DBX10.1:BOOL)==(33))"),
             Arguments.of("(S7_TRIGGER_VAR,50,(%DB111:DBX10.1:BOOL)<=(true))"),
-            Arguments.of("(S7_TRIGGER_VAR,50,(%DB111:DBW10:INT)<=(true))")
+            Arguments.of("(S7_TRIGGER_VAR,50,(%DB111:DBW10:INT)<=(true))"),
+            Arguments.of("(MODBUS_TRIGGER_VAR,50)"),
+            Arguments.of("(MODBUS_TRIGGER_VAR,50,(%DB111:DBW10:INT)<=(11))")
         );
     }
 
diff --git a/plc4j/utils/scraper/src/test/resources/example_triggered_scraper_modbus.yml b/plc4j/utils/scraper/src/test/resources/example_triggered_scraper_modbus.yml
new file mode 100644
index 0000000..6122ae9
--- /dev/null
+++ b/plc4j/utils/scraper/src/test/resources/example_triggered_scraper_modbus.yml
@@ -0,0 +1,30 @@
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+---
+sources:
+  LABJACK_PI: modbus:tcp://192.168.167.149:502
+
+jobs:
+  - name: scheduled-demo-job1
+    triggerConfig: (SCHEDULED,100)
+    sources:
+      - LABJACK_PI
+    fields:
+      test1: 'readholdingregisters:49100[2]'
+