Procházet zdrojové kódy

zkt和ibms增加开关

menglu před 3 roky
rodič
revize
2f06b2e902

+ 11 - 9
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/DaemonThread.java

@@ -66,18 +66,20 @@ public class DaemonThread extends Thread {
 			} catch (Exception e) {
 				log.error(e.getMessage(), e);
 			}
-			try {
-				String validPath = Constant.getLatestPath(Constant.zkt_physical_world, true);
-				if (validPath == null) {
-					while (true) {
-						boolean changed_physical_world = RWDDownloadUtil.Process_zkt_physical_world();
-						if (changed_physical_world) {
-							break;
+			if (Constant.ibms_physical_world_enable) {
+				try {
+					String validPath = Constant.getLatestPath(Constant.zkt_physical_world, true);
+					if (validPath == null) {
+						while (true) {
+							boolean changed_physical_world = RWDDownloadUtil.Process_zkt_physical_world();
+							if (changed_physical_world) {
+								break;
+							}
 						}
 					}
+				} catch (Exception e) {
+					log.error(e.getMessage(), e);
 				}
-			} catch (Exception e) {
-				log.error(e.getMessage(), e);
 			}
 			try {
 				String validPath = Constant.getLatestPath(Constant.config, false);

+ 1 - 1
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/RefreshThread.java

@@ -77,7 +77,7 @@ public class RefreshThread extends Thread {
 				}
 				boolean changed_zkt_physical_world = false;
 				if (last_refresh_zkt_physical_world == null || currTime.getTime() - last_refresh_zkt_physical_world.getTime() > 1000L * 60 * 60) {
-					if (Constant.zkt_physical_world_refresh_enable) {
+					if (Constant.zkt_physical_world_enable && Constant.zkt_physical_world_refresh_enable) {
 						changed_zkt_physical_world = RWDDownloadUtil.Process_zkt_physical_world();
 					}
 					last_refresh_zkt_physical_world = currTime;

+ 4 - 0
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/Constant.java

@@ -26,8 +26,10 @@ public class Constant {
 	public static String physical_world;
 	public static boolean physical_world_refresh_enable;
 	public static String zkt_physical_world;
+	public static boolean zkt_physical_world_enable;
 	public static boolean zkt_physical_world_refresh_enable;
 	public static String ibms_physical_world;
+	public static boolean ibms_physical_world_enable;
 	public static boolean ibms_physical_world_refresh_enable;
 	public static String config;
 	public static boolean config_refresh_enable;
@@ -102,12 +104,14 @@ public class Constant {
 					if (iter.hasNext()) {
 						element = (Element) iter.next();
 						zkt_physical_world = element.attribute("path").getValue();
+						zkt_physical_world_enable = Boolean.parseBoolean(element.attribute("enable").getValue());
 						zkt_physical_world_refresh_enable = Boolean.parseBoolean(element.attribute("refresh_enable").getValue());
 					}
 					iter = document.selectNodes("/root/ibms_physical_world").iterator();
 					if (iter.hasNext()) {
 						element = (Element) iter.next();
 						ibms_physical_world = element.attribute("path").getValue();
+						ibms_physical_world_enable = Boolean.parseBoolean(element.attribute("enable").getValue());
 						ibms_physical_world_refresh_enable = Boolean.parseBoolean(element.attribute("refresh_enable").getValue());
 					}
 					iter = document.selectNodes("/root/config").iterator();

+ 11 - 7
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDRepositoryUtil.java

@@ -25,13 +25,17 @@ public class RWDRepositoryUtil {
 			RWDLoadUtil.LoadPhysicalWorld(Repository);
 			log.warn("LoadReference");
 			RWDLoadUtil.LoadReference(Repository);
-			
-			log.warn("LoadZKTPhysicalWorld");
-			RWDLoadUtil.LoadZKTPhysicalWorld(Repository);
-			
-			log.warn("LoadIBMSPhysicalWorld");
-			RWDLoadUtil.LoadIBMSPhysicalWorld(Repository);
-			
+
+			if (Constant.zkt_physical_world_enable) {
+				log.warn("LoadZKTPhysicalWorld");
+				RWDLoadUtil.LoadZKTPhysicalWorld(Repository);
+			}
+
+			if (Constant.ibms_physical_world_enable) {
+				log.warn("LoadIBMSPhysicalWorld");
+				RWDLoadUtil.LoadIBMSPhysicalWorld(Repository);
+			}
+
 			log.warn("LoadAlarm");
 			if (Constant.alarm_enable) {
 				RWDLoadUtil.LoadAlarm(Repository, false);

+ 2 - 2
ibms-data-sdk/src/main/resources/config.xml

@@ -7,8 +7,8 @@
 	<!-- <rwd url="http://192.168.100.33:9909/dmp-rwd/" /> -->
 	<rwd url="http://192.168.0.30:7707/" />
 	<physical_world path="D-physical_world" refresh_enable="true" />
-	<zkt_physical_world path="D-zkt_physical_world" refresh_enable="true" />
-	<ibms_physical_world path="D-ibms_physical_world" refresh_enable="false" />
+	<zkt_physical_world path="D-zkt_physical_world" enable="true" refresh_enable="true" />
+	<ibms_physical_world path="D-ibms_physical_world" enable="true" refresh_enable="false" />
 	<!-- zkt-monitor的服务地址 -->
 	<zkt_monitor url="http://192.168.100.33:9909/zkt-monitor/" />
 	<config path="D-config" refresh_enable="true" />