|
@@ -25,6 +25,7 @@ import org.springframework.context.ApplicationListener;
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.context.event.ContextClosedEvent;
|
|
|
+import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
|
|
|
import javax.swing.*;
|
|
@@ -32,7 +33,9 @@ import java.awt.*;
|
|
|
import java.awt.event.WindowAdapter;
|
|
|
import java.awt.event.WindowEvent;
|
|
|
import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
import java.io.PrintStream;
|
|
|
+import java.net.URL;
|
|
|
|
|
|
@Slf4j
|
|
|
@EnableAsync
|
|
@@ -76,42 +79,6 @@ public class VdsCommServerApplication implements CommandLineRunner, ApplicationL
|
|
|
|
|
|
@Override
|
|
|
public void run(String... args) throws Exception {
|
|
|
- SwingUtilities.invokeLater(() -> {
|
|
|
- String pathOfImage = "C:\\DEV\\ITS\\01.WINDOWS\\22.01.YONGIN\\JAVA\\vds-comm-server\\src\\main\\resources\\static\\image\\application.png";
|
|
|
- String sysTime = SysUtils.getSysTimeStr();
|
|
|
- //JFrame.setDefaultLookAndFeelDecorated(true);
|
|
|
- JFrame frame = new JFrame("VDS 통신 서버 - [" + sysTime + "]");
|
|
|
- MainUI UI = new MainUI(frame);
|
|
|
- frame.setIconImage(Toolkit.getDefaultToolkit().getImage(pathOfImage));
|
|
|
- frame.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
|
|
|
- frame.setContentPane(UI.getRootPanel());
|
|
|
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
- frame.addWindowListener(new WindowAdapter() {
|
|
|
- @Override
|
|
|
- public void windowClosing(WindowEvent e) {
|
|
|
- if (JOptionPane.showConfirmDialog(UI.getRootPanel(), "시스템을 종료 하시겠습니까?", "시스템 종료", 0) == 0) {
|
|
|
- System.exit(0);
|
|
|
- } else {
|
|
|
- frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- frame.pack();
|
|
|
- frame.setBounds(100, 100, 1000, 800);
|
|
|
- frame.setLocationRelativeTo(null);
|
|
|
- frame.setVisible(true);
|
|
|
-
|
|
|
- JTextArea logArea = UI.getTaLog();
|
|
|
- logArea.setText(null);
|
|
|
- JTextAreaOutputStream out = new JTextAreaOutputStream(logArea);
|
|
|
- System.setOut(new PrintStream(out));
|
|
|
-// try {
|
|
|
-// PrintStream outStream = new PrintStream(out, true, "euc-kr");
|
|
|
-// System.setOut(outStream);
|
|
|
-// } catch (UnsupportedEncodingException e) {
|
|
|
-// //throw new RuntimeException(e);
|
|
|
-// }
|
|
|
- });
|
|
|
|
|
|
ProcessConfig processConfig = (ProcessConfig) AppUtils.getBean(ProcessConfig.class);
|
|
|
|
|
@@ -141,30 +108,53 @@ public class VdsCommServerApplication implements CommandLineRunner, ApplicationL
|
|
|
VdsCtlrService ctlrService = (VdsCtlrService)AppUtils.getBean(VdsCtlrService.class);
|
|
|
ctlrService.loadDb();
|
|
|
ctlrService.updateCtlrStts(true);
|
|
|
- MainUI mainUI = MainUI.getInstance();
|
|
|
- if (mainUI != null) {
|
|
|
- mainUI.LoadControllerInfo(ctlrService);
|
|
|
- }
|
|
|
|
|
|
VdsTcpClientCommService vdsCommClientService = (VdsTcpClientCommService)AppUtils.getBean(VdsTcpClientCommService.class);
|
|
|
vdsCommClientService.run();
|
|
|
|
|
|
CenterTcpServerService centerService = (CenterTcpServerService)AppUtils.getBean(CenterTcpServerService.class);
|
|
|
centerService.run();
|
|
|
-//
|
|
|
-// UdpServerCenterComm udpServerCenterComm = (UdpServerCenterComm)AppUtils.getBean(UdpServerCenterComm.class);
|
|
|
-// udpServerCenterComm.run();
|
|
|
|
|
|
// schedule enable
|
|
|
processConfig.setStartSchedule(true);
|
|
|
|
|
|
- /*byte val1 = 35;
|
|
|
- byte val2 = -35;
|
|
|
- int nval1 = (int)val1;
|
|
|
- int nval2 = (int)val2;
|
|
|
- short sval1 = (short)nval1;
|
|
|
- short sval2 = (short)nval2;
|
|
|
- log.error("val1: {}, val2: {}, nval1: {}, nval2: {}, sval1: {}, sval2: {}", val1, val2, nval1, nval2, sval1, sval2);*/
|
|
|
+ SwingUtilities.invokeLater(() -> {
|
|
|
+ String sysTime = SysUtils.getSysTimeStr();
|
|
|
+ //JFrame.setDefaultLookAndFeelDecorated(true);
|
|
|
+ JFrame frame = new JFrame("VDS 통신 서버 - [" + sysTime + "]");
|
|
|
+ MainUI UI = new MainUI(frame);
|
|
|
+ try {
|
|
|
+ ClassPathResource file = new ClassPathResource("static/image/application.png");
|
|
|
+ URL imgURL = file.getURL();
|
|
|
+ frame.setIconImage(new ImageIcon(imgURL).getImage());
|
|
|
+ } catch (IOException e) {
|
|
|
+ log.error("Not found application icon image");
|
|
|
+ }
|
|
|
+ frame.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
|
|
|
+ frame.setContentPane(UI.getRootPanel());
|
|
|
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
+ frame.addWindowListener(new WindowAdapter() {
|
|
|
+ @Override
|
|
|
+ public void windowClosing(WindowEvent e) {
|
|
|
+ if (JOptionPane.showConfirmDialog(UI.getRootPanel(), "시스템을 종료 하시겠습니까?", "시스템 종료", 0) == 0) {
|
|
|
+ System.exit(0);
|
|
|
+ } else {
|
|
|
+ frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ frame.pack();
|
|
|
+ frame.setBounds(100, 100, 1000, 800);
|
|
|
+ frame.setLocationRelativeTo(null);
|
|
|
+ frame.setVisible(true);
|
|
|
+
|
|
|
+ JTextArea logArea = UI.getTaLog();
|
|
|
+ logArea.setText(null);
|
|
|
+ JTextAreaOutputStream out = new JTextAreaOutputStream(logArea);
|
|
|
+ System.setOut(new PrintStream(out));
|
|
|
+
|
|
|
+ UI.LoadControllerInfo();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
public void terminateApplication() {
|
|
@@ -178,13 +168,6 @@ public class VdsCommServerApplication implements CommandLineRunner, ApplicationL
|
|
|
|
|
|
VdsTcpClientCommService vdsCommClientService = (VdsTcpClientCommService)AppUtils.getBean(VdsTcpClientCommService.class);
|
|
|
vdsCommClientService.shutdown();
|
|
|
-
|
|
|
-// TcpServerVdsComm tcpServersComm = (TcpServerVdsComm)AppUtils.getBean(TcpServerVdsComm.class);
|
|
|
-// tcpServersComm.getAcceptGroups().shutdownGracefully();
|
|
|
-// tcpServersComm.getWorkerGroups().shutdownGracefully();
|
|
|
-
|
|
|
-// UdpServerCenterComm udpServerCenterComm = (UdpServerCenterComm)AppUtils.getBean(UdpServerCenterComm.class);
|
|
|
-// udpServerCenterComm.getNioEventLoopGroup().shutdownGracefully();
|
|
|
}
|
|
|
@Override
|
|
|
public void onApplicationEvent(ContextClosedEvent event) {
|