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/11/29 21:23:08 UTC
[plc4x] branch feature/grpc-proxy created (now d3eb549)
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a change to branch feature/grpc-proxy
in repository https://gitbox.apache.org/repos/asf/plc4x.git.
at d3eb549 - Finetuned the README documentation to lay emphasis on the requirement to use Java 11
This branch includes the following new commits:
new d3eb549 - Finetuned the README documentation to lay emphasis on the requirement to use Java 11
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.
[plc4x] 01/01: - Finetuned the README documentation to lay emphasis
on the requirement to use Java 11
Posted by cd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/grpc-proxy
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit d3eb549b08e454237aa0306a5b4fb7528823a05f
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Sun Nov 29 22:22:52 2020 +0100
- Finetuned the README documentation to lay emphasis on the requirement to use Java 11
---
plc4j/drivers/pom.xml | 1 +
plc4j/drivers/proxy/pom.xml | 193 +++++++++++++++++++++
protocols/proxy/src/main/java/.keepMe | 20 ---
.../org/apache/plc4x/protocols/proxy/proxy.proto | 156 +++++++++++++++++
4 files changed, 350 insertions(+), 20 deletions(-)
diff --git a/plc4j/drivers/pom.xml b/plc4j/drivers/pom.xml
index c61d435..b3133e1 100644
--- a/plc4j/drivers/pom.xml
+++ b/plc4j/drivers/pom.xml
@@ -41,6 +41,7 @@
<module>knxnetip</module>
<module>mock</module>
<module>modbus</module>
+ <module>proxy</module>
<module>s7</module>
<module>opcua</module>
diff --git a/plc4j/drivers/proxy/pom.xml b/plc4j/drivers/proxy/pom.xml
new file mode 100644
index 0000000..2ba37d6
--- /dev/null
+++ b/plc4j/drivers/proxy/pom.xml
@@ -0,0 +1,193 @@
+<?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</groupId>
+ <artifactId>plc4j-drivers</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>plc4j-driver-proxy</artifactId>
+ <name>PLC4J: Driver: Proxy</name>
+ <description>Implementation of a PLC4X driver which communicates with a PLC4X proxy server.</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-proto-files</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4x-protocols-proxy</artifactId>
+ <type>jar</type>
+ <includes>**/*.proto</includes>
+ <outputDirectory>${project.build.directory}/proto</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.github.os72</groupId>
+ <artifactId>protoc-jar-maven-plugin</artifactId>
+ <version>3.11.4</version>
+ <executions>
+ <execution>
+ <id>generate-code</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <inputDirectories>
+ <include>${project.build.directory}/proto</include>
+ </inputDirectories>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-feature-xml</id>
+ <phase>compile</phase>
+ <goals>
+ <!-- Generate the feature.xml -->
+ <goal>features-generate-descriptor</goal>
+ <!-- Check the feature.xml -->
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <enableGeneration>true</enableGeneration>
+ <aggregateFeatures>true</aggregateFeatures>
+ </configuration>
+ </execution>
+ <execution>
+ <id>build-kar</id>
+ <phase>package</phase>
+ <goals>
+ <!--
+ Build a kar archive (Jar containing the feature.xml
+ as well as the module content and it's dependencies.
+ -->
+ <goal>kar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.apache.plc4x.java.osgi.DriverActivator</Bundle-Activator>
+ <Export-Service>org.apache.plc4x.java.api.PlcDriver,org.apache.plc4x.java.s7.readwrite.S7Driver</Export-Service>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies combine.children="append">
+ </usedDependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-api</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-spi</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>3.11.4</version>
+ </dependency>
+
+ <!--dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-transport-tcp</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-buffer</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.vavr</groupId>
+ <artifactId>vavr</artifactId>
+ </dependency-->
+
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4x-protocols-proxy</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <!-- Scope is 'provided' as this way it's not shipped with the driver -->
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-utils-test-utils</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/protocols/proxy/src/main/java/.keepMe b/protocols/proxy/src/main/java/.keepMe
deleted file mode 100644
index 97c6314..0000000
--- a/protocols/proxy/src/main/java/.keepMe
+++ /dev/null
@@ -1,20 +0,0 @@
-
- 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.
-
-This file is required to force the existence of the src/main/java directory
-which activates the "java-module" maven profile.
-
-PLEASE DO NOT DELETE ... it will break the build.
\ No newline at end of file
diff --git a/protocols/proxy/src/main/resources/org/apache/plc4x/protocols/proxy/proxy.proto b/protocols/proxy/src/main/resources/org/apache/plc4x/protocols/proxy/proxy.proto
new file mode 100644
index 0000000..d9eb877
--- /dev/null
+++ b/protocols/proxy/src/main/resources/org/apache/plc4x/protocols/proxy/proxy.proto
@@ -0,0 +1,156 @@
+/*
+ * 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.
+ */
+syntax = "proto3";
+
+package com.apache.plc4x.proxy;
+
+enum PlcResponseCode {
+ OK = 0;
+ NOT_FOUND = 1;
+ ACCESS_DENIED = 2;
+ INVALID_ADDRESS = 3;
+ INVALID_DATATYPE = 4;
+ INVALID_DATA = 5;
+ INTERNAL_ERROR = 6;
+ REMOTE_BUSY = 7;
+ REMOTE_ERROR = 8;
+ UNSUPPORTED = 9;
+ RESPONSE_PENDING = 10;
+}
+
+message PlcValue {
+ oneof PlcValue_impl {
+ bool BOOL = 1;
+ uint32 BYTE = 2;
+ uint32 WORD = 3;
+ uint64 DWORD = 4;
+
+ uint32 USINT = 5;
+ uint32 UINT = 6;
+ uint32 UDINT = 7;
+ uint64 ULINT = 8;
+
+ uint32 SINT = 9;
+ uint32 INT = 10;
+ uint32 DINT = 11;
+ uint64 LINT = 12;
+
+ float REAL = 13;
+ double LREAL = 14;
+
+ string TIME = 15;
+ string LTIME = 16;
+ string DATE = 17;
+ string LDATE = 18;
+ string TIME_OF_DAY = 19;
+ string DATE_AND_TIME = 20;
+
+ string CHAR = 21;
+ string WCHAR = 22;
+ string STRING = 23;
+ string WSTRING = 24;
+ }
+}
+
+////////////////////////////////////////////////////////
+
+message PlcReadRequest {
+ repeated string addresses = 1;
+}
+
+message PlcReadResponse {
+ repeated PlcReadResponseItem items = 1;
+}
+
+message PlcReadResponseItem {
+ string address = 1;
+ PlcResponseCode responseCode = 2;
+ repeated PlcValue values = 3;
+}
+
+////////////////////////////////////////////////////////
+
+message PlcWriteRequest {
+ repeated PlcWriteRequestItem items = 1;
+}
+
+message PlcWriteRequestItem {
+ string address = 1;
+ repeated PlcValue values = 2;
+}
+
+message PlcWriteResponse {
+ repeated PlcWriteResponseItem items = 1;
+}
+
+message PlcWriteResponseItem {
+ string address = 1;
+ PlcResponseCode responseCode = 2;
+}
+
+////////////////////////////////////////////////////////
+
+message PlcSubscriptionRequest {
+ repeated PlsSubscriptionRequestItem items = 1;
+}
+
+message PlsSubscriptionRequestItem {
+ oneof subscription_items {
+ PlsSubscriptionRequestItemChangeOfValue changeOfValueItem = 1;
+ PlsSubscriptionRequestItemPolling pollingItem = 2;
+ PlsSubscriptionRequestItemEvent eventItem = 3;
+ }
+}
+
+message PlsSubscriptionRequestItemChangeOfValue {
+ string address = 1;
+}
+
+message PlsSubscriptionRequestItemPolling {
+ string address = 1;
+ int64 interval = 2;
+}
+
+message PlsSubscriptionRequestItemEvent {
+ string address = 1;
+}
+
+message PlcSubscriptionEvent {
+ repeated PlcSubscriptionEventItem items = 1;
+}
+
+message PlcSubscriptionEventItem {
+ string address = 1;
+ PlcResponseCode responseCode = 2;
+ repeated PlcValue values = 3;
+}
+
+////////////////////////////////////////////////////////
+
+service PlcReader {
+ rpc Read(PlcReadRequest) returns (PlcReadResponse);
+}
+
+service PlcWriter {
+ rpc Write(PlcWriteRequest) returns (PlcWriteResponse);
+}
+
+service PlcSubscriber {
+ rpc Subscribe(PlcSubscriptionRequest) returns (stream PlcSubscriptionEvent);
+}