初始化

This commit is contained in:
2020-06-28 09:01:37 +08:00
commit 88f72990f5
522 changed files with 49365 additions and 0 deletions

49
module-opc/.classpath Normal file
View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

139
module-opc/.factorypath Normal file
View File

@@ -0,0 +1,139 @@
<factorypath>
<factorypathentry kind="VARJAR" id="M2_REPO/com/alibaba/fastjson/1.2.47/fastjson-1.2.47.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/openscada/external/org.openscada.external.jcifs/1.2.25/org.openscada.external.jcifs-1.2.25.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/javax/servlet/javax.servlet-api/4.0.1/javax.servlet-api-4.0.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/openscada/jinterop/org.openscada.jinterop.core/2.1.8/org.openscada.jinterop.core-2.1.8.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/openscada/jinterop/org.openscada.jinterop.deps/1.5.0/org.openscada.jinterop.deps-1.5.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/openscada/utgard/org.openscada.opc.dcom/1.5.0/org.openscada.opc.dcom-1.5.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/openscada/utgard/org.openscada.opc.lib/1.5.0/org.openscada.opc.lib-1.5.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/bouncycastle/bcprov-jdk15on/1.59/bcprov-jdk15on-1.59.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/log4j/log4j/1.2.17/log4j-1.2.17.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/junit/junit/4.12/junit-4.12.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/hamcrest/hamcrest-core/2.1/hamcrest-core-2.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/projectlombok/lombok/1.18.12/lombok-1.18.12.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter/2.2.4.RELEASE/spring-boot-starter-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot/2.2.4.RELEASE/spring-boot-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-logging/2.2.4.RELEASE/spring-boot-starter-logging-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-to-slf4j/2.12.1/log4j-to-slf4j-2.12.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-api/2.12.1/log4j-api-2.12.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/yaml/snakeyaml/1.25/snakeyaml-1.25.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/hamcrest/hamcrest/2.1/hamcrest-2.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/net/bytebuddy/byte-buddy/1.10.6/byte-buddy-1.10.6.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-core/5.2.3.RELEASE/spring-core-5.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-jcl/5.2.3.RELEASE/spring-jcl-5.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-web/2.2.4.RELEASE/spring-boot-starter-web-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-json/2.2.4.RELEASE/spring-boot-starter-json-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.10.2/jackson-datatype-jdk8-2.10.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.10.2/jackson-datatype-jsr310-2.10.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/module/jackson-module-parameter-names/2.10.2/jackson-module-parameter-names-2.10.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-tomcat/2.2.4.RELEASE/spring-boot-starter-tomcat-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/tomcat/embed/tomcat-embed-core/9.0.30/tomcat-embed-core-9.0.30.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/tomcat/embed/tomcat-embed-el/9.0.30/tomcat-embed-el-9.0.30.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.30/tomcat-embed-websocket-9.0.30.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-validation/2.2.4.RELEASE/spring-boot-starter-validation-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/hibernate/validator/hibernate-validator/6.0.18.Final/hibernate-validator-6.0.18.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-web/5.2.3.RELEASE/spring-web-5.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-webmvc/5.2.3.RELEASE/spring-webmvc-5.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-expression/5.2.3.RELEASE/spring-expression-5.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-aop/2.2.4.RELEASE/spring-boot-starter-aop-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-aop/5.2.3.RELEASE/spring-aop-5.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/aspectj/aspectjweaver/1.9.5/aspectjweaver-1.9.5.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context-support/5.2.3.RELEASE/spring-context-support-5.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-beans/5.2.3.RELEASE/spring-beans-5.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context/5.2.3.RELEASE/spring-context-5.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-data-redis/2.2.4.RELEASE/spring-boot-starter-data-redis-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/data/spring-data-redis/2.2.4.RELEASE/spring-data-redis-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/data/spring-data-keyvalue/2.2.4.RELEASE/spring-data-keyvalue-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/data/spring-data-commons/2.2.4.RELEASE/spring-data-commons-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-tx/5.2.3.RELEASE/spring-tx-5.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-oxm/5.2.3.RELEASE/spring-oxm-5.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/lettuce/lettuce-core/5.2.1.RELEASE/lettuce-core-5.2.1.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/netty/netty-common/4.1.45.Final/netty-common-4.1.45.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/netty/netty-handler/4.1.45.Final/netty-handler-4.1.45.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/netty/netty-buffer/4.1.45.Final/netty-buffer-4.1.45.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/netty/netty-codec/4.1.45.Final/netty-codec-4.1.45.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/netty/netty-transport/4.1.45.Final/netty-transport-4.1.45.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/netty/netty-resolver/4.1.45.Final/netty-resolver-4.1.45.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/projectreactor/reactor-core/3.3.2.RELEASE/reactor-core-3.3.2.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-configuration-processor/2.2.4.RELEASE/spring-boot-configuration-processor-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/baomidou/mybatis-plus-boot-starter/3.3.1/mybatis-plus-boot-starter-3.3.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/baomidou/mybatis-plus/3.3.1/mybatis-plus-3.3.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/baomidou/mybatis-plus-extension/3.3.1/mybatis-plus-extension-3.3.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/baomidou/mybatis-plus-core/3.3.1/mybatis-plus-core-3.3.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/baomidou/mybatis-plus-annotation/3.3.1/mybatis-plus-annotation-3.3.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/jsqlparser/jsqlparser/3.1/jsqlparser-3.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/mybatis/mybatis/3.5.3/mybatis-3.5.3.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/mybatis/mybatis-spring/2.0.3/mybatis-spring-2.0.3.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-autoconfigure/2.2.4.RELEASE/spring-boot-autoconfigure-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-jdbc/2.2.4.RELEASE/spring-boot-starter-jdbc-2.2.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/zaxxer/HikariCP/3.4.2/HikariCP-3.4.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-jdbc/5.2.3.RELEASE/spring-jdbc-5.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/mysql/mysql-connector-java/8.0.17/mysql-connector-java-8.0.17.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/postgresql/postgresql/42.2.9/postgresql-42.2.9.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/alibaba/druid-spring-boot-starter/1.1.13/druid-spring-boot-starter-1.1.13.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/alibaba/druid/1.1.13/druid-1.1.13.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/quartz-scheduler/quartz/2.3.0/quartz-2.3.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/mchange/mchange-commons-java/0.2.11/mchange-commons-java-0.2.11.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/commons-fileupload/commons-fileupload/1.2.2/commons-fileupload-1.2.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/commons-io/commons-io/2.5/commons-io-2.5.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/commons-codec/commons-codec/1.10/commons-codec-1.10.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/commons-configuration/commons-configuration/1.10/commons-configuration-1.10.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-core/1.4.0/shiro-core-1.4.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-lang/1.4.0/shiro-lang-1.4.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-cache/1.4.0/shiro-cache-1.4.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-crypto-hash/1.4.0/shiro-crypto-hash-1.4.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-crypto-core/1.4.0/shiro-crypto-core-1.4.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-crypto-cipher/1.4.0/shiro-crypto-cipher-1.4.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-config-core/1.4.0/shiro-config-core-1.4.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-config-ogdl/1.4.0/shiro-config-ogdl-1.4.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-event/1.4.0/shiro-event-1.4.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-spring/1.4.0/shiro-spring-1.4.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-web/1.4.0/shiro-web-1.4.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/jsonwebtoken/jjwt/0.7.0/jjwt-0.7.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.10.2/jackson-databind-2.10.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.10.2/jackson-annotations-2.10.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.10.2/jackson-core-2.10.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/axet/kaptcha/0.0.9/kaptcha-0.0.9.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/jhlabs/filters/2.0.235/filters-2.0.235.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/springfox/springfox-swagger2/2.7.0/springfox-swagger2-2.7.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/swagger/swagger-annotations/1.5.13/swagger-annotations-1.5.13.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/swagger/swagger-models/1.5.13/swagger-models-1.5.13.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/springfox/springfox-spi/2.7.0/springfox-spi-2.7.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/springfox/springfox-core/2.7.0/springfox-core-2.7.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/springfox/springfox-schema/2.7.0/springfox-schema-2.7.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/springfox/springfox-swagger-common/2.7.0/springfox-swagger-common-2.7.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/springfox/springfox-spring-web/2.7.0/springfox-spring-web-2.7.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/reflections/reflections/0.9.11/reflections-0.9.11.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/javassist/javassist/3.21.0-GA/javassist-3.21.0-GA.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/guava/18.0/guava-18.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/plugin/spring-plugin-metadata/1.2.0.RELEASE/spring-plugin-metadata-1.2.0.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/mapstruct/mapstruct/1.1.0.Final/mapstruct-1.1.0.Final.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/springfox/springfox-swagger-ui/2.7.0/springfox-swagger-ui-2.7.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/qiniu/qiniu-java-sdk/7.2.23/qiniu-java-sdk-7.2.23.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/squareup/okhttp3/okhttp/3.14.6/okhttp-3.14.6.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/squareup/okio/okio/1.17.2/okio-1.17.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/aliyun/oss/aliyun-sdk-oss/2.8.3/aliyun-sdk-oss-2.8.3.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpclient/4.5.10/httpclient-4.5.10.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/jdom/jdom/1.1/jdom-1.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/qcloud/cos_api/4.4/cos_api-4.4.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpmime/4.5.10/httpmime-4.5.10.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/json/json/20140107/json-20140107.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/joda-time/joda-time/2.9.9/joda-time-2.9.9.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/cn/hutool/hutool-all/4.1.1/hutool-all-4.1.1.jar" enabled="true" runInBatchMode="false"/>
</factorypath>

23
module-opc/.project Normal file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OpcClient</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

View File

@@ -0,0 +1,4 @@
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genSrcDir=target\\generated-sources\\annotations
org.eclipse.jdt.apt.genTestSrcDir=target\\generated-test-sources\\test-annotations

View File

@@ -0,0 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=enabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

43
module-opc/module-opc.iml Normal file
View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
<sourceRoots>
<root url="file://$MODULE_DIR$/src/main/java" />
<root url="file://$MODULE_DIR$/src/main/resources" />
</sourceRoots>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.47" level="project" />
<orderEntry type="library" name="Maven: org.openscada.external:org.openscada.external.jcifs:1.2.25" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
<orderEntry type="library" name="Maven: org.openscada.jinterop:org.openscada.jinterop.core:2.1.8" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
<orderEntry type="library" name="Maven: org.openscada.jinterop:org.openscada.jinterop.deps:1.5.0" level="project" />
<orderEntry type="library" name="Maven: org.openscada.utgard:org.openscada.opc.dcom:1.5.0" level="project" />
<orderEntry type="library" name="Maven: org.openscada.utgard:org.openscada.opc.lib:1.5.0" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.59" level="project" />
<orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:2.1" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest:2.1" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.12" level="project" />
</component>
</module>

16
module-opc/opcConfig.json Normal file
View File

@@ -0,0 +1,16 @@
[
{
"host": "192.168.0.194",
"clsid": "137CA264-75FA-4c17-BC35-7FE340BF124C",
"user": "OpcUser",
"password": "123456",
"opcid": "1"
},
{
"host": "127.0.0.1",
"clsid": "f8582cf2-88fb-11d0-b850-00c0f0104305",
"user": "OpcUser",
"password": "123456",
"opcid": "0"
}
]

102
module-opc/pom.xml Normal file
View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>module.wcs</groupId>
<artifactId>module-opc</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>Wcs-renren</groupId>
<artifactId>Wcs-renren</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<!-- <build>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-compiler-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <source>7</source>-->
<!-- <target>7</target>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
<dependency>
<groupId>org.openscada.external</groupId>
<artifactId>org.openscada.external.jcifs</artifactId>
<version>1.2.25</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.openscada.jinterop</groupId>
<artifactId>org.openscada.jinterop.core</artifactId>
<version>2.1.8</version>
</dependency>
<dependency>
<groupId>org.openscada.jinterop</groupId>
<artifactId>org.openscada.jinterop.deps</artifactId>
<version>1.5.0</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.openscada.utgard</groupId>
<artifactId>org.openscada.opc.dcom</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>org.openscada.utgard</groupId>
<artifactId>org.openscada.opc.lib</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.59</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,16 @@
package bean;
import lombok.Data;
/**
* @Author: Xu
* @Date:
*/
@Data
public class OpcConfigBean {
private String host;
private String user;
private String clsid;
private String password;
private String opcid;
}

View File

@@ -0,0 +1,397 @@
package bean;
import bean.interfacebean.OpcClient;
import org.apache.log4j.Logger;
import org.jinterop.dcom.common.JIException;
import org.jinterop.dcom.common.JISystem;
import org.jinterop.dcom.core.*;
import org.openscada.opc.dcom.list.ClassDetails;
import org.openscada.opc.lib.common.ConnectionInformation;
import org.openscada.opc.lib.da.*;
import org.openscada.opc.lib.da.browser.FlatBrowser;
import org.openscada.opc.lib.list.Categories;
import org.openscada.opc.lib.list.Category;
import org.openscada.opc.lib.list.ServerList;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
/**
* Description:
*
* @author: XuChenChen
* @date: 2020/3/25 10:20
*/
public class UtgardOpcClient implements OpcClient {
private static Logger logger = Logger.getLogger(UtgardOpcClient.class);
private Server mServer = null;
private final ConnectionInformation connectionInfo = new ConnectionInformation();
private ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
public UtgardOpcClient(OpcConfigBean configBean,String opcServerId)
{
setLoggerOutput(false);
if (mServer==null)
{
System.out.println("创建连接");
if (configBean == null) {
try {
throw new Exception("opcServerId"+opcServerId+"不存在!");
} catch (Exception e) {
myErrorHandler(e);
}
}
connectServer(configBean.getHost(), configBean.getClsid(),configBean.getUser(), configBean.getPassword());
}
}
/**
* 检测是否正常连接
* @return
*/
public Boolean CheckServiceStart() {
return mServer != null;
}
private void myErrorHandler(Exception e)
{
StringWriter stringWriter = new StringWriter();
e.printStackTrace(new PrintWriter(stringWriter, true));
logger.error( stringWriter.toString());
}
/**
* 用于关闭默认log输出
* @param key false关闭true打开
*/
private void setLoggerOutput(boolean key) {
java.util.logging.Logger systemLogger = java.util.logging.Logger.getLogger("org.jinterop");
ConsoleHandler consoleHandler = new ConsoleHandler();
if (!key) {
systemLogger.setLevel(Level.WARNING);
consoleHandler.setLevel(Level.WARNING);
}
}
/**
* 连接opc server
*
* @param host opcServer ip
* @param clsid opcServer 程序注册表CLSID
* @param user opcServer windows账户
* @param password opcServer windows密码
*/
public synchronized boolean connectServer(String host, String clsid, String user, String password) {
boolean mState = false;
try {
connectionInfo.setHost(host);
connectionInfo.setClsid(clsid);
connectionInfo.setUser(user);
connectionInfo.setPassword(password);
myServerConnect(connectionInfo, executor);
CheckConnectState();
mState = true;
} catch (Exception e) {
myErrorHandler(e);
} finally {
if (!mState) {
mServer = null;
logger.error("Connect Opc Server Fail!");
}
}
if (mState) {
logger.info("Connect Opc Server successful!");
}
return mState;
}
protected void myServerConnect(ConnectionInformation connectionInfo, ScheduledExecutorService executor) throws Exception
{
mServer = new Server(connectionInfo, executor);
JISystem.setAutoRegisteration(true); //添加自动注册。
mServer.connect();
mServer.addStateListener(new ServerConnectionStateListener() {
public void connectionStateChanged(boolean state) {
logger.info("Connect state changer,now:" + state);
}
});
}
protected void CheckConnectState(){
Timer timer = new Timer();
TimerTask task = new TimerTask() {
int timeOutCount = 0;
@Override
public void run() {
if (mServer==null)
{
System.out.println("连接终止,取消检测");
cancel();
return;
}
if (mServer.getServerState()==null)
{
timeOutCount++;
System.out.println("超时,次数:" + timeOutCount);
if (timeOutCount ==3)
{
try {
System.out.println("连接断开,尝试重连。。");
myServerConnect(connectionInfo,executor);
timeOutCount =0;
} catch (Exception e) {
myErrorHandler(e);
}
}
}
}
};
timer.schedule(task,0,3000);
}
@Override
public synchronized void disconnectServer() {
if (mServer == null) {
logger.info("Connect is null!");
return;
}
mServer.disconnect();
mServer = null;
logger.info("Disconnect Server");
}
/**
* 显示server上的OPC服务器应用列表
*/
public void showAllOPCServer(String host, String user, String password) {
try {
ServerList serverList = new ServerList(host, user, password, "");
// 支持DA 1.0DA 2.0规范
Collection<ClassDetails> detailsList = serverList.listServersWithDetails(
new Category[]{Categories.OPCDAServer10, Categories.OPCDAServer20}, new Category[]{});
for (final ClassDetails details : detailsList) {
logger.info("Description=" + details.getDescription() + "\nClsId=" + details.getClsId() + "\nProgId=" + details.getProgId());
}
} catch (Exception e) {
myErrorHandler(e);
}
}
/**
* 检查opc server中是否包含指定的地址点列表
*/
public boolean checkItemList(List<String> list) {
// 获取opc server上的所有检测点
FlatBrowser flatBrowser = mServer.getFlatBrowser();
if (flatBrowser == null) {
return false;
}
try {
Collection<String> collection = flatBrowser.browse();
return collection.containsAll(list);
} catch (Exception e) {
myErrorHandler(e);
}
return false;
}
/**
* 检查opc server中是否包含指定的一个地址点
*/
private boolean checkItem(String address) {
// 获取opc server上的所有检测点
FlatBrowser flatBrowser = mServer.getFlatBrowser();
if (flatBrowser == null) {
return false;
}
try {
Collection<String> collection = flatBrowser.browse();
return collection.contains(address);
} catch (Exception e) {
myErrorHandler(e);
}
return false;
}
/**
* 输地址以及新值进行修改。
*
* @param labelName PLC标签名
* @param value 值 支持String,Boolean,Short,Number型
* @return 操作结果
*/
@Override
public boolean setValueByName(String labelName, Object value) {
boolean result = false;
try {
if (!checkItem(labelName)) throw new Exception("Not found:" + labelName);
} catch (Exception e) {
myErrorHandler(e);
return false;
}
try {
Group group = mServer.addGroup();
Item item = group.addItem(labelName);
int type = item.read(true).getValue().getType();
if (type == JIVariant.VT_BSTR && value instanceof String) {
String stringValue = value.toString();
item.write(new JIVariant(stringValue));
logger.info("Address:" + labelName + ",Write:" + value + " successful");
result = true;
} else if (type == JIVariant.VT_BOOL && value instanceof Boolean) {
Boolean booleanValue = (Boolean) value;
item.write(new JIVariant(booleanValue));
logger.info("Address:" + labelName + ",Write:" + value + " successful");
result = true;
} else if (type == JIVariant.VT_I2 && value instanceof Short) {
Short shortValue = (Short) value;
item.write(new JIVariant(shortValue));
logger.info("Address:" + labelName + ",Write:" + value + " successful");
result = true;
}
//TODO 暂时尚未测试 可能需要修复
else if ((type == JIVariant.VT_UI1 || type == JIVariant.VT_UI2 || type == JIVariant.VT_UI4) && value instanceof Number) {
Number numberValue = (Number) value;
JIUnsignedShort jIUnsignedShort = (JIUnsignedShort) JIUnsignedFactory.getUnsigned(numberValue, JIFlags.FLAG_REPRESENTATION_UNSIGNED_SHORT);
item.write(new JIVariant(jIUnsignedShort));
logger.info("Address:" + labelName + ",Write:" + value + " successful");
result = true;
} else if (type == JIVariant.VT_EMPTY) {
logger.warn("Write failed,PLC may not be connected! Value type=VT_EMPTY");
result = false;
} else {
logger.warn("Address:" + labelName + "Value type:" + type + " not support!");
result = false;
}
mServer.removeGroup(group, true);
} catch (Exception e) {
myErrorHandler(e);
}
return result;
}
/**
* 同步取得单个标签值
* 可取数组类型floatbooleanshort。
* 单数据类型 floatbooleanshortstring
*
* @param labelName PLC标签名
* @return 标签数据 string类型
*/
@Override
public ArrayList getValueByName(String labelName) {
try {
if (!checkItem(labelName)) throw new Exception("Not found:" + labelName);
} catch (Exception e) {
myErrorHandler(e);
return null;
}
ArrayList returnValue;
try {
Group group = mServer.addGroup();
Item item = group.addItem(labelName);
JIVariant JiValue=item.read(true).getValue();
returnValue = value(JiValue.getType(), JiValue);
mServer.removeGroup(group, true);
} catch (Exception e) {
myErrorHandler(e);
return null;
}
logger.info("Read Address:" + labelName + ",Type:" + returnValue.getClass().getName() + ",Value:" + returnValue.toString());
return returnValue;
}
/**
* Description: 对标签值进行处理
*/
private ArrayList value(int type, JIVariant item) throws Exception{
JIArray JiArray = item.getObjectAsArray();
ArrayList list=new ArrayList<>();
//Array of REAL4
if (type == 8196) return new ArrayList<>(Arrays.asList((Float[]) JiArray.getArrayInstance()));
//ARRAY of SHORT
else if (type == 8194) return new ArrayList<>(Arrays.asList((Short[]) JiArray.getArrayInstance()));
//ARRAY of Boolean
else if (type == 8203) return new ArrayList<>(Arrays.asList((Boolean[]) JiArray.getArrayInstance()));
//Fixme 字符串数组无法转换
else if (type == 8200) {
String[] VALUE= new String[20];
// String[] value = (String[]) JiArray.getArrayInstance();
VALUE = (String[]) JiArray.getArrayInstance();
return new ArrayList<>(Arrays.asList(VALUE));
}
//Short
else if (type == JIVariant.VT_I2)
{
list.add(item.getObjectAsShort());
return list;
}
//String
else if (type == JIVariant.VT_BSTR) {
list.add(item.getObjectAsString2());
return list;
}
//Number
else if (type == JIVariant.VT_UI1 || type == JIVariant.VT_UI2 || type == JIVariant.VT_UI4)
{
list.add(item.getObjectAsUnsigned().getValue());
return list;
}
//boolean
else if (type == JIVariant.VT_BOOL)
{
list.add(item.getObjectAsBoolean());
return list;
}
else if (type == JIVariant.VT_EMPTY) throw new Exception("Read failed,PLC may not be connected! Value type=VT_EMPTY");
else if (type == JIVariant.VT_NULL) throw new Exception("Read failed,PLC may not be connected! Value type=VT_NULL");
else throw new Exception("Return value type that cannot be processed. Type:" + type);
}
/**
* 对多个标签值进行读取
*/
@Override
public Map<String,ArrayList> getValuesByNameList(ArrayList<String> NameList)
{
Map<String,ArrayList> returnMap = new HashMap<>();
for (String name:NameList)
{
returnMap.put(name,getValueByName(name));
}
return returnMap;
}
public void asyncReadObject(final String itemId, int period) throws Exception {
// 第三个参数用于设置初始化时是否执行访问
AccessBase accessBase;
accessBase = new Async20Access(mServer, 1000, false);
accessBase.addItem(itemId, new DataCallback() {
public void changed(Item item, ItemState itemState) {
// System.out.println("asyncReadObject item=" + itemState);
try {
Object value = itemState.getValue().getObject();
System.out.println(value.toString());
} catch (JIException e) {
myErrorHandler(e);
}
}
});
// 开始读取
accessBase.bind();
Thread.sleep( 1000);
accessBase.unbind();
}
}

View File

@@ -0,0 +1,16 @@
package bean.interfacebean;
import java.util.ArrayList;
import java.util.Map;
/**
* @Author: Xu
* @Date:
*/
public interface OpcClient {
void disconnectServer();
boolean setValueByName(String labelName, Object value);
ArrayList getValueByName(String labelName);
Map<String,ArrayList> getValuesByNameList(ArrayList<String> NameList);
}

View File

@@ -0,0 +1,10 @@
package config;
/**
* @Author: Xu
* @Date:
*/
public class MyConfig {
public static final String MAIN_PROPERTIES_PATH ="OpcClient\\opcConfig.json";
public static final String TEST_PROPERTIES_PATH =".\\opcConfig.json";
}

View File

@@ -0,0 +1,116 @@
package factionry;
import java.util.Map;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import bean.OpcConfigBean;
import bean.UtgardOpcClient;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import bean.interfacebean.OpcClient;
/**
* Description:
* @author: XuChenChen
* @date: 2020/5/20 12:19
* @param:
* @return:
*/
public class OpeClientFactory {
public static Map<String,UtgardOpcClient> utgardOpcClientMap=new HashMap<>();
private static File filePath;
//本地文件配置,路径可配。
public static void setFilePath(File filePath) {
OpeClientFactory.filePath = filePath;
}
/**
* 根据传入的opcserverid判定连接是否为同一个如果为同一个则返回连接本体
* 否则根据opcserverid创建新的连接。存入数组后返回。
* @param opcServerId
* @return
*/
public static OpcClient getUtgardOpcClient(String opcServerId) {
if (utgardOpcClientMap==null||utgardOpcClientMap.isEmpty()||utgardOpcClientMap.get(opcServerId)==null)
{
synchronized (OpeClientFactory.class)
{
if (utgardOpcClientMap.get(opcServerId)==null||!utgardOpcClientMap.get(opcServerId).CheckServiceStart())
{
UtgardOpcClient utgardOpcClient = new UtgardOpcClient(getLocalConfig(opcServerId),opcServerId);
if (utgardOpcClient.CheckServiceStart()) utgardOpcClientMap.put(opcServerId, utgardOpcClient);
}
}
}
return utgardOpcClientMap.get(opcServerId);
}
/*
获取本地的连接配置
*/
private static OpcConfigBean getLocalConfig(String opcServerId)
{
String str = null;
try {
//fixme 设定为相对路径,可以根据需求改为绝对路径。
BufferedInputStream in = new BufferedInputStream(new FileInputStream(filePath.getAbsolutePath()));
byte[] bytes = new byte[2048];
int n;
str = null;
while ((n = in.read(bytes, 0, bytes.length)) != -1) {
//转换成字符串
str = new String(bytes, 0, n, "GBK");
}
in.close();
} catch (IOException e) {
e.printStackTrace();
}
ArrayList<OpcConfigBean> opcConfigBeans = JSON.parseObject(str, new TypeReference<ArrayList<OpcConfigBean>>() {});
if (opcConfigBeans != null)
{
for (OpcConfigBean obj:opcConfigBeans) {
if (obj.getOpcid().equals(opcServerId)) return obj;
}
};
return null;
}
public static Map<String,OpcConfigBean> getLocalConfigsMap() {
Map<String,OpcConfigBean> result= new HashMap<> ();
ArrayList<OpcConfigBean> opcConfigBeans = getLocalConfigsList();
if (opcConfigBeans != null) {
for (OpcConfigBean obj : opcConfigBeans) {
result.put(obj.getOpcid(), obj);
}
return result;
}
return null;
}
public static ArrayList<OpcConfigBean> getLocalConfigsList() {
String str = null;
try {
//fixme 设定为相对路径,可以根据需求改为绝对路径。
BufferedInputStream in = new BufferedInputStream(new FileInputStream(filePath.getAbsolutePath()));
byte[] bytes = new byte[2048];
int n;
str = null;
while ((n = in.read(bytes, 0, bytes.length)) != -1) {
//转换成字符串
str = new String(bytes, 0, n, "GBK");
}
in.close();
} catch (IOException e) {
e.printStackTrace();
}
ArrayList<OpcConfigBean> opcConfigBeans = JSON.parseObject(str, new TypeReference<ArrayList<OpcConfigBean>>() {});
if (opcConfigBeans != null) {
return opcConfigBeans;
}
return null;
}
}

View File

@@ -0,0 +1,63 @@
import bean.OpcConfigBean;
import config.MyConfig;
import factionry.OpeClientFactory;
import bean.interfacebean.OpcClient;
import org.junit.Test;
import java.io.File;
import java.util.Map;
/**
* @Author: Xu
* @Date:
*/
public class opcTest {
public static void main(String[] args) {
//设置本地配置文件的路径(目前为根据相对路径。
OpeClientFactory.setFilePath(new File(MyConfig.MAIN_PROPERTIES_PATH));
//传入想要查询的变量所在的opcid opcid根据本地的配置文件具体设置可变。
final OpcClient utgardOpcClient = OpeClientFactory.getUtgardOpcClient("5102");
// System.out.println(utgardOpcClient.getValueByName("MWSMART.NewPLC.NewItem"));
System.out.println(utgardOpcClient.getValueByName("TEST.A1"));
System.out.println(utgardOpcClient);
utgardOpcClient.disconnectServer();
}
private static void delay(long time) {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@Test
public void test1()
{
OpeClientFactory.setFilePath(new File(MyConfig.TEST_PROPERTIES_PATH));
//测试不同的opcserver是否可以创建不同的连接
for (int i = 0; i < 2; i++) {
OpcClient utgardOpcClient = OpeClientFactory.getUtgardOpcClient(i+"");
System.out.println(""+i+"个:"+utgardOpcClient);
}
//测试创建完成后是否存在与进程中。 连接失败的进程不会保存到连接map中
// for (int i = 0; i < 2; i++) {
// OpcClient utgardOpcClient = OpeClientFactory.getUtgardOpcClient(i+"");
// System.out.println("复检 第"+i+"个:"+utgardOpcClient);
// }
}
@Test
public void test2()
{
//提供获取map以及list的方法供用户在进行添加时判断opcid是否存在。
OpeClientFactory.setFilePath(new File(MyConfig.TEST_PROPERTIES_PATH));
Map<String, OpcConfigBean> localConfigs = OpeClientFactory.getLocalConfigsMap();
OpcConfigBean opcConfigBean = localConfigs.get("1");
System.out.println(opcConfigBean.toString());
System.out.println("============");
System.out.println(OpeClientFactory.getLocalConfigsList());
}
}

View File

@@ -0,0 +1,23 @@
log4j.rootLogger = debug,stdout,D,E
### \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u03E2\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0327 ###
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target = System.out
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern =[%-5p]%d{yyyy-MM-dd HH:mm:ss} Method:%c:%m%n
### \uFFFD\uFFFD\uFFFDDEBUG \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u03F5\uFFFD\uFFFD\uFFFD\u05BE\uFFFD\uFFFD=E://logs/error.log ###
log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
log4j.appender.D.File = D://logs/opclog.log
log4j.appender.D.Append = true
log4j.appender.D.Threshold = DEBUG
log4j.appender.D.layout = org.apache.log4j.PatternLayout
log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %l %m%n
### \uFFFD\uFFFD\uFFFDERROR \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u03F5\uFFFD\uFFFD\uFFFD\u05BE\uFFFD\uFFFD=E://logs/error.log ###
log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
log4j.appender.E.File =D://logs/opcerror.log
log4j.appender.E.Append = true
log4j.appender.E.Threshold = ERROR
log4j.appender.E.layout = org.apache.log4j.PatternLayout
log4j.appender.E.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %l %m%n