You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jf...@apache.org on 2018/11/01 20:18:00 UTC

[incubator-plc4x] 30/35: Moved the Hello OPM example into a dedicated module.

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

jfeinauer pushed a commit to branch add-simple-mock-driver
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git

commit 9bade138e53d9be916bf038cd4c8ac194e4e9924
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Nov 1 12:49:42 2018 +0100

    Moved the Hello OPM example into a dedicated module.
---
 examples/{hello-world-plc4x => hello-opm}/pom.xml  | 52 +++++++++-------------
 .../plc4x/java/examples/helloopm}/HelloOpm.java    |  4 +-
 examples/hello-opm/src/main/resources/logback.xml  | 36 +++++++++++++++
 examples/hello-world-plc4x/pom.xml                 | 12 -----
 examples/pom.xml                                   |  1 +
 .../PlcUsernamePasswordAuthentication.java         |  1 +
 6 files changed, 60 insertions(+), 46 deletions(-)

diff --git a/examples/hello-world-plc4x/pom.xml b/examples/hello-opm/pom.xml
similarity index 62%
copy from examples/hello-world-plc4x/pom.xml
copy to examples/hello-opm/pom.xml
index 8572707..4d68339 100644
--- a/examples/hello-world-plc4x/pom.xml
+++ b/examples/hello-opm/pom.xml
@@ -1,22 +1,22 @@
 <?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>
@@ -27,23 +27,23 @@
     <version>0.2.0-SNAPSHOT</version>
   </parent>
 
-  <artifactId>hello-world-plc4x</artifactId>
-  <name>Examples: Hello-World PLC4X</name>
-  <description>Hello world application for PLC4X.</description>
+  <artifactId>hello-opm</artifactId>
+  <name>Examples: Hello OPM</name>
+  <description>Hello World example of PLC4X using the OPM feature.</description>
 
   <properties>
-    <app.main.class>org.apache.plc4x.java.examples.helloplc4x.HelloPlc4x</app.main.class>
+    <app.main.class>org.apache.plc4x.java.examples.helloopm.HelloOpm</app.main.class>
   </properties>
 
   <dependencies>
     <dependency>
       <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-api</artifactId>
+      <artifactId>plc4j-opm</artifactId>
       <version>0.2.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-core</artifactId>
+      <artifactId>plc4j-connection-pool</artifactId>
       <version>0.2.0-SNAPSHOT</version>
     </dependency>
 
@@ -74,18 +74,6 @@
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-opm</artifactId>
-      <version>0.2.0-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-connection-pool</artifactId>
-      <version>0.2.0-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>
   </dependencies>
 
   <build>
diff --git a/examples/hello-world-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/HelloOpm.java b/examples/hello-opm/src/main/java/org/apache/plc4x/java/examples/helloopm/HelloOpm.java
similarity index 97%
rename from examples/hello-world-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/HelloOpm.java
rename to examples/hello-opm/src/main/java/org/apache/plc4x/java/examples/helloopm/HelloOpm.java
index 99c90bb..a843d7b 100644
--- a/examples/hello-world-plc4x/src/main/java/org/apache/plc4x/java/examples/helloplc4x/HelloOpm.java
+++ b/examples/hello-opm/src/main/java/org/apache/plc4x/java/examples/helloopm/HelloOpm.java
@@ -7,7 +7,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,7 +17,7 @@
  under the License.
  */
 
-package org.apache.plc4x.java.examples.helloplc4x;
+package org.apache.plc4x.java.examples.helloopm;
 
 import org.apache.plc4x.java.opm.OPMException;
 import org.apache.plc4x.java.opm.PlcEntity;
diff --git a/examples/hello-opm/src/main/resources/logback.xml b/examples/hello-opm/src/main/resources/logback.xml
new file mode 100644
index 0000000..27d40c0
--- /dev/null
+++ b/examples/hello-opm/src/main/resources/logback.xml
@@ -0,0 +1,36 @@
+<?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.
+
+-->
+<configuration xmlns="http://ch.qos.logback/xml/ns/logback"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xsi:schemaLocation="http://ch.qos.logback/xml/ns/logback https://raw.githubusercontent.com/enricopulatzo/logback-XSD/master/src/main/xsd/logback.xsd">
+
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <!-- encoders are assigned the type
+         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+    </encoder>
+  </appender>
+
+  <root level="info">
+    <appender-ref ref="STDOUT" />
+  </root>
+
+</configuration>
\ No newline at end of file
diff --git a/examples/hello-world-plc4x/pom.xml b/examples/hello-world-plc4x/pom.xml
index 8572707..a965de9 100644
--- a/examples/hello-world-plc4x/pom.xml
+++ b/examples/hello-world-plc4x/pom.xml
@@ -74,18 +74,6 @@
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-opm</artifactId>
-      <version>0.2.0-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-connection-pool</artifactId>
-      <version>0.2.0-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>
   </dependencies>
 
   <build>
diff --git a/examples/pom.xml b/examples/pom.xml
index 679af6d..07b30a9 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -41,6 +41,7 @@
     <module>hello-connectivity-kafka</module>
     <module>hello-connectivity-mqtt</module>
     <module>hello-integration-edgent</module>
+    <module>hello-opm</module>
     <module>hello-storage-elasticsearch</module>
     <module>hello-world-plc4x</module>
   </modules>
diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/authentication/PlcUsernamePasswordAuthentication.java b/plc4j/api/src/main/java/org/apache/plc4x/java/api/authentication/PlcUsernamePasswordAuthentication.java
index dfb6ff6..b73b2ee 100644
--- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/authentication/PlcUsernamePasswordAuthentication.java
+++ b/plc4j/api/src/main/java/org/apache/plc4x/java/api/authentication/PlcUsernamePasswordAuthentication.java
@@ -61,4 +61,5 @@ public class PlcUsernamePasswordAuthentication implements PlcAuthentication {
             ", password='" + "*****************" + '\'' +
             '}';
     }
+
 }