main
kdg@gmtc.kr 2023-09-15 17:58:39 +09:00
commit 5b94f23274
22 changed files with 1740 additions and 0 deletions

1
applicaion.pid 100644
View File

@ -0,0 +1 @@
10064

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="euc-kr"?>
<Root Updated="2015-05-18 12:19:40">
<AllowClient>
<Connection ID="0" ServerPort="8050" IP="127.0.0.1" Name="LTE-M_Authorizer" RejectConn="FALSE"/>
<Option SndStat="FALSE"/>
</AllowClient>
</Root>
<!--
SndStat
> 주기적으로 상태메시지를 보낼지 여부
-->

50
cfg/client.xml 100644
View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="euc-kr"?>
<Root Updated="2015-02-05 12:39:27">
<!-- <Client> -->
<!-- <Connection ID="0" Tag="0" USE="true" Name="internal_hb" PIP="127.0.0.1" SIP="127.0.0.1" PORT="7400"/> -->
<!-- <Option LineMode="TURE" /> -->
<!-- <Reconnect ReconnUSE="TRUE" Interval="30"/> -->
<!-- </Client> -->
<!-- <Client> -->
<!-- <Connection ID="1" Tag="1" USE="false" Name="mcpmms_hb" PIP="127.0.0.1" SIP="127.0.0.1" PORT="9704"/> -->
<!-- <Option LineMode="TURE" /> -->
<!-- <Reconnect ReconnUSE="TRUE" Interval="30"/> -->
<!-- </Client> -->
</Root>
<!--
PORT
> 서비스 정보
9702 : INTERNAL HB
9704 : MCP/MMS HB
PacketType
> 수신되는 패킷 타입
0 : None
1 : AISRaw
2 : STD7.x
3 : STD8.x
4 : ExtendIEC
RcvDec
> 메시지 수신시 복호화 여부
0 : None
1 : NIS Decrypt
2 : GMT Decrypt
SndEnc
> 메시지 송신시 암호화 여부
0 : None
1 : NIS Encrypt
2 : GMT Encrypt
LineMode
> 송수신 패킷 타입
TRUE : STRING
FALSE : BINARY
SndStat
> 주기적으로 상태메시지를 보낼지 여부
-->

40
cfg/log4j2.xml 100644
View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Properties>
<Property name="baseDir">logs</Property>
</Properties>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{yyyy-MM-dd HH:mm:ss}] : %-5level : %msg %n" />
</Console>
<RollingFile name="Rollingfile" filename="${baseDir}/current.log"
filePattern="${baseDir}/%d{yyyyMM}/%d{dd}/%d{yyyy-MM-dd_HH}.log">
<PatternLayout pattern="[%d{yyyy-MM-dd HH:mm:ss}] : %-5level : %msg%n" />
<DefaultRolloverStrategy>
<Delete basePath="${baseDir}" maxDepth="3">
<IfFileName glob="*/*/*.log" />
<IfLastModified age="93d" />
</Delete>
</DefaultRolloverStrategy>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<Root level="WARN">
<AppenderRef ref="console" />
<AppenderRef ref="Rollingfile" />
</Root>
<logger name="ConsoleLog" level="TRACE" additivity="false" >
<AppenderRef ref="console" />
</logger>
<logger name="FileLog" level="TRACE" additivity="false" >
<AppenderRef ref="Rollingfile" />
</logger>
<logger name="AllLog" level="TRACE" additivity="false" >
<AppenderRef ref="console" />
<AppenderRef ref="Rollingfile" />
</logger>
</Loggers>
</Configuration>

62
cfg/server.xml 100644
View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="euc-kr"?>
<Root Updated="2014-10-15 13:45:41">
<Server>
<Connection ID="9030" Tag="0" Name="필터링 패킷" PORT="9030" USE="TRUE" AllowAny="TRUE"/>
<Option LineMode="TRUE" SingleConn="FALSE" ReSend="TRUE" CheckRcv="FALSE" Interval="60"/>
</Server>
<!--
<Server>
<Connection ID="9000" Tag="0" Name="서버 #1" PORT="9000" USE="TRUE" AllowAny="TRUE"/>
<Option LineMode="FALSE" SingleConn="FALSE" ReSend="TRUE" CheckRcv="TRUE" Interval="60"/>
</Server>
<Server>
<Connection ID="8099" Tag="0" Name="Encrypt Service" PORT="8099" USE="FALSE" AllowAny="TRUE"/>
<Option LineMode="TRUE" SingleConn="FALSE" ReSend="TRUE" CheckRcv="FALSE" Interval="60"/>
</Server>
<Server>
<Connection ID="9000" Tag="0" Name="시스템 상태정보 서비스" PORT="9000" USE="FALSE" AllowAny="TRUE"/>
<Option LineMode="TRUE" SingleConn="FALSE" ReSend="FALSE" CheckRcv="FALSE" Interval="60"/>
</Server>
<Server>
<Connection ID="9010" Tag="0" Name="시스템 로그 서비스" PORT="9010" USE="FALSE" AllowAny="TRUE"/>
<Option LineMode="TRUE" SingleConn="FALSE" ReSend="FALSE" CheckRcv="FALSE" Interval="60"/>
</Server> -->
</Root>
<!--
PacketType
> 수신되는 패킷 타입
0 : None
1 : AISRaw
2 : STD7.x
3 : STD8.x
4 : ExtendIEC
RcvDec
> 메시지 수신시 복호화 여부
0 : None
1 : NIS Decrypt
2 : GMT Decrypt
SndEnc
> 메시지 송신시 암호화 여부
0 : None
1 : NIS Encrypt
2 : GMT Encrypt
LineMode
> 송수신 패킷 타입
TRUE : STRING
FALSE : BINARY
SndStat
> 주기적으로 상태메시지를 보낼지 여부
SingleConn
> 한 IP당 한 세션만 접속 가능
-->

83
cfg/udpsocket.xml 100644
View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="euc-kr"?>
<Root Updated="2015-02-05 12:39:27">
<UdpSocket>
<Connection ID="0" Tag="1" USE="false" Name="udp_recv_test_3384" PIP="127.0.0.1" SIP="127.0.0.1" PORT="3384"/>
<Option LineMode="TURE" InOut="recv" />
<Reconnect ReconnUSE="TRUE" Interval="60"/>
</UdpSocket>
<!-- <UdpSocket> -->
<!-- <Connection ID="1" Tag="2" USE="false" Name="udp_recv_test_2284" PIP="118.220.143.175" SIP="118.220.143.175" PORT="43210"/> -->
<!-- <Option LineMode="TURE" InOut="send" /> -->
<!-- <Reconnect ReconnUSE="TRUE" Interval="60"/> -->
<!-- </UdpSocket> -->
<!-- <UdpSocket> -->
<!-- <Connection ID="2" Tag="3" USE="true" Name="udp_recv_test_22842" PIP="127.0.0.1" SIP="127.0.0.1" PORT="43210"/> -->
<!-- <Option LineMode="TURE" InOut="send" /> -->
<!-- <Reconnect ReconnUSE="TRUE" Interval="60"/> -->
<!-- </UdpSocket> -->
<UdpSocket>
<Connection ID="1" Tag="2" USE="false" Name="udp_recv_test_2284" PIP="239.192.201.7" SIP="127.0.0.1" PORT="55304"/>
<Option LineMode="TURE" InOut="send" />
<Reconnect ReconnUSE="TRUE" Interval="600"/>
</UdpSocket>
<UdpSocket>
<Connection ID="2" Tag="3" USE="false" Name="udp_recv_test_3384" PIP="239.11.12.5" SIP="127.0.0.1" PORT="52114"/>
<Option LineMode="TURE" InOut="send" />
<Reconnect ReconnUSE="TRUE" Interval="600"/>
</UdpSocket>
<UdpSocket>
<Connection ID="1" Tag="2" USE="true" Name="udp_recv_test_2284" PIP="127.0.0.1" SIP="127.0.0.1" PORT="55304"/>
<Option LineMode="TURE" InOut="send" />
<Reconnect ReconnUSE="TRUE" Interval="600"/>
</UdpSocket>
<UdpSocket>
<Connection ID="2" Tag="3" USE="true" Name="udp_recv_test_3384" PIP="127.0.0.1" SIP="127.0.0.1" PORT="52114"/>
<Option LineMode="TURE" InOut="send" />
<Reconnect ReconnUSE="TRUE" Interval="600"/>
</UdpSocket>
</Root>
<!--
PORT
> 서비스 정보
9702 : INTERNAL HB
9704 : MCP/MMS HB
PacketType
> 수신되는 패킷 타입
0 : None
1 : AISRaw
2 : STD7.x
3 : STD8.x
4 : ExtendIEC
RcvDec
> 메시지 수신시 복호화 여부
0 : None
1 : NIS Decrypt
2 : GMT Decrypt
SndEnc
> 메시지 송신시 암호화 여부
0 : None
1 : NIS Encrypt
2 : GMT Encrypt
LineMode
> 송수신 패킷 타입
TRUE : STRING
FALSE : BINARY
SndStat
> 주기적으로 상태메시지를 보낼지 여부
-->

157
pom.xml 100644
View File

@ -0,0 +1,157 @@
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>kr.gmtc</groupId>
<artifactId>EyeGW-ASDE-Send</artifactId>
<version>0.0.0.1</version>
<packaging>jar</packaging>
<name>EyeGW-ASDE-Send</name>
<description>SACP ASDE 수신 S/W</description>
<!-- ====================================================================== -->
<!-- PARENT =============================================================== -->
<!-- ====================================================================== -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
</parent>
<!-- ====================================================================== -->
<!-- REPOSITORIES ========================================================= -->
<!-- ====================================================================== -->
<repositories>
<repository>
<id>xwiki</id>
<name>XWiki Externals Repository</name>
<url>https://maven.xwiki.org/externals</url>
</repository>
<repository>
<id>local-repository</id>
<name>local jars</name>
<url>file://${project.basedir}/lib</url>
</repository>
</repositories>
<!-- ====================================================================== -->
<!-- PROPERTIES =========================================================== -->
<!-- ====================================================================== -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven.test.skip>true</maven.test.skip>
<!-- Security issue resolved : Log4Shell(CVE-2021-44228), DoS(CVE-2021-45105) -->
<log4j2.version>2.17.2</log4j2.version>
</properties>
<!-- ====================================================================== -->
<!-- DEPENDENCIES ========================================================= -->
<!-- ====================================================================== -->
<dependencies>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- Log -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>
<!-- DB -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<!-- oracle -->
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>
<!-- mysql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- mariadb -->
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
</dependency>
<!-- postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<!-- Web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- IPWorks -->
<dependency>
<groupId>ipworks</groupId>
<artifactId>ipworks-local</artifactId>
<version>1.0.0</version>
</dependency>
<!-- GMTC -->
<!-- <dependency>-->
<!-- <groupId>kr.gmtc</groupId>-->
<!-- <artifactId>EyeGW-Core</artifactId>-->
<!-- <version>1.0.0</version>-->
<!-- </dependency>-->
<!-- https://mvnrepository.com/artifact/org.yaml/snakeyaml -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.33</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,54 @@
package kr.gmtc.eyegw;
import java.time.ZoneId;
import java.util.TimeZone;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.context.ApplicationPidFileWriter;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.boot.system.ApplicationHome;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.EnableScheduling;
import gmt.logger.GmtLogManager;
@SpringBootApplication
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
@EnableScheduling
public class GmtApplication {
@Value("${root}")
String path;
public static void main(String[] args) {
ApplicationHome home = new ApplicationHome(GmtApplication.class);
String root = home.getDir().getPath();
System.setProperty("user.dir", root);
Thread.currentThread().setName("JVM - Main");
TimeZone.setDefault(TimeZone.getTimeZone(ZoneId.of("UTC")));
SpringApplication springApplication = new SpringApplication(GmtApplication.class);
springApplication.addListeners(new LogPathSetter());
springApplication.addListeners(new ApplicationPidFileWriter("./applicaion.pid"));
springApplication.run(args);
}
}
class LogPathSetter implements ApplicationListener<ApplicationEnvironmentPreparedEvent> {
@Override
public void onApplicationEvent(ApplicationEnvironmentPreparedEvent applicationEvent) {
GmtLogManager.setpath(applicationEvent.getEnvironment().getProperty("root"));
}
}

View File

@ -0,0 +1,80 @@
package kr.gmtc.eyegw.config;
import java.nio.charset.Charset;
import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration("ServiceConfig")
public class ServiceConfig {
@Value("${root}")
private String root;
@Value("${tcpip.client.send}")
private String clientSendCharsetStr;
@Value("${tcpip.client.receive}")
private String clientReceiveCharsetStr;
@Value("${tcpip.client.checksum}")
private boolean clientReceiveChecksum;
@Value("${tcpip.server.send}")
private String serverSendCharsetStr;
@Value("${tcpip.server.receive}")
private String serverReceiveCharsetStr;
@Value("${tcpip.server.checksum}")
private boolean serverReceiveChecksum;
private Charset clientReceiveCharset;
private Charset serverReceiveCharset;
private Charset clientSendCharset;
private Charset serverSendCharset;
@PostConstruct
private void initialize() {
clientSendCharset = Charset.forName(clientReceiveCharsetStr);
serverSendCharset = Charset.forName(serverReceiveCharsetStr);
clientReceiveCharset = Charset.forName(clientReceiveCharsetStr);
serverReceiveCharset = Charset.forName(serverReceiveCharsetStr);
}
/** @return 프로그램 설치 경로 */
public String getRoot() {
return root;
}
/** @return 클라이언트 포트 송신 인코드 캐릭터셋 */
public Charset getClientSendCharset() {
return clientSendCharset;
}
/** @return 클라이언트 포트 수신 디코드 캐릭터셋 */
public Charset getClientReceiveCharset() {
return clientReceiveCharset;
}
/** @return 클라이언트 포트 수신 체크섬 검증 여부 */
public boolean isClientReceiveChecksum() {
return clientReceiveChecksum;
}
/** @return 서버 포트 송신 인코드 캐릭터셋 */
public Charset getServerSendCharset() {
return serverSendCharset;
}
/** @return 서버 포트 수신 디코드 캐릭터셋 */
public Charset getServerReceiveCharset() {
return serverReceiveCharset;
}
/** @return 서버 포트 수신 체크섬 검증 여부 */
public boolean isServerReceiveChecksum() {
return serverReceiveChecksum;
}
@Bean(name = "packetQ")
public Queue<String> packetQ(){
return new LinkedBlockingQueue<String>();
}
}

View File

@ -0,0 +1,512 @@
package kr.gmtc.eyegw.controller;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import gmt.common.type.LogLevelType;
import gmt.common.util.GmtUtils;
import gmt.common.vo.MsgObjVO;
import gmt.controller.GmtController;
import gmt.io.client.event.GmtClientEventListener;
import gmt.io.server.event.GmtServerEventListener;
import gmt.io.udp.event.GmtUDPEventListener;
import gmt.logger.GmtLogManager;
import kr.gmtc.eyegw.config.ServiceConfig;
import kr.gmtc.eyegw.db.DB1Connection;
import kr.gmtc.eyegw.file.TextReader;
import kr.gmtc.eyegw.file.TextReaderMergeAndSort;
import kr.gmtc.eyegw.frame.CustomThread;
import kr.gmtc.eyegw.frame.StatusReporter;
@Component("controller")
public class MainController extends GmtController implements ApplicationListener<ContextClosedEvent> {
// 프레임 워크 구성요소 //
/** 서비스 설정, {@code application.yml} */
@Resource(name = "ServiceConfig")
private ServiceConfig serviceConfig;
/* 상태 확인 스테드 */
private StatusReporter stateReporter;
/* 실생상태 확인 */
private boolean running = false;
/* UDP test 소켓 */
//UDPEchoClient UDPSocket ;
private long lSendCnt = 0;
@Resource(name = "packetQ")
Queue<String> packetQ;
@Value("${asde.filepath1}")
private String sfilepath1;
@Value("${asde.filepath2}")
private String sfilepath2;
public Queue<Map<String, String>> fileQ;
// DB //
/**
* DB1 Connection<br>
* application.yml db.db1.use true <br>
* db.db1.use false (Bean )
* @see DB1Connection
*/
@Resource(name = "DB1Connection")
private DB1Connection db1Connection;
// 업무처리 //
/** 업무 처리 스레드 */
private CustomThread bizThread;
/**
* <br>
* Spring Bean , logger
*/
public MainController(@Value("${root}") String path) {
super(path);
GmtLogManager.setpath(path);
}
/**
* <br>
* 3 <br>
* false true
* @param msg
* @param spliter
* @return , false true
*/
private boolean verifyChecksum(final String msg, final String originalMsg) {
// 메시지 길이 체크
if (msg == null || msg.trim().isEmpty()) {
return false;
}
// 체크섬 검증
try {
char splitChar = msg.charAt(msg.length() - 4);
if (splitChar == '*') {
String inputChecksum = msg.substring(msg.length() - 2, msg.length());
//String realChecksum = GmtUtils.makeCRC(originalMsg.getBytes());
String realChecksum = GmtUtils.makeCRC(originalMsg);
return inputChecksum.equals(realChecksum);
}
} catch (@SuppressWarnings("unused") Exception e) {
// Nothing to do
}
return false;
}
/**
* <br>
* null safe
* @param rawMsg
* @return , String
*/
private String decodeString(final byte[] rawMsg, Charset charset) {
// 메시지 길이 체크
if (rawMsg == null || rawMsg.length < 1) {
return "";
}
// 캐릭터 셋에 맞게 디코드
return new String(rawMsg, charset).trim();
}
/**
* (1)<br>
*
*/
@Order(0)
@EventListener(ApplicationReadyEvent.class)
public void initialize() {
try {
// 상태보고 스레드 생성, 1분간격으로 보고
stateReporter = new StatusReporter(this, CustomThread.SLEEP_MINIUTE);
// 업무 스레드 생성, 대기 없이 무한반복
bizThread = new CustomThread("bizThread", this, CustomThread.NO_SLEEP, this::bizWork, null, false);
// UDP소켓 객체 생성
//UDPSocket = new UDPEchoClient();
fileQ = new LinkedBlockingQueue<Map<String, String>>();
} catch(Exception e){
logger.writeLevelLog("[MainController] Prepare Fail " + e.getMessage(), LogLevelType.LOG_ERROR, "AllLog");
System.exit(1);
}
}
/**
* (2)<br>
*
*/
@Override
@Order(1)
@EventListener(ApplicationReadyEvent.class)
public void start() {
try {
running = true;
super.start();
// 상태보고 스레드 시작
//stateReporter.start();
// 업무로직 시작
bizThread.start();
// UDP수신 시작
//UDPSocket.start();
getFileBufer(fileQ, sfilepath1, sfilepath2);
} catch (Exception e) {
logger.writeLevelLog("[MainController] Start Fail " + e.getMessage(), LogLevelType.LOG_ERROR, "AllLog");
System.exit(1);
}
}
/**
* <br>
* while .<br>
* {@link CustomThread}
*/
private void bizWork() throws InterruptedException {
String msg = "";
// 읽어드린 데이터를 모두 전송한경우 초기화
if(fileQ.peek() == null) {
getFileBufer(fileQ, sfilepath1, sfilepath2);
lSendCnt = 0;
}
try {
int iSleep = 0;
// 클라이언트 포트 브로드캐스트
MsgObjVO msgVO = new MsgObjVO();
if(fileQ.peek() != null) {
Map<String, String> qMap = new HashMap<String, String>();
Map<String, String> qMap_after = new HashMap<String, String>();
qMap = fileQ.poll();
//msgVO.setMsg(qMap.get("data").getBytes(serviceConfig.getClientSendCharset()));
String sHexData = qMap.get("data").replaceAll("\\p{Z}", "");
msgVO.setMsg(new java.math.BigInteger(sHexData, 16).toByteArray());
broadcastUDP(msgVO);
// 다음 전송까지 대기 시간 계산
qMap_after = fileQ.peek();
String sTime_befre = qMap.get("time");
String sTime_after = qMap_after.get("time");
Date tb = new SimpleDateFormat("yyyyMMddHHmmss").parse(sTime_befre);
Date ta = new SimpleDateFormat("yyyyMMddHHmmss").parse(sTime_after);
long diffSec = (ta.getTime() - tb.getTime());
logger.writeLevelLog("[MainController-bizWork] send log : " + "***전송:" + sTime_befre + "***다음:" + sTime_after + "***차이:" + diffSec, LogLevelType.LOG_INFO, "AllLog");
// if(diffSec <0 ) {
// String sTim = "" ;
// }
lSendCnt ++;
// System.out.print("\n***" + lSendCnt + "건 전송*** " + qMap.get("data"));
Thread.sleep(diffSec);
}
} catch (InterruptedException e) {
if (running) {
logger.writeLevelLog("[MainController-bizWork] InterruptedException : " + e.getMessage(), LogLevelType.LOG_ERROR, "AllLog");
} else { // 종료 중 인터럽트 발생 시 throw
System.out.println(e);
}
} catch (Exception e) {
if (running) {
logger.writeLevelLog("[MainController-bizWork] running process Exception : " + e.getMessage(), LogLevelType.LOG_ERROR, "AllLog");
} else { // 종료 중 인터럽트 발생 시 throw
System.out.println(e);
}
}
}
public void getFileBufer(Queue<Map<String, String>> fileQ, String sFilePath1, String sFilePath2) {
//TextReader rf = new TextReader(file1, file2, sFilePath1, sFilePath2);
TextReaderMergeAndSort rf = new TextReaderMergeAndSort(fileQ, sFilePath1, sFilePath2);
rf.readFile();
// System.out.println(result);
}
public static byte[] binaryStringToByteArray(String s) {
int count = s.length() / 8;
byte[] b = new byte[count];
for (int i = 1; i < count; ++i) {
String t = s.substring((i - 1) * 8, i * 8);
b[i - 1] = binaryStringToByte(t);
}
return b;
}
public static byte binaryStringToByte(String s) {
byte ret = 0, total = 0;
for (int i = 0; i < 8; ++i) {
ret = (s.charAt(7 - i) == '1') ? (byte) (1 << i) : 0;
total = (byte) (ret | total);
}
return total;
}
/** 종료 처리 */
@Override
public void stop() {
super.stop();
// UDP소켓 종료
// try {
// UDPSocket.start();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
/** 종료 이벤트 (강제종료시 수행 안됨) */
@Override
public void onApplicationEvent(@SuppressWarnings("unused") ContextClosedEvent event) {
this.stop();
logger.writeLevelLog("====================== SYSTEM STOPED ======================", LogLevelType.LOG_INFO, "AllLog");
}
/** 클라이언트 포트 데이터 수신 */
@Override
protected void clientDataIn(MsgObjVO vo) {
if (vo.getMsg().length < 1) {
return;
}
try {
// 메시지 디코드
final String msg = decodeString(vo.getMsg(), serviceConfig.getClientReceiveCharset());
// 체크섬 제거한 데이터 추출
String originalMsg = msg.substring(0, msg.length() - 3);
// 체크섬 검증
if (serviceConfig.isClientReceiveChecksum() && !verifyChecksum(msg, originalMsg)) {
return; // 체크섬 에러 발생 시 무시
}
// TODO: 메시지 처리
} catch (Exception e) {
logger.writeLevelLog("[clientDataIn] Unknown Exception Occur2. " + e.getMessage(), LogLevelType.LOG_ERROR, "AllLog");
}
}
/** 서버 포트 데이터 수신 */
@Override
protected void serverDataIn(MsgObjVO vo) {
if (vo.getMsg().length < 1) {
return;
}
try {
// 메시지 디코드
final String msg = decodeString(vo.getMsg(), serviceConfig.getClientReceiveCharset());
// 체크섬 제거한 데이터 추출
String originalMsg = msg.substring(0, msg.length() - 3);
// 체크섬 검증
if (serviceConfig.isServerReceiveChecksum() && !verifyChecksum(msg, originalMsg)) {
return; // 체크섬 에러 발생 시 무시
}
// TODO: 메시지 처리
} catch (Exception e) {
logger.writeLevelLog("[serverDataIn] Unknown Exception Occur. " + e.getMessage(), LogLevelType.LOG_ERROR, "AllLog");
}
}
/** 시리얼 포트 데이터 수신 */
@Override
protected void serialDataIn(MsgObjVO vo) {
if (vo.getMsg().length < 1) {
return ;
}
try {
// TODO: 메시지 처리
}catch (Exception e) {
logger.writeLevelLog("[serialDataIn] Unknown Exception Occur. " + e.getMessage(), LogLevelType.LOG_ERROR, "AllLog");
}
}
/** Client 이벤트 */
@SuppressWarnings({ "unused", "synthetic-access"})
@Override
protected GmtClientEventListener createClientEventListener() {
return new GmtClientEventListener() {
@Override
public void disconnected(String ip, int port, int statusCode, String description) {
String msg = String.format("[Client Disconnect : IP[%s] / PORT [%d]", ip, port);
logger.writeLevelLog(msg, LogLevelType.LOG_INFO, "AllLog");
}
@Override
public void connected(String ip, int port, int statusCode, String description) {
String msg = String.format("[Client Connect : IP[%s] / PORT [%d]", ip, port);
logger.writeLevelLog(msg, LogLevelType.LOG_INFO, "AllLog");
}
@Override
public void readyToSend() {}
@Override
public void error(String ip, int port, int errorCode, String description) {}
@Override
public void dataIn() {}
@Override
public void connectionStatus(String ip, int port, String connEvent, int statusCode, String description) {}
@Override
public void SSLStatus() {}
@Override
public void SSLServerAuthentication() {}
};
}
/** Server 이벤트 */
@SuppressWarnings({ "unused", "synthetic-access"})
@Override
protected GmtServerEventListener createServerEventListener() {
return new GmtServerEventListener() {
@Override
public void disconnected(int serverPort, String remoteHost, int remotePort) {
String msg = String.format("[SERVER %d ] SC Disconnected.. IP : %s PORT : %d", serverPort, remoteHost, remotePort);
logger.writeLevelLog(msg, LogLevelType.LOG_INFO, "AllLog");
}
@Override
public void connected(int serverPort, String remoteHost, int remotePort) {
String msg = String.format("[SERVER %d ] SC Connected.. IP : %s PORT : %d", serverPort, remoteHost, remotePort);
logger.writeLevelLog(msg, LogLevelType.LOG_INFO, "AllLog");
}
@Override
public void readyToSend(int port) {}
@Override
public void error(int serverPort, String remoteHost, int remotePort, int errorCode, String description) {}
@Override
public void dataIn(int serverPort, String remoteHost, int remotePort, String msg) {}
@Override
public void SSLClientAuthentication(int serverPort) {}
};
}
@Override
protected void udpDataIn(MsgObjVO vo) {
if (vo.getMsg().length < 1) {
return;
}
try {
// 메시지 디코드
final String msg = decodeString(vo.getMsg(), serviceConfig.getClientReceiveCharset());
// // 체크섬 제거한 데이터 추출
// String originalMsg = msg.substring(0, msg.length() - 3);
// // 체크섬 검증
// if (serviceConfig.isClientReceiveChecksum() && !verifyChecksum(msg, originalMsg)) {
// return; // 체크섬 에러 발생 시 무시
// }
// TODO: 메시지 처리
packetQ.add(msg);
} catch (Exception e) {
logger.writeLevelLog("[clientDataIn] Unknown Exception Occur1. " + e.getMessage(), LogLevelType.LOG_ERROR, "AllLog");
}
}
@Override
protected GmtUDPEventListener createUDPEventListener() {
GmtUDPEventListener listener = new GmtUDPEventListener() {
@Override
public void readyToSend() {
// TODO Auto-generated method stub
}
@Override
public void error(String ip, int port, int errorCode, String description) {
// TODO Auto-generated method stub
}
@Override
public void disconnected(String ip, int port, int statusCode, String description) {
String msg = "[UDP Socket Disconnect : IP[" + ip + "] / PORT [" + String.valueOf(port) + "] ";
logger.writeLevelLog(msg, LogLevelType.LOG_INFO, "AllLog");
}
@Override
public void dataIn(int serverPort, String remoteHost, int remotePort, String msg) {
String msgd = "[UDP Socket d : IP[" + remoteHost + "] / PORT [" + String.valueOf(remotePort) + "] |msg:"+ msg;
logger.writeLevelLog(msgd, LogLevelType.LOG_INFO, "AllLog");
}
@Override
public void connectionStatus(String ip, int port, String connEvent, int statusCode, String description) {
// TODO Auto-generated method stub
}
@Override
public void connected(String ip, int port, int statusCode, String description) {
String msg = "[UDP Socket Connect : IP[" + ip + "] / PORT [" + String.valueOf(port) + "] ";
logger.writeLevelLog(msg, LogLevelType.LOG_INFO, "AllLog");
}
};
return listener;
}
}

View File

@ -0,0 +1,83 @@
package kr.gmtc.eyegw.db;
import javax.annotation.Resource;
import javax.sql.DataSource;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Mapper
@Configuration
@EnableTransactionManagement
@ConditionalOnProperty("db.db1.use")
@Component("DB1Connection")
public class DB1Connection {
@Bean(name="DB1DataSource")
@ConfigurationProperties(prefix = "db.db1.datasource")
public DataSource db1DataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name="DB1SqlSessionFactory")
public SqlSessionFactory db1SqlSessionFactory(
@Qualifier("DB1DataSource") DataSource dataSource,
ApplicationContext applicationContext) throws Exception {
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
// DataSource 지정
sqlSessionFactoryBean.setDataSource(dataSource);
// sqlmap 경로 지정
sqlSessionFactoryBean.setMapperLocations(applicationContext.getResources("classpath:/kr/gmtc/eyegw/mapper/dao1/DB1.xml"));
// 캐시 사용 여부
sqlSessionFactoryBean.getObject().getConfiguration().setCacheEnabled(false);
// JDBC null 데이터 타입 지정
sqlSessionFactoryBean.getObject().getConfiguration().setJdbcTypeForNull(JdbcType.NULL);
return sqlSessionFactoryBean.getObject();
}
@Bean(name = "DB1Session")
public SqlSessionTemplate session(
@Qualifier("DB1SqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
@Bean(name = "DB1BatchSession")
public SqlSessionTemplate batchSession(
@Qualifier("DB1SqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory, ExecutorType.BATCH);
}
@Resource(name = "DB1Session")
public SqlSessionTemplate session;
@Resource(name = "DB1BatchSession")
public SqlSessionTemplate batchSession;
public boolean isAlive() {
session.selectOne("kr.gmtc.eyegw.mapper.dbo1.DB1.ping");
return true;
}
}

View File

@ -0,0 +1,67 @@
package kr.gmtc.eyegw.file;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Queue;
import org.springframework.beans.factory.annotation.Value;
public class TextReader {
Queue<String> fileQ1;
Queue<String> fileQ2;
private String sfilepath1;
private String sfilepath2;
public TextReader(Queue<String> fileQ1, Queue<String> fileQ2, String sFilePath1, String sFilePath2) {
super();
this.fileQ1 = fileQ1;
this.fileQ2 = fileQ2;
this.sfilepath1 = sFilePath1;
this.sfilepath2 = sFilePath2;
}
public void readFile() {
try{
//파일 객체 생성
File file1 = new File(sfilepath1);
File file2 = new File(sfilepath2);
BufferedReader inFiles = new BufferedReader(new InputStreamReader(new FileInputStream(file1), StandardCharsets.UTF_8));
String line = "";
while((line = inFiles.readLine()) != null){
//if((char)singleCh == '\r')
fileQ1.offer(line);
//System.out.print("n\r" + line);
}
inFiles.close();
inFiles = new BufferedReader(new InputStreamReader(new FileInputStream(file2), StandardCharsets.UTF_8));
line = "";
while((line = inFiles.readLine()) != null){
//if((char)singleCh == '\r')
fileQ2.offer(line);
//System.out.print("n\r" + line);
}
inFiles.close();
}catch (FileNotFoundException e) {
// TODO: handle exception
}catch(IOException e){
System.out.println(e);
}
}
}

View File

@ -0,0 +1,156 @@
package kr.gmtc.eyegw.file;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import XcoreXipworksX160X6588.is;
public class TextReaderMergeAndSort {
HashMap<String, String> splitMap;
ArrayList<HashMap<String,String>> splitMaps1 = new ArrayList<HashMap<String,String>>();
ArrayList<HashMap<String,String>> splitMaps2 = new ArrayList<HashMap<String,String>>();
ArrayList<HashMap<String,String>> mergeList = new ArrayList<HashMap<String,String>>();
Queue<Map<String, String>> fileQ;
private String sfilepath1;
private String sfilepath2;
public TextReaderMergeAndSort(Queue<Map<String, String>> fileQ, String sFilePath1, String sFilePath2) {
super();
this.fileQ = fileQ;
this.sfilepath1 = sFilePath1;
this.sfilepath2 = sFilePath2;
}
public void readFile() {
try{
//파일 객체 생성
File file1 = new File(sfilepath1);
File file2 = new File(sfilepath2);
BufferedReader inFiles = new BufferedReader(new InputStreamReader(new FileInputStream(file1), StandardCharsets.UTF_8));
String line = "";
String lineSplit[] = null;
while((line = inFiles.readLine()) != null){
splitMap = new HashMap<String, String>();
lineSplit = line.split("[|]");
splitMap.put("time", lineSplit[0]);
splitMap.put("data", lineSplit[1]);
splitMaps1.add(splitMap);
}
inFiles.close();
inFiles = new BufferedReader(new InputStreamReader(new FileInputStream(file2), StandardCharsets.UTF_8));
line = "";
while((line = inFiles.readLine()) != null){
splitMap = new HashMap<String, String>();
lineSplit = line.split("[|]");
splitMap.put("time", lineSplit[0]);
splitMap.put("data", lineSplit[1]);
splitMaps2.add(splitMap);
}
inFiles.close();
mergeList.addAll(splitMaps1);
mergeList.addAll(splitMaps2);
// queue에 순서대로 담기
int iSize = mergeList.size();
if(iSize > 0) {
for(int idx=0; idx < iSize; idx++) {
// Unix Time -> KST Time으로 변환
try {
String sUnixTime = mergeList.get(idx).get("time");
sUnixTime = sUnixTime.substring(0, sUnixTime.indexOf(".") );
long ltimestamp = Long.parseLong(sUnixTime);
Date localdate = new Date(ltimestamp * 1000L);
SimpleDateFormat sformat = new SimpleDateFormat("yyyyMMddHHmmss");
sformat.setTimeZone(java.util.TimeZone.getTimeZone("GMT+9"));
String sCnvDate = sformat.format(localdate);
mergeList.get(idx).put("time", sCnvDate);
} catch (Exception e) {
System.out.println(e);
}
}
}
// Unix Time 기준으로 오름차순 정렬
int iTmp = 0;
try {
while(iTmp <= mergeList.size()) {
iTmp++;
Collections.sort(mergeList, new Comparator<HashMap<String, String >>() {
@Override
public int compare(HashMap<String, String> first, HashMap<String, String> second) {
String sfirst = first.get("time");
String ssecond = second.get("time");
return sfirst.compareTo(ssecond);
}
});
}
} catch (Exception e) {
System.out.println(e);
}
// 큐에 담기
// queue에 순서대로 담기
for(int idx=0; idx < iSize; idx++) {
fileQ.offer(mergeList.get(idx));
}
}catch (FileNotFoundException e) {
// TODO: handle exception
}catch(IOException e){
System.out.println(e);
}
}
}

View File

@ -0,0 +1,118 @@
package kr.gmtc.eyegw.frame;
import gmt.common.type.LogLevelType;
import gmt.logger.GmtLogManager;
import kr.gmtc.eyegw.frame.handler.CustomThreadOnTerminate;
import kr.gmtc.eyegw.frame.handler.CustomThreadWork;
public class CustomThread extends Thread{
/* 대기시간 없음 */
public static final long NO_SLEEP = 0;
/* 1밀리 초 */
public static final long SLEEP_MILLI_SEC = 1;
/* 1초 */
public static final long SLEEP_SECOND = 1000;
/* 30초 */
public static final long SLEEP_HALF_MINIUTE = 30000;
/* 1분 */
public static final long SLEEP_MINIUTE = 60000;
public final String controllClassName;
public final long repeatMiliSec;
public final CustomThreadWork definedWork;
public final CustomThreadOnTerminate definedTerminate;
public final GmtLogManager logger;
private boolean running;
/**
* .<br>
* {@link Thread#sleep(long)} .<br>
* sleep <br>
* {@link #gracefulStop()}
* @param threadName
* @param controllClass , this
* @param repeatMiliSec Sleep ( ), 0
* @param definedWork
* @param definedTerminate
* @param autoStart
*/
public CustomThread(String threadName, Object controllClass, long repeatMiliSec,
CustomThreadWork definedWork, CustomThreadOnTerminate definedTerminate, boolean autoStart) {
if (definedWork == null) {
throw new IllegalArgumentException("[CustomThread] - definedWork is null.");
}
this.definedWork = definedWork;
this.definedTerminate = definedTerminate;
this.controllClassName = controllClass == null ? "" : controllClass.getClass().getSimpleName();
this.repeatMiliSec = repeatMiliSec > 0 ? repeatMiliSec : 0;
this.logger = GmtLogManager.getInstance();
this.running = false;
setName(threadName);
setDaemon(true);
if (autoStart) {
this.start();
}
}
private void log(LogLevelType level, String message) {
String str = String.format("[%s] - %s: %s", controllClassName, getName(), message);
logger.writeLevelLog(str, level, "AllLog");
}
@Override
public void run() {
log(LogLevelType.LOG_INFO, "Started.");
while ( this.running && !this.isInterrupted()) {
try {
try {
this.definedWork.work();
} finally {
if (this.repeatMiliSec > 0) {
Thread.sleep(this.repeatMiliSec);
}
}
} catch(InterruptedException e) { // 인터럽트 수신시 종료
log(LogLevelType.LOG_ERROR, "Interrupted. " + e.toString());
Thread.currentThread().interrupt();
break;
} catch(Exception e) { // 처리되지 않은 예외 로깅, 예외에 의한 무한루프에 주의
log(LogLevelType.LOG_ERROR, "Unknown Exception Occur. " + e.toString());
}
}
if(this.definedTerminate != null) {
this.definedTerminate.onTerminate();
}
log(LogLevelType.LOG_ERROR, "Stoped.");
}
@Override
public String toString() {
return "CustomThread [controllClass=" + this.controllClassName + ", threadName=" + getName() +
", runnig=" + this.running + ", alive=" + isAlive()+ ", repeatMiliSec=" + this.repeatMiliSec +
", definedTerminate=" + (this.definedTerminate == null ? "no" : "yes") + "]";
}
@Override
public synchronized void start() {
this.running = true;
super.start();
}
/**
* , .
*/
public void gracefulStop() {
this.running = false;
}
}

View File

@ -0,0 +1,104 @@
package kr.gmtc.eyegw.frame;
import gmt.common.type.LogLevelType;
import gmt.io.client.vo.ClientInfoVO;
import gmt.io.server.vo.ServerInfoVO;
import gmt.io.server.vo.ServiceClientVO;
import gmt.logger.GmtLogManager;
import kr.gmtc.eyegw.controller.MainController;
public class StatusReporter {
private final CustomThread reporter;
private final MainController controller;
private final GmtLogManager logger;
public StatusReporter(MainController controller, long reportInterval) {
reporter = new CustomThread("stateReporter", controller, reportInterval, this::reportState, null, false);
this.controller = controller;
this.logger = GmtLogManager.getInstance();
}
/** 상태 보고 스레드 */
private void reportState() {
try {
StringBuilder logContent = new StringBuilder();
logContent.append("\n=================== Monitoring info ===================");
logContent.append("\n");
logContent.append(String.format("1. Total RcvQ : %d/%d", controller.getCurrnetRecvQCount(), 100000));
logContent.append("\n");
logContent.append(String.format("2. Total SndQ : %d/%d", controller.getCurrnetSendQCount(), 100000));
int cnt;
if (controller.clientAccess) {
logContent.append("\n3. Client Monitor Info(s)");
cnt = 0;
for (ClientInfoVO clientInfo: controller.clientInfoList) {
String infoStr = String.format("%d. [%s:%d] %s: Rcv - %d, Snd - %d, QCnt - %d/%d",
cnt++,
clientInfo.getIp(),
clientInfo.getPort(),
clientInfo.getName(),
clientInfo.getMonitorInfo().getRecvMonitorCount(),
clientInfo.getMonitorInfo().getSendMonitorCount(),
clientInfo.getMonitorInfo().getSendQCount(),
clientInfo.getMonitorInfo().getSendQBufferCount());
logContent.append("\n\t");
logContent.append(infoStr);
}
} else {
logContent.append("\n3. Client Not Used.");
}
if (controller.serverAccess) {
logContent.append("\n4. Server Monitor Info(s)");
cnt = 0;
for (ServerInfoVO serverInfo: controller.serverInfoList) {
String infoStr = String.format("%d. [:%d] %s: SC cnt - %d, QCnt - %d/%d",
cnt++,
serverInfo.getPort(),
serverInfo.getName(),
serverInfo.getServiceClientCount(),
serverInfo.getSndQcount(),
serverInfo.getMaxSndQCount());
logContent.append("\n\t");
logContent.append(infoStr);
}
logContent.append("\n5. Service Client Monitor Info(s)");
cnt = 0;
for (ServiceClientVO serverClientVO: controller.serverScInfoList.values()) {
String infoStr = String.format("%d. [:%d <- %s:%d] %s: Rcv - %d, Snd - %d, RcvByte - %d, SndByte - %d, Qcnt - %d/%d",
cnt++,
serverClientVO.getServerPort(),
serverClientVO.getIp(),
serverClientVO.getServicePort(),
serverClientVO.getName(),
serverClientVO.getMonitorInfoVO().getRecvMonitorCount(),
serverClientVO.getMonitorInfoVO().getSendMonitorCount(),
serverClientVO.getMonitorInfoVO().getRecvMonitorByteSize(),
serverClientVO.getMonitorInfoVO().getSendMonitorByteSize(),
serverClientVO.getMonitorInfoVO().getSendQCount(),
serverClientVO.getMonitorInfoVO().getSendQBufferCount());
logContent.append("\n\t");
logContent.append(infoStr);
}
} else {
logContent.append("\n\t4. Server Not Used.");
logContent.append("\n\t5. Service Client Not Used.");
}
logContent.append("\n=======================================================");
logger.writeLevelLog("[reportState] Report Status:" + logContent.toString(), LogLevelType.LOG_INFO, "AllLog");
} catch (Exception e) {
logger.writeLevelLog("[reportState] Unknown Exception Occur. " + e.getMessage(), LogLevelType.LOG_ERROR, "AllLog");
}
}
public void start() {
reporter.start();
}
public void stop() {
reporter.gracefulStop();
}
}

View File

@ -0,0 +1,6 @@
package kr.gmtc.eyegw.frame.handler;
@FunctionalInterface
public interface CustomThreadOnTerminate {
public void onTerminate();
}

View File

@ -0,0 +1,6 @@
package kr.gmtc.eyegw.frame.handler;
@FunctionalInterface
public interface CustomThreadWork {
public void work() throws Exception;
}

View File

@ -0,0 +1,47 @@
package kr.gmtc.eyegw.udpsocket;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
public class UDPEchoClient {
final static String SERVER_IP = "localhost";
final static int SERVER_PORT = 3384;
DatagramSocket ds;
public void start() throws IOException {
ds = new DatagramSocket(3384); // 패킷을 전송받을 포트를 열어둔다.
//ds.connect(new InetSocketAddress(7000));
System.out.println("isConnected : "+ ds.isConnected());
System.out.println("port : "+ ds.getPort());
System.out.println("localAddr : "+ ds.getLocalAddress());
System.out.println("localPort : "+ ds.getLocalPort());
while(true) { // 무한루프 통해 메시지 계속 전송받는다
byte[] data = new byte[65508]; // 한번에 받을 수 있는 최대 용량의 데이터 공간은 기본 정보 공간을 제외한 65,508 byte
//데이터를 수신받을 객체
DatagramPacket dp = new DatagramPacket(data, data.length);
ds.receive(dp);
//전송받은 패킷이 발송된 곳의 IP주소와 내용 출력
System.out.println(dp.getAddress().getHostAddress() + " >> " + new String(dp.getData()).trim());
}
}
public void stop() {
if(!ds.isClosed()) {
ds.close();
}
}
}

View File

@ -0,0 +1,82 @@
## Client/Server Port Configuration
## Default ##
#tcpip:
# client:
# send: UTF-8
# receive: UTF-8
# checksum: true
# server:
# receive: UTF-8
# send: UTF-8
# checksum: true
tcpip:
client:
send: UTF-8
receive: UTF-8
checksum: true
server:
receive: UTF-8
send: UTF-8
checksum: true
server:
port: 8081
asde:
filepath1: D:\\작업임시\\Asterix_Parse\\java\\Asterix010.txt
filepath2: D:\\작업임시\\Asterix_Parse\\java\\Asterix011.txt
## DB Configuration
db:
db1:
use: true
datasource:
poolName: IPT DB
jdbc-url: jdbc:oracle:thin:@118.220.143.155:1521:TEST155
username: IPT
password: IPT
autoCommit: true
connectionTimeout: 3000
idleTimeout: 600000
keepaliveTime: 0
maxLifetime: 1800000
minimumIdle: 1
maximumPoolSize: 5
# db2:
# use: false
# datasource:
# poolName: secondary
# jdbc-url: jdbc:tibero:thin:@118.220.143.155:8629:secondary
# username: secondary
# password: secondary
# autoCommit: true
# connectionTimeout: 3000
# idleTimeout: 600000
# keepaliveTime: 0
# maxLifetime: 1800000
# minimumIdle: 1
# maximumPoolSize: 5
## Execution Profile
## spring.profiles - Execution Profile Name, Set as "-Dspring.profiles.active=${PROFILE}"
## root - Application installed location
---
## "default" Execution Profile
spring:
profiles: default
# root: /home/manager/GMT/EyeGW_FlowController
root: D:\Workspace\Eclipse_UDP-Send\EyeGW-UDP-Send
---
## "production" Execution Profile
spring:
profiles: production
# root: /home/manager/GMT/EyeGW_FlowController
root: D:\Workspace\Eclipse_UDP-Send\EyeGW-UDP-Send
---
## "debug" Execution Profile
spring:
profiles: debug
# root: D:\[Project]\_E_Nav\UnSyncWorkSpace\EyeGW
root: D:\Workspace\Eclipse_UDP-Send\EyeGW-UDP-Send

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.gmtc.eyegw.mapper.dbo1.DB1">
<select id="ping" resultType="java.lang.Integer">
SELECT 1 FROM DUAL
</select>
</mapper>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!-- 데이터 소스 관리는 Spring Boot에서 하기 때문에 여기에 작성하지 않는다. -->
<mappers>
<mapper resource="kr/gmtc/eyegw/mapper/dao1/Db1.xml"/>
</mappers>
</configuration>

Binary file not shown.