|
@@ -1,9 +1,18 @@
|
|
|
package com.icontrols.bridge;
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
+import com.google.gson.Gson;
|
|
|
+import com.google.gson.JsonArray;
|
|
|
+import com.google.gson.JsonElement;
|
|
|
+import com.google.gson.JsonObject;
|
|
|
+import com.icontrols.bridge.common.COMMON_INFO;
|
|
|
+import com.icontrols.bridge.common.CommonUtil;
|
|
|
+import com.icontrols.bridge.dto.ServiceDetail;
|
|
|
import com.icontrols.bridge.wallpad.IMapMultiSocket;
|
|
|
|
|
|
public class Main {
|
|
@@ -23,7 +32,36 @@ public class Main {
|
|
|
logger.info("* ******* *");
|
|
|
logger.info("* BRIDGE BY PANGS *");
|
|
|
logger.info("*************************************************************************");
|
|
|
-
|
|
|
+
|
|
|
+ // 초기 설정
|
|
|
+ String str = CommonUtil.readFile(CommonUtil.getPropFileDir());
|
|
|
+ JsonObject object = CommonUtil.getJsonObject(str);
|
|
|
+
|
|
|
+ COMMON_INFO.propList = (JsonArray)object.get("services");
|
|
|
+
|
|
|
+ if(COMMON_INFO.propList == null) {
|
|
|
+ logger.error("설정정보를 가져올 수 없습니다......");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ COMMON_INFO.serviceDtailList = new ArrayList<>();
|
|
|
+
|
|
|
+ for(JsonElement jsonObj : COMMON_INFO.propList) {
|
|
|
+ ServiceDetail service = new Gson().fromJson(jsonObj.toString(), ServiceDetail.class);
|
|
|
+ COMMON_INFO.serviceDtailList.add(service);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(COMMON_INFO.propList.size() == 0) {
|
|
|
+ logger.error("설정정보가 존재하지 않습니다.....");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ StringBuffer bufStr = new StringBuffer();
|
|
|
+ bufStr.append("설정된 서비스 \n");
|
|
|
+ for(ServiceDetail service:COMMON_INFO.serviceDtailList)
|
|
|
+ bufStr.append(service.toString()).append("\n");
|
|
|
+
|
|
|
+ logger.info(bufStr.toString());
|
|
|
+
|
|
|
// 소켓 서버 시작
|
|
|
new IMapMultiSocket();
|
|
|
}
|