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 2018/09/28 21:22:37 UTC
[incubator-plc4x] branch master updated: Added first Apache NIFI
support
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
The following commit(s) were added to refs/heads/master by this push:
new 4a78fad Added first Apache NIFI support
4a78fad is described below
commit 4a78fad3014ce0628dde0801b6c71a46258c5208
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Fri Sep 28 17:22:32 2018 -0400
Added first Apache NIFI support
---
integrations/apache-nifi/nifi-plc4x-nar/pom.xml | 79 ++++++++++++++
.../apache-nifi/nifi-plc4x-processors/pom.xml | 63 +++++++++++
.../org/apache/plc4x/nifi/BasePlc4xProcessor.java | 119 +++++++++++++++++++++
.../org/apache/plc4x/nifi/Plc4xSinkProcessor.java | 78 ++++++++++++++
.../apache/plc4x/nifi/Plc4xSourceProcessor.java | 80 ++++++++++++++
.../services/org.apache.nifi.processor.Processor | 17 +++
.../plc4x4nifi/Plc4xSinkProcessorTest.java | 40 +++++++
.../plc4x4nifi/Plc4xSourceProcessorTest.java | 42 ++++++++
integrations/apache-nifi/pom.xml | 91 ++++++++++++++++
integrations/pom.xml | 4 +-
pom.xml | 11 +-
src/site/asciidoc/index.adoc | 2 +-
12 files changed, 619 insertions(+), 7 deletions(-)
diff --git a/integrations/apache-nifi/nifi-plc4x-nar/pom.xml b/integrations/apache-nifi/nifi-plc4x-nar/pom.xml
new file mode 100644
index 0000000..05916a9
--- /dev/null
+++ b/integrations/apache-nifi/nifi-plc4x-nar/pom.xml
@@ -0,0 +1,79 @@
+<?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>apache-nifi</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>nifi-plc4x-nar</artifactId>
+ <packaging>nar</packaging>
+
+ <properties>
+ <maven.javadoc.skip>true</maven.javadoc.skip>
+ <source.skip>true</source.skip>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>nifi-plc4x-processors</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </dependency>
+ <!-- PLC4X -->
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-api</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-core</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </dependency>
+ <!-- Bundle Drivers -->
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-protocol-ads</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-protocol-ethernetip</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-protocol-modbus</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-protocol-s7</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-protocol-test</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/pom.xml b/integrations/apache-nifi/nifi-plc4x-processors/pom.xml
new file mode 100644
index 0000000..2eb5617
--- /dev/null
+++ b/integrations/apache-nifi/nifi-plc4x-processors/pom.xml
@@ -0,0 +1,63 @@
+<?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>apache-nifi</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>nifi-plc4x-processors</artifactId>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-api</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-core</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-utils</artifactId>
+ <version>1.7.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-mock</artifactId>
+ <version>1.7.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/BasePlc4xProcessor.java b/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/BasePlc4xProcessor.java
new file mode 100644
index 0000000..1f8cb85
--- /dev/null
+++ b/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/BasePlc4xProcessor.java
@@ -0,0 +1,119 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+package org.apache.plc4x.nifi;
+
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.PropertyValue;
+import org.apache.nifi.processor.AbstractProcessor;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessorInitializationContext;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.plc4x.java.PlcDriverManager;
+import org.apache.plc4x.java.api.connection.PlcConnection;
+import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
+
+import java.util.*;
+
+public abstract class BasePlc4xProcessor extends AbstractProcessor {
+
+ private static final PropertyDescriptor PLC_CONNECTION_STRING = new PropertyDescriptor
+ .Builder().name("PLC_CONNECTION_STRING")
+ .displayName("PLC connection String")
+ .description("PLC4X connection string used to connect to a given PLC device.")
+ .required(true)
+ .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+ .build();
+ private static final PropertyDescriptor PLC_ADDRESS_STRING = new PropertyDescriptor
+ .Builder().name("PLC_ADDRESS_STRING")
+ .displayName("PLC resource address String")
+ .description("PLC4X address string used identify the resource to read/write on a given PLC device " +
+ "(Multiple values supported). The expected format is: {name}={address}(;{name}={address})*")
+ .required(true)
+ .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+ .build();
+
+ static final Relationship SUCCESS = new Relationship.Builder()
+ .name("SUCCESS")
+ .description("Successfully converted incoming json file to EntitymakerJSON")
+ .build();
+ static final Relationship FAILURE = new Relationship.Builder()
+ .name("FAILURE")
+ .description("Successfully converted incoming json file to EntitymakerJSON")
+ .build();
+
+ private List<PropertyDescriptor> descriptors;
+
+ Set<Relationship> relationships;
+
+ private PlcConnection connection;
+
+ private Map<String, String> addressMap;
+
+ @Override
+ protected void init(final ProcessorInitializationContext context) {
+ this.descriptors = Arrays.asList(PLC_CONNECTION_STRING, PLC_ADDRESS_STRING);
+ this.relationships = new HashSet<>(Arrays.asList(SUCCESS, FAILURE));
+ }
+
+ PlcConnection getConnection() {
+ return connection;
+ }
+
+ Collection<String> getFields() {
+ return addressMap.keySet();
+ }
+ String getAddress(String field) {
+ return addressMap.get(field);
+ }
+
+ @Override
+ public Set<Relationship> getRelationships() {
+ return this.relationships;
+ }
+
+ @Override
+ public final List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+ return descriptors;
+ }
+
+ @OnScheduled
+ public void onScheduled(final ProcessContext context) {
+ PropertyValue property = context.getProperty(PLC_CONNECTION_STRING.getName());
+ if ((connection == null) || !connection.isConnected()) {
+ try {
+ connection = new PlcDriverManager().getConnection(property.getValue());
+ } catch (PlcConnectionException e) {
+ getLogger().error("Error connecting to " + property.getValue());
+ }
+ }
+
+ addressMap = new HashMap<>();
+ PropertyValue addresses = context.getProperty(PLC_ADDRESS_STRING.getName());
+ for (String segment : addresses.getValue().split(";")) {
+ String[] parts = segment.split("=");
+ if(parts.length != 2) {
+ throw new RuntimeException("Invalid address format");
+ }
+ addressMap.put(parts[0], parts[1]);
+ }
+ }
+
+}
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSinkProcessor.java b/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSinkProcessor.java
new file mode 100644
index 0000000..4c8721b
--- /dev/null
+++ b/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSinkProcessor.java
@@ -0,0 +1,78 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+package org.apache.plc4x.nifi;
+
+import org.apache.nifi.annotation.behavior.InputRequirement;
+import org.apache.nifi.annotation.behavior.ReadsAttribute;
+import org.apache.nifi.annotation.behavior.ReadsAttributes;
+import org.apache.nifi.annotation.behavior.TriggerSerially;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.plc4x.java.api.connection.PlcWriter;
+import org.apache.plc4x.java.api.messages.PlcWriteRequest;
+import org.apache.plc4x.java.api.messages.PlcWriteResponse;
+
+import java.util.concurrent.CompletableFuture;
+
+@TriggerSerially
+@Tags({"plc4x-sink"})
+@InputRequirement(InputRequirement.Requirement.INPUT_REQUIRED)
+@CapabilityDescription("Processor able to write data to industrial PLCs using Apache PLC4X")
+@ReadsAttributes({@ReadsAttribute(attribute="value", description="some value")})
+public class Plc4xSinkProcessor extends BasePlc4xProcessor {
+
+ @Override
+ public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
+ FlowFile flowFile = session.get();
+
+ // Abort if there's nothing to do.
+ if (flowFile == null) {
+ return;
+ }
+
+ // Get an instance of a component able to write to a PLC.
+ PlcWriter writer = getConnection().getWriter().orElseThrow(
+ () -> new ProcessException("Writing not supported by connection"));
+
+ // Prepare the request.
+ PlcWriteRequest.Builder builder = writer.writeRequestBuilder();
+ flowFile.getAttributes().forEach((field, value) -> {
+ String address = getAddress(field);
+ if(address != null) {
+ builder.addItem(field, address, value);
+ }
+ });
+ PlcWriteRequest writeRequest = builder.build();
+
+ // Send the request to the PLC.
+ CompletableFuture<PlcWriteResponse<?>> future = writer.write(writeRequest);
+ future.whenComplete((response, throwable) -> {
+ if (throwable != null) {
+ session.transfer(session.create(), FAILURE);
+ } else {
+ session.transfer(session.create(), SUCCESS);
+ }
+ });
+ }
+
+}
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSourceProcessor.java b/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSourceProcessor.java
new file mode 100644
index 0000000..d7a3b73
--- /dev/null
+++ b/integrations/apache-nifi/nifi-plc4x-processors/src/main/java/org/apache/plc4x/nifi/Plc4xSourceProcessor.java
@@ -0,0 +1,80 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+package org.apache.plc4x.nifi;
+
+import org.apache.nifi.annotation.behavior.InputRequirement;
+import org.apache.nifi.annotation.behavior.WritesAttribute;
+import org.apache.nifi.annotation.behavior.WritesAttributes;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.plc4x.java.api.connection.PlcReader;
+import org.apache.plc4x.java.api.messages.PlcReadRequest;
+import org.apache.plc4x.java.api.messages.PlcReadResponse;
+import org.json.simple.JSONObject;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.concurrent.ExecutionException;
+
+@Tags({"plc4x-source"})
+@InputRequirement(InputRequirement.Requirement.INPUT_FORBIDDEN)
+@CapabilityDescription("Processor able to read data from industrial PLCs using Apache PLC4X")
+@WritesAttributes({@WritesAttribute(attribute="value", description="some value")})
+public class Plc4xSourceProcessor extends BasePlc4xProcessor {
+
+ @Override
+ public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
+ // Get an instance of a component able to read from a PLC.
+ PlcReader reader = getConnection().getReader().orElseThrow(
+ () -> new ProcessException("Writing not supported by connection"));
+
+ // Prepare the request.
+ PlcReadRequest.Builder builder = reader.readRequestBuilder();
+ getFields().forEach(field -> {
+ String address = getAddress(field);
+ if(address != null) {
+ builder.addItem(field, address);
+ }
+ });
+ PlcReadRequest readRequest = builder.build();
+
+ FlowFile flowFile = session.create();
+ session.append(flowFile, out -> {
+ try {
+ PlcReadResponse<?> response = reader.read(readRequest).get();
+ JSONObject obj = new JSONObject();
+ for (String fieldName : response.getFieldNames()) {
+ for(int i = 0; i < response.getNumberOfValues(fieldName); i++) {
+ Object value = response.getObject(fieldName, i);
+ obj.put(fieldName, value);
+ }
+ }
+ obj.writeJSONString(new OutputStreamWriter(out));
+ } catch (InterruptedException | ExecutionException e) {
+ throw new IOException(e);
+ }
+ });
+ session.transfer(flowFile, SUCCESS);
+ }
+
+}
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor b/integrations/apache-nifi/nifi-plc4x-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
new file mode 100644
index 0000000..b614dd5
--- /dev/null
+++ b/integrations/apache-nifi/nifi-plc4x-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
@@ -0,0 +1,17 @@
+# 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.
+
+org.apache.plc4x.nifi.Plc4xSinkProcessor
+org.apache.plc4x.nifi.Plc4xSourceProcessor
\ No newline at end of file
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSinkProcessorTest.java b/integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSinkProcessorTest.java
new file mode 100644
index 0000000..25eecbc
--- /dev/null
+++ b/integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSinkProcessorTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.plc4x.processors.plc4x4nifi;
+
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.apache.plc4x.nifi.Plc4xSinkProcessor;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class Plc4xSinkProcessorTest {
+
+ private TestRunner testRunner;
+
+ @Before
+ public void init() {
+ testRunner = TestRunners.newTestRunner(Plc4xSinkProcessor.class);
+ }
+
+ @Test
+ public void testProcessor() {
+
+ }
+
+}
diff --git a/integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSourceProcessorTest.java b/integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSourceProcessorTest.java
new file mode 100644
index 0000000..06a7bda
--- /dev/null
+++ b/integrations/apache-nifi/nifi-plc4x-processors/src/test/java/org/apache/plc4x/processors/plc4x4nifi/Plc4xSourceProcessorTest.java
@@ -0,0 +1,42 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+package org.apache.plc4x.processors.plc4x4nifi;
+
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.apache.plc4x.nifi.Plc4xSourceProcessor;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class Plc4xSourceProcessorTest {
+
+ private TestRunner testRunner;
+
+ @Before
+ public void init() {
+ testRunner = TestRunners.newTestRunner(Plc4xSourceProcessor.class);
+ }
+
+ @Test
+ public void testProcessor() {
+
+ }
+
+}
diff --git a/integrations/apache-nifi/pom.xml b/integrations/apache-nifi/pom.xml
new file mode 100644
index 0000000..f393083
--- /dev/null
+++ b/integrations/apache-nifi/pom.xml
@@ -0,0 +1,91 @@
+<?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.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>apache-nifi</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Integrations: Apache Nifi</name>
+ <description>Integration module for integrating PLC4X into Apache Nifi.</description>
+
+ <modules>
+ <module>nifi-plc4x-processors</module>
+ <module>nifi-plc4x-nar</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <!-- Add the ability to create nar packages -->
+ <plugin>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-nar-maven-plugin</artifactId>
+ <version>1.2.0</version>
+ <extensions>true</extensions>
+ </plugin>
+ <!-- Makes buildRevision and buildBranch available to the NAR Plugin so they can be populated in the MANIFEST -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <inherited>true</inherited>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <doCheck>false</doCheck>
+ <doUpdate>false</doUpdate>
+ <shortRevisionLength>7</shortRevisionLength>
+ <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
+ <revisionOnScmFailure />
+ <buildNumberPropertyName>buildRevision</buildNumberPropertyName>
+ <scmBranchPropertyName>buildBranch</scmBranchPropertyName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi</artifactId>
+ <version>1.7.1</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-nar-bundles</artifactId>
+ <version>1.7.1</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+</project>
diff --git a/integrations/pom.xml b/integrations/pom.xml
index c69be07..f3af466 100644
--- a/integrations/pom.xml
+++ b/integrations/pom.xml
@@ -16,8 +16,7 @@
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>
@@ -39,6 +38,7 @@
<module>apache-edgent</module>
<module>apache-kafka</module>
<module>apache-mynewt</module>
+ <module>apache-nifi</module>
</modules>
</project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index b4b2867..6c38b27 100644
--- a/pom.xml
+++ b/pom.xml
@@ -301,6 +301,9 @@
</goals>
<configuration>
<rules>
+ <requireJavaVersion>
+ <version>1.8.0</version>
+ </requireJavaVersion>
<banVulnerable implementation="org.sonatype.ossindex.maven.enforcer.BanVulnerableDependencies" />
</rules>
</configuration>
@@ -316,7 +319,7 @@
</plugin>
<!-- Plugin for analysing the project based on neo4j queries -->
- <plugin>
+ <!--plugin>
<groupId>com.buschmais.jqassistant</groupId>
<artifactId>jqassistant-maven-plugin</artifactId>
<version>1.3.0</version>
@@ -338,7 +341,7 @@
</configuration>
</execution>
</executions>
- </plugin>
+ </plugin-->
<!-- Check if all source files have the required apache license headers -->
<plugin>
@@ -951,7 +954,7 @@
</configuration>
</plugin>
- <plugin>
+ <!--plugin>
<groupId>com.buschmais.jqassistant</groupId>
<artifactId>jqassistant-maven-plugin</artifactId>
<reportSets>
@@ -961,7 +964,7 @@
</reports>
</reportSet>
</reportSets>
- </plugin>
+ </plugin-->
</plugins>
</reporting>
diff --git a/src/site/asciidoc/index.adoc b/src/site/asciidoc/index.adoc
index d68a0d1..35583ad 100644
--- a/src/site/asciidoc/index.adoc
+++ b/src/site/asciidoc/index.adoc
@@ -73,7 +73,7 @@ a|image::apache_edgent_logo.png[width=80%,link=https://edgent.apache.org] a|imag
|icon:check[role=green] https://edgent.apache.org[Apache Edgent (Incubating)] |icon:check[role=green] https://camel.apache.org[Apache Camel] |icon:wrench[role=yellow] https://kafka.apache.org[Apache Kafka]
a|image::apache_nifi_logo.svg[width=80%,link=https://nifi.apache.org] a|image::apache_brooklyn_logo.png[width=80%,link=https://brooklyn.apache.org] a|image::apache_mynewt_logo.png[width=80%,link=https://mynewt.apache.org]
-|icon:pause-circle[role=light-gray] https://nifi.apache.org[Apache Nifi] |icon:pause-circle[role=light-gray] https://brooklyn.apache.org[Apache Brooklyn] |icon:pause-circle[role=light-gray] https://mynewt.apache.org[Apache Mynewt]
+|icon:wrench[role=yellow] https://nifi.apache.org[Apache Nifi] |icon:pause-circle[role=light-gray] https://brooklyn.apache.org[Apache Brooklyn] |icon:pause-circle[role=light-gray] https://mynewt.apache.org[Apache Mynewt]
|===
Hereby greatly reducing the barriers and the learning curve for creating industrial IoT applications.
\ No newline at end of file