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/05/10 14:53:59 UTC
[plc4x] branch develop updated: Revert: Merge branch 'develop' of
https://gitbox.apache.org/repos/asf/plc4x into develop
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/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new fd40493 Revert: Merge branch 'develop' of https://gitbox.apache.org/repos/asf/plc4x into develop
fd40493 is described below
commit fd40493afd39bf915533de79807001fbf3e9e118
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Fri May 10 16:23:34 2019 +0200
Revert: Merge branch 'develop' of https://gitbox.apache.org/repos/asf/plc4x into develop
- Undid the accidental changes with the last commit
- Added some documentation on how to setup the environment
---
.gitignore | 1 +
.vscode/settings.json | 8 +
Jenkinsfile | 6 +-
README | 7 +-
integrations/apache-brooklyn/pom.xml | 40 ---
plc4cpp/CMakeLists.txt | 16 +-
plc4cpp/api/CMakeLists.txt | 7 +-
.../cpp/org/apache/plc4x/cpp/PlcDriverManager.cpp | 175 ----------
.../cpp/org/apache/plc4x/cpp/PlcDriverManager.h | 71 ----
.../cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp | 93 ++----
.../cpp/org/apache/plc4x/cpp/api/PlcConnection.h | 228 +++++--------
.../plc4x/cpp/api/messages/PlcFieldRequest.h | 10 +-
.../plc4x/cpp/api/messages/PlcReadRequest.cpp | 6 +
.../apache/plc4x/cpp/api/messages/PlcReadRequest.h | 10 +-
...lcReadRequest.cpp => PlcReadRequestBuilder.cpp} | 9 +-
...PlcRequestBuilder.h => PlcReadRequestBuilder.h} | 15 +-
.../plc4x/cpp/api/messages/PlcRequestBuilder.h | 1 +
plc4cpp/{utils => examples}/CMakeLists.txt | 4 +-
.../karaf-s7-feature => plc4cpp/examples}/pom.xml | 41 +--
plc4cpp/{utils => integrations}/CMakeLists.txt | 5 +-
.../apache-mynewt}/CMakeLists.txt | 4 +-
.../integrations}/apache-mynewt/pom.xml | 6 +-
.../edgex-foundry}/CMakeLists.txt | 4 +-
.../integrations/edgex-foundry}/pom.xml | 34 +-
{integrations => plc4cpp/integrations}/pom.xml | 14 +-
plc4cpp/pom.xml | 3 +
plc4cpp/protocols/driver-bases/base/CMakeLists.txt | 7 +-
.../cpp/base/connection/AbstractPlcConnection.cpp | 31 +-
.../cpp/base/connection/AbstractPlcConnection.h | 5 +-
.../plc4x/cpp/base/connection/PlcFieldHandler.h | 2 +-
.../cpp/base/messages/DefaultPlcReadRequest.cpp | 100 +++---
.../cpp/base/messages/DefaultPlcReadRequest.h | 35 +-
.../cpp/base/messages/DefaultPlcWriteRequest.cpp | 127 +++----
.../cpp/base/messages/DefaultPlcWriteRequest.h | 11 +-
.../cpp/base/messages/InternalPlcFieldRequest.h | 2 +-
plc4cpp/utils/CMakeLists.txt | 2 -
plc4cpp/utils/logger/CMakeLists.txt | 6 -
.../org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp | 6 +-
.../org/apache/plc4x/cpp/utils/logger/ExLog.cpp | 2 +-
{examples => plc4j/examples}/dummy-driver/pom.xml | 6 +-
.../java/examples/dummydriver/DummyDriver.java | 4 +-
.../dummydriver/connection/DummyConnection.java | 0
.../examples/dummydriver/model/DummyField.java | 0
.../examples/dummydriver/netty/DummyProtocol.java | 0
.../services/org.apache.plc4x.java.spi.PlcDriver | 0
.../examples}/hello-cloud-azure/pom.xml | 6 +-
.../java/examples/cloud/azure/CliOptions.java | 0
.../cloud/azure/S7PlcToAzureIoTHubSample.java | 0
.../examples}/hello-cloud-google/README.md | 0
.../examples}/hello-cloud-google/pom.xml | 6 +-
.../java/examples/cloud/google/CliOptions.java | 0
.../cloud/google/S7PlcToGoogleIoTCoreSample.java | 0
.../src/main/resources/logback.xml | 0
.../hello-connectivity-kafka/kafka-connector.yml | 0
.../examples}/hello-connectivity-kafka/pom.xml | 6 +-
.../examples}/hello-connectivity-kafka/server.sh | 0
.../connectivity/kafka/KafkaConnector.java | 0
.../connectivity/kafka/model/Configuration.java | 0
.../connectivity/kafka/model/KafkaConfig.java | 0
.../connectivity/kafka/model/PlcConfig.java | 0
.../connectivity/kafka/model/PlcFieldConfig.java | 0
.../connectivity/kafka/model/PlcMemoryBlock.java | 0
.../src/main/resources/logback.xml | 0
.../hello-connectivity-mqtt/mqtt-connector.yml | 0
.../examples}/hello-connectivity-mqtt/pom.xml | 6 +-
.../examples/connectivity/mqtt/MqttConnector.java | 0
.../connectivity/mqtt/model/Configuration.java | 0
.../connectivity/mqtt/model/MqttConfig.java | 0
.../connectivity/mqtt/model/PlcConfig.java | 0
.../connectivity/mqtt/model/PlcFieldConfig.java | 0
.../connectivity/mqtt/model/PlcMemoryBlock.java | 0
.../src/main/resources/logback.xml | 0
.../examples}/hello-integration-edgent/pom.xml | 6 +-
.../examples/integration/edgent/CliOptions.java | 0
.../examples/integration/edgent/PlcLogger.java | 0
.../src/main/resources/logback.xml | 0
{examples => plc4j/examples}/hello-opm/pom.xml | 6 +-
.../plc4x/java/examples/helloopm/HelloOpm.java | 0
.../hello-opm/src/main/resources/logback.xml | 0
.../hello-storage-elasticsearch/README.adoc | 0
.../examples}/hello-storage-elasticsearch/pom.xml | 6 +-
.../elasticsearch/ElasticsearchStorage.java | 0
.../src/main/resources/log4j2.xml | 0
.../src/main/resources/logback.xml | 0
.../examples}/hello-webapp/client/pom.xml | 17 +-
.../client/src/main/royale/HelloPLC4X.mxml | 0
.../client/src/main/royale/service/RobotService.as | 0
{examples => plc4j/examples}/hello-webapp/pom.xml | 6 +-
.../examples}/hello-webapp/service/pom.xml | 6 +-
.../robot/controllers/RobotController.java | 0
.../examples}/hello-webapp/webapp/pom.xml | 16 +-
.../apache/plc4x/examples/robot/Application.java | 0
.../src/main/resources/application.properties | 0
.../examples}/hello-world-plc4x/pom.xml | 6 +-
.../plc4x/java/examples/helloplc4x/CliOptions.java | 0
.../plc4x/java/examples/helloplc4x/HelloPlc4x.java | 0
.../src/main/resources/logback.xml | 0
{examples => plc4j/examples}/pom.xml | 36 +-
.../integrations}/apache-calcite/pom.xml | 6 +-
.../main/java/org/apache/plc4x/Plc4xBaseTable.java | 0
.../main/java/org/apache/plc4x/Plc4xSchema.java | 0
.../java/org/apache/plc4x/Plc4xSchemaFactory.java | 0
.../java/org/apache/plc4x/Plc4xStreamTable.java | 0
.../src/main/java/org/apache/plc4x/Plc4xTable.java | 0
.../java/org/apache/plc4x/DriverManagerTest.java | 0
.../java/org/apache/plc4x/Plc4XBaseTableTest.java | 0
.../org/apache/plc4x/Plc4xSchemaFactoryTest.java | 2 -
.../apache-calcite/src/test/resources/example.yml | 0
.../apache-calcite}/src/test/resources/logback.xml | 0
.../apache-calcite/src/test/resources/model.json | 0
.../integrations}/apache-camel/pom.xml | 7 +-
.../apache-camel/src/main/docs/PLC4X.adoc | 0
.../java/org/apache/plc4x/camel/Constants.java | 0
.../org/apache/plc4x/camel/Plc4XComponent.java | 0
.../java/org/apache/plc4x/camel/Plc4XConsumer.java | 0
.../java/org/apache/plc4x/camel/Plc4XEndpoint.java | 0
.../apache/plc4x/camel/Plc4XPollingConsumer.java | 0
.../java/org/apache/plc4x/camel/Plc4XProducer.java | 0
.../services/org/apache/camel/component/plc4x | 0
.../java/org/apache/plc4x/camel/ConstantsTest.java | 0
.../java/org/apache/plc4x/camel/ManualTest.java | 0
.../java/org/apache/plc4x/camel/MockDriver.java | 0
.../org/apache/plc4x/camel/Plc4XComponentTest.java | 0
.../org/apache/plc4x/camel/Plc4XConsumerTest.java | 0
.../org/apache/plc4x/camel/Plc4XEndpointTest.java | 0
.../plc4x/camel/Plc4XPollingConsumerTest.java | 0
.../org/apache/plc4x/camel/Plc4XProducerTest.java | 0
.../services/org.apache.plc4x.java.spi.PlcDriver | 0
.../src/test/resources/log4j2.properties | 0
.../apache-camel}/src/test/resources/logback.xml | 0
.../integrations}/apache-edgent/pom.xml | 7 +-
.../apache/plc4x/edgent/PlcConnectionAdapter.java | 0
.../java/org/apache/plc4x/edgent/PlcFunctions.java | 0
.../java/org/apache/plc4x/edgent/package-info.java | 0
.../plc4x/edgent/PlcConnectionAdapterTest.java | 0
.../org/apache/plc4x/edgent/PlcFunctionsTest.java | 0
.../apache/plc4x/edgent/mock/MockConnection.java | 0
.../org/apache/plc4x/edgent/mock/MockDriver.java | 4 +-
.../org/apache/plc4x/edgent/mock/MockField.java | 0
.../apache/plc4x/edgent/mock/MockFieldHandler.java | 0
.../apache/plc4x/edgent/mock/MockFieldItem.java | 0
.../services/org.apache.plc4x.java.spi.PlcDriver | 0
.../integrations}/apache-kafka/README.md | 0
.../apache-kafka/config/sink.properties | 0
.../apache-kafka/config/source.properties | 0
.../integrations}/apache-kafka/pom.xml | 7 +-
.../org/apache/plc4x/kafka/Plc4xSinkConnector.java | 5 +-
.../java/org/apache/plc4x/kafka/Plc4xSinkTask.java | 0
.../apache/plc4x/kafka/Plc4xSourceConnector.java | 3 +-
.../org/apache/plc4x/kafka/Plc4xSourceTask.java | 0
.../org/apache/plc4x/kafka/util/VersionUtil.java | 0
.../apache-karaf/karaf-ads-feature/pom.xml | 15 +-
.../apache-karaf/karaf-demo-server/pom.xml | 28 +-
.../apache-karaf/karaf-ethernet-ip-feature/pom.xml | 15 +-
.../apache-karaf/karaf-modbus-feature/pom.xml | 15 +-
.../apache-karaf/karaf-s7-feature/pom.xml | 15 +-
.../apache-karaf/karaf-simulated-feature/pom.xml | 15 +-
.../integrations}/apache-karaf/pom.xml | 15 +-
.../apache-nifi/nifi-plc4x-nar/false-positives.xml | 0
.../apache-nifi/nifi-plc4x-nar/pom.xml | 23 +-
.../apache-nifi/nifi-plc4x-processors/pom.xml | 6 +-
.../org/apache/plc4x/nifi/BasePlc4xProcessor.java | 0
.../org/apache/plc4x/nifi/Plc4xSinkProcessor.java | 0
.../apache/plc4x/nifi/Plc4xSourceProcessor.java | 0
.../services/org.apache.nifi.processor.Processor | 0
.../plc4x4nifi/Plc4xSinkProcessorTest.java | 0
.../plc4x4nifi/Plc4xSourceProcessorTest.java | 0
.../integrations}/apache-nifi/pom.xml | 6 +-
.../integrations}/pom.xml | 42 +--
plc4j/pom.xml | 296 +++++++++++++++++
plc4j/protocols/delta-v/pom.xml | 15 +
plc4j/src/site/asciidoc/users/gettingstarted.adoc | 178 ++++++++++
plc4net/.gitignore | 344 +++++++++++++++++++
plc4net/api/PlcDriverManager.cs | 104 ++++++
.../utils/CMakeLists.txt => plc4net/api/api.csproj | 13 +-
plc4net/api/api/IPlcConnection.cs | 89 +++++
plc4net/api/api/IPlcDriver.cs | 57 ++++
.../api/api/authentication/IPlcAuthentication.cs | 18 +-
.../PlcUsernamePasswordAuthentication.cs | 48 +++
.../api/api/metadata/IPlcConnectionMetadata.cs | 30 +-
.../api/exceptions/PlcConnectionException.cs | 37 ++-
.../api/exceptions/PlcException.cs | 39 ++-
.../api/exceptions/PlcInvalidFieldException.cs | 33 +-
plc4net/api/messages/IPlcFieldRequest.cs | 52 +++
plc4net/api/messages/IPlcFieldResponse.cs | 49 +++
.../api/messages/IPlcMessage.cs | 18 +-
.../api/messages/IPlcReadRequest.cs | 18 +-
.../api/messages/IPlcReadRequestBuilder.cs | 30 +-
.../api/messages/IPlcReadResponse.cs | 18 +-
.../api/messages/IPlcRequest.cs | 23 +-
.../api/messages/IPlcRequestBuilder.cs | 23 +-
.../api/messages/IPlcResponse.cs | 22 +-
.../api/messages/IPlcSubscriptionEventArgs.cs | 22 +-
.../api/messages/IPlcSubscriptionRequest.cs | 18 +-
.../api/messages/IPlcSubscriptionRequestBuilder.cs | 54 +++
.../api/messages/IPlcSubscriptionResponse.cs | 33 +-
.../api/messages/IPlcUnsubscriptionRequest.cs | 18 +-
.../messages/IPlcUnsubscriptionRequestBuilder.cs | 45 +++
.../api/messages/IPlcUnsubscriptionResponse.cs | 18 +-
.../api/messages/IPlcWriteRequest.cs | 21 +-
plc4net/api/messages/IPlcWriteRequestBuilder.cs | 134 ++++++++
plc4net/api/model/IPlcField.cs | 39 +++
.../api/model/IPlcSubscriptionHandle.cs | 22 +-
{plc4cpp => plc4net/api}/pom.xml | 46 +--
.../api/types/PlcResponseCode.cs | 24 +-
.../plc4net.driver/plc4net.driver.csproj | 20 +-
{plc4cpp => plc4net/plc4net.driver}/pom.xml | 42 +--
plc4net/plc4net.sln | 44 +++
{plc4cpp => plc4net}/pom.xml | 32 +-
plc4py/pom.xml | 4 +-
.../python/org/apache/plc4x/PlcDriverManager.py | 1 +
.../org/apache/plc4x/test_PlcDriverManager.py | 3 +-
pom.xml | 368 ++-------------------
src/site/asciidoc/developers/conferences.adoc | 3 +-
src/site/asciidoc/users/gettingstarted.adoc | 3 +
tools/thrift/src/assembly/python.xml | 7 +
216 files changed, 2527 insertions(+), 1577 deletions(-)
diff --git a/.gitignore b/.gitignore
index 5aeefeb..ac3cf67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -94,3 +94,4 @@ plc4cpp/cmake-build-debug/
# Exclude temporary python stuff
plc4py/venv/
**/__pycache__/**/*
+/plc4cpp/.vscode/ipch
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..2421e38
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,8 @@
+{
+ "files.exclude": {
+ "**/.classpath": true,
+ "**/.project": true,
+ "**/.settings": true,
+ "**/.factorypath": true
+ }
+}
\ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
index 840d7c8..c4b06e1 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -106,7 +106,7 @@ pipeline {
// We'll deploy to a relative directory so we can save
// that and deploy in a later step on a different node
- sh 'mvn -P${JENKINS_PROFILE},development,with-cpp,with-python,with-proxies,with-sandbox ${MVN_TEST_FAIL_IGNORE} ${JQASSISTANT_NEO4J_VERSION} -DaltDeploymentRepository=snapshot-repo::default::file:./local-snapshots-dir clean deploy'
+ sh 'mvn -P${JENKINS_PROFILE},development,with-cpp,with-java,with-dotnet,with-python,with-proxies,with-sandbox ${MVN_TEST_FAIL_IGNORE} ${JQASSISTANT_NEO4J_VERSION} -DaltDeploymentRepository=snapshot-repo::default::file:./local-snapshots-dir clean deploy'
// Stash the build results so we can deploy them on another node
stash name: 'plc4x-build-snapshots', includes: 'local-snapshots-dir/**'
@@ -126,7 +126,7 @@ pipeline {
steps {
echo 'Checking Code Quality'
withSonarQubeEnv('ASF Sonar Analysis') {
- sh 'mvn -P${JENKINS_PROFILE},with-cpp,with-python,with-proxies sonar:sonar'
+ sh 'mvn -P${JENKINS_PROFILE},with-cpp,with-java,with-dotnet,with-python,with-proxies sonar:sonar'
}
}
}
@@ -167,7 +167,7 @@ pipeline {
}
steps {
echo 'Building Site'
- sh 'mvn -P${JENKINS_PROFILE} site'
+ sh 'mvn -P${JENKINS_PROFILE} -P${JENKINS_PROFILE},with-cpp,with-java,with-dotnet,with-python,with-proxies site'
}
}
diff --git a/README b/README
index edd064d..12fc41f 100644
--- a/README
+++ b/README
@@ -36,7 +36,7 @@ Linux
On a clean Ubuntu 18.04 the following software needs to be installed:
- sudo apt install bison flex python-dev
+ sudo apt
If you're building a source-distribution and haven't installed git yet, be sure to do so:
@@ -99,7 +99,7 @@ downloaded and installed by the maven wrapper `mvnw`.
Build PLC4X Java jars and install them in your local maven repository
-$ ./mvnw install # add -DskipTests to omit running the tests
+$ ./mvnw install -P with-java # add -DskipTests to omit running the tests
You can now construct Java applications that use PLC4X. The PLC4X samples
are a good place to start and are available inside the `examples`
@@ -123,6 +123,9 @@ The windows version can be found here: https://sourceforge.net/projects/winpcap4
(In order to read PCAPNG files we require a libpcap version 1.1.0 or greater. The default
Windows version is 1.0. At this location is a patched version based on libpcap 1.7.4)
+Same applies for Python with the `with-python` and the C# .Net imeplemtation with `with-dotnet` profiles.
+However both of these are in a pretty experimental state.
+
Building the C++ libraries
--------------------------
diff --git a/integrations/apache-brooklyn/pom.xml b/integrations/apache-brooklyn/pom.xml
deleted file mode 100644
index ea3aeef..0000000
--- a/integrations/apache-brooklyn/pom.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?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>integrations</artifactId>
- <version>0.4.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>apache-brooklyn</artifactId>
- <packaging>pom</packaging>
-
- <name>Integrations: Apache Brooklyn</name>
- <description>Integration module for integrating PLC4X into Apache Brooklyn.</description>
-
- <modules>
-
- </modules>
-
-</project>
\ No newline at end of file
diff --git a/plc4cpp/CMakeLists.txt b/plc4cpp/CMakeLists.txt
index f5ac41a..668ef96 100644
--- a/plc4cpp/CMakeLists.txt
+++ b/plc4cpp/CMakeLists.txt
@@ -24,18 +24,6 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(PLC4CPP_ROOT_DIR ${CMAKE_SOURCE_DIR})
-set(BOOST_ROOT "./libs/boost/target/boost_1_70_0/")
-set(Boost_USE_STATIC_LIBS ON)
-set(Boost_USE_MULTITHREADED ON)
-find_package(Boost COMPONENTS filesystem log REQUIRED)
-
-#[[ Trace CMAKE Variable ]]
-get_cmake_property(_variableNames VARIABLES)
-list (SORT _variableNames)
-foreach (_variableName ${_variableNames})
- message(STATUS "${_variableName}=${${_variableName}}")
-endforeach()
-
#[[
Build all the modules of PLC4Cpp
@@ -43,4 +31,6 @@ endforeach()
add_subdirectory(api)
add_subdirectory(protocols)
add_subdirectory(utils)
-add_subdirectory(examples)
\ No newline at end of file
+
+add_subdirectory(examples)
+add_subdirectory(integrations)
diff --git a/plc4cpp/api/CMakeLists.txt b/plc4cpp/api/CMakeLists.txt
index 9d442d3..9db5fc7 100644
--- a/plc4cpp/api/CMakeLists.txt
+++ b/plc4cpp/api/CMakeLists.txt
@@ -22,9 +22,7 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
-add_library(plc4cpp-api
- src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.cpp
- src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp
+add_library(plc4cpp-api src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp
src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcAuthentication.cpp
src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcUsernamePasswordAuthentication.cpp
src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcConnectionException.cpp
@@ -44,6 +42,7 @@ add_library(plc4cpp-api
src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldResponse.cpp
src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcMessage.cpp
src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp
+ src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.cpp
src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadResponse.cpp
src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequest.cpp
src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.cpp
@@ -74,6 +73,4 @@ add_library(plc4cpp-api
Import the boost headers
]]
target_include_directories (plc4cpp-api PUBLIC target/dependencies/include)
-target_include_directories (plc4cpp-api PUBLIC ${Boost_INCLUDE_DIRS})
-target_include_directories (plc4cpp-api PUBLIC ../utils/logger/src/main/cpp)
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.cpp b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.cpp
deleted file mode 100644
index 5c3506a..0000000
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.cpp
+++ /dev/null
@@ -1,175 +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.
-*/
-
-#include "PlcDriverManager.h"
-#include <windows.h>
-#include <boost/filesystem.hpp>
-#include <boost/regex.hpp>
-#include <iostream>
-
-namespace fs = boost::filesystem;
-
-namespace org
-{
- namespace apache
- {
- namespace plc4x
- {
- namespace cpp
- {
- PlcDriverManager::PlcDriverManager()
- {
- findDrivers();
- }
-
- PlcDriverManager::~PlcDriverManager()
- {
- }
-
- /**
- * Connects to a PLC using the given plc connection string.
- *
- * @param url plc connection string.
- * @return PlcConnection object.
- * @throws PlcConnectionException an exception if the connection attempt failed.
- */
- PlcConnection* PlcDriverManager::getConnection(std::string url)
- {
- PlcDriver* pPlcDriver = NULL;
- PlcConnection* pPlcConnection = NULL;
-
- pPlcDriver = getDriver(url);
- if (pPlcDriver != NULL)
- {
- pPlcConnection = pPlcDriver->connect(url);
- }
-
- return pPlcConnection;
- }
-
- /**
- * Connects to a PLC using the given plc connection string using given authentication credentials.
- *
- * @param url plc connection string.
- * @param authentication authentication credentials.
- * @return PlcConnection object.
- * @throws PlcConnectionException an exception if the connection attempt failed.
- **/
- PlcConnection* PlcDriverManager::getConnection(std::string url, PlcAuthentication& authentication)
- {
- PlcDriver* pPlcDriver = NULL;
- PlcConnection* pPlcConnection = NULL;
-
- pPlcDriver = getDriver(url);
- if (pPlcDriver != NULL)
- {
- pPlcConnection = pPlcDriver->connect(url, authentication);
- }
-
- return pPlcConnection;
- }
-
- PlcDriver* PlcDriverManager::getDriver(std::string url)
- {
- PlcDriver* pPlcDriver = NULL;
- std::string strProtocol = "";
-
- try
- {
- boost::regex exFilter(REGEX_PROTOCOL.c_str());
- boost::smatch what;
-
- if (boost::regex_search(url, what, exFilter))
- {
- if (what.size() > 1)
- {
- strProtocol = what[1].str();
- pPlcDriver = _mapDrivers[strProtocol];
- }
- }
-
- if (pPlcDriver == NULL)
- {
- BOOST_THROW_EXCEPTION(PlcConnectionException("Unable to find driver for protocol '" + strProtocol + "'"));
- }
- }
- catch (std::exception& ex)
- {
- BOOST_THROW_EXCEPTION(PlcConnectionException("Invalid plc4; connection string '" + url + "'", ex));
- }
-
- return pPlcDriver;
- }
-
- void PlcDriverManager::findDrivers()
- {
- typedef PlcDriver* (*pfCreatePlcDriver)();
- pfCreatePlcDriver CreatePlcDriver;
-
- boost::regex exFilter(PLC_DRIVER_TEMPLATE);
- boost::smatch what;
-
- for (fs::recursive_directory_iterator itDirFiles("../.."); itDirFiles != fs::recursive_directory_iterator(); itDirFiles++)
- {
- if (boost::filesystem::is_regular_file(*itDirFiles))
- {
- std::string strFilename = itDirFiles->path().filename().string();
-
- if (boost::regex_search(strFilename, what, exFilter))
- {
- std::string strDriverName = what[1].str();
-
- try
- {
- //TODO: Only implemented for Windows
- HINSTANCE hdll = NULL;
- hdll = LoadLibrary((itDirFiles->path().string().c_str()));
- if (hdll != NULL)
- {
- CreatePlcDriver = (pfCreatePlcDriver)GetProcAddress(hdll, PLC_CREATE_DRIVER_INSTANCE.c_str());
- if (CreatePlcDriver != NULL)
- {
- PlcDriver* pPlcDriver = NULL;
-
- pPlcDriver = CreatePlcDriver();
- if (pPlcDriver != NULL)
- {
- _mapDrivers.insert(std::pair<std::string, PlcDriver*>(pPlcDriver->getProtocolCode(), pPlcDriver));
- }
- }
- }
- }
- catch (...)
- {
- }
- }
- }
- }
-
- if (_mapDrivers.size() == 0)
- {
- BOOST_THROW_EXCEPTION(PlcConnectionException("Unable to find drivers"));
- }
-
- return;
- }
- }
- }
- }
-}
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.h b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.h
deleted file mode 100644
index 227310f..0000000
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/PlcDriverManager.h
+++ /dev/null
@@ -1,71 +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.
-*/
-
-#ifndef _PLC_DRIVER_MANAGER
-#define _PLC_DRIVER_MANAGER
-#include <vector>
-#include <map>
-#include <string>
-#include <iostream>
-#include "./api/PlcConnection.h"
-#include "./spi/PlcDriver.h"
-#include "./api/exceptions/PlcConnectionException.h"
-
-using namespace org::apache::plc4x::cpp::api::exceptions;
-using namespace org::apache::plc4x::cpp::spi;
-
-namespace org
-{
- namespace apache
- {
- namespace plc4x
- {
- namespace cpp
- {
- class PlcDriverManager
- {
-
- public:
- PlcDriverManager();
-
- ~PlcDriverManager();
-
- PlcConnection* getConnection(std::string url);
- PlcConnection* getConnection(std::string url, PlcAuthentication& authentication);
-
- protected:
-
- private:
- std::map<std::string, PlcDriver*> _mapDrivers;
- PlcDriver* getDriver(std::string url);
-
- void findDrivers();
-
- const std::string PLC_DRIVER_TEMPLATE = "plc4cpp-driver-(.*)(.dll|.so)";
- const std::string PLC_CREATE_DRIVER_INSTANCE = "_CreatePlcDriverInstance";
- const std::string REGEX_PROTOCOL = "^(?<proto>.*)://";
-
-
- };
- }
- }
- }
-}
-
-#endif
\ No newline at end of file
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp
index 1b4479c..12a9e9c 100755
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp
@@ -1,81 +1,36 @@
/*
- 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
+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
+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.
+*/
- 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.
- */
-
#include "PlcConnection.h"
-#include "exceptions/PlcRuntimeException.h"
namespace org
{
- namespace apache
- {
- namespace plc4x
- {
- namespace cpp
- {
- namespace api
+ namespace apache
+ {
+ namespace plc4x
+ {
+ namespace cpp
{
- using namespace org::apache::plc4x::cpp::api::exceptions;
-
- PlcConnection::PlcConnection() :
- _bConnected(false),
- _pSendBuffer(nullptr),
- _pRecvBuffer(nullptr),
- _iSendBufferSize(0),
- _iRecvBufferSize(0)
- {
- setSendBufferSize(DEFAULT_BUFFER_SIZE);
- setRecvBufferSize(DEFAULT_BUFFER_SIZE);
- _strErrorMessage = "";
- }
-
- PlcConnection::~PlcConnection()
- {
- if (_pSendBuffer != NULL) delete[] _pSendBuffer;
- if (_pRecvBuffer != NULL) delete[] _pRecvBuffer;
- }
-
- PlcField* PlcConnection::prepareField(std::string strFieldQuery)
- {
- BOOST_THROW_EXCEPTION(PlcRuntimeException("Parse method is not implemented for this connection / driver"));
- }
-
- void PlcConnection::setSendBufferSize(int iBufferSize)
- {
- if (iBufferSize != _iSendBufferSize)
- {
- _iSendBufferSize = iBufferSize;
- if (_pSendBuffer != NULL) delete[] _pSendBuffer;
- _pSendBuffer = new unsigned char[_iSendBufferSize];
- }
- }
-
- void PlcConnection::setRecvBufferSize(int iBufferSize)
+ namespace api
{
- if (iBufferSize != _iRecvBufferSize)
- {
- _iRecvBufferSize = iBufferSize;
- if (_pRecvBuffer != NULL) delete[] _pRecvBuffer;
- _pRecvBuffer = new unsigned char[_iRecvBufferSize];
- }
}
}
- }
- }
- }
+ }
+ }
}
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.h b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.h
index 0dc3762..b301696 100755
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.h
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.h
@@ -1,21 +1,22 @@
/*
- 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.
- */
+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.
+*/
+
#ifndef _PLC_CONNECTION
#define _PLC_CONNECTION
@@ -25,136 +26,87 @@
#include "../api/messages/PlcSubscriptionRequest.h"
#include "../api/messages/PlcUnsubscriptionRequest.h"
-#include <org/apache/plc4x/cpp/utils/logger/DatDmp.h>
-#include <boost/signals2.hpp>
-#include <boost/thread.hpp>
-
-#define DEFAULT_BUFFER_SIZE 16384
+using namespace org::apache::plc4x::cpp::api::metadata;
+using namespace org::apache::plc4x::cpp::api::messages;
namespace org
{
- namespace apache
- {
- namespace plc4x
- {
- namespace cpp
- {
- namespace api
+ namespace apache
+ {
+ namespace plc4x
+ {
+ namespace cpp
{
-
- using namespace boost::signals2;
- using namespace org::apache::plc4x::cpp::api::metadata;
- using namespace org::apache::plc4x::cpp::api::messages;
- using namespace org::apache::plc4x::cpp::utils;
-
- /**
- * Interface defining the most basic methods a PLC4X connection should support.
- * This generally handles the connection establishment itself and the parsing of
- * field address strings to the platform dependent PlcField instances.
- */
-
- class PlcConnection
+ namespace api
{
- public:
-
- PlcConnection();
- ~PlcConnection();
-
-
/**
- * Establishes the connection to the remote PLC.
- * @throws PlcConnectionException if the connection attempt failed
+ * Interface defining the most basic methods a PLC4X connection should support.
+ * This generally handles the connection establishment itself and the parsing of
+ * field address strings to the platform dependent PlcField instances.
*/
- virtual void connect() = 0;
-
- /**
- * Indicates if the connection is established to a remote PLC.
- * @return {@code true} if connected, {@code false} otherwise
- */
-
- inline bool isConnected() const { return _bConnected; }
-
- /**
- * Closes the connection to the remote PLC.
- * @throws Exception if shutting down the connection failed
- */
- virtual void close() = 0;
-
- /**
- * Parse a fieldQuery for the given connection type.
- *
- * @throws PlcRuntimeException If the string cannot be parsed
- */
- PlcField* prepareField(std::string strFieldQuery);
-
- /**
- * Provides connection metadata.
- */
- virtual PlcConnectionMetadata* getMetadata() = 0;
-
- /**
- * Execute a ping query against a remote device to check the availability of the connection.
- *
- * @return CompletableFuture that is completed successfully (Void) or unsuccessfully with an PlcException.
- */
- virtual void ping() = 0;
-
- /**
- * Obtain read request builder.
- * @throws PlcUnsupportedOperationException if the connection does not support reading
- */
- virtual PlcReadRequest::Builder* readRequestBuilder() = 0;
-
- /**
- * Obtain write request builder.
- * @throws PlcUnsupportedOperationException if the connection does not support writing
- */
- //virtual void Builder* writeRequestBuilder() = 0;
-
- /**
- * Obtain subscription request builder.
- * @throws PlcUnsupportedOperationException if the connection does not support subscription
- */
- //virtual void Builder* subscriptionRequestBuilder() = 0;
-
- /**
- * Obtain unsubscription request builder.
- * @throws PlcUnsupportedOperationException if the connection does not support subscription
- */
- //virtual void Builder* unsubscriptionRequestBuilder() = 0;
-
-
- virtual bool send(unsigned char* pBytesToSend, int iNumBytesToSend) = 0;
-
-
- inline int getSendBufferSize() const { return _iSendBufferSize; }
- void setSendBufferSize(int iBufferSize);
-
- inline int getRecvBufferSize() const { return _iRecvBufferSize; }
- void setRecvBufferSize(int iBlockSize);
-
- protected:
-
- virtual void onReceive(const boost::system::error_code& errorCode, std::size_t szRecvBytes) = 0;
-
- protected:
- bool _bConnected;
- unsigned char* _pSendBuffer;
- int _iSendBufferSize;
- unsigned char* _pRecvBuffer;
- int _iRecvBufferSize;
- std::string _strErrorMessage;
-
- boost::mutex _mtxComLock;
- boost::condition_variable _condComHandler;
-
- DatDmp _dump;
-
- };
+ class PlcConnection
+ {
+ public:
+ /**
+ * Establishes the connection to the remote PLC.
+ * @throws PlcConnectionException if the connection attempt failed
+ */
+ virtual void connect() = 0;
+
+ /**
+ * Indicates if the connection is established to a remote PLC.
+ * @return {@code true} if connected, {@code false} otherwise
+ */
+ virtual bool isConnected() = 0;
+
+ /**
+ * Closes the connection to the remote PLC.
+ * @throws Exception if shutting down the connection failed
+ * Todo: implement java.lang.Autocloseable
+ */
+
+ virtual void close() = 0;
+
+ /**
+ * Provides connection metadata.
+ */
+ virtual PlcConnectionMetadata* getMetadata() const = 0;
+
+ /**
+ * Obtain read request builder.
+ * @throws PlcUnsupportedOperationException if the connection does not support reading
+ * Todo: implement pendant for java Builder pattern
+ */
+ virtual PlcReadRequest* readRequestBuilder() = 0;
+
+ /**
+ * Obtain write request builder.
+ * @throws PlcUnsupportedOperationException if the connection does not support writing
+ * Todo: implement pendant for java Builder pattern (PlcWriteRequest.Builder)
+ */
+ virtual PlcWriteRequest* writeRequestBuilder() = 0;
+
+ /**
+ * Obtain subscription request builder.
+ * @throws PlcUnsupportedOperationException if the connection does not support subscription
+ * Todo: implement pendant for java Builder pattern (PlcSubscriptionRequest.Builder)
+ */
+ virtual PlcSubscriptionRequest* subscriptionRequestBuilder() = 0;
+
+ /**
+ * Obtain unsubscription request builder.
+ * @throws PlcUnsupportedOperationException if the connection does not support subscription
+ * Todo: implement pendant for java Builder pattern (PlcSubscriptionRequest.Builder)
+
+ */
+ virtual PlcUnsubscriptionRequest* unsubscriptionRequestBuilder() = 0;
+
+ private:
+ };
+ }
}
}
- }
- }
+ }
}
#endif
\ No newline at end of file
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.h b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.h
index 1b4d302..16cc1f9 100755
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.h
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.h
@@ -24,7 +24,6 @@ under the License.
#include "PlcFieldResponse.h"
#include <string>
-#include <map>
namespace org
{
@@ -41,14 +40,13 @@ namespace org
/**
* Base type for all messages sent from the plc4x system to a connected plc.
*/
- class PlcFieldRequest : public PlcRequest
+ class PlcFieldRequest : PlcRequest
{
public:
virtual int getNumberOfFields() = 0;
- virtual std::vector<std::string> getFieldNames();
- virtual PlcField* getField(std::string) = 0;
- virtual std::vector<PlcField*> getFields() = 0;
- virtual std::map<std::string, PlcField*> getNamedFields() = 0;
+ virtual std::vector<std::string>* getFieldNames() const = 0;
+ virtual PlcField* getField(std::string) const = 0;
+ virtual std::vector<PlcField>* getFields() const = 0;
private:
};
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp
index 9b9f9a0..88a9b9f 100755
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp
@@ -33,12 +33,18 @@ namespace org
{
PlcReadRequest::PlcReadRequest()
{
+ _pPlcbuilder = nullptr;
}
PlcReadRequest::~PlcReadRequest()
{
// TODO Free Pointer eg. use Smartpointer ?
}
+
+ PlcReadRequestBuilder* PlcReadRequest::getBuilder() const
+ {
+ return _pPlcbuilder;
+ }
}
}
}
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.h b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.h
index afcdbe5..65dc62b 100755
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.h
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.h
@@ -22,6 +22,7 @@ under the License.
#include "PlcFieldRequest.h"
#include "PlcRequestBuilder.h"
+#include "PlcReadRequestBuilder.h"
namespace org
@@ -45,15 +46,10 @@ namespace org
PlcReadRequest();
~PlcReadRequest();
- class Builder : public PlcRequestBuilder
- {
- public:
- virtual PlcReadRequest* build() = 0;
- virtual Builder* addItem(std::string& strName, std::string& strFieldQuery) = 0;
- };
+ PlcReadRequestBuilder* getBuilder() const;
private:
-
+ PlcReadRequestBuilder* _pPlcbuilder;
};
}
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.cpp
old mode 100755
new mode 100644
similarity index 82%
copy from plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp
copy to plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.cpp
index 9b9f9a0..45f2ced
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.cpp
@@ -17,7 +17,7 @@ specific language governing permissions and limitations
under the License.
*/
-#include "PlcReadRequest.h"
+#include "PlcReadRequestBuilder.h"
namespace org
{
@@ -31,14 +31,7 @@ namespace org
{
namespace messages
{
- PlcReadRequest::PlcReadRequest()
- {
- }
- PlcReadRequest::~PlcReadRequest()
- {
- // TODO Free Pointer eg. use Smartpointer ?
- }
}
}
}
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.h
old mode 100755
new mode 100644
similarity index 77%
copy from plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h
copy to plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.h
index 6b80d19..cdb16a7
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.h
@@ -17,10 +17,12 @@ specific language governing permissions and limitations
under the License.
*/
-#ifndef _PLC_REQUEST_BUILDER
-#define _PLC_REQUEST_BUILDER
+#ifndef _PLC_READ_REQUEST_BUILDER
+#define _PLC_READ_REQUEST_BUILDER
-#include "PlcRequest.h"
+#include "PlcRequestBuilder.h"
+
+#include <string>
namespace org
{
@@ -37,12 +39,13 @@ namespace org
/**
* Base type for all forms of messages passed between plc and plc4x system.
*/
- class PlcRequestBuilder
+ class PlcReadRequestBuilder : public PlcRequestBuilder
{
- public:
+ public:
+ virtual PlcReadRequestBuilder* addItem(std::string& strName, std::string& strFieldQuery) = 0;
- private:
};
+
}
}
}
diff --git a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h
index 6b80d19..d0732c3 100755
--- a/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h
+++ b/plc4cpp/api/src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.h
@@ -40,6 +40,7 @@ namespace org
class PlcRequestBuilder
{
public:
+ virtual PlcRequest* build() = 0;
private:
};
diff --git a/plc4cpp/utils/CMakeLists.txt b/plc4cpp/examples/CMakeLists.txt
similarity index 93%
copy from plc4cpp/utils/CMakeLists.txt
copy to plc4cpp/examples/CMakeLists.txt
index be2e8f8..1989a97 100644
--- a/plc4cpp/utils/CMakeLists.txt
+++ b/plc4cpp/examples/CMakeLists.txt
@@ -17,6 +17,4 @@
under the License.
]]
-add_subdirectory(logger)
-add_subdirectory(systemconfig)
-
+//add_subdirectory(module-name)
diff --git a/integrations/apache-karaf/karaf-s7-feature/pom.xml b/plc4cpp/examples/pom.xml
similarity index 61%
copy from integrations/apache-karaf/karaf-s7-feature/pom.xml
copy to plc4cpp/examples/pom.xml
index 47f3ad2..4751b7c 100644
--- a/integrations/apache-karaf/karaf-s7-feature/pom.xml
+++ b/plc4cpp/examples/pom.xml
@@ -8,7 +8,7 @@
"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
+ 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
@@ -17,36 +17,39 @@
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>
- <artifactId>apache-karaf</artifactId>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4cpp</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>karaf-s7-feature</artifactId>
- <packaging>feature</packaging>
+ <groupId>org.apache.plc4x.examples</groupId>
+ <artifactId>plc4cpp-examples</artifactId>
+ <packaging>pom</packaging>
- <name>Integrations: Apache Karaf: S7</name>
+ <name>PLC4Cpp: Examples</name>
+ <description>Parent of all C++ based application example modules.</description>
- <dependencies>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-driver-s7</artifactId>
- <version>0.4.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
+ <modules>
+ </modules>
<build>
- <plugins>
- <plugin>
- <groupId>org.apache.karaf.tooling</groupId>
- <artifactId>karaf-maven-plugin</artifactId>
- </plugin>
- </plugins>
+ <pluginManagement>
+ <plugins>
+ <!-- No need to deploy examples in a maven repo -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
</project>
\ No newline at end of file
diff --git a/plc4cpp/utils/CMakeLists.txt b/plc4cpp/integrations/CMakeLists.txt
similarity index 92%
copy from plc4cpp/utils/CMakeLists.txt
copy to plc4cpp/integrations/CMakeLists.txt
index be2e8f8..7086afa 100644
--- a/plc4cpp/utils/CMakeLists.txt
+++ b/plc4cpp/integrations/CMakeLists.txt
@@ -17,6 +17,5 @@
under the License.
]]
-add_subdirectory(logger)
-add_subdirectory(systemconfig)
-
+add_subdirectory(apache-mynewt)
+add_subdirectory(edgex-foundry)
\ No newline at end of file
diff --git a/plc4cpp/utils/CMakeLists.txt b/plc4cpp/integrations/apache-mynewt/CMakeLists.txt
similarity index 93%
copy from plc4cpp/utils/CMakeLists.txt
copy to plc4cpp/integrations/apache-mynewt/CMakeLists.txt
index be2e8f8..1989a97 100644
--- a/plc4cpp/utils/CMakeLists.txt
+++ b/plc4cpp/integrations/apache-mynewt/CMakeLists.txt
@@ -17,6 +17,4 @@
under the License.
]]
-add_subdirectory(logger)
-add_subdirectory(systemconfig)
-
+//add_subdirectory(module-name)
diff --git a/integrations/apache-mynewt/pom.xml b/plc4cpp/integrations/apache-mynewt/pom.xml
similarity index 89%
rename from integrations/apache-mynewt/pom.xml
rename to plc4cpp/integrations/apache-mynewt/pom.xml
index 10496f6..8773724 100644
--- a/integrations/apache-mynewt/pom.xml
+++ b/plc4cpp/integrations/apache-mynewt/pom.xml
@@ -23,14 +23,14 @@
<parent>
<groupId>org.apache.plc4x</groupId>
- <artifactId>integrations</artifactId>
+ <artifactId>plc4cpp-integrations</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>apache-mynewt</artifactId>
+ <artifactId>plc4cpp-apache-mynewt</artifactId>
<packaging>pom</packaging>
- <name>Integrations: Apache Mynewt</name>
+ <name>PLC4Cpp: Integrations: Apache Mynewt</name>
<description>Integration module for integrating PLC4X into Apache Mynewt.</description>
<modules>
diff --git a/plc4cpp/utils/CMakeLists.txt b/plc4cpp/integrations/edgex-foundry/CMakeLists.txt
similarity index 93%
copy from plc4cpp/utils/CMakeLists.txt
copy to plc4cpp/integrations/edgex-foundry/CMakeLists.txt
index be2e8f8..1989a97 100644
--- a/plc4cpp/utils/CMakeLists.txt
+++ b/plc4cpp/integrations/edgex-foundry/CMakeLists.txt
@@ -17,6 +17,4 @@
under the License.
]]
-add_subdirectory(logger)
-add_subdirectory(systemconfig)
-
+//add_subdirectory(module-name)
diff --git a/integrations/apache-karaf/karaf-s7-feature/pom.xml b/plc4cpp/integrations/edgex-foundry/pom.xml
similarity index 65%
copy from integrations/apache-karaf/karaf-s7-feature/pom.xml
copy to plc4cpp/integrations/edgex-foundry/pom.xml
index 47f3ad2..b036617 100644
--- a/integrations/apache-karaf/karaf-s7-feature/pom.xml
+++ b/plc4cpp/integrations/edgex-foundry/pom.xml
@@ -8,7 +8,7 @@
"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
+ 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
@@ -17,36 +17,22 @@
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>
- <artifactId>apache-karaf</artifactId>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4cpp-integrations</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>karaf-s7-feature</artifactId>
- <packaging>feature</packaging>
-
- <name>Integrations: Apache Karaf: S7</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-driver-s7</artifactId>
- <version>0.4.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.karaf.tooling</groupId>
- <artifactId>karaf-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
+ <artifactId>plc4cpp-edgex-foundry</artifactId>
+ <packaging>pom</packaging>
+
+ <name>PLC4Cpp: Integrations: EdgeX-Foundry</name>
+
+ <modules>
+ </modules>
</project>
\ No newline at end of file
diff --git a/integrations/pom.xml b/plc4cpp/integrations/pom.xml
similarity index 78%
rename from integrations/pom.xml
rename to plc4cpp/integrations/pom.xml
index b7cc8c8..a21c84b 100644
--- a/integrations/pom.xml
+++ b/plc4cpp/integrations/pom.xml
@@ -22,25 +22,19 @@
<parent>
<groupId>org.apache.plc4x</groupId>
- <artifactId>plc4x-parent</artifactId>
+ <artifactId>plc4cpp</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>integrations</artifactId>
+ <artifactId>plc4cpp-integrations</artifactId>
<packaging>pom</packaging>
- <name>Integrations</name>
+ <name>PLC4Cpp: Integrations</name>
<description>Parent of all product specific integration modules.</description>
<modules>
- <module>apache-brooklyn</module>
- <module>apache-camel</module>
- <module>apache-edgent</module>
- <module>apache-kafka</module>
<module>apache-mynewt</module>
- <module>apache-nifi</module>
- <module>apache-karaf</module>
- <module>apache-calcite</module>
+ <module>edgex-foundry</module>
</modules>
</project>
\ No newline at end of file
diff --git a/plc4cpp/pom.xml b/plc4cpp/pom.xml
index 789c209..236e1c0 100644
--- a/plc4cpp/pom.xml
+++ b/plc4cpp/pom.xml
@@ -43,6 +43,9 @@
<module>protocols</module>
<module>utils</module>
+ <module>examples</module>
+ <module>integrations</module>
+
<!-- Third party libs -->
<module>libs</module>
</modules>
diff --git a/plc4cpp/protocols/driver-bases/base/CMakeLists.txt b/plc4cpp/protocols/driver-bases/base/CMakeLists.txt
index 3c5d607..e3157a7 100644
--- a/plc4cpp/protocols/driver-bases/base/CMakeLists.txt
+++ b/plc4cpp/protocols/driver-bases/base/CMakeLists.txt
@@ -22,9 +22,7 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
-add_library(plc4cpp-protocols-driver-base-base
- src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp
- #src/main/cpp/org/apache/plc4x/cpp/base/connection/BoostConnection.cpp
+add_library(plc4cpp-protocols-driver-base-base src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp
src/main/cpp/org/apache/plc4x/cpp/base/connection/ChannelFactory.cpp
src/main/cpp/org/apache/plc4x/cpp/base/connection/DefaultPlcFieldHandler.cpp
src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.cpp
@@ -65,6 +63,3 @@ add_library(plc4cpp-protocols-driver-base-base
Import the headers for boost and the plc4cpp-api module
]]
target_include_directories (plc4cpp-protocols-driver-base-base PUBLIC target/dependencies/include)
-target_include_directories (plc4cpp-protocols-driver-base-base PUBLIC ${Boost_INCLUDE_DIRS})
-target_include_directories (plc4cpp-protocols-driver-base-base PUBLIC ../../../api/src/main/cpp)
-target_include_directories (plc4cpp-protocols-driver-base-base PUBLIC ../../../utils/logger/src/main/cpp)
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp
index 6a6eab0..af47faa 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.cpp
@@ -18,7 +18,6 @@ under the License.
*/
#include "AbstractPlcConnection.h"
-#include <org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedOperationException.h>
namespace org
{
@@ -32,11 +31,9 @@ namespace org
{
namespace connection
{
- using namespace org::apache::plc4x::cpp::api::exceptions;
-
- PlcConnectionMetadata* AbstractPlcConnection::getMetadata()
+ PlcConnectionMetadata& AbstractPlcConnection::getMetadata()
{
- return this;
+ return *this;
}
bool AbstractPlcConnection::canRead()
{
@@ -50,30 +47,6 @@ namespace org
{
return false;
}
-
- PlcReadRequest::Builder* AbstractPlcConnection::readRequestBuilder()
- {
- BOOST_THROW_EXCEPTION(PlcUnsupportedOperationException("The connection does not support reading"));
- }
-
-
-
- /*@Override
- public PlcWriteRequest.Builder writeRequestBuilder() {
- throw new PlcUnsupportedOperationException("The connection does not support writing");
- }
-
- @Override
- public PlcSubscriptionRequest.Builder subscriptionRequestBuilder() {
- throw new PlcUnsupportedOperationException("The connection does not support subscription");
- }
-
- @Override
- public PlcUnsubscriptionRequest.Builder unsubscriptionRequestBuilder() {
- throw new PlcUnsupportedOperationException("The connection does not support subscription");
- }*/
-
-
}
}
}
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.h b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.h
index c17e933..e7b0683 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.h
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/AbstractPlcConnection.h
@@ -48,7 +48,7 @@ namespace org
{
public:
- PlcConnectionMetadata* getMetadata();
+ PlcConnectionMetadata& getMetadata();
bool canRead();
bool canWrite();
bool canSubscribe();
@@ -57,7 +57,8 @@ namespace org
virtual void close() = 0;
virtual bool send(unsigned char* pBytesToSend, int iNumBytesToSend) = 0;
- PlcReadRequest::Builder* readRequestBuilder();
+ // Todo: Check if required
+ //PlcReadRequest.Builder readRequestBuilder();
// PlcWriteRequest.Builder writeRequestBuilder();
// PlcSubscriptionRequest.Builder subscriptionRequestBuilder();
// PlcUnsubscriptionRequest.Builder nsubscriptionRequestBuilder();
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.h b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.h
index 3ee2257..b26339f 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.h
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/connection/PlcFieldHandler.h
@@ -58,7 +58,7 @@ namespace org
public:
- virtual PlcField* createField(std::string strFieldQuery) = 0;
+ virtual PlcField createField(std::string strFieldQuery) = 0;
virtual BaseDefaultFieldItem<bool>* encodeBoolean(PlcField plcField, std::vector<void*> pValues) = 0;
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.cpp b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.cpp
index 82a53ad..21005b7 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.cpp
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.cpp
@@ -39,103 +39,81 @@ namespace org
}
// =========================================================
- DefaultPlcReadRequest::DefaultPlcReadRequest(PlcReader* plcReader, std::map<std::string, PlcField*> mplcFields)
+ DefaultPlcReadRequest::DefaultPlcReadRequest(PlcReader* reader, std::map<std::string, PlcField> fields)
{
- _plcReader = plcReader;
- _mplcFields = mplcFields;
+ this->_reader = reader;
+ this->_fields = fields;
}
- // ====================================================
- PlcReader* DefaultPlcReadRequest::getReader()
- {
- return _plcReader;
- }
-
// ==========================================================
int DefaultPlcReadRequest::getNumberOfFields()
{
- return _mplcFields.size();
+ return _fields.size();
}
// =========================================================
- PlcField* DefaultPlcReadRequest::getField(std::string strName)
+ PlcField* DefaultPlcReadRequest::getField(std::string name)
{
- PlcField* plcField = nullptr;
-
- std::map<std::string, PlcField*>::iterator iterator = _mplcFields.find(strName);
+ // sgl: check 1st, whether the key is contained in vector
+ // (otherwise an exception is thrown)...
+ std::map<std::string, PlcField>::iterator iterator = _fields.find(name);
- if (iterator != _mplcFields.end())
+ if (iterator == _fields.end())
{
- plcField = iterator->second;
+ return nullptr;
}
- return plcField;
+ return &(iterator->second);
+
}
// ======================================================
- std::map<std::string, PlcField*> DefaultPlcReadRequest::getNamedFields()
+ std::map<std::string, PlcField> DefaultPlcReadRequest::getNamedFields()
+ {
+ // Todo:
+ /*return fields.entrySet()
+ .stream()
+ .map(stringPlcFieldEntry->Pair.of(stringPlcFieldEntry.getKey(), stringPlcFieldEntry.getValue()))
+ .collect(Collectors.toCollection(LinkedList::new));
+*/
+ return std::map<std::string, PlcField>();
+ }
+
+ // ====================================================
+ PlcReader* DefaultPlcReadRequest::getReader()
{
- return std::map<std::string, PlcField*>();
+ return _reader;
}
// =====================================================
- std::vector<PlcField*> DefaultPlcReadRequest::getFields()
+ std::vector<PlcField> DefaultPlcReadRequest::getFields()
{
- std::pair<std::string, PlcField*> me;
- std::vector<PlcField*> vplcFields;
+ // TODO: check if already exists...
+ std::pair<std::string, PlcField> me;
+ std::vector<PlcField> vNames;
- BOOST_FOREACH(me, _mplcFields)
+ BOOST_FOREACH(me, _fields)
{
- vplcFields.push_back(me.second);
+ vNames.push_back(me.second);
}
- return vplcFields;
+ return vNames;
}
// =========================================================
std::vector<std::string> DefaultPlcReadRequest::getFieldNames()
{
// TODO: check if already exists...
- std::pair<std::string, PlcField*> me;
- std::vector<std::string> vstrNames;
+ std::pair<std::string, PlcField> me;
+ std::vector<std::string> vNames;
- BOOST_FOREACH(me, _mplcFields)
+ BOOST_FOREACH(me, _fields)
{
- vstrNames.push_back(me.first);
+ vNames.push_back(me.first);
}
- return vstrNames;
- }
-
- DefaultPlcReadRequest::Builder::Builder(PlcReader* plcReader, PlcFieldHandler* plcFieldHandler)
- {
- _plcReader = plcReader;
- _plcFieldHandler = plcFieldHandler;
- }
-
- DefaultPlcReadRequest::Builder* DefaultPlcReadRequest::Builder::addItem(std::string strName, std::string strFieldQuery)
- {
- std::map<std::string, std::string>::iterator iterator = _mFields.find(strName);
- if (iterator != _mFields.end())
- {
- BOOST_THROW_EXCEPTION(PlcRuntimeException("Duplicate field definition '" + strName + "'"));
- }
- _mFields.insert(std::pair<std::string,std::string>(strName, strFieldQuery));
- return this;
- }
-
- PlcReadRequest* DefaultPlcReadRequest::Builder::build()
- {
- std::map<std::string, PlcField*> mParsedFields;
- std::pair<std::string, std::string> me;
-
- BOOST_FOREACH(me, _mFields)
- {
- PlcField* parsedField = _plcFieldHandler->createField(me.second);
- mParsedFields.insert(std::pair<std::string, PlcField*>(me.first, parsedField));
- }
- return new DefaultPlcReadRequest(_plcReader, mParsedFields);
- }
+ return vNames;
+ }
}
}
}
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.h b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.h
index 4ce2c9c..ef31dd1 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.h
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcReadRequest.h
@@ -24,12 +24,11 @@ under the License.
#include "InternalPlcFieldRequest.h"
#include "PlcReader.h"
#include <org/apache/plc4x/cpp/api/model/PlcField.h>
-#include "../connection/PlcFieldHandler.h"
#include <map>
#include <boost/foreach.hpp>
-
+using namespace org::apache::plc4x::cpp::api::messages;
namespace org
@@ -44,10 +43,8 @@ namespace org
{
namespace messages
{
- using namespace org::apache::plc4x::cpp::api::messages;
- using namespace org::apache::plc4x::cpp::base::connection;
-
- class DefaultPlcReadRequest : public InternalPlcReadRequest
+
+ class DefaultPlcReadRequest : public InternalPlcReadRequest //, public InternalPlcFieldRequest
{
public:
// Todo:
@@ -58,37 +55,21 @@ namespace org
// Todo: implement java Builder-pattern for C++
- DefaultPlcReadRequest(PlcReader* plcReader, std::map<std::string, PlcField*> mplcFields);
+ DefaultPlcReadRequest(PlcReader* reader, std::map<std::string, PlcField> fields);
int getNumberOfFields();
std::vector<std::string> getFieldNames();
PlcField* getField(std::string name);
- std::vector<PlcField*> getFields();
- std::map<std::string, PlcField*> getNamedFields();
-
- class Builder
- {
- public:
- Builder(PlcReader* plcReader, PlcFieldHandler* plcFieldHandler);
- Builder* addItem(std::string strName, std::string strFieldQuery);
- PlcReadRequest* build();
-
- private:
- PlcReader* _plcReader;
- PlcFieldHandler* _plcFieldHandler;
- std::map<std::string, std::string> _mFields;
- };
-
+ std::vector<PlcField> getFields();
+ std::map<std::string, PlcField> getNamedFields();
protected:
-
PlcReader* getReader();
private:
-
DefaultPlcReadRequest();
- PlcReader* _plcReader;
- std::map<std::string, PlcField*> _mplcFields;
+ PlcReader* _reader;
+ std::map<std::string, PlcField> _fields;
};
}
}
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.cpp b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.cpp
index e0d6f9d..bccc0c3 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.cpp
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.cpp
@@ -17,7 +17,7 @@ specific language governing permissions and limitations
under the License.
*/
-#include "DefaultPlcWriteRequest.h"
+#include "DefaultPlcReadRequest.h"
namespace org
{
@@ -32,83 +32,86 @@ namespace org
namespace messages
{
// =========================================================
- DefaultPlcWriteRequest::DefaultPlcWriteRequest()
+ DefaultPlcReadRequest::DefaultPlcReadRequest()
{
}
// =========================================================
- DefaultPlcWriteRequest::DefaultPlcWriteRequest(PlcWriter* plcWriter, std::map<std::string, PlcField*> mplcFields)
+ DefaultPlcReadRequest::DefaultPlcReadRequest(PlcReader* reader, std::map<std::string, PlcField> fields)
{
- _plcWriter = plcWriter;
- _mplcFields = mplcFields;
+ this->_reader = reader;
+ this->_fields = fields;
}
- // ====================================================
- PlcWriter* DefaultPlcWriteRequest::getWriter()
- {
- return _plcWriter;
- }
-
- // ==========================================================
- int DefaultPlcWriteRequest::getNumberOfFields()
- {
- return _mplcFields.size();
- }
-
- // =========================================================
- PlcField* DefaultPlcWriteRequest::getField(std::string strName)
- {
- PlcField* plcField = nullptr;
-
- std::map<std::string, PlcField*>::iterator iterator = _mplcFields.find(strName);
-
- if (iterator != _mplcFields.end())
- {
- plcField = iterator->second;
- }
-
- return plcField;
-
- }
+ // ==========================================================
+ int DefaultPlcReadRequest::getNumberOfFields()
+ {
+ return _fields.size();
+ }
- // ======================================================
- std::map<std::string, PlcField*> DefaultPlcWriteRequest::getNamedFields()
- {
- return std::map<std::string, PlcField*>();
- }
+ // =========================================================
+ PlcField* DefaultPlcReadRequest::getField(std::string name)
+ {
+ // sgl: check 1st, whether the key is contained in vector
+ // (otherwise an exception is thrown)...
+ std::map<std::string, PlcField>::iterator iterator = _fields.find(name);
- // =====================================================
- std::vector<PlcField*> DefaultPlcWriteRequest::getFields()
- {
- std::pair<std::string, PlcField*> me;
- std::vector<PlcField*> vplcFields;
+ if (iterator == _fields.end())
+ {
+ return nullptr;
+ }
- BOOST_FOREACH(me, _mplcFields)
- {
- vplcFields.push_back(me.second);
- }
+ return &(iterator->second);
+
+ }
- return vplcFields;
- }
+ // ======================================================
+ std::map<std::string, PlcField> DefaultPlcReadRequest::getNamedFields()
+ {
+ // Todo:
+ /*return fields.entrySet()
+ .stream()
+ .map(stringPlcFieldEntry->Pair.of(stringPlcFieldEntry.getKey(), stringPlcFieldEntry.getValue()))
+ .collect(Collectors.toCollection(LinkedList::new));
+*/
+ return std::map<std::string, PlcField>();
+ }
- // =========================================================
- std::vector<std::string> DefaultPlcWriteRequest::getFieldNames()
- {
- // TODO: check if already exists...
- std::pair<std::string, PlcField*> me;
- std::vector<std::string> vstrNames;
+ // ====================================================
+ PlcReader* DefaultPlcReadRequest::getReader()
+ {
+ return _reader;
+ }
- BOOST_FOREACH(me, _mplcFields)
- {
- vstrNames.push_back(me.first);
- }
+ // =====================================================
+ std::vector<PlcField> DefaultPlcReadRequest::getFields()
+ {
+ // TODO: check if already exists...
+ std::pair<std::string, PlcField> me;
+ std::vector<PlcField> vNames;
- return vstrNames;
- }
+ BOOST_FOREACH(me, _fields)
+ {
+ vNames.push_back(me.second);
+ }
-
+ return vNames;
+ }
-
+ // =========================================================
+ std::vector<std::string> DefaultPlcReadRequest::getFieldNames()
+ {
+ // TODO: check if already exists...
+ std::pair<std::string, PlcField> me;
+ std::vector<std::string> vNames;
+
+ BOOST_FOREACH(me, _fields)
+ {
+ vNames.push_back(me.first);
+ }
+
+ return vNames;
+ }
}
}
}
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.h b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.h
index a349dbe..163c64b 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.h
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/DefaultPlcWriteRequest.h
@@ -54,21 +54,22 @@ namespace org
// Todo: implement java Builder-pattern for C++
- DefaultPlcWriteRequest(PlcWriter* writer, std::map<std::string, PlcField*> fields);
+ DefaultPlcWriteRequest(PlcWriter* writer, std::map<std::string, PlcField> fields);
int getNumberOfFields();
std::vector<std::string> getFieldNames();
PlcField* getField(std::string name);
- std::vector<PlcField*> getFields();
- std::map<std::string, PlcField*> getNamedFields();
+ std::vector<PlcField> getFields();
+ std::map<std::string, PlcField> getNamedFields();
// Todo: implement callback to: execute() { _writer.write(this); }
protected:
PlcWriter* getWriter();
+
private:
DefaultPlcWriteRequest();
- PlcWriter* _plcWriter;
- std::map<std::string, PlcField*> _mplcFields;
+ PlcWriter* _writer;
+ std::map<std::string, PlcField> _fields;
};
}
}
diff --git a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.h b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.h
index 37415ca..9247d54 100644
--- a/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.h
+++ b/plc4cpp/protocols/driver-bases/base/src/main/cpp/org/apache/plc4x/cpp/base/messages/InternalPlcFieldRequest.h
@@ -41,7 +41,7 @@ namespace org
class InternalPlcFieldRequest : public InternalPlcRequest, PlcFieldRequest
{
public:
- virtual std::map<std::string, PlcField*> getNamedFields() = 0;
+ virtual std::map<std::string, PlcField> getNamedFields() = 0;
InternalPlcFieldRequest();
};
}
diff --git a/plc4cpp/utils/CMakeLists.txt b/plc4cpp/utils/CMakeLists.txt
index be2e8f8..557916a 100644
--- a/plc4cpp/utils/CMakeLists.txt
+++ b/plc4cpp/utils/CMakeLists.txt
@@ -18,5 +18,3 @@
]]
add_subdirectory(logger)
-add_subdirectory(systemconfig)
-
diff --git a/plc4cpp/utils/logger/CMakeLists.txt b/plc4cpp/utils/logger/CMakeLists.txt
index 8c4a38d..eccf20e 100644
--- a/plc4cpp/utils/logger/CMakeLists.txt
+++ b/plc4cpp/utils/logger/CMakeLists.txt
@@ -34,10 +34,4 @@ add_library(plc4cpp-utils-logger
#[[
Import the headers for boost and the plc4cpp-utils module
]]
-
-TARGET_LINK_LIBRARIES (plc4cpp-utils-logger ${Boost_LIBRARIES})
-
-
target_include_directories (plc4cpp-utils-logger PUBLIC target/dependencies/include)
-target_include_directories (plc4cpp-utils-logger PUBLIC ${Boost_INCLUDE_DIRS})
-
diff --git a/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp b/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp
index 09c8e88..57c99e5 100644
--- a/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp
+++ b/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/DbgTrace.cpp
@@ -33,9 +33,9 @@ void TracerW(const wchar_t* formatStr, ...)
static wchar_t arcBuffer[TRACE_BUFFERSIZE];
va_list args;
va_start(args, formatStr);
- swprintf_s(arcBuffer, TRACE_BUFFERSIZE, formatStr, args);
+ _vstprintf_s(arcBuffer, TRACE_BUFFERSIZE, formatStr, args);
va_end(args);
- ::OutputDebugStringW(arcBuffer);
+ ::OutputDebugString(buffer);
}
@@ -46,7 +46,7 @@ void Tracer(const char* formatStr, ...)
va_start(args, formatStr);
vsprintf_s(arcBuffer, TRACE_BUFFERSIZE, formatStr, args);
va_end(args);
- ::OutputDebugStringA(arcBuffer);
+ ::OutputDebugStringA(buffer);
}
#endif
diff --git a/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ExLog.cpp b/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ExLog.cpp
index 6dae0f6..455d907 100644
--- a/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ExLog.cpp
+++ b/plc4cpp/utils/logger/src/main/cpp/org/apache/plc4x/cpp/utils/logger/ExLog.cpp
@@ -19,7 +19,7 @@ under the License.
#include <boost/exception/all.hpp>
#include <exception>
-#include <boost/lexical_cast.hpp>
+#include <boost/lexical_cast.hpp>"
#include <typeinfo>
#include "ErrorInfoException.h"
diff --git a/examples/dummy-driver/pom.xml b/plc4j/examples/dummy-driver/pom.xml
similarity index 94%
rename from examples/dummy-driver/pom.xml
rename to plc4j/examples/dummy-driver/pom.xml
index 4ace59b..5083a58 100644
--- a/examples/dummy-driver/pom.xml
+++ b/plc4j/examples/dummy-driver/pom.xml
@@ -23,12 +23,12 @@
<parent>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>examples</artifactId>
+ <artifactId>plc4j-examples</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>dummy-driver</artifactId>
- <name>Examples: Protocol: Dummy</name>
+ <artifactId>plc4j-dummy-driver</artifactId>
+ <name>PLC4J: 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.
diff --git a/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/DummyDriver.java b/plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/DummyDriver.java
similarity index 100%
rename from examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/DummyDriver.java
rename to plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/DummyDriver.java
index d9e182b..76e54f1 100644
--- a/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/DummyDriver.java
+++ b/plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/DummyDriver.java
@@ -18,11 +18,11 @@ under the License.
*/
package org.apache.plc4x.java.examples.dummydriver;
-import org.apache.plc4x.java.spi.PlcDriver;
-import org.apache.plc4x.java.api.authentication.PlcAuthentication;
import org.apache.plc4x.java.api.PlcConnection;
+import org.apache.plc4x.java.api.authentication.PlcAuthentication;
import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
import org.apache.plc4x.java.examples.dummydriver.connection.DummyConnection;
+import org.apache.plc4x.java.spi.PlcDriver;
import java.net.InetAddress;
import java.net.UnknownHostException;
diff --git a/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java b/plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java
similarity index 100%
rename from examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java
rename to plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java
diff --git a/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/model/DummyField.java b/plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/model/DummyField.java
similarity index 100%
rename from examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/model/DummyField.java
rename to plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/model/DummyField.java
diff --git a/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/netty/DummyProtocol.java b/plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/netty/DummyProtocol.java
similarity index 100%
rename from examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/netty/DummyProtocol.java
rename to plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/netty/DummyProtocol.java
diff --git a/examples/dummy-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.spi.PlcDriver b/plc4j/examples/dummy-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.spi.PlcDriver
similarity index 100%
rename from examples/dummy-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.spi.PlcDriver
rename to plc4j/examples/dummy-driver/src/main/resources/META-INF/services/org.apache.plc4x.java.spi.PlcDriver
diff --git a/examples/hello-cloud-azure/pom.xml b/plc4j/examples/hello-cloud-azure/pom.xml
similarity index 94%
rename from examples/hello-cloud-azure/pom.xml
rename to plc4j/examples/hello-cloud-azure/pom.xml
index f42d164..35f8f9e 100644
--- a/examples/hello-cloud-azure/pom.xml
+++ b/plc4j/examples/hello-cloud-azure/pom.xml
@@ -21,13 +21,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>examples</artifactId>
<groupId>org.apache.plc4x.examples</groupId>
+ <artifactId>plc4j-examples</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>hello-cloud-azure</artifactId>
- <name>Examples: Cloud: Azure IoT Hub</name>
+ <artifactId>plc4j-hello-cloud-azure</artifactId>
+ <name>PLC4J: Examples: Cloud: Azure IoT Hub</name>
<description>
Implementation of a PLC4X application gathering information from
a PLC and making that available in an Azure IoT Hub.
diff --git a/examples/hello-cloud-azure/src/main/java/org/apache/plc4x/java/examples/cloud/azure/CliOptions.java b/plc4j/examples/hello-cloud-azure/src/main/java/org/apache/plc4x/java/examples/cloud/azure/CliOptions.java
similarity index 100%
rename from examples/hello-cloud-azure/src/main/java/org/apache/plc4x/java/examples/cloud/azure/CliOptions.java
rename to plc4j/examples/hello-cloud-azure/src/main/java/org/apache/plc4x/java/examples/cloud/azure/CliOptions.java
diff --git a/examples/hello-cloud-azure/src/main/java/org/apache/plc4x/java/examples/cloud/azure/S7PlcToAzureIoTHubSample.java b/plc4j/examples/hello-cloud-azure/src/main/java/org/apache/plc4x/java/examples/cloud/azure/S7PlcToAzureIoTHubSample.java
similarity index 100%
rename from examples/hello-cloud-azure/src/main/java/org/apache/plc4x/java/examples/cloud/azure/S7PlcToAzureIoTHubSample.java
rename to plc4j/examples/hello-cloud-azure/src/main/java/org/apache/plc4x/java/examples/cloud/azure/S7PlcToAzureIoTHubSample.java
diff --git a/examples/hello-cloud-google/README.md b/plc4j/examples/hello-cloud-google/README.md
similarity index 100%
rename from examples/hello-cloud-google/README.md
rename to plc4j/examples/hello-cloud-google/README.md
diff --git a/examples/hello-cloud-google/pom.xml b/plc4j/examples/hello-cloud-google/pom.xml
similarity index 95%
rename from examples/hello-cloud-google/pom.xml
rename to plc4j/examples/hello-cloud-google/pom.xml
index a64c3f0..a9ae206 100644
--- a/examples/hello-cloud-google/pom.xml
+++ b/plc4j/examples/hello-cloud-google/pom.xml
@@ -21,13 +21,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>examples</artifactId>
<groupId>org.apache.plc4x.examples</groupId>
+ <artifactId>plc4j-examples</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>hello-cloud-google</artifactId>
- <name>Examples: Cloud: Google Cloud IoT Core</name>
+ <artifactId>plc4j-hello-cloud-google</artifactId>
+ <name>PLC4J: Examples: Cloud: Google Cloud IoT Core</name>
<description>
Implementation of a PLC4X application gathering information from
a PLC and making that available in an the Google Cloud IoT Core.
diff --git a/examples/hello-cloud-google/src/main/java/org/apache/plc4x/java/examples/cloud/google/CliOptions.java b/plc4j/examples/hello-cloud-google/src/main/java/org/apache/plc4x/java/examples/cloud/google/CliOptions.java
similarity index 100%
rename from examples/hello-cloud-google/src/main/java/org/apache/plc4x/java/examples/cloud/google/CliOptions.java
rename to plc4j/examples/hello-cloud-google/src/main/java/org/apache/plc4x/java/examples/cloud/google/CliOptions.java
diff --git a/examples/hello-cloud-google/src/main/java/org/apache/plc4x/java/examples/cloud/google/S7PlcToGoogleIoTCoreSample.java b/plc4j/examples/hello-cloud-google/src/main/java/org/apache/plc4x/java/examples/cloud/google/S7PlcToGoogleIoTCoreSample.java
similarity index 100%
rename from examples/hello-cloud-google/src/main/java/org/apache/plc4x/java/examples/cloud/google/S7PlcToGoogleIoTCoreSample.java
rename to plc4j/examples/hello-cloud-google/src/main/java/org/apache/plc4x/java/examples/cloud/google/S7PlcToGoogleIoTCoreSample.java
diff --git a/examples/hello-cloud-google/src/main/resources/logback.xml b/plc4j/examples/hello-cloud-google/src/main/resources/logback.xml
similarity index 100%
rename from examples/hello-cloud-google/src/main/resources/logback.xml
rename to plc4j/examples/hello-cloud-google/src/main/resources/logback.xml
diff --git a/examples/hello-connectivity-kafka/kafka-connector.yml b/plc4j/examples/hello-connectivity-kafka/kafka-connector.yml
similarity index 100%
rename from examples/hello-connectivity-kafka/kafka-connector.yml
rename to plc4j/examples/hello-connectivity-kafka/kafka-connector.yml
diff --git a/examples/hello-connectivity-kafka/pom.xml b/plc4j/examples/hello-connectivity-kafka/pom.xml
similarity index 96%
rename from examples/hello-connectivity-kafka/pom.xml
rename to plc4j/examples/hello-connectivity-kafka/pom.xml
index a989e91..c035912 100644
--- a/examples/hello-connectivity-kafka/pom.xml
+++ b/plc4j/examples/hello-connectivity-kafka/pom.xml
@@ -23,12 +23,12 @@
<parent>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>examples</artifactId>
+ <artifactId>plc4j-examples</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>hello-connectivity-kafka</artifactId>
- <name>Examples: Connectivity: Kafka</name>
+ <artifactId>plc4j-hello-connectivity-kafka</artifactId>
+ <name>PLC4J: Examples: Connectivity: Kafka</name>
<description>Sample application that reads data from a connected PLC and publishes this information to a Kafka topic.</description>
<properties>
diff --git a/examples/hello-connectivity-kafka/server.sh b/plc4j/examples/hello-connectivity-kafka/server.sh
similarity index 100%
rename from examples/hello-connectivity-kafka/server.sh
rename to plc4j/examples/hello-connectivity-kafka/server.sh
diff --git a/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/KafkaConnector.java b/plc4j/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/KafkaConnector.java
similarity index 100%
rename from examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/KafkaConnector.java
rename to plc4j/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/KafkaConnector.java
diff --git a/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/Configuration.java b/plc4j/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/Configuration.java
similarity index 100%
rename from examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/Configuration.java
rename to plc4j/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/Configuration.java
diff --git a/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/KafkaConfig.java b/plc4j/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/KafkaConfig.java
similarity index 100%
rename from examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/KafkaConfig.java
rename to plc4j/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/KafkaConfig.java
diff --git a/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/PlcConfig.java b/plc4j/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/PlcConfig.java
similarity index 100%
rename from examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/PlcConfig.java
rename to plc4j/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/PlcConfig.java
diff --git a/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/PlcFieldConfig.java b/plc4j/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/PlcFieldConfig.java
similarity index 100%
rename from examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/PlcFieldConfig.java
rename to plc4j/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/PlcFieldConfig.java
diff --git a/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/PlcMemoryBlock.java b/plc4j/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/PlcMemoryBlock.java
similarity index 100%
rename from examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/PlcMemoryBlock.java
rename to plc4j/examples/hello-connectivity-kafka/src/main/java/org/apache/plc4x/java/examples/connectivity/kafka/model/PlcMemoryBlock.java
diff --git a/examples/hello-connectivity-mqtt/src/main/resources/logback.xml b/plc4j/examples/hello-connectivity-kafka/src/main/resources/logback.xml
similarity index 100%
rename from examples/hello-connectivity-mqtt/src/main/resources/logback.xml
rename to plc4j/examples/hello-connectivity-kafka/src/main/resources/logback.xml
diff --git a/examples/hello-connectivity-mqtt/mqtt-connector.yml b/plc4j/examples/hello-connectivity-mqtt/mqtt-connector.yml
similarity index 100%
rename from examples/hello-connectivity-mqtt/mqtt-connector.yml
rename to plc4j/examples/hello-connectivity-mqtt/mqtt-connector.yml
diff --git a/examples/hello-connectivity-mqtt/pom.xml b/plc4j/examples/hello-connectivity-mqtt/pom.xml
similarity index 96%
rename from examples/hello-connectivity-mqtt/pom.xml
rename to plc4j/examples/hello-connectivity-mqtt/pom.xml
index 799ec0f..74cdcb4 100644
--- a/examples/hello-connectivity-mqtt/pom.xml
+++ b/plc4j/examples/hello-connectivity-mqtt/pom.xml
@@ -23,12 +23,12 @@
<parent>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>examples</artifactId>
+ <artifactId>plc4j-examples</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>hello-connectivity-mqtt</artifactId>
- <name>Examples: Connectivity: MQTT</name>
+ <artifactId>plc4j-hello-connectivity-mqtt</artifactId>
+ <name>PLC4J: Examples: Connectivity: MQTT</name>
<description>Sample application, that reads data from a connected PLC and publishes this information via MQTT.</description>
<properties>
diff --git a/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/MqttConnector.java b/plc4j/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/MqttConnector.java
similarity index 100%
rename from examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/MqttConnector.java
rename to plc4j/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/MqttConnector.java
diff --git a/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/Configuration.java b/plc4j/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/Configuration.java
similarity index 100%
rename from examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/Configuration.java
rename to plc4j/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/Configuration.java
diff --git a/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/MqttConfig.java b/plc4j/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/MqttConfig.java
similarity index 100%
rename from examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/MqttConfig.java
rename to plc4j/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/MqttConfig.java
diff --git a/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/PlcConfig.java b/plc4j/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/PlcConfig.java
similarity index 100%
rename from examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/PlcConfig.java
rename to plc4j/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/PlcConfig.java
diff --git a/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/PlcFieldConfig.java b/plc4j/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/PlcFieldConfig.java
similarity index 100%
rename from examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/PlcFieldConfig.java
rename to plc4j/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/PlcFieldConfig.java
diff --git a/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/PlcMemoryBlock.java b/plc4j/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/PlcMemoryBlock.java
similarity index 100%
rename from examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/PlcMemoryBlock.java
rename to plc4j/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/model/PlcMemoryBlock.java
diff --git a/examples/hello-connectivity-kafka/src/main/resources/logback.xml b/plc4j/examples/hello-connectivity-mqtt/src/main/resources/logback.xml
similarity index 100%
rename from examples/hello-connectivity-kafka/src/main/resources/logback.xml
rename to plc4j/examples/hello-connectivity-mqtt/src/main/resources/logback.xml
diff --git a/examples/hello-integration-edgent/pom.xml b/plc4j/examples/hello-integration-edgent/pom.xml
similarity index 95%
rename from examples/hello-integration-edgent/pom.xml
rename to plc4j/examples/hello-integration-edgent/pom.xml
index 54618e5..079362c 100644
--- a/examples/hello-integration-edgent/pom.xml
+++ b/plc4j/examples/hello-integration-edgent/pom.xml
@@ -23,12 +23,12 @@
<parent>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>examples</artifactId>
+ <artifactId>plc4j-examples</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>hellp-integration-edgent</artifactId>
- <name>Examples: Edgent</name>
+ <artifactId>plc4j-hello-integration-edgent</artifactId>
+ <name>PLC4J: Examples: Edgent</name>
<description>Application using Edgent to output PLC data to the console.</description>
<properties>
diff --git a/examples/hello-integration-edgent/src/main/java/org/apache/plc4x/java/examples/integration/edgent/CliOptions.java b/plc4j/examples/hello-integration-edgent/src/main/java/org/apache/plc4x/java/examples/integration/edgent/CliOptions.java
similarity index 100%
rename from examples/hello-integration-edgent/src/main/java/org/apache/plc4x/java/examples/integration/edgent/CliOptions.java
rename to plc4j/examples/hello-integration-edgent/src/main/java/org/apache/plc4x/java/examples/integration/edgent/CliOptions.java
diff --git a/examples/hello-integration-edgent/src/main/java/org/apache/plc4x/java/examples/integration/edgent/PlcLogger.java b/plc4j/examples/hello-integration-edgent/src/main/java/org/apache/plc4x/java/examples/integration/edgent/PlcLogger.java
similarity index 100%
rename from examples/hello-integration-edgent/src/main/java/org/apache/plc4x/java/examples/integration/edgent/PlcLogger.java
rename to plc4j/examples/hello-integration-edgent/src/main/java/org/apache/plc4x/java/examples/integration/edgent/PlcLogger.java
diff --git a/examples/hello-world-plc4x/src/main/resources/logback.xml b/plc4j/examples/hello-integration-edgent/src/main/resources/logback.xml
similarity index 100%
rename from examples/hello-world-plc4x/src/main/resources/logback.xml
rename to plc4j/examples/hello-integration-edgent/src/main/resources/logback.xml
diff --git a/examples/hello-opm/pom.xml b/plc4j/examples/hello-opm/pom.xml
similarity index 95%
rename from examples/hello-opm/pom.xml
rename to plc4j/examples/hello-opm/pom.xml
index e477c6e..1a54c8c 100644
--- a/examples/hello-opm/pom.xml
+++ b/plc4j/examples/hello-opm/pom.xml
@@ -23,12 +23,12 @@
<parent>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>examples</artifactId>
+ <artifactId>plc4j-examples</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>hello-opm</artifactId>
- <name>Examples: Hello OPM</name>
+ <artifactId>plc4j-hello-opm</artifactId>
+ <name>PLC4J: Examples: Hello OPM</name>
<description>Hello World example of PLC4X using the OPM feature.</description>
<properties>
diff --git a/examples/hello-opm/src/main/java/org/apache/plc4x/java/examples/helloopm/HelloOpm.java b/plc4j/examples/hello-opm/src/main/java/org/apache/plc4x/java/examples/helloopm/HelloOpm.java
similarity index 100%
rename from examples/hello-opm/src/main/java/org/apache/plc4x/java/examples/helloopm/HelloOpm.java
rename to plc4j/examples/hello-opm/src/main/java/org/apache/plc4x/java/examples/helloopm/HelloOpm.java
diff --git a/examples/hello-opm/src/main/resources/logback.xml b/plc4j/examples/hello-opm/src/main/resources/logback.xml
similarity index 100%
rename from examples/hello-opm/src/main/resources/logback.xml
rename to plc4j/examples/hello-opm/src/main/resources/logback.xml
diff --git a/examples/hello-storage-elasticsearch/README.adoc b/plc4j/examples/hello-storage-elasticsearch/README.adoc
similarity index 100%
rename from examples/hello-storage-elasticsearch/README.adoc
rename to plc4j/examples/hello-storage-elasticsearch/README.adoc
diff --git a/examples/hello-storage-elasticsearch/pom.xml b/plc4j/examples/hello-storage-elasticsearch/pom.xml
similarity index 95%
rename from examples/hello-storage-elasticsearch/pom.xml
rename to plc4j/examples/hello-storage-elasticsearch/pom.xml
index 198ea09..3b099dc 100644
--- a/examples/hello-storage-elasticsearch/pom.xml
+++ b/plc4j/examples/hello-storage-elasticsearch/pom.xml
@@ -23,12 +23,12 @@
<parent>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>examples</artifactId>
+ <artifactId>plc4j-examples</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>hello-elasticsearch</artifactId>
- <name>Examples: Storage: ElasticSearch</name>
+ <artifactId>plc4j-hello-storage-elasticsearch</artifactId>
+ <name>PLC4J: Examples: Storage: ElasticSearch</name>
<description>Client application demonstrating PLC4X in our virtual IoT Factory using ElasticSearch.</description>
<properties>
diff --git a/examples/hello-storage-elasticsearch/src/main/java/org/apache/plc4x/java/examples/storage/elasticsearch/ElasticsearchStorage.java b/plc4j/examples/hello-storage-elasticsearch/src/main/java/org/apache/plc4x/java/examples/storage/elasticsearch/ElasticsearchStorage.java
similarity index 100%
rename from examples/hello-storage-elasticsearch/src/main/java/org/apache/plc4x/java/examples/storage/elasticsearch/ElasticsearchStorage.java
rename to plc4j/examples/hello-storage-elasticsearch/src/main/java/org/apache/plc4x/java/examples/storage/elasticsearch/ElasticsearchStorage.java
diff --git a/examples/hello-storage-elasticsearch/src/main/resources/log4j2.xml b/plc4j/examples/hello-storage-elasticsearch/src/main/resources/log4j2.xml
similarity index 100%
rename from examples/hello-storage-elasticsearch/src/main/resources/log4j2.xml
rename to plc4j/examples/hello-storage-elasticsearch/src/main/resources/log4j2.xml
diff --git a/examples/hello-storage-elasticsearch/src/main/resources/logback.xml b/plc4j/examples/hello-storage-elasticsearch/src/main/resources/logback.xml
similarity index 100%
rename from examples/hello-storage-elasticsearch/src/main/resources/logback.xml
rename to plc4j/examples/hello-storage-elasticsearch/src/main/resources/logback.xml
diff --git a/examples/hello-webapp/client/pom.xml b/plc4j/examples/hello-webapp/client/pom.xml
similarity index 86%
rename from examples/hello-webapp/client/pom.xml
rename to plc4j/examples/hello-webapp/client/pom.xml
index 90a5abc..e78c910 100644
--- a/examples/hello-webapp/client/pom.xml
+++ b/plc4j/examples/hello-webapp/client/pom.xml
@@ -22,14 +22,14 @@
<parent>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>hello-webapp</artifactId>
+ <artifactId>plc4j-hello-webapp</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>hello-webapp-client</artifactId>
+ <artifactId>plc4j-hello-webapp-client</artifactId>
<packaging>swf</packaging>
- <name>Examples: Hello-Webapp: Client</name>
+ <name>PLC4J: Examples: Hello-Webapp: Client</name>
<build>
<sourceDirectory>src/main/royale</sourceDirectory>
@@ -60,6 +60,17 @@
</dependency>
</dependencies>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies>
+ <usedDependency>org.apache.royale.framework:Jewel</usedDependency>
+ <usedDependency>org.apache.royale.framework:Language</usedDependency>
+ <usedDependency>org.apache.royale.framework:Network</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
</plugins>
</build>
diff --git a/examples/hello-webapp/client/src/main/royale/HelloPLC4X.mxml b/plc4j/examples/hello-webapp/client/src/main/royale/HelloPLC4X.mxml
similarity index 100%
rename from examples/hello-webapp/client/src/main/royale/HelloPLC4X.mxml
rename to plc4j/examples/hello-webapp/client/src/main/royale/HelloPLC4X.mxml
diff --git a/examples/hello-webapp/client/src/main/royale/service/RobotService.as b/plc4j/examples/hello-webapp/client/src/main/royale/service/RobotService.as
similarity index 100%
rename from examples/hello-webapp/client/src/main/royale/service/RobotService.as
rename to plc4j/examples/hello-webapp/client/src/main/royale/service/RobotService.as
diff --git a/examples/hello-webapp/pom.xml b/plc4j/examples/hello-webapp/pom.xml
similarity index 94%
rename from examples/hello-webapp/pom.xml
rename to plc4j/examples/hello-webapp/pom.xml
index 581732f..65f8633 100644
--- a/examples/hello-webapp/pom.xml
+++ b/plc4j/examples/hello-webapp/pom.xml
@@ -23,12 +23,12 @@
<parent>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>examples</artifactId>
+ <artifactId>plc4j-examples</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>hello-webapp</artifactId>
- <name>Examples: Hello-Webapp (root)</name>
+ <artifactId>plc4j-hello-webapp</artifactId>
+ <name>PLC4J: Examples: Hello-Webapp (root)</name>
<packaging>pom</packaging>
<properties>
diff --git a/examples/hello-webapp/service/pom.xml b/plc4j/examples/hello-webapp/service/pom.xml
similarity index 93%
rename from examples/hello-webapp/service/pom.xml
rename to plc4j/examples/hello-webapp/service/pom.xml
index e933162..506598f 100644
--- a/examples/hello-webapp/service/pom.xml
+++ b/plc4j/examples/hello-webapp/service/pom.xml
@@ -24,13 +24,13 @@
<parent>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>hello-webapp</artifactId>
+ <artifactId>plc4j-hello-webapp</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>hello-webapp-service</artifactId>
+ <artifactId>plc4j-hello-webapp-service</artifactId>
- <name>Examples: Hello-Webapp: Service</name>
+ <name>PLC4J: Examples: Hello-Webapp: Service</name>
<build>
<plugins>
diff --git a/examples/hello-webapp/service/src/main/java/org/apache/plc4x/examples/robot/controllers/RobotController.java b/plc4j/examples/hello-webapp/service/src/main/java/org/apache/plc4x/examples/robot/controllers/RobotController.java
similarity index 100%
rename from examples/hello-webapp/service/src/main/java/org/apache/plc4x/examples/robot/controllers/RobotController.java
rename to plc4j/examples/hello-webapp/service/src/main/java/org/apache/plc4x/examples/robot/controllers/RobotController.java
diff --git a/examples/hello-webapp/webapp/pom.xml b/plc4j/examples/hello-webapp/webapp/pom.xml
similarity index 88%
rename from examples/hello-webapp/webapp/pom.xml
rename to plc4j/examples/hello-webapp/webapp/pom.xml
index 3f51385..fb1e8e8 100644
--- a/examples/hello-webapp/webapp/pom.xml
+++ b/plc4j/examples/hello-webapp/webapp/pom.xml
@@ -24,14 +24,14 @@
<parent>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>hello-webapp</artifactId>
+ <artifactId>plc4j-hello-webapp</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>hello-webapp-webapp</artifactId>
+ <artifactId>plc4j-hello-webapp-webapp</artifactId>
<packaging>war</packaging>
- <name>Examples: Hello-Webapp: Spring-Boot WAR</name>
+ <name>PLC4J: Examples: Hello-Webapp: Spring-Boot WAR</name>
<properties>
<start.class>org.apache.plc4x.examples.robot.Application</start.class>
@@ -71,7 +71,7 @@
<artifactItems>
<artifactItem>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>hello-webapp-client</artifactId>
+ <artifactId>plc4j-hello-webapp-client</artifactId>
<version>0.4.0-SNAPSHOT</version>
<type>war</type>
<outputDirectory>${project.build.outputDirectory}/static/</outputDirectory>
@@ -83,8 +83,8 @@
<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>
+ <usedDependency>org.apache.plc4x.examples:plc4j-hello-webapp-service</usedDependency>
+ <usedDependency>org.apache.plc4x.examples:plc4j-hello-webapp-client</usedDependency>
</usedDependencies>
</configuration>
</plugin>
@@ -106,7 +106,7 @@
<dependencies>
<dependency>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>hello-webapp-service</artifactId>
+ <artifactId>plc4j-hello-webapp-service</artifactId>
<version>0.4.0-SNAPSHOT</version>
</dependency>
@@ -130,7 +130,7 @@
<dependency>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>hello-webapp-client</artifactId>
+ <artifactId>plc4j-hello-webapp-client</artifactId>
<version>0.4.0-SNAPSHOT</version>
<type>war</type>
<scope>runtime</scope>
diff --git a/examples/hello-webapp/webapp/src/main/java/org/apache/plc4x/examples/robot/Application.java b/plc4j/examples/hello-webapp/webapp/src/main/java/org/apache/plc4x/examples/robot/Application.java
similarity index 100%
rename from examples/hello-webapp/webapp/src/main/java/org/apache/plc4x/examples/robot/Application.java
rename to plc4j/examples/hello-webapp/webapp/src/main/java/org/apache/plc4x/examples/robot/Application.java
diff --git a/examples/hello-webapp/webapp/src/main/resources/application.properties b/plc4j/examples/hello-webapp/webapp/src/main/resources/application.properties
similarity index 100%
rename from examples/hello-webapp/webapp/src/main/resources/application.properties
rename to plc4j/examples/hello-webapp/webapp/src/main/resources/application.properties
diff --git a/examples/hello-world-plc4x/pom.xml b/plc4j/examples/hello-world-plc4x/pom.xml
similarity index 95%
rename from examples/hello-world-plc4x/pom.xml
rename to plc4j/examples/hello-world-plc4x/pom.xml
index fbd1b74..e327713 100644
--- a/examples/hello-world-plc4x/pom.xml
+++ b/plc4j/examples/hello-world-plc4x/pom.xml
@@ -23,12 +23,12 @@
<parent>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>examples</artifactId>
+ <artifactId>plc4j-examples</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>hello-world-plc4x</artifactId>
- <name>Examples: Hello-World PLC4X</name>
+ <artifactId>plc4j-hello-world-plc4x</artifactId>
+ <name>PLC4J: Examples: Hello-World PLC4X</name>
<description>Hello world application for PLC4X.</description>
<properties>
diff --git a/examples/hello-world-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/CliOptions.java b/plc4j/examples/hello-world-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/CliOptions.java
similarity index 100%
rename from examples/hello-world-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/CliOptions.java
rename to plc4j/examples/hello-world-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/CliOptions.java
diff --git a/examples/hello-world-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/HelloPlc4x.java b/plc4j/examples/hello-world-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/HelloPlc4x.java
similarity index 100%
rename from examples/hello-world-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/HelloPlc4x.java
rename to plc4j/examples/hello-world-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/HelloPlc4x.java
diff --git a/examples/hello-integration-edgent/src/main/resources/logback.xml b/plc4j/examples/hello-world-plc4x/src/main/resources/logback.xml
similarity index 100%
rename from examples/hello-integration-edgent/src/main/resources/logback.xml
rename to plc4j/examples/hello-world-plc4x/src/main/resources/logback.xml
diff --git a/examples/pom.xml b/plc4j/examples/pom.xml
similarity index 80%
rename from examples/pom.xml
rename to plc4j/examples/pom.xml
index 8f1edf7..21fc77c 100644
--- a/examples/pom.xml
+++ b/plc4j/examples/pom.xml
@@ -1,38 +1,38 @@
<?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
+ 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.
-
--->
+ 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>plc4x-parent</artifactId>
+ <artifactId>plc4j</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.plc4x.examples</groupId>
- <artifactId>examples</artifactId>
+ <artifactId>plc4j-examples</artifactId>
<packaging>pom</packaging>
- <name>Examples</name>
- <description>Parent of all application example modules.</description>
+ <name>PLC4J: Examples</name>
+ <description>Parent of all java based application example modules.</description>
<modules>
<module>dummy-driver</module>
diff --git a/integrations/apache-calcite/pom.xml b/plc4j/integrations/apache-calcite/pom.xml
similarity index 95%
rename from integrations/apache-calcite/pom.xml
rename to plc4j/integrations/apache-calcite/pom.xml
index f0f4312..e54bfe8 100644
--- a/integrations/apache-calcite/pom.xml
+++ b/plc4j/integrations/apache-calcite/pom.xml
@@ -20,15 +20,15 @@
<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">
<parent>
- <artifactId>integrations</artifactId>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-integrations</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>apache-calcite</artifactId>
+ <artifactId>plc4j-apache-calcite</artifactId>
- <name>Integrations: Apache Calcite</name>
+ <name>PLC4J: Integrations: Apache Calcite</name>
<properties>
<calcite-core.version>1.17.0</calcite-core.version>
diff --git a/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xBaseTable.java b/plc4j/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xBaseTable.java
similarity index 100%
rename from integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xBaseTable.java
rename to plc4j/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xBaseTable.java
diff --git a/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchema.java b/plc4j/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchema.java
similarity index 100%
rename from integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchema.java
rename to plc4j/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchema.java
diff --git a/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchemaFactory.java b/plc4j/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchemaFactory.java
similarity index 100%
rename from integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchemaFactory.java
rename to plc4j/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xSchemaFactory.java
diff --git a/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xStreamTable.java b/plc4j/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xStreamTable.java
similarity index 100%
rename from integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xStreamTable.java
rename to plc4j/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xStreamTable.java
diff --git a/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xTable.java b/plc4j/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xTable.java
similarity index 100%
rename from integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xTable.java
rename to plc4j/integrations/apache-calcite/src/main/java/org/apache/plc4x/Plc4xTable.java
diff --git a/integrations/apache-calcite/src/test/java/org/apache/plc4x/DriverManagerTest.java b/plc4j/integrations/apache-calcite/src/test/java/org/apache/plc4x/DriverManagerTest.java
similarity index 100%
rename from integrations/apache-calcite/src/test/java/org/apache/plc4x/DriverManagerTest.java
rename to plc4j/integrations/apache-calcite/src/test/java/org/apache/plc4x/DriverManagerTest.java
diff --git a/integrations/apache-calcite/src/test/java/org/apache/plc4x/Plc4XBaseTableTest.java b/plc4j/integrations/apache-calcite/src/test/java/org/apache/plc4x/Plc4XBaseTableTest.java
similarity index 100%
rename from integrations/apache-calcite/src/test/java/org/apache/plc4x/Plc4XBaseTableTest.java
rename to plc4j/integrations/apache-calcite/src/test/java/org/apache/plc4x/Plc4XBaseTableTest.java
diff --git a/integrations/apache-calcite/src/test/java/org/apache/plc4x/Plc4xSchemaFactoryTest.java b/plc4j/integrations/apache-calcite/src/test/java/org/apache/plc4x/Plc4xSchemaFactoryTest.java
similarity index 96%
rename from integrations/apache-calcite/src/test/java/org/apache/plc4x/Plc4xSchemaFactoryTest.java
rename to plc4j/integrations/apache-calcite/src/test/java/org/apache/plc4x/Plc4xSchemaFactoryTest.java
index 2edc905..a70eac7 100644
--- a/integrations/apache-calcite/src/test/java/org/apache/plc4x/Plc4xSchemaFactoryTest.java
+++ b/plc4j/integrations/apache-calcite/src/test/java/org/apache/plc4x/Plc4xSchemaFactoryTest.java
@@ -23,8 +23,6 @@ import org.junit.jupiter.api.Test;
import java.util.Collections;
-import static org.junit.jupiter.api.Assertions.*;
-
class Plc4xSchemaFactoryTest implements WithAssertions {
@Test
diff --git a/integrations/apache-calcite/src/test/resources/example.yml b/plc4j/integrations/apache-calcite/src/test/resources/example.yml
similarity index 100%
rename from integrations/apache-calcite/src/test/resources/example.yml
rename to plc4j/integrations/apache-calcite/src/test/resources/example.yml
diff --git a/integrations/apache-camel/src/test/resources/logback.xml b/plc4j/integrations/apache-calcite/src/test/resources/logback.xml
similarity index 100%
rename from integrations/apache-camel/src/test/resources/logback.xml
rename to plc4j/integrations/apache-calcite/src/test/resources/logback.xml
diff --git a/integrations/apache-calcite/src/test/resources/model.json b/plc4j/integrations/apache-calcite/src/test/resources/model.json
similarity index 100%
rename from integrations/apache-calcite/src/test/resources/model.json
rename to plc4j/integrations/apache-calcite/src/test/resources/model.json
diff --git a/integrations/apache-camel/pom.xml b/plc4j/integrations/apache-camel/pom.xml
similarity index 97%
rename from integrations/apache-camel/pom.xml
rename to plc4j/integrations/apache-camel/pom.xml
index 463d7ef..bd9da84 100644
--- a/integrations/apache-camel/pom.xml
+++ b/plc4j/integrations/apache-camel/pom.xml
@@ -23,12 +23,13 @@
<parent>
<groupId>org.apache.plc4x</groupId>
- <artifactId>integrations</artifactId>
+ <artifactId>plc4j-integrations</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>apache-camel</artifactId>
- <name>Integrations: Apache Camel</name>
+ <artifactId>plc4j-apache-camel</artifactId>
+
+ <name>PLC4J: Integrations: Apache Camel</name>
<description>Integration module for integrating PLC4X into Apache Camel.</description>
<properties>
diff --git a/integrations/apache-camel/src/main/docs/PLC4X.adoc b/plc4j/integrations/apache-camel/src/main/docs/PLC4X.adoc
similarity index 100%
rename from integrations/apache-camel/src/main/docs/PLC4X.adoc
rename to plc4j/integrations/apache-camel/src/main/docs/PLC4X.adoc
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java b/plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
similarity index 100%
copy from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
copy to plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XComponent.java b/plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XComponent.java
similarity index 100%
rename from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XComponent.java
rename to plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XComponent.java
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java b/plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java
similarity index 100%
rename from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java
rename to plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XEndpoint.java b/plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XEndpoint.java
similarity index 100%
rename from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XEndpoint.java
rename to plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XEndpoint.java
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XPollingConsumer.java b/plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XPollingConsumer.java
similarity index 100%
rename from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XPollingConsumer.java
rename to plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XPollingConsumer.java
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XProducer.java b/plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XProducer.java
similarity index 100%
rename from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XProducer.java
rename to plc4j/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Plc4XProducer.java
diff --git a/integrations/apache-camel/src/main/resources/META-INF/services/org/apache/camel/component/plc4x b/plc4j/integrations/apache-camel/src/main/resources/META-INF/services/org/apache/camel/component/plc4x
similarity index 100%
rename from integrations/apache-camel/src/main/resources/META-INF/services/org/apache/camel/component/plc4x
rename to plc4j/integrations/apache-camel/src/main/resources/META-INF/services/org/apache/camel/component/plc4x
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java b/plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
similarity index 100%
copy from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
copy to plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ManualTest.java b/plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ManualTest.java
similarity index 100%
rename from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ManualTest.java
rename to plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ManualTest.java
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/MockDriver.java b/plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/MockDriver.java
similarity index 100%
rename from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/MockDriver.java
rename to plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/MockDriver.java
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XComponentTest.java b/plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XComponentTest.java
similarity index 100%
rename from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XComponentTest.java
rename to plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XComponentTest.java
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XConsumerTest.java b/plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XConsumerTest.java
similarity index 100%
rename from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XConsumerTest.java
rename to plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XConsumerTest.java
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XEndpointTest.java b/plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XEndpointTest.java
similarity index 100%
rename from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XEndpointTest.java
rename to plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XEndpointTest.java
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XPollingConsumerTest.java b/plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XPollingConsumerTest.java
similarity index 100%
rename from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XPollingConsumerTest.java
rename to plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XPollingConsumerTest.java
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XProducerTest.java b/plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XProducerTest.java
similarity index 100%
rename from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XProducerTest.java
rename to plc4j/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/Plc4XProducerTest.java
diff --git a/integrations/apache-camel/src/test/resources/META-INF/services/org.apache.plc4x.java.spi.PlcDriver b/plc4j/integrations/apache-camel/src/test/resources/META-INF/services/org.apache.plc4x.java.spi.PlcDriver
similarity index 100%
rename from integrations/apache-camel/src/test/resources/META-INF/services/org.apache.plc4x.java.spi.PlcDriver
rename to plc4j/integrations/apache-camel/src/test/resources/META-INF/services/org.apache.plc4x.java.spi.PlcDriver
diff --git a/integrations/apache-camel/src/test/resources/log4j2.properties b/plc4j/integrations/apache-camel/src/test/resources/log4j2.properties
similarity index 100%
rename from integrations/apache-camel/src/test/resources/log4j2.properties
rename to plc4j/integrations/apache-camel/src/test/resources/log4j2.properties
diff --git a/integrations/apache-calcite/src/test/resources/logback.xml b/plc4j/integrations/apache-camel/src/test/resources/logback.xml
similarity index 100%
rename from integrations/apache-calcite/src/test/resources/logback.xml
rename to plc4j/integrations/apache-camel/src/test/resources/logback.xml
diff --git a/integrations/apache-edgent/pom.xml b/plc4j/integrations/apache-edgent/pom.xml
similarity index 94%
rename from integrations/apache-edgent/pom.xml
rename to plc4j/integrations/apache-edgent/pom.xml
index 936b546..bf985fe 100644
--- a/integrations/apache-edgent/pom.xml
+++ b/plc4j/integrations/apache-edgent/pom.xml
@@ -23,12 +23,13 @@
<parent>
<groupId>org.apache.plc4x</groupId>
- <artifactId>integrations</artifactId>
+ <artifactId>plc4j-integrations</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>apache-edgent</artifactId>
- <name>Integrations: Apache Edgent</name>
+ <artifactId>plc4j-apache-edgent</artifactId>
+
+ <name>PLC4J: Integrations: Apache Edgent</name>
<description>Integration module for integrating PLC4X into Apache Edgent.</description>
<properties>
diff --git a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java b/plc4j/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
similarity index 100%
rename from integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
rename to plc4j/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
diff --git a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcFunctions.java b/plc4j/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcFunctions.java
similarity index 100%
rename from integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcFunctions.java
rename to plc4j/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcFunctions.java
diff --git a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java b/plc4j/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
similarity index 100%
copy from integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
copy to plc4j/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
diff --git a/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/PlcConnectionAdapterTest.java b/plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/PlcConnectionAdapterTest.java
similarity index 100%
rename from integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/PlcConnectionAdapterTest.java
rename to plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/PlcConnectionAdapterTest.java
diff --git a/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/PlcFunctionsTest.java b/plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/PlcFunctionsTest.java
similarity index 100%
rename from integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/PlcFunctionsTest.java
rename to plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/PlcFunctionsTest.java
diff --git a/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockConnection.java b/plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockConnection.java
similarity index 100%
rename from integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockConnection.java
rename to plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockConnection.java
diff --git a/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockDriver.java b/plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockDriver.java
similarity index 100%
rename from integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockDriver.java
rename to plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockDriver.java
index 887ce2e..0a13907 100644
--- a/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockDriver.java
+++ b/plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockDriver.java
@@ -18,10 +18,10 @@ under the License.
*/
package org.apache.plc4x.edgent.mock;
-import org.apache.plc4x.java.spi.PlcDriver;
-import org.apache.plc4x.java.api.authentication.PlcAuthentication;
import org.apache.plc4x.java.api.PlcConnection;
+import org.apache.plc4x.java.api.authentication.PlcAuthentication;
import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
+import org.apache.plc4x.java.spi.PlcDriver;
public class MockDriver implements PlcDriver {
diff --git a/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockField.java b/plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockField.java
similarity index 100%
rename from integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockField.java
rename to plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockField.java
diff --git a/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockFieldHandler.java b/plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockFieldHandler.java
similarity index 100%
rename from integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockFieldHandler.java
rename to plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockFieldHandler.java
diff --git a/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockFieldItem.java b/plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockFieldItem.java
similarity index 100%
rename from integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockFieldItem.java
rename to plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockFieldItem.java
diff --git a/integrations/apache-edgent/src/test/resources/META-INF/services/org.apache.plc4x.java.spi.PlcDriver b/plc4j/integrations/apache-edgent/src/test/resources/META-INF/services/org.apache.plc4x.java.spi.PlcDriver
similarity index 100%
rename from integrations/apache-edgent/src/test/resources/META-INF/services/org.apache.plc4x.java.spi.PlcDriver
rename to plc4j/integrations/apache-edgent/src/test/resources/META-INF/services/org.apache.plc4x.java.spi.PlcDriver
diff --git a/integrations/apache-kafka/README.md b/plc4j/integrations/apache-kafka/README.md
similarity index 100%
rename from integrations/apache-kafka/README.md
rename to plc4j/integrations/apache-kafka/README.md
diff --git a/integrations/apache-kafka/config/sink.properties b/plc4j/integrations/apache-kafka/config/sink.properties
similarity index 100%
rename from integrations/apache-kafka/config/sink.properties
rename to plc4j/integrations/apache-kafka/config/sink.properties
diff --git a/integrations/apache-kafka/config/source.properties b/plc4j/integrations/apache-kafka/config/source.properties
similarity index 100%
rename from integrations/apache-kafka/config/source.properties
rename to plc4j/integrations/apache-kafka/config/source.properties
diff --git a/integrations/apache-kafka/pom.xml b/plc4j/integrations/apache-kafka/pom.xml
similarity index 94%
rename from integrations/apache-kafka/pom.xml
rename to plc4j/integrations/apache-kafka/pom.xml
index b9b3eea..32c6d5c 100644
--- a/integrations/apache-kafka/pom.xml
+++ b/plc4j/integrations/apache-kafka/pom.xml
@@ -22,12 +22,13 @@
<parent>
<groupId>org.apache.plc4x</groupId>
- <artifactId>integrations</artifactId>
+ <artifactId>plc4j-integrations</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>apache-kafka</artifactId>
- <name>Integrations: Apache Kafka</name>
+ <artifactId>plc4j-apache-kafka</artifactId>
+
+ <name>PLC4J: Integrations: Apache Kafka</name>
<description>Integration module for integrating PLC4X into Apache Kafka (Kafka-Connect-Plugin)</description>
<properties>
diff --git a/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSinkConnector.java b/plc4j/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSinkConnector.java
similarity index 95%
rename from integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSinkConnector.java
rename to plc4j/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSinkConnector.java
index fa2e32d..c68a1a8 100644
--- a/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSinkConnector.java
+++ b/plc4j/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSinkConnector.java
@@ -24,7 +24,10 @@ import org.apache.kafka.connect.connector.Task;
import org.apache.kafka.connect.sink.SinkConnector;
import org.apache.plc4x.kafka.util.VersionUtil;
-import java.util.*;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
public class Plc4xSinkConnector extends SinkConnector {
static final String URL_CONFIG = "url";
diff --git a/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSinkTask.java b/plc4j/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSinkTask.java
similarity index 100%
rename from integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSinkTask.java
rename to plc4j/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSinkTask.java
diff --git a/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSourceConnector.java b/plc4j/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSourceConnector.java
similarity index 98%
rename from integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSourceConnector.java
rename to plc4j/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSourceConnector.java
index 4be1842..cddef09 100644
--- a/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSourceConnector.java
+++ b/plc4j/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSourceConnector.java
@@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
@@ -91,7 +92,7 @@ public class Plc4xSourceConnector extends SourceConnector {
} else {
try {
// TODO
- String config = new Scanner(new URL(json).openStream(), "UTF-8").useDelimiter("\\A").next();
+ String config = new Scanner(new URL(json).openStream(), StandardCharsets.UTF_8.name()).useDelimiter("\\A").next();
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> values = mapper.readValue(config, new TypeReference<Map<String, Object>>() {});
List<Map<String, Object>> plcs = (List<Map<String, Object>>) values.get("PLCs");
diff --git a/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSourceTask.java b/plc4j/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSourceTask.java
similarity index 100%
rename from integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSourceTask.java
rename to plc4j/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/Plc4xSourceTask.java
diff --git a/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/util/VersionUtil.java b/plc4j/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/util/VersionUtil.java
similarity index 100%
rename from integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/util/VersionUtil.java
rename to plc4j/integrations/apache-kafka/src/main/java/org/apache/plc4x/kafka/util/VersionUtil.java
diff --git a/integrations/apache-karaf/karaf-ads-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-ads-feature/pom.xml
similarity index 76%
rename from integrations/apache-karaf/karaf-ads-feature/pom.xml
rename to plc4j/integrations/apache-karaf/karaf-ads-feature/pom.xml
index fc75b12..a01d68d 100644
--- a/integrations/apache-karaf/karaf-ads-feature/pom.xml
+++ b/plc4j/integrations/apache-karaf/karaf-ads-feature/pom.xml
@@ -22,15 +22,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>apache-karaf</artifactId>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-apache-karaf</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>karaf-ads-feature</artifactId>
+ <artifactId>plc4j-karaf-ads-feature</artifactId>
<packaging>feature</packaging>
- <name>Integrations: Apache Karaf: ADS</name>
+ <name>PLC4J: Integrations: Apache Karaf: ADS</name>
<dependencies>
<dependency>
@@ -46,6 +46,15 @@
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies>
+ <usedDependency>org.apache.plc4x:plc4j-driver-ads</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
</plugins>
</build>
diff --git a/integrations/apache-karaf/karaf-demo-server/pom.xml b/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml
similarity index 73%
rename from integrations/apache-karaf/karaf-demo-server/pom.xml
rename to plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml
index 33992f0..d6e3d31 100644
--- a/integrations/apache-karaf/karaf-demo-server/pom.xml
+++ b/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml
@@ -23,15 +23,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>apache-karaf</artifactId>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-apache-karaf</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>karaf-demo-server</artifactId>
+ <artifactId>plc4j-karaf-demo-server</artifactId>
<packaging>karaf-assembly</packaging>
- <name>Integrations: Apache Karaf: Demo Server</name>
+ <name>PLC4J: Integrations: Apache Karaf: Demo Server</name>
<dependencies>
<dependency>
@@ -83,6 +83,13 @@
<classifier>features</classifier>
<type>xml</type>
</dependency>
+
+ <!-- This is just a way of removing this dependency -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -99,6 +106,21 @@
</bootFeatures>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies>
+ <usedDependency>org.apache.karaf.features:framework</usedDependency>
+ <usedDependency>org.apache.karaf.features:standard</usedDependency>
+ <usedDependency>org.apache.plc4x:karaf-ads-feature</usedDependency>
+ <usedDependency>org.apache.plc4x:karaf-ethernet-ip-feature</usedDependency>
+ <usedDependency>org.apache.plc4x:karaf-modbus-feature</usedDependency>
+ <usedDependency>org.apache.plc4x:karaf-s7-feature</usedDependency>
+ <usedDependency>org.apache.plc4x:karaf-simulated-feature</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
</plugins>
</build>
diff --git a/integrations/apache-karaf/karaf-ethernet-ip-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-ethernet-ip-feature/pom.xml
similarity index 75%
rename from integrations/apache-karaf/karaf-ethernet-ip-feature/pom.xml
rename to plc4j/integrations/apache-karaf/karaf-ethernet-ip-feature/pom.xml
index b832395..b5b9584 100644
--- a/integrations/apache-karaf/karaf-ethernet-ip-feature/pom.xml
+++ b/plc4j/integrations/apache-karaf/karaf-ethernet-ip-feature/pom.xml
@@ -22,15 +22,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>apache-karaf</artifactId>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-apache-karaf</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>karaf-ethernet-ip-feature</artifactId>
+ <artifactId>plc4j-karaf-ethernet-ip-feature</artifactId>
<packaging>feature</packaging>
- <name>Integrations: Apache Karaf: EtherNet/IP</name>
+ <name>PLC4J: Integrations: Apache Karaf: EtherNet/IP</name>
<dependencies>
<dependency>
@@ -46,6 +46,15 @@
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies>
+ <usedDependency>org.apache.plc4x:plc4j-driver-ethernet-ip</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
</plugins>
</build>
diff --git a/integrations/apache-karaf/karaf-modbus-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-modbus-feature/pom.xml
similarity index 76%
rename from integrations/apache-karaf/karaf-modbus-feature/pom.xml
rename to plc4j/integrations/apache-karaf/karaf-modbus-feature/pom.xml
index f0362c0..50b0924 100644
--- a/integrations/apache-karaf/karaf-modbus-feature/pom.xml
+++ b/plc4j/integrations/apache-karaf/karaf-modbus-feature/pom.xml
@@ -22,15 +22,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>apache-karaf</artifactId>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-apache-karaf</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>karaf-modbus-feature</artifactId>
+ <artifactId>plc4j-karaf-modbus-feature</artifactId>
<packaging>feature</packaging>
- <name>Integrations: Apache Karaf: Modbus</name>
+ <name>PLC4J: Integrations: Apache Karaf: Modbus</name>
<dependencies>
<dependency>
@@ -46,6 +46,15 @@
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies>
+ <usedDependency>org.apache.plc4x:plc4j-driver-modbus</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
</plugins>
</build>
diff --git a/integrations/apache-karaf/karaf-s7-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml
similarity index 76%
copy from integrations/apache-karaf/karaf-s7-feature/pom.xml
copy to plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml
index 47f3ad2..9930826 100644
--- a/integrations/apache-karaf/karaf-s7-feature/pom.xml
+++ b/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml
@@ -22,15 +22,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>apache-karaf</artifactId>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-apache-karaf</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>karaf-s7-feature</artifactId>
+ <artifactId>plc4j-karaf-s7-feature</artifactId>
<packaging>feature</packaging>
- <name>Integrations: Apache Karaf: S7</name>
+ <name>PLC4J: Integrations: Apache Karaf: S7</name>
<dependencies>
<dependency>
@@ -46,6 +46,15 @@
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
</plugin>
+ <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>
diff --git a/integrations/apache-karaf/karaf-simulated-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-simulated-feature/pom.xml
similarity index 75%
rename from integrations/apache-karaf/karaf-simulated-feature/pom.xml
rename to plc4j/integrations/apache-karaf/karaf-simulated-feature/pom.xml
index 53659ed..30c72de 100644
--- a/integrations/apache-karaf/karaf-simulated-feature/pom.xml
+++ b/plc4j/integrations/apache-karaf/karaf-simulated-feature/pom.xml
@@ -22,15 +22,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>apache-karaf</artifactId>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-apache-karaf</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>karaf-simulated-feature</artifactId>
+ <artifactId>plc4j-karaf-simulated-feature</artifactId>
<packaging>feature</packaging>
- <name>Integrations: Apache Karaf: Simulated</name>
+ <name>PLC4J: Integrations: Apache Karaf: Simulated</name>
<dependencies>
<dependency>
@@ -46,6 +46,15 @@
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies>
+ <usedDependency>org.apache.plc4x:plc4j-driver-simulated</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
</plugins>
</build>
diff --git a/integrations/apache-karaf/pom.xml b/plc4j/integrations/apache-karaf/pom.xml
similarity index 87%
rename from integrations/apache-karaf/pom.xml
rename to plc4j/integrations/apache-karaf/pom.xml
index 2932009..38b6971 100644
--- a/integrations/apache-karaf/pom.xml
+++ b/plc4j/integrations/apache-karaf/pom.xml
@@ -23,15 +23,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>integrations</artifactId>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-integrations</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>apache-karaf</artifactId>
+ <artifactId>plc4j-apache-karaf</artifactId>
<packaging>pom</packaging>
- <name>Integrations: Apache Karaf</name>
+ <name>PLC4J: Integrations: Apache Karaf</name>
<description>Integration module for integrating PLC4X into Apache Karaf.</description>
<properties>
@@ -50,15 +50,6 @@
</modules>
<build>
- <plugins>
- <plugin>
- <groupId>com.buschmais.jqassistant</groupId>
- <artifactId>jqassistant-maven-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
<pluginManagement>
<plugins>
<plugin>
diff --git a/integrations/apache-nifi/nifi-plc4x-nar/false-positives.xml b/plc4j/integrations/apache-nifi/nifi-plc4x-nar/false-positives.xml
similarity index 100%
copy from integrations/apache-nifi/nifi-plc4x-nar/false-positives.xml
copy to plc4j/integrations/apache-nifi/nifi-plc4x-nar/false-positives.xml
diff --git a/integrations/apache-nifi/nifi-plc4x-nar/pom.xml b/plc4j/integrations/apache-nifi/nifi-plc4x-nar/pom.xml
similarity index 73%
rename from integrations/apache-nifi/nifi-plc4x-nar/pom.xml
rename to plc4j/integrations/apache-nifi/nifi-plc4x-nar/pom.xml
index cea180e..10d2e67 100644
--- a/integrations/apache-nifi/nifi-plc4x-nar/pom.xml
+++ b/plc4j/integrations/apache-nifi/nifi-plc4x-nar/pom.xml
@@ -18,14 +18,14 @@
<parent>
<groupId>org.apache.plc4x</groupId>
- <artifactId>apache-nifi</artifactId>
+ <artifactId>plc4j-apache-nifi</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>nifi-plc4x-nar</artifactId>
+ <artifactId>plc4j-nifi-plc4x-nar</artifactId>
<packaging>nar</packaging>
- <name>Integrations: Apache Nifi: NAR</name>
+ <name>PLC4J: Integrations: Apache Nifi: NAR</name>
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
@@ -42,6 +42,21 @@
<suppressionFiles>${project.basedir}/false-positives.xml</suppressionFiles>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies>
+ <usedDependency>org.apache.plc4x:plc4j-nifi-plc4x-processors</usedDependency>
+ <usedDependency>org.apache.plc4x:plc4j-api</usedDependency>
+ <usedDependency>org.apache.plc4x:plc4j-driver-ads</usedDependency>
+ <usedDependency>org.apache.plc4x:plc4j-driver-ethernet-ip</usedDependency>
+ <usedDependency>org.apache.plc4x:plc4j-driver-modbus</usedDependency>
+ <usedDependency>org.apache.plc4x:plc4j-driver-s7</usedDependency>
+ <usedDependency>org.apache.plc4x:plc4j-driver-simulated</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
</plugins>
</pluginManagement>
</build>
@@ -49,7 +64,7 @@
<dependencies>
<dependency>
<groupId>org.apache.plc4x</groupId>
- <artifactId>nifi-plc4x-processors</artifactId>
+ <artifactId>plc4j-nifi-plc4x-processors</artifactId>
<version>0.4.0-SNAPSHOT</version>
</dependency>
<!-- PLC4X -->
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/pom.xml b/plc4j/integrations/apache-nifi/nifi-plc4x-processors/pom.xml
similarity index 92%
rename from integrations/apache-nifi/nifi-plc4x-processors/pom.xml
rename to plc4j/integrations/apache-nifi/nifi-plc4x-processors/pom.xml
index cc2f500..e21f1df 100644
--- a/integrations/apache-nifi/nifi-plc4x-processors/pom.xml
+++ b/plc4j/integrations/apache-nifi/nifi-plc4x-processors/pom.xml
@@ -18,13 +18,13 @@
<parent>
<groupId>org.apache.plc4x</groupId>
- <artifactId>apache-nifi</artifactId>
+ <artifactId>plc4j-apache-nifi</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>nifi-plc4x-processors</artifactId>
+ <artifactId>plc4j-nifi-plc4x-processors</artifactId>
- <name>Integrations: Apache Nifi: Processors</name>
+ <name>PLC4J: Integrations: Apache Nifi: Processors</name>
<dependencies>
<dependency>
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/BasePlc4xProcessor.java b/plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/BasePlc4xProcessor.java
similarity index 100%
rename from integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/BasePlc4xProcessor.java
rename to plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/BasePlc4xProcessor.java
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSinkProcessor.java b/plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSinkProcessor.java
similarity index 100%
rename from integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSinkProcessor.java
rename to plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSinkProcessor.java
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSourceProcessor.java b/plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSourceProcessor.java
similarity index 100%
rename from integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSourceProcessor.java
rename to plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSourceProcessor.java
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor b/plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
similarity index 100%
rename from integrations/apache-nifi/nifi-plc4x-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
rename to plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSinkProcessorTest.java b/plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSinkProcessorTest.java
similarity index 100%
rename from integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSinkProcessorTest.java
rename to plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSinkProcessorTest.java
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSourceProcessorTest.java b/plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSourceProcessorTest.java
similarity index 100%
rename from integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSourceProcessorTest.java
rename to plc4j/integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSourceProcessorTest.java
diff --git a/integrations/apache-nifi/pom.xml b/plc4j/integrations/apache-nifi/pom.xml
similarity index 96%
rename from integrations/apache-nifi/pom.xml
rename to plc4j/integrations/apache-nifi/pom.xml
index 096a1a2..4875900 100644
--- a/integrations/apache-nifi/pom.xml
+++ b/plc4j/integrations/apache-nifi/pom.xml
@@ -18,14 +18,14 @@
<parent>
<groupId>org.apache.plc4x</groupId>
- <artifactId>integrations</artifactId>
+ <artifactId>plc4j-integrations</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>apache-nifi</artifactId>
+ <artifactId>plc4j-apache-nifi</artifactId>
<packaging>pom</packaging>
- <name>Integrations: Apache Nifi</name>
+ <name>PLC4J: Integrations: Apache Nifi</name>
<description>Integration module for integrating PLC4X into Apache Nifi.</description>
<properties>
diff --git a/integrations/apache-karaf/karaf-s7-feature/pom.xml b/plc4j/integrations/pom.xml
similarity index 53%
rename from integrations/apache-karaf/karaf-s7-feature/pom.xml
rename to plc4j/integrations/pom.xml
index 47f3ad2..3df6cdd 100644
--- a/integrations/apache-karaf/karaf-s7-feature/pom.xml
+++ b/plc4j/integrations/pom.xml
@@ -8,7 +8,7 @@
"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
+ 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
@@ -16,37 +16,29 @@
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">
-<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>
- <artifactId>apache-karaf</artifactId>
<groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>karaf-s7-feature</artifactId>
- <packaging>feature</packaging>
-
- <name>Integrations: Apache Karaf: S7</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.plc4x</groupId>
- <artifactId>plc4j-driver-s7</artifactId>
- <version>0.4.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.karaf.tooling</groupId>
- <artifactId>karaf-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
+ <artifactId>plc4j-integrations</artifactId>
+ <packaging>pom</packaging>
+
+ <name>PLC4J: Integrations</name>
+ <description>Parent of all product specific integration modules.</description>
+
+ <modules>
+ <module>apache-camel</module>
+ <module>apache-edgent</module>
+ <module>apache-kafka</module>
+ <module>apache-nifi</module>
+ <module>apache-karaf</module>
+ <module>apache-calcite</module>
+ </modules>
</project>
\ No newline at end of file
diff --git a/plc4j/pom.xml b/plc4j/pom.xml
index 9458652..a99925e 100644
--- a/plc4j/pom.xml
+++ b/plc4j/pom.xml
@@ -38,6 +38,302 @@
<module>drivers</module>
<module>protocols</module>
<module>utils</module>
+
+ <module>examples</module>
+ <module>integrations</module>
</modules>
+ <build>
+ <plugins>
+
+ <!-- Compile any groovy code located in "src/test/groovy" -->
+ <plugin>
+ <groupId>org.codehaus.gmavenplus</groupId>
+ <artifactId>gmavenplus-plugin</artifactId>
+ <version>1.6.2</version>
+ <executions>
+ <execution>
+ <id>compile-groovy-tests</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>addTestSources</goal>
+ <goal>compileTests</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--
+ This plugin doesn't really do much, it makes sure the jacoco agent
+ is downloaded and that the path to this is saved in an environment
+ variable so we can access this later on in the build.
+ -->
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <executions>
+ <!--
+ Prepares the property pointing to the JaCoCo runtime agent which
+ is passed as VM argument when Maven the Surefire plugin is executed.
+ -->
+ <execution>
+ <id>pre-unit-test</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <configuration>
+ <!--
+ Sets the name of the property containing the settings
+ for JaCoCo runtime agent.
+ -->
+ <propertyName>surefireArgLine</propertyName>
+ </configuration>
+ </execution>
+ <!--
+ Prepares the property pointing to the JaCoCo runtime agent which
+ is passed as VM argument when Maven the Failsafe plugin is executed.
+ -->
+ <execution>
+ <id>pre-integration-test</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>prepare-agent-integration</goal>
+ </goals>
+ <configuration>
+ <!--
+ Sets the name of the property containing the settings
+ for JaCoCo runtime agent.
+ -->
+ <propertyName>failsafeArgLine</propertyName>
+ </configuration>
+ </execution>
+ <!--
+ Check if the unit-test-coverage is at least a certain minimum.
+ -->
+ <execution>
+ <id>check-coverage</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <configuration>
+ <!-- TODO: Turn this on as soon as possible. -->
+ <haltOnFailure>false</haltOnFailure>
+ <rules>
+ <rule implementation="org.jacoco.maven.RuleConfiguration">
+ <element>BUNDLE</element>
+ <limits>
+ <!-- Fail the build if the instruction level coverage is below 80%. -->
+ <limit implementation="org.jacoco.report.check.Limit">
+ <counter>INSTRUCTION</counter>
+ <value>COVEREDRATIO</value>
+ <minimum>0.50</minimum>
+ </limit>
+ <!-- Fail the build if there are classes without any coverage. -->
+ <limit implementation="org.jacoco.report.check.Limit">
+ <counter>CLASS</counter>
+ <value>MISSEDCOUNT</value>
+ <maximum>0</maximum>
+ </limit>
+ </limits>
+ </rule>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--
+ Make the surefire execute all unit-tests
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!--
+ We have to slightly increase the heap-size or some tests will fail.
+ Notice the @ instead of the $ as prefix? That's late evaluation.
+ -->
+ <argLine>-Xmx256m @{surefireArgLine}</argLine>
+ <includes>
+ <include>**/*Test.java</include>
+ <include>**/*Tests.java</include>
+ <include>**/*Spec.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+
+ <!--
+ Generate an OSGI compatible MANIFEST file.
+ -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundle-manifest</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--
+ Use the MANIFEST file generated by the maven-bundle-plugin.
+ -->
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <!--
+ Make the failsafe execute all integration-tests
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <!--
+ Notice the @ instead of the $ as prefix? That's late evaluation.
+ -->
+ <argLine>@{failsafeArgLine}</argLine>
+ </configuration>
+ </plugin>
+
+ <!--
+ Even if Maven transitively pulls in dependencies, relying on these can
+ quite often cause hard to find problems. So it's a good practice to make
+ sure everything directly required is also directly added as a dependency.
+ On the other side adding unused dependency only over-complicates the
+ the dependency graph, so the maven-dependency-plugin checks we depend on
+ what we need and only that and that runtime dependencies are correctly
+ imported with runtime scope.
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>check-dependencies</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>analyze-only</goal>
+ </goals>
+ <configuration>
+ <failOnWarning>true</failOnWarning>
+ <ignoredDependencies>
+ <ignoredDependency>org.assertj:assertj-core</ignoredDependency>
+ <ignoredDependency>junit:junit</ignoredDependency>
+ <ignoredDependency>org.junit.jupiter:junit-jupiter-api</ignoredDependency>
+ <ignoredDependency>org.junit.jupiter:junit-jupiter-params</ignoredDependency>
+ <ignoredDependency>org.junit.jupiter:junit-jupiter-engine</ignoredDependency>
+ <ignoredDependency>org.junit.vintage:junit-vintage-engine</ignoredDependency>
+ <ignoredDependency>org.hamcrest:hamcrest-core</ignoredDependency>
+ <ignoredDependency>org.hamcrest:hamcrest-library</ignoredDependency>
+ <ignoredDependency>org.mockito:mockito-core</ignoredDependency>
+ <ignoredDependency>org.mockito:mockito-junit-jupiter</ignoredDependency>
+ <ignoredDependency>org.slf4j:slf4j-api</ignoredDependency>
+ <ignoredDependency>ch.qos.logback:logback-classic</ignoredDependency>
+ <ignoredDependency>org.codehaus.groovy:groovy-test-junit5</ignoredDependency>
+ <ignoredDependency>org.codehaus.groovy:groovy</ignoredDependency>
+ <ignoredDependency>com.athaydes:spock-reports</ignoredDependency>
+ </ignoredDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- Dependencies common to all java modules -->
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- JUnit 4 Support -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- JUnit 5 Support -->
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-params</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-test-junit5</artifactId>
+ <version>2.5.3</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
</project>
\ No newline at end of file
diff --git a/plc4j/protocols/delta-v/pom.xml b/plc4j/protocols/delta-v/pom.xml
index f3ddfca..a06ded5 100644
--- a/plc4j/protocols/delta-v/pom.xml
+++ b/plc4j/protocols/delta-v/pom.xml
@@ -67,6 +67,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.elasticsearch</groupId>
+ <artifactId>elasticsearch-x-content</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>transport-netty4-client</artifactId>
<scope>test</scope>
@@ -82,6 +87,16 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <configuration>
+ <usedDependencies>
+ <usedDependency>org.pcap4j:pcap4j-packetfactory-static</usedDependency>
+ <usedDependency>de.dentrassi.elasticsearch:log4j2-mock</usedDependency>
+ </usedDependencies>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
diff --git a/plc4j/src/site/asciidoc/users/gettingstarted.adoc b/plc4j/src/site/asciidoc/users/gettingstarted.adoc
new file mode 100644
index 0000000..c2a692d
--- /dev/null
+++ b/plc4j/src/site/asciidoc/users/gettingstarted.adoc
@@ -0,0 +1,178 @@
+//
+// 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.
+//
+
+== Getting Started
+
+=== Using the PLC4X API directly
+
+In order to write a valid PLC4X Java application, all you need, is to add a dependency to the `api module`.
+When using Maven, all you need to do is add this dependency:
+
+[subs=attributes+]
+----
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-api</artifactId>
+ <version>{project-version}</version>
+ </dependency>
+----
+
+This will allow you to write a valid application, that compiles fine.
+However in order to actually connect to a device using a given protocol, you need to add this protocol implementation to the classpath.
+
+For example in order to communicate with an `S7 device` using the `S7 Protocol`, you would need to add the following dependency:
+
+[subs=attributes+]
+----
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-driver-s7</artifactId>
+ <version>{project-version}</version>
+ <scope>runtime</scope>
+ </dependency>
+----
+
+So as soon as your project has the API and a driver implementation available, you first need to get a `PlcConnection` instance.
+This is done via the `PlcDriverManager` by asking this to create an instance for a given `PLC4X connection string`.
+
+----
+String connectionString = "s7://10.10.64.20/1/1";
+
+try (PlcConnection plcConnection = new PlcDriverManager().getConnection(connectionString)) {
+
+ ... do something with the connection here ...
+
+}
+----
+
+PLC4X generally supports a very limited set of functions, which is not due to the fact, that we didn't implement things, but that PLCs generally support a very limited set of functions.
+
+The basic functions supported by PLCs and therefore supported by PLC4X are:
+
+* Read data
+* Write data
+* Subscribe for data
+* Execute functions in the PLC
+* List resources in the PLC
+
+In general we will try to offer as many features as possible.
+So if a protocol doesn't support subscription based communication it is our goal to simulate this by polling in the background so it is transparent for the users.
+
+But there are some cases in which we can't simulate or features are simply disabled intentionally:
+
+* If a PLC and/or protocol don't support executing of functions, we simply can't provide this functionality.
+* We will be providing stripped down versions of drivers, that for example intentionally don't support any writing of data and executing of functions.
+
+Therefore we use metadata to check programmatically, if a given feature is available:
+
+----
+// Check if this connection support reading of data.
+if (!plcConnection.getMetadata().canRead()) {
+ logger.error("This connection doesn't support reading.");
+ return;
+}
+----
+
+As soon as you have ensured that a feature is available, you are ready to build a first request.
+This is done by getting a `PlcRequestBuilder`:
+
+----
+// Create a new read request:
+// - Give the single item requested the alias name "value"
+PlcReadRequest.Builder builder = plcConnection.readRequestBuilder();
+builder.addItem("value-1", "%Q0.4:BOOL");
+builder.addItem("value-2", "%Q0:BYTE");
+builder.addItem("value-3", "%I0.2:BOOL");
+builder.addItem("value-4", "%DB.DB1.4:INT");
+PlcReadRequest readRequest = builder.build();
+----
+
+
+So, as you can see, you prepare a request, by adding items to the request and in the end by calling the `build` method.
+
+The request is sent to the PLC by issuing the `execute` method on the request object:
+
+----
+CompletableFuture<? extends PlcReadResponse> asyncResponse = readRequest.execute();
+asyncResponse.whenComplete((response, throwable) -> {
+ ... process the response ...
+});
+----
+
+In general all requests are executed asynchronously.
+So as soon as the request is fully processed, the callback gets called and will contain a `readResponse`, if everything went right or a `throwable` if there were problems.
+
+However if you want to write your code in a more synchronous fashion, the following alternative will provide this:
+
+----
+PlcReadResponse response = readRequest.execute().get();
+----
+
+Processing of the responses is identical in both cases.
+The following example will demonstrate some of the options you have:
+
+----
+for (String fieldName : response.getFieldNames()) {
+ if(response.getResponseCode(fieldName) == PlcResponseCode.OK) {
+ int numValues = response.getNumberOfValues(fieldName);
+ // If it's just one element, output just one single line.
+ if(numValues == 1) {
+ logger.info("Value[" + fieldName + "]: " + response.getObject(fieldName));
+ }
+ // If it's more than one element, output each in a single row.
+ else {
+ logger.info("Value[" + fieldName + "]:");
+ for(int i = 0; i < numValues; i++) {
+ logger.info(" - " + response.getObject(fieldName, i));
+ }
+ }
+ }
+ // Something went wrong, to output an error message instead.
+ else {
+ logger.error("Error[" + fieldName + "]: " + response.getResponseCode(fieldName).name());
+ }
+}
+----
+
+In the for loop, we are demonstrating how the user can iterate over the address aliases in the response.
+In case of an ordinary read request, this will be predefined by the items in the request, however in case of a subscription response, the response might only contain some of the items that were subscribed.
+
+Before accessing the data, it is advisable to check if an item was correctly returned.
+This is done by the `getResponseCode` method for a given alias.
+If this is `PlcResponseCode.OK`, everything is ok, however it could be one of the following:
+
+- NOT_FOUND
+- ACCESS_DENIED
+- INVALID_ADDRESS
+- INVALID_DATATYPE
+- INTERNAL_ERROR
+- RESPONSE_PENDING
+
+Assuming the return code was `OK`, we can continue accessing the data.
+
+As some addresses support reading arrays, with the method `getNumberOfValues` the user can check how many items of a given type are returned.
+For convenience the response object has single-argument methods for accessing the data, which default to returning the first element.
+
+ response.getObject(fieldName)
+
+If you want to access a given element number, please use the two-argument version instead:
+
+ response.getObject(fieldName, 42)
+
+PLC4X provides getters and setters for a wide variety of Java types and automatically handles the type conversion.
+However when for example trying to get a long-value as a byte and the long-value exceeds the range supported by the smaller type, a `RuntimeException` of type `PlcIncompatibleDatatypeException`.
+In order to avoid causing this exception to be thrown, however there are `isValid{TypeName}` methods that you can use to check if the value is compatible.
diff --git a/plc4net/.gitignore b/plc4net/.gitignore
new file mode 100644
index 0000000..912bc0a
--- /dev/null
+++ b/plc4net/.gitignore
@@ -0,0 +1,344 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- Backup*.rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
\ No newline at end of file
diff --git a/plc4net/api/PlcDriverManager.cs b/plc4net/api/PlcDriverManager.cs
new file mode 100644
index 0000000..7597e3a
--- /dev/null
+++ b/plc4net/api/PlcDriverManager.cs
@@ -0,0 +1,104 @@
+/*
+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.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using org.apache.plc4net.api;
+using org.apache.plc4net.api.authentication;
+using org.apache.plc4net.exceptions;
+
+namespace org.apache.plc4net
+{
+ /// <summary>
+ /// Manages connections to PLCs
+ /// </summary>
+ public class PlcDriverManager
+ {
+ /// <summary>
+ /// Singleton instance of the manager
+ /// </summary>
+ private static PlcDriverManager _instance;
+
+ /// <summary>
+ /// Get the singleton instance
+ /// </summary>
+ public static PlcDriverManager Instance => _instance ?? (_instance = new PlcDriverManager());
+
+ /// <summary>
+ /// Dictionary for the drivers
+ /// </summary>
+ private readonly Dictionary<string, IPlcDriver> _drivers;
+
+ /// <summary>
+ /// Private constructor for the singleton driver manager.
+ /// </summary>
+ private PlcDriverManager()
+ {
+ _drivers = new Dictionary<string, IPlcDriver>();
+
+ /*
+ * TODO: Implement some mechanism to provide drivers -> MEF?
+ */
+ }
+
+ /// <summary>
+ /// Get the connection to the a PLC identified by the URL
+ /// </summary>
+ /// <param name="url">URL including the schema to connect to the PLC</param>
+ /// <param name="authentication">Authentication to use</param>
+ /// <returns>Created PLC connection</returns>
+ public async Task<IPlcConnection> GetConnection(string url, IPlcAuthentication authentication)
+ {
+ var plcDriver = GetDriver(url);
+ var connection = await plcDriver.ConnectAsync(url, authentication);
+
+ //TODO: Does the driver method already connect or is a separate connect needed?
+ //TODO: Should we do it like this?
+ if (!connection.IsConnected)
+ {
+ await connection.ConnectAsync();
+ }
+
+ return connection;
+ }
+
+ public IPlcDriver GetDriver(string url)
+ {
+ try
+ {
+ Uri plcUri = new Uri(url);
+ var proto = plcUri.Scheme;
+
+ _drivers.TryGetValue(proto, out var plcDriver);
+
+ if (plcDriver == null)
+ {
+ throw new PlcConnectionException($"Unknown driver for protocol '{proto}'");
+ }
+
+ return plcDriver;
+ }
+ catch (UriFormatException invalidUriException)
+ {
+ throw new PlcConnectionException($"Provided connection string '{url}' is invalid", invalidUriException);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/plc4cpp/utils/CMakeLists.txt b/plc4net/api/api.csproj
similarity index 76%
copy from plc4cpp/utils/CMakeLists.txt
copy to plc4net/api/api.csproj
index be2e8f8..eb00812 100644
--- a/plc4cpp/utils/CMakeLists.txt
+++ b/plc4net/api/api.csproj
@@ -1,4 +1,5 @@
-#[[
+<?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
@@ -15,8 +16,12 @@
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-]]
+-->
+<Project Sdk="Microsoft.NET.Sdk">
-add_subdirectory(logger)
-add_subdirectory(systemconfig)
+ <PropertyGroup>
+ <TargetFramework>netstandard2.0</TargetFramework>
+ <RootNamespace>org.apache.plc4net</RootNamespace>
+ </PropertyGroup>
+</Project>
diff --git a/plc4net/api/api/IPlcConnection.cs b/plc4net/api/api/IPlcConnection.cs
new file mode 100644
index 0000000..cc22990
--- /dev/null
+++ b/plc4net/api/api/IPlcConnection.cs
@@ -0,0 +1,89 @@
+/*
+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.
+*/
+
+using System;
+using System.Threading.Tasks;
+using org.apache.plc4net.api.metadata;
+using org.apache.plc4net.messages;
+using org.apache.plc4net.model;
+
+namespace org.apache.plc4net.api
+{
+ /// <summary>
+ /// Interface for generalized PLC connections providing
+ /// functionality for basic operations like connect / disconnect etc.
+ /// </summary>
+ public interface IPlcConnection: IDisposable
+ {
+ /// <summary>
+ /// Connect to the PLC asynchronously
+ /// </summary>
+ /// <returns>Awaitable task</returns>
+ /// <exception cref="org.apache.plc4net.exceptions.PlcConnectionException">Thrown if the connection to the PLC fails</exception>
+ Task ConnectAsync();
+
+ /// <summary>
+ /// Indicates the connection state
+ /// </summary>
+ bool IsConnected { get; }
+
+ /// <summary>
+ /// Close the PLC connection asynchronously
+ /// </summary>
+ /// <returns>Awaitable task</returns>
+ Task CloseAsync();
+
+ /// <summary>
+ /// Get the metadata for the connection
+ /// </summary>
+ IPlcConnectionMetadata PlcConnectionMetadata { get; }
+
+ /// <summary>
+ /// Parse the given field query
+ /// </summary>
+ /// <param name="fieldQuery">Query for the field</param>
+ /// <returns>Field parsed from the query string</returns>
+ /// <exception cref="org.apache.plc4net.exceptions.PlcInvalidFieldException">Thrown when the query can not be parsed</exception>
+ IPlcField Parse(string fieldQuery);
+
+ /// <summary>
+ /// Request builder for constructing read requests
+ /// </summary>
+ /// <returns>null if the connection does not support reading</returns>
+ IPlcReadRequestBuilder ReadRequestBuilder { get; }
+
+ /// <summary>
+ /// Request builder for constructing write requests
+ /// </summary>
+ /// <returns>null if the connection does not support writing</returns>
+ IPlcWriteRequestBuilder WriteRequestBuilder { get; }
+
+ /// <summary>
+ /// Request builder for constructing subscription requests
+ /// </summary>
+ /// <returns>null if the connection does not support subscriptions</returns>
+ IPlcSubscriptionRequestBuilder SubscriptionRequestBuilder { get; }
+
+ /// <summary>
+ /// Request builder for unsubscribing
+ /// </summary>
+ /// <returns>null if the connection does not support subscriptions</returns>
+ IPlcUnsubscriptionRequestBuilder UnsubscriptionRequestBuilder { get; }
+ }
+}
\ No newline at end of file
diff --git a/plc4net/api/api/IPlcDriver.cs b/plc4net/api/api/IPlcDriver.cs
new file mode 100644
index 0000000..40aff40
--- /dev/null
+++ b/plc4net/api/api/IPlcDriver.cs
@@ -0,0 +1,57 @@
+/*
+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.
+*/
+
+using System.Threading.Tasks;
+using org.apache.plc4net.api.authentication;
+
+namespace org.apache.plc4net.api
+{
+ /// <summary>
+ /// Interface for PLC drivers to be implemented
+ /// </summary>
+ public interface IPlcDriver
+ {
+ /// <summary>
+ /// Get the code of the implemented protocol
+ /// </summary>
+ string ProtocolCode { get; }
+
+ /// <summary>
+ /// Full Name of the implemented protocol
+ /// </summary>
+ string ProtocolName { get; }
+
+ /// <summary>
+ /// Connects to the PLC identified by the connection string
+ /// </summary>
+ /// <param name="connectionString">Connection string identifying the PLC to connect to</param>
+ /// <returns>Awaitable task returning the <see cref="IPlcConnection"/> to which the connection was established</returns>
+ /// <exception cref="org.apache.plc4net.exceptions.PlcConnectionException">Thrown on connection failure</exception>
+ Task<IPlcConnection> ConnectAsync(string connectionString);
+
+ /// <summary>
+ /// Connects to the PLC identified by the connection string and using the
+ /// </summary>
+ /// <param name="connectionString"></param>
+ /// <param name="authentication"></param>
+ /// <returns>Awaitable task returning the <see cref="IPlcConnection"/> to which the connection was established</returns>
+ /// <exception cref="org.apache.plc4net.exceptions.PlcConnectionException">Thrown on connection failure</exception>
+ Task<IPlcConnection> ConnectAsync(string connectionString, IPlcAuthentication authentication);
+ }
+}
\ No newline at end of file
diff --git a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java b/plc4net/api/api/authentication/IPlcAuthentication.cs
similarity index 77%
copy from integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
copy to plc4net/api/api/authentication/IPlcAuthentication.cs
index c01a1e7..4a94403 100644
--- a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
+++ b/plc4net/api/api/authentication/IPlcAuthentication.cs
@@ -16,10 +16,14 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-/**
- * Apache Edgent connector to plc4x.
- *
- * The conneector enables creating Apache Edgent topology's
- * that source and sink data from and to plc4x devices respectively.
- */
-package org.apache.plc4x.edgent;
\ No newline at end of file
+
+namespace org.apache.plc4net.api.authentication
+{
+ /// <summary>
+ /// Base interface for possible authentication methods
+ /// used by the PLCs
+ /// </summary>
+ public interface IPlcAuthentication
+ {
+ }
+}
\ No newline at end of file
diff --git a/plc4net/api/api/authentication/PlcUsernamePasswordAuthentication.cs b/plc4net/api/api/authentication/PlcUsernamePasswordAuthentication.cs
new file mode 100644
index 0000000..2c7f52c
--- /dev/null
+++ b/plc4net/api/api/authentication/PlcUsernamePasswordAuthentication.cs
@@ -0,0 +1,48 @@
+/*
+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.
+*/
+
+namespace org.apache.plc4net.api.authentication
+{
+ /// <summary>
+ /// Authentication using Username and Password
+ /// </summary>
+ public class PlcUsernamePasswordAuthentication : IPlcAuthentication
+ {
+ /// <summary>
+ /// Create a new instance using username and password
+ /// </summary>
+ /// <param name="username">Username to set</param>
+ /// <param name="password">Password to set</param>
+ public PlcUsernamePasswordAuthentication(string username, string password)
+ {
+ Username = username;
+ Password = password;
+ }
+
+ /// <summary>
+ /// Username
+ /// </summary>
+ public string Username { get; protected set; }
+
+ /// <summary>
+ /// Password
+ /// </summary>
+ public string Password { get; protected set; }
+ }
+}
\ No newline at end of file
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java b/plc4net/api/api/metadata/IPlcConnectionMetadata.cs
similarity index 58%
copy from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
copy to plc4net/api/api/metadata/IPlcConnectionMetadata.cs
index b13c074..7504c91 100644
--- a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
+++ b/plc4net/api/api/metadata/IPlcConnectionMetadata.cs
@@ -16,22 +16,24 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-import org.junit.Test;
+namespace org.apache.plc4net.api.metadata
+{
+ public interface IPlcConnectionMetadata
+ {
+ /// <summary>
+ /// Indicates that the connection is able to read from the PLC
+ /// </summary>
+ bool CanRead { get; }
-import java.lang.reflect.Constructor;
+ /// <summary>
+ /// Indicates that the connection is able to write to the PLC
+ /// </summary>
+ bool CanWrite { get; }
-public class ConstantsTest {
-
- @Test(expected = IllegalStateException.class)
- public void testConstantsNotInstanceable() throws Throwable {
- try {
- Constructor<Constants> constructor = Constants.class.getDeclaredConstructor();
- constructor.setAccessible(true);
- constructor.newInstance();
- } catch (Exception e) {
- throw e.getCause();
- }
+ /// <summary>
+ /// Indicates that the connection is able to subscribe to PLC data
+ /// </summary>
+ bool CanSubscribe { get; }
}
}
\ No newline at end of file
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java b/plc4net/api/exceptions/PlcConnectionException.cs
similarity index 53%
copy from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
copy to plc4net/api/exceptions/PlcConnectionException.cs
index b13c074..bc6af44 100644
--- a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
+++ b/plc4net/api/exceptions/PlcConnectionException.cs
@@ -16,22 +16,35 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-import org.junit.Test;
+using System;
+using System.Runtime.Serialization;
-import java.lang.reflect.Constructor;
+namespace org.apache.plc4net.exceptions
+{
+ /// <summary>
+ /// Exception raised when the connection to a
+ /// PLC fails
+ /// </summary>
+ [Serializable]
+ public class PlcConnectionException : PlcException
+ {
+ public PlcConnectionException()
+ {
+ }
+
+ public PlcConnectionException(string message) : base(message)
+ {
+ }
-public class ConstantsTest {
+ public PlcConnectionException(string message, Exception inner) : base(message, inner)
+ {
+ }
- @Test(expected = IllegalStateException.class)
- public void testConstantsNotInstanceable() throws Throwable {
- try {
- Constructor<Constants> constructor = Constants.class.getDeclaredConstructor();
- constructor.setAccessible(true);
- constructor.newInstance();
- } catch (Exception e) {
- throw e.getCause();
+ protected PlcConnectionException(
+ SerializationInfo info,
+ StreamingContext context) : base(info, context)
+ {
}
}
}
\ No newline at end of file
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java b/plc4net/api/exceptions/PlcException.cs
similarity index 53%
copy from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
copy to plc4net/api/exceptions/PlcException.cs
index b13c074..6345854 100644
--- a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
+++ b/plc4net/api/exceptions/PlcException.cs
@@ -16,22 +16,35 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-import org.junit.Test;
+using System;
+using System.Runtime.Serialization;
-import java.lang.reflect.Constructor;
+namespace org.apache.plc4net.exceptions
+{
+ /// <summary>
+ /// General exception that gets thrown when errors while communicating
+ /// with PLC
+ /// </summary>
+ [Serializable]
+ public class PlcException : Exception
+ {
+ public PlcException()
+ {
+ }
+
+ public PlcException(string message) : base(message)
+ {
+ }
-public class ConstantsTest {
+ public PlcException(string message, Exception inner) : base(message, inner)
+ {
+ }
- @Test(expected = IllegalStateException.class)
- public void testConstantsNotInstanceable() throws Throwable {
- try {
- Constructor<Constants> constructor = Constants.class.getDeclaredConstructor();
- constructor.setAccessible(true);
- constructor.newInstance();
- } catch (Exception e) {
- throw e.getCause();
+ protected PlcException(
+ SerializationInfo info,
+ StreamingContext context) : base(info, context)
+ {
}
- }
+ }
}
\ No newline at end of file
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java b/plc4net/api/exceptions/PlcInvalidFieldException.cs
similarity index 56%
copy from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
copy to plc4net/api/exceptions/PlcInvalidFieldException.cs
index b13c074..b3c4aa9 100644
--- a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
+++ b/plc4net/api/exceptions/PlcInvalidFieldException.cs
@@ -16,22 +16,31 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-import org.junit.Test;
+using System;
+using System.Runtime.Serialization;
-import java.lang.reflect.Constructor;
+namespace org.apache.plc4net.exceptions
+{
+ [Serializable]
+ public class PlcInvalidFieldException : PlcException
+ {
+ public PlcInvalidFieldException()
+ {
+ }
+
+ public PlcInvalidFieldException(string message) : base(message)
+ {
+ }
-public class ConstantsTest {
+ public PlcInvalidFieldException(string message, Exception inner) : base(message, inner)
+ {
+ }
- @Test(expected = IllegalStateException.class)
- public void testConstantsNotInstanceable() throws Throwable {
- try {
- Constructor<Constants> constructor = Constants.class.getDeclaredConstructor();
- constructor.setAccessible(true);
- constructor.newInstance();
- } catch (Exception e) {
- throw e.getCause();
+ protected PlcInvalidFieldException(
+ SerializationInfo info,
+ StreamingContext context) : base(info, context)
+ {
}
}
}
\ No newline at end of file
diff --git a/plc4net/api/messages/IPlcFieldRequest.cs b/plc4net/api/messages/IPlcFieldRequest.cs
new file mode 100644
index 0000000..d66b9b1
--- /dev/null
+++ b/plc4net/api/messages/IPlcFieldRequest.cs
@@ -0,0 +1,52 @@
+/*
+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.
+*/
+
+using System.Collections.Generic;
+using org.apache.plc4net.model;
+
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Request for certain fields inside the PLC
+ /// </summary>
+ public interface IPlcFieldRequest: IPlcRequest
+ {
+ /// <summary>
+ /// Number of fields in the request
+ /// </summary>
+ int FieldCount { get; }
+
+ /// <summary>
+ /// Enumeration of field names
+ /// </summary>
+ IEnumerable<string> FieldNames { get; }
+
+ /// <summary>
+ /// Get a field inside the request by its name
+ /// </summary>
+ /// <param name="name">Name of the PLC field to return</param>
+ /// <returns></returns>
+ IPlcField GetFieldByName(string name);
+
+ /// <summary>
+ /// Returns all fields inside the request
+ /// </summary>
+ IEnumerable<IPlcField> Fields { get; }
+ }
+}
\ No newline at end of file
diff --git a/plc4net/api/messages/IPlcFieldResponse.cs b/plc4net/api/messages/IPlcFieldResponse.cs
new file mode 100644
index 0000000..b418ad8
--- /dev/null
+++ b/plc4net/api/messages/IPlcFieldResponse.cs
@@ -0,0 +1,49 @@
+/*
+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.
+*/
+
+using System.Collections.Generic;
+using org.apache.plc4net.model;
+using org.apache.plc4net.types;
+
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Interface for responses to requests realted to
+ /// a specific PLC field
+ /// </summary>
+ public interface IPlcFieldResponse: IPlcResponse
+ {
+ /// <summary>
+ /// Enumeration of fields in the response
+ /// </summary>
+ IEnumerable<string> FieldNames { get; }
+
+ /// <summary>
+ /// Get a field by name
+ /// </summary>
+ /// <param name="name">Name of the field to retrieve</param>
+ /// <returns>Field with the given name</returns>
+ IPlcField GetFieldByName(string name);
+
+ /// <summary>
+ /// Get the response code from the PLC
+ /// </summary>
+ PlcResponseCode ResponseCode { get; }
+ }
+}
\ No newline at end of file
diff --git a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java b/plc4net/api/messages/IPlcMessage.cs
similarity index 78%
copy from integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
copy to plc4net/api/messages/IPlcMessage.cs
index c01a1e7..e7af221 100644
--- a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
+++ b/plc4net/api/messages/IPlcMessage.cs
@@ -16,10 +16,14 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-/**
- * Apache Edgent connector to plc4x.
- *
- * The conneector enables creating Apache Edgent topology's
- * that source and sink data from and to plc4x devices respectively.
- */
-package org.apache.plc4x.edgent;
\ No newline at end of file
+
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Base interface for PLC messages
+ /// </summary>
+ public interface IPlcMessage
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java b/plc4net/api/messages/IPlcReadRequest.cs
similarity index 78%
copy from integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
copy to plc4net/api/messages/IPlcReadRequest.cs
index c01a1e7..17182ca 100644
--- a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
+++ b/plc4net/api/messages/IPlcReadRequest.cs
@@ -16,10 +16,14 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-/**
- * Apache Edgent connector to plc4x.
- *
- * The conneector enables creating Apache Edgent topology's
- * that source and sink data from and to plc4x devices respectively.
- */
-package org.apache.plc4x.edgent;
\ No newline at end of file
+
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Interface for requests reading data from a PLC
+ /// </summary>
+ public interface IPlcReadRequest: IPlcRequest
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java b/plc4net/api/messages/IPlcReadRequestBuilder.cs
similarity index 56%
copy from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
copy to plc4net/api/messages/IPlcReadRequestBuilder.cs
index b13c074..79ff783 100644
--- a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
+++ b/plc4net/api/messages/IPlcReadRequestBuilder.cs
@@ -16,22 +16,20 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-import org.junit.Test;
-
-import java.lang.reflect.Constructor;
-
-public class ConstantsTest {
-
- @Test(expected = IllegalStateException.class)
- public void testConstantsNotInstanceable() throws Throwable {
- try {
- Constructor<Constants> constructor = Constants.class.getDeclaredConstructor();
- constructor.setAccessible(true);
- constructor.newInstance();
- } catch (Exception e) {
- throw e.getCause();
- }
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Builds requests for reading values from a PLC
+ /// </summary>
+ public interface IPlcReadRequestBuilder: IPlcRequestBuilder<IPlcReadRequest>
+ {
+ /// <summary>
+ /// Add an item to the request
+ /// </summary>
+ /// <param name="name">Name of the field to add</param>
+ /// <param name="fieldQuery">Query string for the field parameter</param>
+ /// <returns>Request builder to allow fluent API calls</returns>
+ IPlcReadRequestBuilder AddItem(string name, string fieldQuery);
}
}
\ No newline at end of file
diff --git a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java b/plc4net/api/messages/IPlcReadResponse.cs
similarity index 78%
copy from integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
copy to plc4net/api/messages/IPlcReadResponse.cs
index c01a1e7..66fc79b 100644
--- a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
+++ b/plc4net/api/messages/IPlcReadResponse.cs
@@ -16,10 +16,14 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-/**
- * Apache Edgent connector to plc4x.
- *
- * The conneector enables creating Apache Edgent topology's
- * that source and sink data from and to plc4x devices respectively.
- */
-package org.apache.plc4x.edgent;
\ No newline at end of file
+
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Response for read requests <see cref="IPlcReadRequest"/>
+ /// </summary>
+ public interface IPlcReadResponse : IPlcResponse
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java b/plc4net/api/messages/IPlcRequest.cs
similarity index 62%
copy from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
copy to plc4net/api/messages/IPlcRequest.cs
index eefde57..174d506 100644
--- a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
+++ b/plc4net/api/messages/IPlcRequest.cs
@@ -16,14 +16,21 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-public class Constants {
+using System.Threading.Tasks;
- public static final String FIELD_NAME_HEADER = "fieldName";
- public static final String FIELD_QUERY_HEADER = "fieldQuery";
-
- private Constants() {
- throw new IllegalStateException("Utility class!");
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Base interface for PLC requests that can be executed
+ /// and receive responses
+ /// </summary>
+ public interface IPlcRequest : IPlcMessage
+ {
+ /// <summary>
+ /// Execute the request asynchronously
+ /// </summary>
+ /// <returns>Awaitable task returning the response from the PLC</returns>
+ Task<IPlcResponse> ExecuteAsync();
}
-}
+}
\ No newline at end of file
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java b/plc4net/api/messages/IPlcRequestBuilder.cs
similarity index 61%
copy from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
copy to plc4net/api/messages/IPlcRequestBuilder.cs
index eefde57..44e25d9 100644
--- a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
+++ b/plc4net/api/messages/IPlcRequestBuilder.cs
@@ -16,14 +16,19 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-public class Constants {
-
- public static final String FIELD_NAME_HEADER = "fieldName";
- public static final String FIELD_QUERY_HEADER = "fieldQuery";
-
- private Constants() {
- throw new IllegalStateException("Utility class!");
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Base interface for request builders
+ /// </summary>
+ /// <typeparam name="TRequest">Type of request returned when building the request</typeparam>
+ public interface IPlcRequestBuilder<out TRequest> where TRequest : IPlcRequest
+ {
+ /// <summary>
+ /// Builds the defined request
+ /// </summary>
+ /// <returns>Request built from the definition</returns>
+ TRequest Build();
}
-}
+}
\ No newline at end of file
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java b/plc4net/api/messages/IPlcResponse.cs
similarity index 70%
copy from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
copy to plc4net/api/messages/IPlcResponse.cs
index eefde57..616a380 100644
--- a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
+++ b/plc4net/api/messages/IPlcResponse.cs
@@ -16,14 +16,18 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-public class Constants {
-
- public static final String FIELD_NAME_HEADER = "fieldName";
- public static final String FIELD_QUERY_HEADER = "fieldQuery";
-
- private Constants() {
- throw new IllegalStateException("Utility class!");
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Interface for responses received from
+ /// PLCs
+ /// </summary>
+ public interface IPlcResponse: IPlcMessage
+ {
+ /// <summary>
+ /// Get the request that generated the response
+ /// </summary>
+ IPlcRequest Request { get; }
}
-}
+}
\ No newline at end of file
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java b/plc4net/api/messages/IPlcSubscriptionEventArgs.cs
similarity index 68%
copy from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
copy to plc4net/api/messages/IPlcSubscriptionEventArgs.cs
index eefde57..0b7c447 100644
--- a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
+++ b/plc4net/api/messages/IPlcSubscriptionEventArgs.cs
@@ -16,14 +16,20 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-public class Constants {
+using System;
- public static final String FIELD_NAME_HEADER = "fieldName";
- public static final String FIELD_QUERY_HEADER = "fieldQuery";
-
- private Constants() {
- throw new IllegalStateException("Utility class!");
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Base interface for event data associated with
+ /// subscription events
+ /// </summary>
+ public interface IPlcSubscriptionEventArgs
+ {
+ /// <summary>
+ /// Timestamp of the event that occured
+ /// </summary>
+ DateTime Timestamp { get; }
}
-}
+}
\ No newline at end of file
diff --git a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java b/plc4net/api/messages/IPlcSubscriptionRequest.cs
similarity index 77%
copy from integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
copy to plc4net/api/messages/IPlcSubscriptionRequest.cs
index c01a1e7..7fcaf3b 100644
--- a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
+++ b/plc4net/api/messages/IPlcSubscriptionRequest.cs
@@ -16,10 +16,14 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-/**
- * Apache Edgent connector to plc4x.
- *
- * The conneector enables creating Apache Edgent topology's
- * that source and sink data from and to plc4x devices respectively.
- */
-package org.apache.plc4x.edgent;
\ No newline at end of file
+
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Interface for requests to subscribe to value changes
+ /// </summary>
+ public interface IPlcSubscriptionRequest: IPlcFieldRequest
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/plc4net/api/messages/IPlcSubscriptionRequestBuilder.cs b/plc4net/api/messages/IPlcSubscriptionRequestBuilder.cs
new file mode 100644
index 0000000..773f8ed
--- /dev/null
+++ b/plc4net/api/messages/IPlcSubscriptionRequestBuilder.cs
@@ -0,0 +1,54 @@
+/*
+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.
+*/
+
+using System;
+
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Interface for classes building requests for subscriptions
+ /// </summary>
+ public interface IPlcSubscriptionRequestBuilder: IPlcRequestBuilder<IPlcSubscriptionRequest>
+ {
+ /// <summary>
+ /// Add a field that gets polled cyclically
+ /// </summary>
+ /// <param name="name">Alias for the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <param name="pollingInterval">Time Interval at which the field should be polled</param>
+ /// <returns>Builder instance for Fluid API requests</returns>
+ IPlcSubscriptionRequestBuilder AddCyclicField(string name, string fieldQuery, TimeSpan pollingInterval);
+
+ /// <summary>
+ /// Add a field that sends an update when its value is changed
+ /// </summary>
+ /// <param name="name">Alias for the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <returns>Builder instance for Fluid API requests</returns>
+ IPlcSubscriptionRequestBuilder AddChangeOfStateField(string name, string fieldQuery);
+
+ /// <summary>
+ /// Add a field that sends an update when an event occurs
+ /// </summary>
+ /// <param name="name">Alias for the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <returns>Builder instance for Fluid API requests</returns>
+ IPlcSubscriptionRequestBuilder AddEventField(string name, string fieldQuery);
+ }
+}
\ No newline at end of file
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java b/plc4net/api/messages/IPlcSubscriptionResponse.cs
similarity index 51%
rename from integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
rename to plc4net/api/messages/IPlcSubscriptionResponse.cs
index b13c074..25e0fcd 100644
--- a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ConstantsTest.java
+++ b/plc4net/api/messages/IPlcSubscriptionResponse.cs
@@ -16,22 +16,27 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-import org.junit.Test;
+using System.Collections.Generic;
+using org.apache.plc4net.model;
-import java.lang.reflect.Constructor;
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Response to a <see cref="IPlcSubscriptionRequest"/>
+ /// </summary>
+ public interface IPlcSubscriptionResponse: IPlcFieldResponse
+ {
+ /// <summary>
+ /// Get the handle for the subscription with the given name
+ /// </summary>
+ /// <param name="name">Name of the subscription</param>
+ /// <returns>Subscription handle</returns>
+ IPlcSubscriptionHandle GetSubscriptionHandle(string name);
-public class ConstantsTest {
-
- @Test(expected = IllegalStateException.class)
- public void testConstantsNotInstanceable() throws Throwable {
- try {
- Constructor<Constants> constructor = Constants.class.getDeclaredConstructor();
- constructor.setAccessible(true);
- constructor.newInstance();
- } catch (Exception e) {
- throw e.getCause();
- }
+ /// <summary>
+ /// Get all subscription handles
+ /// </summary>
+ IEnumerable<IPlcSubscriptionHandle> SubscriptionHandles { get; }
}
}
\ No newline at end of file
diff --git a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java b/plc4net/api/messages/IPlcUnsubscriptionRequest.cs
similarity index 78%
copy from integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
copy to plc4net/api/messages/IPlcUnsubscriptionRequest.cs
index c01a1e7..0d0bd1f 100644
--- a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
+++ b/plc4net/api/messages/IPlcUnsubscriptionRequest.cs
@@ -16,10 +16,14 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-/**
- * Apache Edgent connector to plc4x.
- *
- * The conneector enables creating Apache Edgent topology's
- * that source and sink data from and to plc4x devices respectively.
- */
-package org.apache.plc4x.edgent;
\ No newline at end of file
+
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Request for releasing a subscription
+ /// </summary>
+ public interface IPlcUnsubscriptionRequest: IPlcRequest
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/plc4net/api/messages/IPlcUnsubscriptionRequestBuilder.cs b/plc4net/api/messages/IPlcUnsubscriptionRequestBuilder.cs
new file mode 100644
index 0000000..a5752f8
--- /dev/null
+++ b/plc4net/api/messages/IPlcUnsubscriptionRequestBuilder.cs
@@ -0,0 +1,45 @@
+/*
+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.
+*/
+
+using System.Collections.Generic;
+using org.apache.plc4net.model;
+
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Constructs requests for unsubscribing from PLC fields
+ /// </summary>
+ public interface IPlcUnsubscriptionRequestBuilder:
+ IPlcRequestBuilder<IPlcUnsubscriptionRequest>
+ {
+ /// <summary>
+ /// Add the given handles to the unsubscription request
+ /// </summary>
+ /// <param name="subscriptionHandles">Handles to unsubscribe</param>
+ /// <returns>Builder for chaining requests as Fluid API</returns>
+ IPlcUnsubscriptionRequestBuilder AddHandles(params IPlcSubscriptionHandle[] subscriptionHandles);
+
+ /// <summary>
+ /// Add the given handles to the unsubscription request
+ /// </summary>
+ /// <param name="subscriptionHandles">Handles to unsubscribe</param>
+ /// <returns>Builder for chaining requests as Fluid API</returns>
+ IPlcUnsubscriptionRequestBuilder AddHandles(IEnumerable<IPlcSubscriptionHandle> subscriptionHandles);
+ }
+}
\ No newline at end of file
diff --git a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java b/plc4net/api/messages/IPlcUnsubscriptionResponse.cs
similarity index 77%
rename from integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
rename to plc4net/api/messages/IPlcUnsubscriptionResponse.cs
index c01a1e7..0b5e8f9 100644
--- a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/package-info.java
+++ b/plc4net/api/messages/IPlcUnsubscriptionResponse.cs
@@ -16,10 +16,14 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-/**
- * Apache Edgent connector to plc4x.
- *
- * The conneector enables creating Apache Edgent topology's
- * that source and sink data from and to plc4x devices respectively.
- */
-package org.apache.plc4x.edgent;
\ No newline at end of file
+
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Interface for requests to release a subscription
+ /// </summary>
+ public interface IPlcUnsubscriptionResponse: IPlcResponse
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java b/plc4net/api/messages/IPlcWriteRequest.cs
similarity index 71%
copy from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
copy to plc4net/api/messages/IPlcWriteRequest.cs
index eefde57..13e617a 100644
--- a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
+++ b/plc4net/api/messages/IPlcWriteRequest.cs
@@ -16,14 +16,17 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-public class Constants {
-
- public static final String FIELD_NAME_HEADER = "fieldName";
- public static final String FIELD_QUERY_HEADER = "fieldQuery";
-
- private Constants() {
- throw new IllegalStateException("Utility class!");
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Interface for writing values to PLCs
+ /// </summary>
+ public interface IPlcWriteRequest: IPlcRequest
+ {
+ /// <summary>
+ /// Number of values in the request
+ /// </summary>
+ int NumberOfValues { get; }
}
-}
+}
\ No newline at end of file
diff --git a/plc4net/api/messages/IPlcWriteRequestBuilder.cs b/plc4net/api/messages/IPlcWriteRequestBuilder.cs
new file mode 100644
index 0000000..4e24554
--- /dev/null
+++ b/plc4net/api/messages/IPlcWriteRequestBuilder.cs
@@ -0,0 +1,134 @@
+/*
+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.
+*/
+
+/*
+ * TODO: Decide if distinguishment between date, time and datetime are needed (see plc4j)
+ * TODO: Decide if implementation of byte[] and Byte[] as in plc4j are needed
+ * TODO: Check type compatibility between Java BigDecimal and Decimal
+ */
+
+using System;
+
+namespace org.apache.plc4net.messages
+{
+ /// <summary>
+ /// Interface for a builder that constructs write requests
+ /// </summary>
+ public interface IPlcWriteRequestBuilder: IPlcRequestBuilder<IPlcWriteRequest>
+ {
+ /// <summary>
+ /// Add item with bool value
+ /// </summary>
+ /// <param name="name">Identifying name of the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <param name="values">Values to set</param>
+ /// <returns>Own instance to allow Fluid API calls</returns>
+ IPlcWriteRequestBuilder AddItem(string name, string fieldQuery, params bool[] values);
+
+ /// <summary>
+ /// Add item with byte value
+ /// </summary>
+ /// <param name="name">Identifying name of the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <param name="values">Values to set</param>
+ /// <returns>Own instance to allow Fluid API calls</returns>
+ IPlcWriteRequestBuilder AddItem(string name, string fieldQuery, params byte[] values);
+
+ /// <summary>
+ /// Add item with short value
+ /// </summary>
+ /// <param name="name">Identifying name of the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <param name="values">Values to set</param>
+ /// <returns>Own instance to allow Fluid API calls</returns>
+ IPlcWriteRequestBuilder AddItem(string name, string fieldQuery, params short[] values);
+
+ /// <summary>
+ /// Add item with int value
+ /// </summary>
+ /// <param name="name">Identifying name of the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <param name="values">Values to set</param>
+ /// <returns>Own instance to allow Fluid API calls</returns>
+ IPlcWriteRequestBuilder AddItem(string name, string fieldQuery, params int[] values);
+
+ /// <summary>
+ /// Add item with long value
+ /// </summary>
+ /// <param name="name">Identifying name of the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <param name="values">Values to set</param>
+ /// <returns>Own instance to allow Fluid API calls</returns>
+ IPlcWriteRequestBuilder AddItem(string name, string fieldQuery, params long[] values);
+
+ /// <summary>
+ /// Add item with float value
+ /// </summary>
+ /// <param name="name">Identifying name of the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <param name="values">Values to set</param>
+ /// <returns>Own instance to allow Fluid API calls</returns>
+ IPlcWriteRequestBuilder AddItem(string name, string fieldQuery, params float[] values);
+
+ /// <summary>
+ /// Add item with double value
+ /// </summary>
+ /// <param name="name">Identifying name of the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <param name="values">Values to set</param>
+ /// <returns>Own instance to allow Fluid API calls</returns>
+ IPlcWriteRequestBuilder AddItem(string name, string fieldQuery, params double[] values);
+
+ /// <summary>
+ /// Add item with Decimal value
+ /// </summary>
+ /// <param name="name">Identifying name of the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <param name="values">Values to set</param>
+ /// <returns>Own instance to allow Fluid API calls</returns>
+ IPlcWriteRequestBuilder AddItem(string name, string fieldQuery, params Decimal[] values);
+
+ /// <summary>
+ /// Add item with string value
+ /// </summary>
+ /// <param name="name">Identifying name of the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <param name="values">Values to set</param>
+ /// <returns>Own instance to allow Fluid API calls</returns>
+ IPlcWriteRequestBuilder AddItem(string name, string fieldQuery, params string[] values);
+
+ /// <summary>
+ /// Add item with DateTime value
+ /// </summary>
+ /// <param name="name">Identifying name of the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <param name="values">Values to set</param>
+ /// <returns>Own instance to allow Fluid API calls</returns>
+ IPlcWriteRequestBuilder AddItem(string name, string fieldQuery, params DateTime[] values);
+
+ /// <summary>
+ /// Add item with value of generic type
+ /// </summary>
+ /// <param name="name">Identifying name of the field</param>
+ /// <param name="fieldQuery">Query string for the field</param>
+ /// <param name="values">Values to set</param>
+ /// <returns>Own instance to allow Fluid API calls</returns>
+ IPlcWriteRequestBuilder AddItem<T>(string name, string fieldQuery, params T[] values);
+ }
+}
\ No newline at end of file
diff --git a/plc4net/api/model/IPlcField.cs b/plc4net/api/model/IPlcField.cs
new file mode 100644
index 0000000..098baf3
--- /dev/null
+++ b/plc4net/api/model/IPlcField.cs
@@ -0,0 +1,39 @@
+/*
+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.
+*/
+
+
+namespace org.apache.plc4net.model
+{
+ /// <summary>
+ /// Base type for all field types.
+ /// Typically every driver provides an implementation of this interface in order
+ /// to be able to describe the fields of a resource.As this is completely tied to
+ /// the implemented protocol, this base interface makes absolutely no assumption to
+ /// any information it should provide.
+
+ /// In order to stay platform and protocol independent every driver connection implementation
+ /// provides a prepareField(String) method that is able to parse a string representation of
+ /// a resource into it's individual field type. Manually constructing PlcField objects
+ /// manually makes the solution less independent from the protocol, but might be faster.
+ /// </summary>
+ public interface IPlcField
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java b/plc4net/api/model/IPlcSubscriptionHandle.cs
similarity index 65%
copy from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
copy to plc4net/api/model/IPlcSubscriptionHandle.cs
index eefde57..c2c1d54 100644
--- a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
+++ b/plc4net/api/model/IPlcSubscriptionHandle.cs
@@ -16,14 +16,20 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-public class Constants {
+using System;
+using org.apache.plc4net.messages;
- public static final String FIELD_NAME_HEADER = "fieldName";
- public static final String FIELD_QUERY_HEADER = "fieldQuery";
-
- private Constants() {
- throw new IllegalStateException("Utility class!");
+namespace org.apache.plc4net.model
+{
+ /// <summary>
+ /// Handle to a subscription
+ /// </summary>
+ public interface IPlcSubscriptionHandle
+ {
+ /// <summary>
+ /// Event that can be subscribed to handle events raised by the subscription
+ /// </summary>
+ event EventHandler<IPlcSubscriptionEventArgs> PlcSubscriptionEvent;
}
-}
+}
\ No newline at end of file
diff --git a/plc4cpp/pom.xml b/plc4net/api/pom.xml
similarity index 56%
copy from plc4cpp/pom.xml
copy to plc4net/api/pom.xml
index 789c209..b531d23 100644
--- a/plc4cpp/pom.xml
+++ b/plc4net/api/pom.xml
@@ -23,40 +23,46 @@
<parent>
<groupId>org.apache.plc4x</groupId>
- <artifactId>plc4x-parent</artifactId>
+ <artifactId>plc4net</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>plc4cpp</artifactId>
+ <artifactId>plc4net-api</artifactId>
<packaging>pom</packaging>
- <name>PLC4Cpp</name>
- <description>Implementation of the protocol adapters for usage as C++ library.</description>
+ <name>PLC4Net: API</name>
+ <description>Implementation of the protocol adapters for usage as .Net module.</description>
- <!-- Disabled for now as C++ support is currently not installed in Apache SonarQube -->
+ <!-- Disabled for now as C# support is currently not installed in Apache SonarQube -->
<!--properties>
- <sonar.language>c++</sonar.language>
+ <sonar.language>c#</sonar.language>
</properties-->
- <modules>
- <module>api</module>
- <module>protocols</module>
- <module>utils</module>
-
- <!-- Third party libs -->
- <module>libs</module>
- </modules>
-
<build>
<plugins>
- <!-- Prevent the jar plugin from building a jar -->
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.6.0</version>
<executions>
<execution>
- <id>default-jar</id>
- <phase/>
+ <id>dotnet-build</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>dotnet</executable>
+ <workingDirectory>${project.basedir}</workingDirectory>
+ <arguments>
+ <argument>build</argument>
+ <argument>api.csproj</argument>
+ <argument>--configuration=Debug</argument>
+ <argument>--framework=netstandard2.0</argument>
+ <argument>--output=${project.build.directory}/build</argument>
+ <argument>-p:Version=${project.version}</argument>
+ </arguments>
+ </configuration>
</execution>
</executions>
</plugin>
diff --git a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java b/plc4net/api/types/PlcResponseCode.cs
similarity index 72%
rename from integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
rename to plc4net/api/types/PlcResponseCode.cs
index eefde57..7b9d0f8 100644
--- a/integrations/apache-camel/src/main/java/org/apache/plc4x/camel/Constants.java
+++ b/plc4net/api/types/PlcResponseCode.cs
@@ -16,14 +16,20 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
-package org.apache.plc4x.camel;
-public class Constants {
-
- public static final String FIELD_NAME_HEADER = "fieldName";
- public static final String FIELD_QUERY_HEADER = "fieldQuery";
-
- private Constants() {
- throw new IllegalStateException("Utility class!");
+namespace org.apache.plc4net.types
+{
+ /// <summary>
+ /// Possible responses
+ /// </summary>
+ public enum PlcResponseCode
+ {
+ Ok,
+ NotFound,
+ AccessDenied,
+ InvalidAddress,
+ InvalidDatatype,
+ InternalError,
+ ResponsePending
}
-}
+}
\ No newline at end of file
diff --git a/integrations/apache-nifi/nifi-plc4x-nar/false-positives.xml b/plc4net/plc4net.driver/plc4net.driver.csproj
similarity index 70%
rename from integrations/apache-nifi/nifi-plc4x-nar/false-positives.xml
rename to plc4net/plc4net.driver/plc4net.driver.csproj
index 0f9c316..e54dfc4 100644
--- a/integrations/apache-nifi/nifi-plc4x-nar/false-positives.xml
+++ b/plc4net/plc4net.driver/plc4net.driver.csproj
@@ -16,12 +16,14 @@
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
- -->
-<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.2.xsd">
- <suppress>
- <notes><![CDATA[
- The plugin is detecting our nifi-plc4x-processors module as really old NIFI artifact and reporting it as vulnerable.
- ]]></notes>
- <cpe>cpe:/a:apache:nifi</cpe>
- </suppress>
-</suppressions>
+-->
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>netstandard2.0</TargetFramework>
+ <BaseOutputPath>target/classes</BaseOutputPath>
+ <BaseIntermediateOutputPath>target/classes-intermediate</BaseIntermediateOutputPath>
+ <RestoreOutputPath>target/restore-output-path</RestoreOutputPath>
+ </PropertyGroup>
+
+</Project>
diff --git a/plc4cpp/pom.xml b/plc4net/plc4net.driver/pom.xml
similarity index 62%
copy from plc4cpp/pom.xml
copy to plc4net/plc4net.driver/pom.xml
index 789c209..4be89de 100644
--- a/plc4cpp/pom.xml
+++ b/plc4net/plc4net.driver/pom.xml
@@ -23,40 +23,42 @@
<parent>
<groupId>org.apache.plc4x</groupId>
- <artifactId>plc4x-parent</artifactId>
+ <artifactId>plc4net</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>plc4cpp</artifactId>
+ <artifactId>plc4net-driver</artifactId>
<packaging>pom</packaging>
- <name>PLC4Cpp</name>
- <description>Implementation of the protocol adapters for usage as C++ library.</description>
+ <name>PLC4Net: Driver</name>
+ <description>Implementation of the protocol adapters for usage as .Net module.</description>
- <!-- Disabled for now as C++ support is currently not installed in Apache SonarQube -->
+ <!-- Disabled for now as C# support is currently not installed in Apache SonarQube -->
<!--properties>
- <sonar.language>c++</sonar.language>
+ <sonar.language>c#</sonar.language>
</properties-->
- <modules>
- <module>api</module>
- <module>protocols</module>
- <module>utils</module>
-
- <!-- Third party libs -->
- <module>libs</module>
- </modules>
-
<build>
<plugins>
- <!-- Prevent the jar plugin from building a jar -->
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.6.0</version>
<executions>
<execution>
- <id>default-jar</id>
- <phase/>
+ <id>dotnet-build</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>dotnet</executable>
+ <workingDirectory>${project.basedir}</workingDirectory>
+ <arguments>
+ <argument>build</argument>
+ <argument>plc4net.driver.csproj</argument>
+ </arguments>
+ </configuration>
</execution>
</executions>
</plugin>
diff --git a/plc4net/plc4net.sln b/plc4net/plc4net.sln
new file mode 100644
index 0000000..a872a2d
--- /dev/null
+++ b/plc4net/plc4net.sln
@@ -0,0 +1,44 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+
+#
+# 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.
+#
+
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28803.156
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "api", "plc4net\plc4net.csproj", "{343770DC-ECE5-4131-9066-A09C120BB3D9}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {343770DC-ECE5-4131-9066-A09C120BB3D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {343770DC-ECE5-4131-9066-A09C120BB3D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {343770DC-ECE5-4131-9066-A09C120BB3D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {343770DC-ECE5-4131-9066-A09C120BB3D9}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {DCB0DDB3-E6AA-4801-844E-5C71EB50CB1B}
+ EndGlobalSection
+EndGlobal
diff --git a/plc4cpp/pom.xml b/plc4net/pom.xml
similarity index 65%
copy from plc4cpp/pom.xml
copy to plc4net/pom.xml
index 789c209..2b0123f 100644
--- a/plc4cpp/pom.xml
+++ b/plc4net/pom.xml
@@ -27,40 +27,20 @@
<version>0.4.0-SNAPSHOT</version>
</parent>
- <artifactId>plc4cpp</artifactId>
+ <artifactId>plc4net</artifactId>
<packaging>pom</packaging>
- <name>PLC4Cpp</name>
- <description>Implementation of the protocol adapters for usage as C++ library.</description>
+ <name>PLC4Net</name>
+ <description>Implementation of the protocol adapters for usage as .Net module.</description>
- <!-- Disabled for now as C++ support is currently not installed in Apache SonarQube -->
+ <!-- Disabled for now as C# support is currently not installed in Apache SonarQube -->
<!--properties>
- <sonar.language>c++</sonar.language>
+ <sonar.language>c#</sonar.language>
</properties-->
<modules>
<module>api</module>
- <module>protocols</module>
- <module>utils</module>
-
- <!-- Third party libs -->
- <module>libs</module>
+ <!--module>plc4net.driver</module-->
</modules>
- <build>
- <plugins>
- <!-- Prevent the jar plugin from building a jar -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>default-jar</id>
- <phase/>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
</project>
\ No newline at end of file
diff --git a/plc4py/pom.xml b/plc4py/pom.xml
index 82fc4b4..661acc7 100644
--- a/plc4py/pom.xml
+++ b/plc4py/pom.xml
@@ -158,9 +158,9 @@
</goals>
<configuration>
<executable>python</executable>
- <workingDirectory>${project.basedir}</workingDirectory>
+ <workingDirectory>${project.build.directory}/python</workingDirectory>
<arguments>
- <argument>setup.py</argument>
+ <argument>../../setup.py</argument>
<argument>build</argument>
<argument>--build-base=${project.build.directory}/python</argument>
</arguments>
diff --git a/plc4py/src/main/python/org/apache/plc4x/PlcDriverManager.py b/plc4py/src/main/python/org/apache/plc4x/PlcDriverManager.py
index 8f98e63..aa68418 100644
--- a/plc4py/src/main/python/org/apache/plc4x/PlcDriverManager.py
+++ b/plc4py/src/main/python/org/apache/plc4x/PlcDriverManager.py
@@ -18,6 +18,7 @@
import subprocess
import time
import warnings
+
from generated.org.apache.plc4x.interop.InteropServer import Client, PlcException
from thrift.protocol import TBinaryProtocol
from thrift.transport import TSocket, TTransport
diff --git a/plc4py/src/test/python/org/apache/plc4x/test_PlcDriverManager.py b/plc4py/src/test/python/org/apache/plc4x/test_PlcDriverManager.py
index 63d4e0d..0373565 100644
--- a/plc4py/src/test/python/org/apache/plc4x/test_PlcDriverManager.py
+++ b/plc4py/src/test/python/org/apache/plc4x/test_PlcDriverManager.py
@@ -17,10 +17,11 @@
import time
import unittest
-from generated.org.apache.plc4x.interop.InteropServer import Request, PlcException
from subprocess import Popen
from unittest import TestCase
+from generated.org.apache.plc4x.interop.InteropServer import Request, PlcException
+
from org.apache.plc4x.PlcDriverManager import PlcDriverManager
if __name__ == '__main__':
diff --git a/pom.xml b/pom.xml
index 6b68eff..937e35f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -166,19 +166,6 @@
<!-- Definition of the protocol message formats -->
<module>protocols</module>
- <!-- Core PLC4X modules -->
- <!--module>plc4cpp</module-->
- <module>plc4j</module>
-
- <!-- Python language binding-->
- <module>plc4py</module>
-
- <!-- Integration modules for other frameworks -->
- <module>integrations</module>
-
- <!-- Examples -->
- <module>examples</module>
-
<!-- Tools needed throughout the build -->
<module>tools</module>
</modules>
@@ -711,6 +698,7 @@
<exclude>**/.project</exclude>
<exclude>**/.settings/**</exclude>
<exclude>**/.classpath</exclude>
+ <exclude>**/.factorypath</exclude>
<!-- IntelliJ related files -->
<exclude>**/.idea/**</exclude>
@@ -737,6 +725,9 @@
<!-- CLion stuff (C++ IDE) -->
<exclude>**/cmake-build-debug/**</exclude>
+ <!-- Stuff created during a plc4net build -->
+ <exclude>**/obj/**</exclude>
+
<!-- Temporarily exclude generated code from thrift in python modules -->
<exclude>generated/**</exclude>
@@ -772,23 +763,6 @@
</executions>
</plugin>
- <!-- Compile any groovy code located in "src/test/groovy" -->
- <plugin>
- <groupId>org.codehaus.gmavenplus</groupId>
- <artifactId>gmavenplus-plugin</artifactId>
- <version>1.6.2</version>
- <executions>
- <execution>
- <id>compile-groovy-tests</id>
- <phase>test-compile</phase>
- <goals>
- <goal>addTestSources</goal>
- <goal>compileTests</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
<!--
===================================
== ==
@@ -1037,6 +1011,7 @@
<attributes>
<source-highlighter>prettify</source-highlighter>
<imagesoutdir>${project.build.directory}/site/images</imagesoutdir>
+ <project-version>${project.version}</project-version>
</attributes>
<requires>
<require>asciidoctor-diagram</require>
@@ -1245,6 +1220,23 @@
</modules>
</profile>
+ <!-- Build PLC4X including the Java modules -->
+ <profile>
+ <id>with-java</id>
+ <modules>
+ <module>plc4j</module>
+ </modules>
+ </profile>
+
+ <!-- Build PLC4X including the .Net modules -->
+ <profile>
+ <id>with-dotnet</id>
+ <modules>
+ <module>plc4net</module>
+ </modules>
+ </profile>
+
+ <!-- Build PLC4X including the Python modules -->
<profile>
<id>with-python</id>
<modules>
@@ -1252,7 +1244,7 @@
</modules>
</profile>
- <!-- Build PLC4X including the CPP modules -->
+ <!-- Build PLC4X including the Sandbox modules -->
<profile>
<id>with-sandbox</id>
<modules>
@@ -1260,6 +1252,11 @@
</modules>
</profile>
+ <!-- Profile, which is used in sub-modules to enable Thrift related proxy modules -->
+ <profile>
+ <id>with-proxies</id>
+ </profile>
+
<!-- Profile for linux -->
<profile>
<id>unix</id>
@@ -1360,27 +1357,6 @@
-->
<profile>
<id>jenkins-build</id>
- <properties>
- </properties>
- <build>
- <plugins>
- <!--TODO Remove this after fix for NVE CVS-->
- <plugin>
- <groupId>org.owasp</groupId>
- <artifactId>dependency-check-maven</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <failBuildOnCVSS>8</failBuildOnCVSS>
- </configuration>
- </plugin>
- </plugins>
- </build>
</profile>
<!--
@@ -1434,294 +1410,6 @@
</build>
</profile>
- <!--
- This profile has java-specific plugin configurations
- that might not apply to other languages.
- -->
- <profile>
- <id>java-module</id>
- <activation>
- <file>
- <exists>src/main/java</exists>
- </file>
- </activation>
-
- <!-- Dependencies common to all java modules -->
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>test</scope>
- </dependency>
-
- <!-- JUnit 4 Support -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- JUnit 5 Support -->
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-core</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-junit-jupiter</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-test-junit5</artifactId>
- <version>2.5.3</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <!--
- Even if Maven transitively pulls in dependencies, relying on these can
- quite often cause hard to find problems. So it's a good practice to make
- sure everything directly required is also directly added as a dependency.
- On the other side adding unused dependency only over-complicates the
- the dependency graph, so the maven-dependency-plugin checks we depend on
- what we need and only that and that runtime dependencies are correctly
- imported with runtime scope.
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>check-dependencies</id>
- <phase>verify</phase>
- <goals>
- <goal>analyze-only</goal>
- </goals>
- <configuration>
- <failOnWarning>true</failOnWarning>
- <ignoredDependencies>
- <ignoredDependency>org.assertj:assertj-core</ignoredDependency>
- <ignoredDependency>junit:junit</ignoredDependency>
- <ignoredDependency>org.junit.jupiter:junit-jupiter-api</ignoredDependency>
- <ignoredDependency>org.junit.jupiter:junit-jupiter-params</ignoredDependency>
- <ignoredDependency>org.junit.jupiter:junit-jupiter-engine</ignoredDependency>
- <ignoredDependency>org.junit.vintage:junit-vintage-engine</ignoredDependency>
- <ignoredDependency>org.hamcrest:hamcrest-core</ignoredDependency>
- <ignoredDependency>org.hamcrest:hamcrest-library</ignoredDependency>
- <ignoredDependency>org.mockito:mockito-core</ignoredDependency>
- <ignoredDependency>org.mockito:mockito-junit-jupiter</ignoredDependency>
- <ignoredDependency>org.slf4j:slf4j-api</ignoredDependency>
- <ignoredDependency>ch.qos.logback:logback-classic</ignoredDependency>
- <ignoredDependency>org.codehaus.groovy:groovy-test-junit5</ignoredDependency>
- <ignoredDependency>org.codehaus.groovy:groovy</ignoredDependency>
- <ignoredDependency>com.athaydes:spock-reports</ignoredDependency>
- </ignoredDependencies>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <!--
- This plugin doesn't really do much, it makes sure the jacoco agent
- is downloaded and that the path to this is saved in an environment
- variable so we can access this later on in the build.
- -->
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <executions>
- <!--
- Prepares the property pointing to the JaCoCo runtime agent which
- is passed as VM argument when Maven the Surefire plugin is executed.
- -->
- <execution>
- <id>pre-unit-test</id>
- <phase>generate-test-sources</phase>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- <configuration>
- <!--
- Sets the name of the property containing the settings
- for JaCoCo runtime agent.
- -->
- <propertyName>surefireArgLine</propertyName>
- </configuration>
- </execution>
- <!--
- Prepares the property pointing to the JaCoCo runtime agent which
- is passed as VM argument when Maven the Failsafe plugin is executed.
- -->
- <execution>
- <id>pre-integration-test</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>prepare-agent-integration</goal>
- </goals>
- <configuration>
- <!--
- Sets the name of the property containing the settings
- for JaCoCo runtime agent.
- -->
- <propertyName>failsafeArgLine</propertyName>
- </configuration>
- </execution>
- <!--
- Check if the unit-test-coverage is at least a certain minimum.
- -->
- <execution>
- <id>check-coverage</id>
- <phase>verify</phase>
- <goals>
- <goal>check</goal>
- </goals>
- <configuration>
- <!-- TODO: Turn this on as soon as possible. -->
- <haltOnFailure>false</haltOnFailure>
- <rules>
- <rule implementation="org.jacoco.maven.RuleConfiguration">
- <element>BUNDLE</element>
- <limits>
- <!-- Fail the build if the instruction level coverage is below 80%. -->
- <limit implementation="org.jacoco.report.check.Limit">
- <counter>INSTRUCTION</counter>
- <value>COVEREDRATIO</value>
- <minimum>0.50</minimum>
- </limit>
- <!-- Fail the build if there are classes without any coverage. -->
- <limit implementation="org.jacoco.report.check.Limit">
- <counter>CLASS</counter>
- <value>MISSEDCOUNT</value>
- <maximum>0</maximum>
- </limit>
- </limits>
- </rule>
- </rules>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <!--
- Make the surefire execute all unit-tests
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!--
- We have to slightly increase the heap-size or some tests will fail.
- Notice the @ instead of the $ as prefix? That's late evaluation.
- -->
- <argLine>-Xmx256m @{surefireArgLine}</argLine>
- <includes>
- <include>**/*Test.java</include>
- <include>**/*Tests.java</include>
- <include>**/*Spec.java</include>
- </includes>
- </configuration>
- </plugin>
-
- <!--
- Generate an OSGI compatible MANIFEST file.
- -->
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <executions>
- <execution>
- <id>bundle-manifest</id>
- <phase>process-classes</phase>
- <goals>
- <goal>manifest</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <!--
- Use the MANIFEST file generated by the maven-bundle-plugin.
- -->
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
- </plugin>
-
- <!--
- Make the failsafe execute all integration-tests
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <!--
- Notice the @ instead of the $ as prefix? That's late evaluation.
- -->
- <argLine>@{failsafeArgLine}</argLine>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
<profile>
<id>with-jqassistant</id>
<build>
diff --git a/src/site/asciidoc/developers/conferences.adoc b/src/site/asciidoc/developers/conferences.adoc
index cf7ce62..299d95b 100644
--- a/src/site/asciidoc/developers/conferences.adoc
+++ b/src/site/asciidoc/developers/conferences.adoc
@@ -36,6 +36,7 @@ On this page we are listing options to attend talks and events around PLC4X.
|4th June 2018 |Cologne (GER) |Conference |https://www.buildingiot.de/[Building IoT] |https://www.buildingiot.de/veranstaltung-6815-industrial-iot-und-edge-computing-mit-apache-plc4x-und-apache-edgent-%5Bsponsored-talk%5D.html?id=6815[Industrial IoT und Edge Computing mit Apache PLC4X und Apache Edgent]
|5th April 2018 |Hamburg (GER) |Conference |https://techcamp.hamburg/[TechCamp Hamburg] |https://techcamp.hamburg/events/revolutionizing-industrial-iot-with-apache-plc4x/[Revolutionizing Industrial IoT with Apache PLC4X]
|21th January 2018 |Hamburg (GER) |Conference |https://www.nortec-hamburg.de/[Nortec] |Mehr für Weniger? Aber Sicher!
+|4th-5th May 2019 |Brussels (BE) |Hackathon |https://eufossahackathon.bemyapp.com[EU FOSSA Apache Hackathon] | Co-creating the future of open source
|=========================================================
Looking forward to meeting you.
@@ -44,4 +45,4 @@ If you've got or found any events or talks we might be missing, please inform us
== Additional Material
-PLC4X [Banner](../images/PLC4X_rollup_83x237cm-final.pdf)
+link:/images/PLC4X_rollup_83x237cm-final.pdf[PLC4X Banner]
diff --git a/src/site/asciidoc/users/gettingstarted.adoc b/src/site/asciidoc/users/gettingstarted.adoc
index c975484..6de1c67 100644
--- a/src/site/asciidoc/users/gettingstarted.adoc
+++ b/src/site/asciidoc/users/gettingstarted.adoc
@@ -17,5 +17,8 @@
== Getting Started
+Depending on the programming language, the usage will differ, therefore please go to the `Getting Started` version of the language of choice.
+=== Java
+For guides on how to write PLC4X applications with Java, please go to the link:../plc4j/users/gettingstarted.html[Java Getting Started]
\ No newline at end of file
diff --git a/tools/thrift/src/assembly/python.xml b/tools/thrift/src/assembly/python.xml
index f1cd89f..40a8f08 100644
--- a/tools/thrift/src/assembly/python.xml
+++ b/tools/thrift/src/assembly/python.xml
@@ -44,6 +44,13 @@
<outputDirectory/>
</fileSet>
<fileSet>
+ <directory>${project.build.directory}/thrift-${thrift.version}/lib/py/build/lib.macosx-10.14-intel-2.7</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <outputDirectory/>
+ </fileSet>
+ <fileSet>
<directory>${project.build.directory}/thrift-${thrift.version}/lib/py/build/lib.win-amd64-2.7</directory>
<includes>
<include>**</include>