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 2019/05/19 19:39:02 UTC

[plc4x] 03/07: Added Author field

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

jfeinauer pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 98c62d048c327de3d057275583bed9eff235e78f
Author: Mathi <de...@googlemail.com>
AuthorDate: Mon May 13 19:45:03 2019 +0200

    Added Author field
---
 .../apache/plc4x/java/opcua/OPCUAPlcDriver.java    | 12 +++--------
 .../opcua/connection/BaseOPCUAPlcConnection.java   |  7 ++++++-
 .../opcua/connection/OPCUAConnectionFactory.java   |  2 ++
 .../opcua/connection/OPCUATcpPlcConnection.java    |  3 ++-
 .../plc4x/java/opcua/protocol/OpcuaField.java      |  5 +++--
 .../java/opcua/protocol/model/OpcuaDataTypes.java  |  2 ++
 .../opcua/protocol/model/OpcuaIdentifierType.java  |  2 ++
 .../opcua/protocol/model/OpcuaPlcFieldHandler.java |  5 ++---
 .../protocol/model/OpcuaSubsriptionHandle.java     |  8 ++++++--
 .../java/opcua/connection/ManualPLC4XOPCUA.java    | 24 +++++++++++-----------
 10 files changed, 40 insertions(+), 30 deletions(-)

diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/OPCUAPlcDriver.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/OPCUAPlcDriver.java
index 68f3886..4e20b8c 100644
--- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/OPCUAPlcDriver.java
+++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/OPCUAPlcDriver.java
@@ -15,27 +15,21 @@
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
+
+ * @author Matthias Milan Stlrljic
+ * Created by Matthias Milan Stlrljic on 10.05.2019
  */
 package org.apache.plc4x.java.opcua;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.plc4x.java.PlcDriverManager;
 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.api.messages.PlcReadRequest;
-import org.apache.plc4x.java.api.messages.PlcReadResponse;
-import org.apache.plc4x.java.api.messages.PlcWriteRequest;
-import org.apache.plc4x.java.api.messages.PlcWriteResponse;
-import org.apache.plc4x.java.api.model.PlcField;
 import org.apache.plc4x.java.opcua.connection.OPCUAConnectionFactory;
-import org.apache.plc4x.java.opcua.connection.OPCUATcpPlcConnection;
-import org.apache.plc4x.java.opcua.protocol.model.OpcuaPlcFieldHandler;
 import org.apache.plc4x.java.spi.PlcDriver;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
-import java.util.Collection;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/BaseOPCUAPlcConnection.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/BaseOPCUAPlcConnection.java
index b7221e2..26cbb09 100644
--- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/BaseOPCUAPlcConnection.java
+++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/BaseOPCUAPlcConnection.java
@@ -15,11 +15,16 @@
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
+ * @author Matthias Milan Stlrljic
+ * Created by Matthias Milan Stlrljic on 10.05.2019
  */
 package org.apache.plc4x.java.opcua.connection;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.plc4x.java.api.messages.*;
+import org.apache.plc4x.java.api.messages.PlcReadRequest;
+import org.apache.plc4x.java.api.messages.PlcSubscriptionRequest;
+import org.apache.plc4x.java.api.messages.PlcUnsubscriptionRequest;
+import org.apache.plc4x.java.api.messages.PlcWriteRequest;
 import org.apache.plc4x.java.base.connection.AbstractPlcConnection;
 import org.apache.plc4x.java.base.messages.*;
 import org.apache.plc4x.java.opcua.protocol.model.OpcuaPlcFieldHandler;
diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/OPCUAConnectionFactory.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/OPCUAConnectionFactory.java
index 1bf0e60..b82b696 100644
--- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/OPCUAConnectionFactory.java
+++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/OPCUAConnectionFactory.java
@@ -15,6 +15,8 @@
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
+ * @author Matthias Milan Stlrljic
+ * Created by Matthias Milan Stlrljic on 10.05.2019
  */
 package org.apache.plc4x.java.opcua.connection;
 
diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/OPCUATcpPlcConnection.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/OPCUATcpPlcConnection.java
index 7235226..4929bf8 100644
--- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/OPCUATcpPlcConnection.java
+++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/connection/OPCUATcpPlcConnection.java
@@ -15,6 +15,8 @@
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
+ * @author Matthias Milan Stlrljic
+ * Created by Matthias Milan Stlrljic on 10.05.2019
  */
 package org.apache.plc4x.java.opcua.connection;
 
@@ -25,7 +27,6 @@ import org.apache.plc4x.java.api.messages.*;
 import org.apache.plc4x.java.api.model.PlcConsumerRegistration;
 import org.apache.plc4x.java.api.model.PlcField;
 import org.apache.plc4x.java.api.model.PlcSubscriptionHandle;
-
 import org.apache.plc4x.java.api.types.PlcResponseCode;
 import org.apache.plc4x.java.base.messages.*;
 import org.apache.plc4x.java.base.messages.items.*;
diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaField.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaField.java
index 317d6ad..0ac3c9f 100644
--- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaField.java
+++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/OpcuaField.java
@@ -15,12 +15,13 @@ software distributed under the License is distributed on an
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-*/
+ * @author Matthias Milan Stlrljic
+ * Created by Matthias Milan Stlrljic on 10.05.2019
+ */
 package org.apache.plc4x.java.opcua.protocol;
 
 import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
 import org.apache.plc4x.java.api.model.PlcField;
-import org.apache.plc4x.java.opcua.protocol.model.OpcuaDataTypes;
 import org.apache.plc4x.java.opcua.protocol.model.OpcuaIdentifierType;
 
 import java.util.Objects;
diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaDataTypes.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaDataTypes.java
index e3f056e..c0bfe65 100644
--- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaDataTypes.java
+++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaDataTypes.java
@@ -15,6 +15,8 @@
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
+ * @author Matthias Milan Stlrljic
+ * Created by Matthias Milan Stlrljic on 10.05.2019
  */
 package org.apache.plc4x.java.opcua.protocol.model;
 
diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaIdentifierType.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaIdentifierType.java
index afcef2a..599ad05 100644
--- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaIdentifierType.java
+++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaIdentifierType.java
@@ -15,6 +15,8 @@
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
+ * @author Matthias Milan Stlrljic
+ * Created by Matthias Milan Stlrljic on 10.05.2019
  */
 package org.apache.plc4x.java.opcua.protocol.model;
 
diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaPlcFieldHandler.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaPlcFieldHandler.java
index 81fe4f2..0a3c5c6 100644
--- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaPlcFieldHandler.java
+++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaPlcFieldHandler.java
@@ -15,13 +15,13 @@
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
+ * @author Matthias Milan Stlrljic
+ * Created by Matthias Milan Stlrljic on 10.05.2019
  */
 package org.apache.plc4x.java.opcua.protocol.model;
 
 
-
 import org.apache.plc4x.java.api.exceptions.PlcInvalidFieldException;
-import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
 import org.apache.plc4x.java.api.model.PlcField;
 import org.apache.plc4x.java.base.connection.DefaultPlcFieldHandler;
 import org.apache.plc4x.java.base.messages.items.*;
@@ -29,7 +29,6 @@ import org.apache.plc4x.java.opcua.protocol.OpcuaField;
 
 import java.math.BigInteger;
 import java.util.ArrayList;
-import java.util.List;
 
 public class OpcuaPlcFieldHandler extends DefaultPlcFieldHandler {
 
diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaSubsriptionHandle.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaSubsriptionHandle.java
index 4a03345..582993c 100644
--- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaSubsriptionHandle.java
+++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/protocol/model/OpcuaSubsriptionHandle.java
@@ -15,6 +15,8 @@
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
+ * @author Matthias Milan Stlrljic
+ * Created by Matthias Milan Stlrljic on 10.05.2019
  */
 package org.apache.plc4x.java.opcua.protocol.model;
 
@@ -32,9 +34,11 @@ import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue;
 import org.eclipse.milo.opcua.stack.core.types.builtin.StatusCode;
 import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger;
 
-import java.awt.*;
 import java.time.Instant;
-import java.util.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 import java.util.function.Consumer;
 
 public class OpcuaSubsriptionHandle implements PlcSubscriptionHandle {
diff --git a/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/connection/ManualPLC4XOPCUA.java b/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/connection/ManualPLC4XOPCUA.java
index eb29494..462b58a 100644
--- a/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/connection/ManualPLC4XOPCUA.java
+++ b/plc4j/drivers/opcua/src/test/java/org/apache/plc4x/java/opcua/connection/ManualPLC4XOPCUA.java
@@ -15,6 +15,8 @@
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
+ * @author Matthias Milan Stlrljic
+ * Created by Matthias Milan Stlrljic on 10.05.2019
  */
 package org.apache.plc4x.java.opcua.connection;
 
@@ -29,13 +31,11 @@ import org.apache.plc4x.java.base.model.SubscriptionPlcField;
 import org.apache.plc4x.java.opcua.protocol.OpcuaField;
 import org.apache.plc4x.java.opcua.protocol.model.OpcuaPlcFieldHandler;
 
-import java.math.BigInteger;
 import java.time.Duration;
 import java.time.temporal.ChronoUnit;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashMap;
-import java.util.concurrent.CompletableFuture;
 import java.util.function.Consumer;
 
 public class ManualPLC4XOPCUA {
@@ -44,18 +44,18 @@ public class ManualPLC4XOPCUA {
 
 
 
-        OPCUATcpPlcConnection adsConnection = null;
+        OPCUATcpPlcConnection opcuaConnection = null;
         OpcuaPlcFieldHandler fieldH = new OpcuaPlcFieldHandler();
         PlcField field = fieldH.createField("ns=2;i=10855");
         try {
-            adsConnection = (OPCUATcpPlcConnection)
+            opcuaConnection = (OPCUATcpPlcConnection)
                 new PlcDriverManager().getConnection("opcua:tcp://opcua.demo-this.com:51210/UA/SampleServer");
 
         } catch (PlcConnectionException e) {
             e.printStackTrace();
         }
         try {
-            PlcReadRequest.Builder builder = adsConnection.readRequestBuilder();
+            PlcReadRequest.Builder builder = opcuaConnection.readRequestBuilder();
             //builder.addItem("String", "ns=2;i=10855");
             builder.addItem("Bool", "ns=2;i=10844");
             builder.addItem("ByteString", "ns=2;i=10858");
@@ -76,10 +76,10 @@ public class ManualPLC4XOPCUA {
             builder.addItem("DoesNotExists", "ns=2;i=12512623");
 
             PlcReadRequest request = builder.build();
-            PlcReadResponse response = adsConnection.read(request).get();
+            PlcReadResponse response = opcuaConnection.read(request).get();
             Collection coll = response.getAllStrings("String");
 
-            PlcWriteRequest.Builder wBuilder = adsConnection.writeRequestBuilder();
+            PlcWriteRequest.Builder wBuilder = opcuaConnection.writeRequestBuilder();
             //wBuilder.addItem("w-Bool", "ns=2;i=10844", "TEST");
             //wBuilder.addItem("w-Bool", "ns=2;i=11012", true);
             //--->> wBuilder.addItem("w-ByteString", "ns=2;i=10858", "TEST".getBytes());
@@ -102,10 +102,10 @@ public class ManualPLC4XOPCUA {
 
             */
             PlcWriteRequest writeRequest = wBuilder.build();
-            PlcWriteResponse wResponse = adsConnection.write(writeRequest).get();
+            PlcWriteResponse wResponse = opcuaConnection.write(writeRequest).get();
 
-            PlcSubscriptionResponse subResp = adsConnection.subscribe(new DefaultPlcSubscriptionRequest(
-                adsConnection,
+            PlcSubscriptionResponse subResp = opcuaConnection.subscribe(new DefaultPlcSubscriptionRequest(
+                opcuaConnection,
                 new LinkedHashMap<>(
                     Collections.singletonMap("field1",
                         new SubscriptionPlcField(PlcSubscriptionType.CHANGE_OF_STATE, OpcuaField.of("ns=2;i=10855"), Duration.of(1, ChronoUnit.SECONDS)))
@@ -113,11 +113,11 @@ public class ManualPLC4XOPCUA {
             )).get();
 
             Consumer<PlcSubscriptionEvent> consumer = plcSubscriptionEvent -> System.out.println(plcSubscriptionEvent.toString());
-            PlcConsumerRegistration registration = adsConnection.register(consumer, subResp.getSubscriptionHandles());
+            PlcConsumerRegistration registration = opcuaConnection.register(consumer, subResp.getSubscriptionHandles());
             Thread.sleep(7000);
             registration.unregister();
             Thread.sleep(200000);
-            adsConnection.close();
+            opcuaConnection.close();
         } catch (Exception e) {
             e.printStackTrace();
         }