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/01/30 16:40:07 UTC
[incubator-plc4x] branch develop updated: - Added a multi-module
example consisting of an Apache Royale JavaScript frontend,
a Spring service module and a Spring-Boot WAR application bundling
everything together.
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new ced3a50 - Added a multi-module example consisting of an Apache Royale JavaScript frontend, a Spring service module and a Spring-Boot WAR application bundling everything together.
ced3a50 is described below
commit ced3a501f78e5f5822b1d58cbbb979d564eaf485
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Wed Jan 30 17:40:04 2019 +0100
- Added a multi-module example consisting of an Apache Royale JavaScript frontend, a Spring service module and a Spring-Boot WAR application bundling everything together.
---
examples/hello-webapp/client/pom.xml | 125 ++++++++++++++++++
.../client/src/main/royale/HelloPLC4X.mxml | 104 +++++++++++++++
.../client/src/main/royale/service/RobotService.as | 92 ++++++++++++++
examples/hello-webapp/pom.xml | 77 ++++++++++++
examples/hello-webapp/service/pom.xml | 76 +++++++++++
.../robot/controllers/RobotController.java | 98 +++++++++++++++
examples/hello-webapp/webapp/pom.xml | 140 +++++++++++++++++++++
.../apache/plc4x/examples/robot/Application.java | 32 +++++
.../src/main/resources/application.properties | 25 ++++
examples/pom.xml | 1 +
.../apache/plc4x/protocols/s7/protocol.scxml.xml | 11 +-
sandbox/dynamic-driver-s7/pom.xml | 127 +++++++++++++++++++
sandbox/pom.xml | 1 +
13 files changed, 907 insertions(+), 2 deletions(-)
diff --git a/examples/hello-webapp/client/pom.xml b/examples/hello-webapp/client/pom.xml
new file mode 100644
index 0000000..5409285
--- /dev/null
+++ b/examples/hello-webapp/client/pom.xml
@@ -0,0 +1,125 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.plc4x.examples</groupId>
+ <artifactId>hello-webapp</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>hello-webapp-client</artifactId>
+ <packaging>swf</packaging>
+
+ <name>Examples: Hello-Webapp: Client</name>
+
+ <build>
+ <sourceDirectory>src/main/royale</sourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.royale.compiler</groupId>
+ <artifactId>royale-maven-plugin</artifactId>
+ <version>0.9.6-SNAPSHOT</version>
+ <extensions>true</extensions>
+ <configuration>
+ <mainClass>HelloPLC4X.mxml</mainClass>
+ <targets>JSRoyale</targets>
+ <debug>true</debug>
+ <!--keepAs3Metadata>
+ <name>Bindable</name>
+ <name>Managed</name>
+ <name>ChangeEvent</name>
+ <name>NonCommittingChangeEvent</name>
+ <name>Transient</name>
+ <name>Mixin</name>
+ </keepAs3Metadata-->
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.royale.compiler</groupId>
+ <artifactId>compiler-jx</artifactId>
+ <version>0.9.6-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.royale.framework</groupId>
+ <artifactId>Jewel</artifactId>
+ <version>0.9.6-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>js</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.royale.framework</groupId>
+ <artifactId>Language</artifactId>
+ <version>0.9.6-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>js</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.royale.framework</groupId>
+ <artifactId>Network</artifactId>
+ <version>0.9.6-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>js</classifier>
+ </dependency>
+ <!--dependency>
+ <groupId>org.apache.royale.framework</groupId>
+ <artifactId>HTML</artifactId>
+ <version>0.9.6-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>js</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.royale.framework</groupId>
+ <artifactId>Collections</artifactId>
+ <version>0.9.6-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>js</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.royale.framework</groupId>
+ <artifactId>Binding</artifactId>
+ <version>0.9.6-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>js</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.royale.framework</groupId>
+ <artifactId>Graphics</artifactId>
+ <version>0.9.6-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>js</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.royale.framework</groupId>
+ <artifactId>Basic</artifactId>
+ <version>0.9.6-SNAPSHOT</version>
+ <type>swc</type>
+ <classifier>js</classifier>
+ </dependency-->
+ </dependencies>
+
+</project>
diff --git a/examples/hello-webapp/client/src/main/royale/HelloPLC4X.mxml b/examples/hello-webapp/client/src/main/royale/HelloPLC4X.mxml
new file mode 100644
index 0000000..c78bb06
--- /dev/null
+++ b/examples/hello-webapp/client/src/main/royale/HelloPLC4X.mxml
@@ -0,0 +1,104 @@
+<?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.
+ -->
+<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:j="library://ns.apache.org/royale/jewel"
+ xmlns:js="library://ns.apache.org/royale/basic"
+ xmlns:service="service.*">
+
+ <j:beads>
+ <js:ContainerDataBinding/>
+ <service:RobotService id="robotService" success="onSuccess(event)"/>
+ </j:beads>
+
+
+ <fx:Script>
+ <![CDATA[
+ import org.apache.royale.events.Event;
+ import org.apache.royale.events.MouseEvent;
+
+ public function move(event:MouseEvent):void {
+ if (event.target == moveForwardLeftButton) {
+ robotService.moveForwardLeft();
+ } else if (event.target == moveForwardButton) {
+ robotService.moveForward();
+ } else if (event.target == moveForwardRightButton) {
+ robotService.moveForwardRight();
+ } else if (event.target == turnLeftButton) {
+ robotService.turnLeft();
+ } else if (event.target == stopButton) {
+ robotService.stop();
+ } else if (event.target == turnRightButton) {
+ robotService.turnRight();
+ } else if (event.target == moveBackwardLeftButton) {
+ robotService.moveBackwardLeft();
+ } else if (event.target == moveBackwardButton) {
+ robotService.moveBackward();
+ } else if (event.target == moveBackwardRightButton) {
+ robotService.moveBackwardRight();
+ }
+ }
+
+ public function onSuccess(event:Event):void {
+
+ }
+ ]]>
+ </fx:Script>
+
+ <j:initialView>
+ <j:View width="100%" height="100%">
+ <j:HGroup width="100%" height="100%">
+ <j:VGroup width="33%" height="100%">
+ <j:Button id="moveForwardLeftButton" text="Left Forward"
+ click="move(event)"
+ width="100%" height="33%"/>
+ <j:Button id="turnLeftButton" text="Left"
+ click="move(event)"
+ width="100%" height="33%"/>
+ <j:Button id="moveBackwardLeftButton" text="Left Backward"
+ click="move(event)"
+ width="100%" height="33%"/>
+ </j:VGroup>
+ <j:VGroup width="33%" height="100%">
+ <j:Button id="moveForwardButton" text="Forward"
+ click="move(event)"
+ width="100%" height="33%"/>
+ <j:Button id="stopButton" text="Stop"
+ click="move(event)"
+ width="100%" height="33%"/>
+ <j:Button id="moveBackwardButton" text="Backward"
+ click="move(event)"
+ width="100%" height="33%"/>
+ </j:VGroup>
+ <j:VGroup width="33%" height="100%">
+ <j:Button id="moveForwardRightButton" text="Right Forward"
+ click="move(event)"
+ width="100%" height="33%"/>
+ <j:Button id="turnRightButton" text="Right"
+ click="move(event)"
+ width="100%" height="33%"/>
+ <j:Button id="moveBackwardRightButton" text="Right Backward"
+ click="move(event)"
+ width="100%" height="33%"/>
+ </j:VGroup>
+ </j:HGroup>
+ </j:View>
+ </j:initialView>
+
+</j:Application>
diff --git a/examples/hello-webapp/client/src/main/royale/service/RobotService.as b/examples/hello-webapp/client/src/main/royale/service/RobotService.as
new file mode 100644
index 0000000..03aaaaa
--- /dev/null
+++ b/examples/hello-webapp/client/src/main/royale/service/RobotService.as
@@ -0,0 +1,92 @@
+/*
+ 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 service
+{
+import org.apache.royale.events.Event;
+import org.apache.royale.events.EventDispatcher;
+import org.apache.royale.net.HTTPConstants;
+import org.apache.royale.net.HTTPService;
+
+[Event(name="success", type="org.apache.royale.events.Event")]
+public class RobotService extends EventDispatcher {
+
+ private var remoteService:HTTPService;
+ private var _url:String = null;
+
+ /**
+ * constructor
+ */
+ public function RobotService():void {
+ remoteService = new HTTPService();
+ remoteService.addEventListener(HTTPConstants.COMPLETE, completeHandler);
+ _url = "api/robot/move";
+ }
+
+ private function completeHandler(event:Event):void {
+ dispatchEvent(new Event("success"));
+ }
+
+ public function moveForwardLeft():void {
+ remoteService.url = _url + "?direction=forward-left";
+ remoteService.send();
+ }
+
+ public function moveForward():void {
+ remoteService.url = _url + "?direction=forward";
+ remoteService.send();
+ }
+
+ public function moveForwardRight():void {
+ remoteService.url = _url + "?direction=forward-right";
+ remoteService.send();
+ }
+
+ public function turnLeft():void {
+ remoteService.url = _url + "?direction=left";
+ remoteService.send();
+ }
+
+ public function stop():void {
+ remoteService.url = _url + "?direction=stop";
+ remoteService.send();
+ }
+
+ public function turnRight():void {
+ remoteService.url = _url + "?direction=right";
+ remoteService.send();
+ }
+
+ public function moveBackwardLeft():void {
+ remoteService.url = _url + "?direction=backward-left";
+ remoteService.send();
+ }
+
+ public function moveBackward():void {
+ remoteService.url = _url + "?direction=backward";
+ remoteService.send();
+ }
+
+ public function moveBackwardRight():void {
+ remoteService.url = _url + "?direction=backward-right";
+ remoteService.send();
+ }
+
+}
+}
\ No newline at end of file
diff --git a/examples/hello-webapp/pom.xml b/examples/hello-webapp/pom.xml
new file mode 100644
index 0000000..1d2fdb0
--- /dev/null
+++ b/examples/hello-webapp/pom.xml
@@ -0,0 +1,77 @@
+<?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.examples</groupId>
+ <artifactId>examples</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>hello-webapp</artifactId>
+ <name>Examples: Hello-Webapp (root)</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <spring-boot.version>2.1.2.RELEASE</spring-boot.version>
+ </properties>
+
+ <modules>
+ <module>client</module>
+ <module>service</module>
+ <module>webapp</module>
+ </modules>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>com.buschmais.jqassistant</groupId>
+ <artifactId>jqassistant-maven-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <skipAssembly>true</skipAssembly>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring-boot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+</project>
\ No newline at end of file
diff --git a/examples/hello-webapp/service/pom.xml b/examples/hello-webapp/service/pom.xml
new file mode 100644
index 0000000..e933162
--- /dev/null
+++ b/examples/hello-webapp/service/pom.xml
@@ -0,0 +1,76 @@
+<?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.examples</groupId>
+ <artifactId>hello-webapp</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>hello-webapp-service</artifactId>
+
+ <name>Examples: Hello-Webapp: Service</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies>
+ <usedDependency>org.apache.plc4x:plc4j-driver-s7</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-api</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-driver-s7</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/examples/hello-webapp/service/src/main/java/org/apache/plc4x/examples/robot/controllers/RobotController.java b/examples/hello-webapp/service/src/main/java/org/apache/plc4x/examples/robot/controllers/RobotController.java
new file mode 100644
index 0000000..9fe5194
--- /dev/null
+++ b/examples/hello-webapp/service/src/main/java/org/apache/plc4x/examples/robot/controllers/RobotController.java
@@ -0,0 +1,98 @@
+/*
+ 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.examples.robot.controllers;
+
+import org.apache.plc4x.java.PlcDriverManager;
+import org.apache.plc4x.java.api.PlcConnection;
+import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
+import org.apache.plc4x.java.api.messages.PlcWriteRequest;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.PostConstruct;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+@RestController
+@RequestMapping("api/robot")
+public class RobotController {
+
+ private static byte MOTOR_RIGHT_BACKWARDS = 0x01;
+ private static byte MOTOR_RIGHT_ON = 0x02;
+ private static byte MOTOR_LEFT_BACKWARDS = 0x04;
+ private static byte MOTOR_LEFT_ON = 0x08;
+
+ @Value("${plc4x.connection-string}")
+ private String connectionString;
+
+ @Value("${plc4x.address-string}")
+ private String addressString;
+
+ private PlcConnection connection;
+
+ @PostConstruct
+ public void init() throws PlcConnectionException {
+ connection = new PlcDriverManager().getConnection(connectionString);
+ }
+
+ @RequestMapping("move")
+ public boolean move(@RequestParam(value="direction", defaultValue="stop") String direction) {
+ System.out.println("Move in direction: " + direction);
+ byte state = 0;
+ switch (direction) {
+ case "forward-right":
+ state = MOTOR_LEFT_ON;
+ break;
+ case "forward":
+ state = (byte) (MOTOR_LEFT_ON | MOTOR_RIGHT_ON);
+ break;
+ case "forward-left":
+ state = MOTOR_RIGHT_ON;
+ break;
+ case "left":
+ state = (byte) (MOTOR_LEFT_BACKWARDS | MOTOR_LEFT_ON | MOTOR_RIGHT_ON);
+ break;
+ case "right":
+ state = (byte) (MOTOR_LEFT_ON | MOTOR_RIGHT_BACKWARDS | MOTOR_RIGHT_ON);
+ break;
+ case "backward-right":
+ state = (byte) (MOTOR_LEFT_BACKWARDS | MOTOR_LEFT_ON);
+ break;
+ case "backward":
+ state = (byte) (MOTOR_LEFT_BACKWARDS | MOTOR_LEFT_ON | MOTOR_RIGHT_BACKWARDS | MOTOR_RIGHT_ON);
+ break;
+ case "backward-left":
+ state = (byte) (MOTOR_RIGHT_BACKWARDS | MOTOR_RIGHT_ON);
+ break;
+ }
+ try {
+ PlcWriteRequest updateRequest = connection.writeRequestBuilder().addItem("state", addressString, state).build();
+ updateRequest.execute().get(2000, TimeUnit.MILLISECONDS);
+ return true;
+ } catch (InterruptedException | ExecutionException | TimeoutException e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+}
diff --git a/examples/hello-webapp/webapp/pom.xml b/examples/hello-webapp/webapp/pom.xml
new file mode 100644
index 0000000..ce92ab4
--- /dev/null
+++ b/examples/hello-webapp/webapp/pom.xml
@@ -0,0 +1,140 @@
+<?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.examples</groupId>
+ <artifactId>hello-webapp</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>hello-webapp-webapp</artifactId>
+ <packaging>war</packaging>
+
+ <name>Examples: Hello-Webapp: Spring-Boot WAR</name>
+
+ <properties>
+ <start.class>org.apache.plc4x.examples.robot.Application</start.class>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring-boot.version}</version>
+ <executions>
+ <execution>
+ <id>repackage</id>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>${start.class}</mainClass>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <!-- Unpack the client content into this module in order to be able to serve the client too. -->
+ <execution>
+ <id>copy-client</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.plc4x.examples</groupId>
+ <artifactId>hello-webapp-client</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <type>war</type>
+ <outputDirectory>${project.build.outputDirectory}/static/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <usedDependencies>
+ <usedDependency>org.springframework.boot:spring-boot-starter-web</usedDependency>
+ <usedDependency>org.apache.plc4x.examples:hello-webapp-service</usedDependency>
+ <usedDependency>org.apache.plc4x.examples:hello-webapp-client</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>${start.class}</mainClass>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.plc4x.examples</groupId>
+ <artifactId>hello-webapp-service</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-autoconfigure</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.plc4x.examples</groupId>
+ <artifactId>hello-webapp-client</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <type>war</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+
+</project>
\ No newline at end of file
diff --git a/examples/hello-webapp/webapp/src/main/java/org/apache/plc4x/examples/robot/Application.java b/examples/hello-webapp/webapp/src/main/java/org/apache/plc4x/examples/robot/Application.java
new file mode 100644
index 0000000..4493cf8
--- /dev/null
+++ b/examples/hello-webapp/webapp/src/main/java/org/apache/plc4x/examples/robot/Application.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.examples.robot;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/examples/hello-webapp/webapp/src/main/resources/application.properties b/examples/hello-webapp/webapp/src/main/resources/application.properties
new file mode 100644
index 0000000..9c6a18d
--- /dev/null
+++ b/examples/hello-webapp/webapp/src/main/resources/application.properties
@@ -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.
+#
+
+debug=true
+spring.mvc.view.prefix= /
+spring.mvc.view.suffix= .html
+
+plc4x.connection-string=s7://10.10.64.21/0/0?controller-type=LOGO
+plc4x.address-string=%DB1.DB1064:BYTE
diff --git a/examples/pom.xml b/examples/pom.xml
index 2b32779..ff7b740 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -43,6 +43,7 @@
<module>hello-integration-edgent</module>
<module>hello-opm</module>
<module>hello-storage-elasticsearch</module>
+ <module>hello-webapp</module>
<module>hello-world-plc4x</module>
</modules>
diff --git a/protocols/s7/src/main/resources/org/apache/plc4x/protocols/s7/protocol.scxml.xml b/protocols/s7/src/main/resources/org/apache/plc4x/protocols/s7/protocol.scxml.xml
index 1073a0b..d9c54aa 100644
--- a/protocols/s7/src/main/resources/org/apache/plc4x/protocols/s7/protocol.scxml.xml
+++ b/protocols/s7/src/main/resources/org/apache/plc4x/protocols/s7/protocol.scxml.xml
@@ -29,7 +29,6 @@
<onentry>
<!-- Setup the initial content of the connection context (Callback in the driver) -->
<plc4x:initContext/>
- <plc4x:connect type="tcp" host="{connection-host}" port="{connection-port}"/>
</onentry>
<initial>
<transition target="connect"/>
@@ -41,9 +40,17 @@
<state id="connect">
<initial>
- <transition target="sendCotpConnectionRequest"/>
+ <transition target="establishNetworkConnection"/>
</initial>
+ <state id="establishNetworkConnection">
+ <onentry>
+ <!-- Initialize the network connection to the remote host using the tcp adapter with a given host and port -->
+ <plc4x:connect type="tcp" host="{connection-host}" port="{connection-port}"/>
+ </onentry>
+ <transition target="sendCotpConnectionRequest"/>
+ </state>
+
<state id="sendCotpConnectionRequest">
<onentry>
<plc4x:send>
diff --git a/sandbox/dynamic-driver-s7/pom.xml b/sandbox/dynamic-driver-s7/pom.xml
new file mode 100644
index 0000000..daa559e
--- /dev/null
+++ b/sandbox/dynamic-driver-s7/pom.xml
@@ -0,0 +1,127 @@
+<?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.sandbox</groupId>
+ <artifactId>plc4x-sandbox</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>plc4j-dynamic-driver-s7</artifactId>
+ <name>Sandbox: Dynamic-Driver: S7</name>
+ <description>Implementation of a S7 driver based on definitions provided by DFDL and SCXML.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-api</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId></artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-protocol-driver-base</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-protocol-driver-base-tcp</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-transport</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-buffer</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-configuration2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-protocol-driver-base-test</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.pcap4j</groupId>
+ <artifactId>pcap4j-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.pcap4j</groupId>
+ <artifactId>pcap4j-packetfactory-static</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-utils-test-utils</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies combine.children="append">
+ <usedDependency>org.pcap4j:pcap4j-packetfactory-static</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/sandbox/pom.xml b/sandbox/pom.xml
index 89c9fb1..7df89ba 100644
--- a/sandbox/pom.xml
+++ b/sandbox/pom.xml
@@ -27,6 +27,7 @@
<version>0.4.0-SNAPSHOT</version>
</parent>
+ <groupId>org.apache.plc4x.sandbox</groupId>
<artifactId>plc4x-sandbox</artifactId>
<packaging>pom</packaging>