FileFetchRequestHandler 구현
This commit is contained in:
+6
-1
@@ -8,4 +8,9 @@ build
|
||||
*.log
|
||||
*.tmp
|
||||
bin
|
||||
tmp
|
||||
tmp
|
||||
libs/
|
||||
.metadata/
|
||||
.idea/
|
||||
weblogic_mock/
|
||||
.gitignore
|
||||
@@ -8,9 +8,6 @@ ANT_HOME=/c/eactive/apps/apache-ant-1.10.15
|
||||
|
||||
export PATH=${PATH}:${JAVA_HOME}/bin:${ANT_HOME}/bin
|
||||
|
||||
cd /c/eactive/workspaces/kjb-bap/BAPRMSClient
|
||||
ant -s build-server.xml archive
|
||||
|
||||
cd /c/eactive/workspaces/kjb-bap/BAPWeb
|
||||
ant -s build.xml war
|
||||
```
|
||||
|
||||
@@ -17,16 +17,16 @@
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
|
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
|
||||
">
|
||||
">
|
||||
|
||||
<bean id="TimerEventListener" class="com.eactive.eai.common.routing.jms.TimerEventListenerQueueConsumerService">
|
||||
<property name="uri" value="jms/cft01BapConnectionFactory"/>
|
||||
<property name="queue" value="jms/qu01Bap11Svr01TimerQueue"/>
|
||||
<bean id="TimerEventListener" class="com.eactive.eai.common.routing.TimerEventListenerConsumerService">
|
||||
<property name="uri" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
|
||||
<property name="queue" value="com.eactive.eai.common.timerQueue"/>
|
||||
<property name="maxThread" value="100"/>
|
||||
</bean>
|
||||
<bean id="JobPolingHandler" class="com.eactive.eai.common.routing.jms.JobPolingHandlerQueueConsumerService">
|
||||
<property name="uri" value="jms/cft01BapConnectionFactory"/>
|
||||
<property name="queue" value="jms/qu01Bap11Svr01JobQueue"/>
|
||||
<bean id="JobPolingHandler" class="com.eactive.eai.common.routing.JobHandlerConsumerService">
|
||||
<property name="uri" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
|
||||
<property name="queue" value="com.eactive.eai.common.jobQueue"/>
|
||||
<property name="maxThread" value="100"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ applicationContext-jms.xml<?xml version="1.0" encoding="UTF-8"?>
|
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
|
||||
">
|
||||
|
||||
<bean id="TimerEventListener" class="com.eactive.eai.common.routing.jms.TimerEventListenerQueueConsumerService">
|
||||
<property name="uri" value="jms/cft01BapConnectionFactory"/>
|
||||
<property name="queue" value="jms/qu01Bap11Svr01TimerQueue"/>
|
||||
<bean id="TimerEventListener" class="com.eactive.eai.common.routing.TimerEventListenerConsumerService">
|
||||
<property name="uri" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
|
||||
<property name="queue" value="com.eactive.eai.common.timerQueue"/>
|
||||
<property name="maxThread" value="100"/>
|
||||
</bean>
|
||||
<bean id="JobPolingHandler" class="com.eactive.eai.common.routing.jms.JobPolingHandlerQueueConsumerService">
|
||||
<property name="uri" value="jms/cft01BapConnectionFactory"/>
|
||||
<property name="queue" value="jms/qu01Bap11Svr01JobQueue"/>
|
||||
<bean id="JobPolingHandler" class="com.eactive.eai.common.routing.JobHandlerConsumerService">
|
||||
<property name="uri" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
|
||||
<property name="queue" value="com.eactive.eai.common.jobQueue"/>
|
||||
<property name="maxThread" value="100"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ applicationContext-jms.xml<?xml version="1.0" encoding="UTF-8"?>
|
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
|
||||
">
|
||||
|
||||
<bean id="TimerEventListener" class="com.eactive.eai.common.routing.jms.TimerEventListenerQueueConsumerService">
|
||||
<property name="uri" value="jms/cft01BapConnectionFactory"/>
|
||||
<property name="queue" value="jms/qu01Bap21Svr01TimerQueue"/>
|
||||
<bean id="TimerEventListener" class="com.eactive.eai.common.routing.TimerEventListenerConsumerService">
|
||||
<property name="uri" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
|
||||
<property name="queue" value="com.eactive.eai.common.timerQueue"/>
|
||||
<property name="maxThread" value="100"/>
|
||||
</bean>
|
||||
<bean id="JobPolingHandler" class="com.eactive.eai.common.routing.jms.JobPolingHandlerQueueConsumerService">
|
||||
<property name="uri" value="jms/cft01BapConnectionFactory"/>
|
||||
<property name="queue" value="jms/qu01Bap21Svr01JobQueue"/>
|
||||
<bean id="JobPolingHandler" class="com.eactive.eai.common.routing.JobHandlerConsumerService">
|
||||
<property name="uri" value="vm://localhost?broker.persistent=false&broker.useJmx=false"/>
|
||||
<property name="queue" value="com.eactive.eai.common.jobQueue"/>
|
||||
<property name="maxThread" value="100"/>
|
||||
</bean>
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -37,24 +37,14 @@
|
||||
</servlet>
|
||||
<servlet>
|
||||
<description></description>
|
||||
<servlet-name>FepSendFile</servlet-name>
|
||||
<servlet-class>com.eactive.eai.agent.web.FepSendFile</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<description></description>
|
||||
<servlet-name>FepReqRecvFile</servlet-name>
|
||||
<servlet-class>com.eactive.eai.agent.web.FepReqRecvFile</servlet-class>
|
||||
<servlet-name>FileFetchRequest</servlet-name>
|
||||
<servlet-class>com.eactive.eai.agent.web.FileFetchRequestHandler</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<description></description>
|
||||
<servlet-name>CheckFileSysHealth</servlet-name>
|
||||
<servlet-class>com.eactive.eai.agent.web.CheckFileSysHealth</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<description></description>
|
||||
<servlet-name>FepFileSend</servlet-name>
|
||||
<servlet-class>com.eactive.eai.agent.web.FepFileSend</servlet-class>
|
||||
</servlet>
|
||||
<servlet>
|
||||
<description></description>
|
||||
<servlet-name>FepFileReceive</servlet-name>
|
||||
@@ -71,21 +61,13 @@
|
||||
<url-pattern>/DBRefreshAgent</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>FepSendFile</servlet-name>
|
||||
<url-pattern>/FepSendFile</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>FepReqRecvFile</servlet-name>
|
||||
<url-pattern>/FepReqRecvFile</url-pattern>
|
||||
<servlet-name>FileFetchRequest</servlet-name>
|
||||
<url-pattern>/FileFetchRequest</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>CheckFileSysHealth</servlet-name>
|
||||
<url-pattern>/CheckFileSysHealth</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>FepFileSend</servlet-name>
|
||||
<url-pattern>/FepFileSend</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>FepFileReceive</servlet-name>
|
||||
<url-pattern>/FepFileReceive</url-pattern>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd">
|
||||
<wls:context-root>BAPWeb</wls:context-root>
|
||||
|
||||
<wls:container-descriptor>
|
||||
<wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
|
||||
</wls:container-descriptor>
|
||||
</wls:weblogic-web-app>
|
||||
@@ -1,58 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project basedir="." default="build" name="BAPWeb">
|
||||
<property environment="env"/>
|
||||
<property name="WEBLOGIC_HOME.location" value="/weblogic/Oracle14120/MiddleWare/Oracle_Home" />
|
||||
<!-- <property name="WEBLOGIC_HOME.location" value="C:\Oracle\Middleware\Oracle_Home"/> -->
|
||||
<property name="debuglevel" value="source,lines,vars"/>
|
||||
<property name="target" value="1.8"/>
|
||||
<property name="source" value="1.8"/>
|
||||
<property name="BAPRMSClient.location" value="../BAPRMSClient"/>
|
||||
<property name="target" value="17"/>
|
||||
<property name="source" value="17"/>
|
||||
|
||||
<property name="libs" value="WebContent/WEB-INF/lib"/>
|
||||
|
||||
<path id="WebApp.Libraries">
|
||||
<fileset dir="WebContent/WEB-INF/lib/" includes="*.jar"/>
|
||||
<fileset dir="${BAPRMSClient.location}/.deploy" includes="BAPRMSClient.jar"/>
|
||||
<!--fileset dir="WebContent/WEB-INF/lib/" includes="*.jar"/ -->
|
||||
<fileset dir="WebContent/WEB-INF/lib/" includes="*.jar" excludes="ezgatormodule2.jar"/>
|
||||
<fileset dir="libs/" includes="*.jar"/>
|
||||
</path>
|
||||
|
||||
<!--path id="Servlet.Libraries">
|
||||
<fileset dir="../COMWeb/module-build/" includes="*.jar"/>
|
||||
</path-->
|
||||
<path id="WebLogic System Libraries.libraryclasspath">
|
||||
<fileset dir="${WEBLOGIC_HOME.location}/wlserver/server/lib/" includes="*.jar"/>
|
||||
<fileset dir="${WEBLOGIC_HOME.location}/oracle_common/modules/" includes="*.jar"/>
|
||||
<fileset dir="${WEBLOGIC_HOME.location}/wlserver/modules/" includes="*.jar"/>
|
||||
|
||||
<!-- <pathelement location="${WEBLOGIC_HOME.location}/wlserver/server/lib/api.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/org.glassfish.web.javax.servlet.jsp.jstl.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.annotation_1.2.0.0_1-1.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.ejb_3.3.0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.enterprise.deploy_1.4.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.enterprise.inject_1.2.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.interceptor_1.3.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.jdo_2.0.4.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.jms_1.1.4.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/glassfish.jsf_2.0.0.0_2-1-20.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.jsp_4.0.0.0_2-2.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.mail_2.0.0.0_1-4-4.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.management.j2ee_1.2.0.0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.persistence_2.0.0.0_2-0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.resource_1.7.0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.security.auth.message_2.2.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.security.jacc_1.2.0.0_1-1.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.servlet_2.2.0.0_3-0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.transaction_2.2.0.0_1-1.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.validation_1.2.0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.xml.bind_1.0.0.0_2-2-3.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.xml.registry_1.2.0.0_1-0-4.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/jaxrpc-api-1.1.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/oracle_common/modules/javax.xml.ws_1.0.0.0_2-2.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.websocket_1.0.0.0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/modules/javax.json_1.0.0.0_1-0.jar"/>
|
||||
<pathelement location="${WEBLOGIC_HOME.location}/wlserver/server/lib/wls-api.jar"/> -->
|
||||
</path>
|
||||
<path id="BAPWeb.classpath">
|
||||
<pathelement location="build/classes"/>
|
||||
<path refid="WebApp.Libraries"/>
|
||||
<path refid="WebLogic System Libraries.libraryclasspath"/>
|
||||
</path>
|
||||
<target name="init">
|
||||
<mkdir dir="build/classes"/>
|
||||
@@ -68,21 +31,15 @@
|
||||
<target depends="clean" name="cleanall">
|
||||
</target>
|
||||
<target depends="build-project" name="build"/>
|
||||
<target name="build-subprojects">
|
||||
<ant antfile="build-server.xml" dir="${BAPRMSClient.location}" inheritAll="false" target="archive">
|
||||
<propertyset>
|
||||
<propertyref name="build.compiler"/>
|
||||
</propertyset>
|
||||
</ant>
|
||||
</target>
|
||||
<target depends="init" name="build-project">
|
||||
<echo message="${ant.project.name}: ${ant.file}"/>
|
||||
<javac debug="true" debuglevel="${debuglevel}" destdir="build/classes" includeantruntime="false" source="${source}" target="${target}" encoding="utf-8">
|
||||
<src path="src"/>
|
||||
<classpath refid="BAPWeb.classpath"/>
|
||||
</javac>
|
||||
<javac debug="true" debuglevel="${debuglevel}" destdir="build/classes" includeantruntime="false" source="${source}" target="${target}" encoding="utf-8" fork="true">
|
||||
<src path="src"/>
|
||||
<classpath refid="BAPWeb.classpath"/>
|
||||
<compilerarg value="-Xlint:-options"/>
|
||||
</javac>
|
||||
</target>
|
||||
<target depends="clean,build-subprojects,build-project" name="war" >
|
||||
<target depends="clean,build-project" name="war" >
|
||||
<delete dir="dist"></delete>
|
||||
<mkdir dir="dist"></mkdir>
|
||||
<war jarfile="dist/BAPWeb.war" webxml="WebContent/WEB-INF/web.xml">
|
||||
@@ -91,9 +48,6 @@
|
||||
<exclude name="WEB-INF/web.xml" />
|
||||
<exclude name="META-INF/context*.xml" />
|
||||
</zipfileset>
|
||||
<zipfileset dir="${BAPRMSClient.location}/.deploy" prefix="WEB-INF/lib" >
|
||||
<include name="BAPRMSClient.jar"/>
|
||||
</zipfileset>
|
||||
<classes dir="build/classes" />
|
||||
</war>
|
||||
<tstamp>
|
||||
|
||||
@@ -0,0 +1,409 @@
|
||||
package com.eactive.eai.adapter.ftp;
|
||||
|
||||
import com.eactive.eai.adapter.socket.config.ConfigurationContext;
|
||||
import com.eactive.eai.adapter.socket.service.SocketService;
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.batch.common.CalendarUtil;
|
||||
import com.eactive.eai.batch.common.LogUtil;
|
||||
import com.eactive.eai.batch.common.StringUtil;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.doc.Body;
|
||||
import com.eactive.eai.batch.doc.Header;
|
||||
import com.eactive.eai.batch.ftp.FTPFileObject;
|
||||
import com.eactive.eai.batch.ftp.FTPUtil;
|
||||
import com.eactive.eai.batch.running.BatchRunningJobManager;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
import com.eactive.eai.common.util.DatetimeUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* DJBank 공융 sftp 전송을 위함 SFTP proxy사용
|
||||
*
|
||||
* 파일명 : FTPDJ
|
||||
*
|
||||
*/
|
||||
|
||||
public class FTPDJ extends Transfer implements SocketService {
|
||||
|
||||
private static final String PROP_GROUP_NAME_PREFIX = "TelegramInfo";
|
||||
|
||||
private static final String REMOTE_PATH = "remote.path";// 원격지 경로 #YYYYMMDD#
|
||||
private static final String FILENAME_PATTERN = "filename.pattern";// 기준일자 [YYYYMMDD] 당일이전일 [YYYYMMDD-1][YYYYMMDD-2][YYYYMMDD+1]
|
||||
private static final String EXT_NAME = "ext.name";
|
||||
private static final String FTP_TRANSFER_TYPE = "ftp.transfer.type";// ftp ASCII 인 경우만 default BINARY
|
||||
private static final String BASE_DATE_OVER_YN = "basedate.over.yn"; // 기준일 이후 파일전송여부
|
||||
private static final String PROXY_SERVER = "proxy.server"; // 프록시 서버
|
||||
private static final String PROTOCOL = "protocol"; // 프록시 서버
|
||||
private static final String CHECK_FILE_EXT = "check.file.ext";
|
||||
|
||||
/** ftp 0 , 인증 방법 1 = id, 2 = key 방식 */
|
||||
private static final String AUTH_TYPE = "sftp.auth.type";
|
||||
private static final String TRANS_LIB = "sftp.trans.lib";
|
||||
|
||||
enum Protocol {
|
||||
FTP("0", false), SFTP_PASSWD("1"), SFTP_KEY("2");
|
||||
|
||||
private final String val;
|
||||
private final boolean isSFtp;
|
||||
|
||||
Protocol(String val) { this(val, true); }
|
||||
Protocol(String val, boolean isSFtp) {
|
||||
this.val = val;
|
||||
this.isSFtp = isSFtp;
|
||||
}
|
||||
|
||||
private static final Map<String, Protocol> MAP = Arrays.stream(values())
|
||||
.collect(Collectors.toMap(p -> p.name().toLowerCase(), p -> p));
|
||||
|
||||
public static Protocol get(String protocol) {
|
||||
if (protocol == null || protocol.trim().isEmpty())
|
||||
return SFTP_PASSWD;
|
||||
return MAP.getOrDefault(protocol.trim().toLowerCase(), SFTP_PASSWD);
|
||||
}
|
||||
}
|
||||
|
||||
private static class FtpEnv {
|
||||
private static final Pattern pattern = Pattern.compile("#YYYYMMDD([+-]\\d+)?#");
|
||||
String propName;
|
||||
|
||||
String ipaddress;
|
||||
int port;
|
||||
String userid;
|
||||
String passwd;
|
||||
Protocol protocol;
|
||||
String remotePath;
|
||||
String remoteFile;
|
||||
String proxyServer;
|
||||
int connTimeout;
|
||||
int setTimeout;
|
||||
int bandWidth;
|
||||
|
||||
String ftpTransferType;
|
||||
String checkFileExt;
|
||||
|
||||
private FtpEnv init(BatchDoc batchDoc) {
|
||||
Header batchHeader = batchDoc.getBatchMsg().getHeader();
|
||||
|
||||
propName = PROP_GROUP_NAME_PREFIX + "{" +
|
||||
batchHeader.getProcessCode() +
|
||||
"_" +
|
||||
batchHeader.getInstitutionCode() + "}";
|
||||
PropManager pmanager = PropManager.getInstance();
|
||||
|
||||
ipaddress = batchHeader.getRemoteIP();
|
||||
port = Integer.parseInt(batchHeader.getPort());
|
||||
userid = batchHeader.getUserID();
|
||||
passwd = batchHeader.getUserPassword();
|
||||
|
||||
remotePath = pmanager.getProperties(propName).getProperty(REMOTE_PATH, "");
|
||||
Path requestFile = Paths.get(batchHeader.getFileName());
|
||||
String requestPath = Optional.ofNullable(requestFile.getParent())
|
||||
.map(Path::toString)
|
||||
.orElse("");
|
||||
remoteFile = requestFile.getFileName().toString();
|
||||
remotePath = Paths.get(remotePath).resolve(requestPath).normalize().toString();
|
||||
//batchHeader.setFileName(remoteFile);
|
||||
|
||||
proxyServer = pmanager.getProperties(propName).getProperty(PROXY_SERVER, "");
|
||||
protocol = Protocol.get(pmanager.getProperties(propName).getProperty(PROTOCOL, ""));
|
||||
|
||||
String connTimeoutStr = pmanager.getProperties(propName).getProperty(CONNECTION_TIMEOUT, "30");
|
||||
connTimeout = Integer.parseInt(connTimeoutStr);
|
||||
String setTimeoutStr = pmanager.getProperties(propName).getProperty(READ_TIMEOUT, "30");
|
||||
setTimeout = Integer.parseInt(setTimeoutStr);
|
||||
String bandWidthLimit = pmanager.getProperties(propName).getProperty(BADNWIDTH, "0");
|
||||
bandWidthLimit = bandWidthLimit.replace("K", "000").replace("M", "000000").replace(",", "");
|
||||
bandWidth = Integer.parseInt(bandWidthLimit);
|
||||
|
||||
ftpTransferType = pmanager.getProperties(propName).getProperty(FTP_TRANSFER_TYPE, "BINARY");
|
||||
checkFileExt = BatchDirUtil.getResponseRootExt();
|
||||
|
||||
try {
|
||||
Matcher matcher = pattern.matcher(remotePath);
|
||||
if (matcher.find()) {
|
||||
String offset = matcher.group(1);
|
||||
int days = (offset != null) ? Integer.parseInt(offset) : 0;
|
||||
String baseDate = DatetimeUtil.addDays(DatetimeUtil.getCurrentDate(), days);
|
||||
batchHeader.setBaseDate(baseDate);
|
||||
remotePath = matcher.replaceAll(baseDate);
|
||||
}
|
||||
if (!remotePath.endsWith("/"))
|
||||
remotePath += "/";
|
||||
} catch ( Exception e) {
|
||||
((Logger) batchDoc.getLogger(Logger.LOGGER_ADAPTER)).error("", e);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Header batchHeader;
|
||||
Body batchBody;
|
||||
|
||||
@Override
|
||||
public void sendFile(BatchDoc batchDoc) throws Exception {
|
||||
throw new UnsupportedOperationException("send is not implemented yet");
|
||||
}
|
||||
|
||||
public void recvFile(BatchDoc batchDoc) throws Exception {
|
||||
|
||||
if ( logger.isInfoEnabled() ) logger.info("[FTPDJ] ■ 대외기관 → FEP 파일 수신 시작...... ");
|
||||
batchHeader = batchDoc.getBatchMsg().getHeader();
|
||||
batchBody = batchDoc.getBatchMsg().getBody();
|
||||
|
||||
firstActivity = System.currentTimeMillis();
|
||||
BatchRunningJobManager.getInstance().addRunningJobInfo(batchHeader.getUUID(), this, batchDoc);
|
||||
|
||||
FtpEnv ftpEnv = new FtpEnv().init(batchDoc);
|
||||
|
||||
if(logger.isDebugEnabled()) logger.debug("[FTPDJ] userid:" + ftpEnv.userid + ", localPath=" + batchHeader.getFilePath());
|
||||
|
||||
try {
|
||||
batchBody.setPhaseStartTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
LogUtil.setLogFileStart(batchDoc);
|
||||
|
||||
//changeRecvPath(batchHeader);
|
||||
FTPFileObject[] list = FTPUtil.listFilesJSCH(
|
||||
ftpEnv.ipaddress, ftpEnv.port, ftpEnv.userid, ftpEnv.passwd,
|
||||
ftpEnv.remotePath,
|
||||
ftpEnv.protocol.isSFtp,
|
||||
batchDoc.getLogger(),
|
||||
ftpEnv.protocol.val,
|
||||
ftpEnv.proxyServer
|
||||
);
|
||||
|
||||
if ( list == null ) { // 파일 경로가 없는경우 20231025
|
||||
if(logger.isDebugEnabled()) logger.debug("[FTPDJ] Not found remote path :: "+ftpEnv.remotePath);
|
||||
throw new RuntimeException("[FTPDJ] Not found remote path :: "+ftpEnv.remotePath);
|
||||
}
|
||||
|
||||
FTPFileObject found = Arrays.stream(list)
|
||||
.filter(FTPFileObject::isFile)
|
||||
.filter(f -> ftpEnv.remoteFile.equals(f.getName()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if ( found == null ) {
|
||||
if(logger.isDebugEnabled()) logger.debug("[FTPDJ] Not found remote file :: "+ftpEnv.remotePath + "/" + ftpEnv.remoteFile);
|
||||
throw new RuntimeException("[FTPDJ] Not found remote file :: "+ftpEnv.remotePath + "/" + ftpEnv.remoteFile);
|
||||
}
|
||||
|
||||
fileDownProcess(batchDoc, ftpEnv, found);
|
||||
//fileDownEndProcess(batchDoc, ftpEnv.remoteFile, "");
|
||||
|
||||
} catch (Exception ex) {
|
||||
String[] msgArgs = new String[1];
|
||||
msgArgs[0] = batchHeader.getProcessCode();
|
||||
String errCode = "BECEAIFJI002";
|
||||
String errMsg = ExceptionUtil.getErrorCode(ex, errCode, msgArgs);
|
||||
batchBody.setErrorMsg(errMsg);
|
||||
//batchBody.setPhaseEndTime(DatetimeUtil.getCurrentTimeMillis());
|
||||
LogUtil.setErrorLog(batchDoc, ex.getMessage());
|
||||
logger.error(errMsg, ex);
|
||||
throw ex;
|
||||
} finally {
|
||||
batchBody.setPhaseEndTime(DatetimeUtil.getCurrentTimeMillis());
|
||||
LogUtil.setLogFileEnd(batchDoc);
|
||||
this.disconnect();
|
||||
}
|
||||
|
||||
if(logger.isInfoEnabled()) logger.info("[FTPDJ] ■ VAN사 → FEP 파일 수신 완료.");
|
||||
}
|
||||
|
||||
private void changeRecvPath(Header h) {
|
||||
String removed = h.getFilePath().replace("/" + h.getProcessCode() + "/" + h.getInstitutionCode(), "");
|
||||
String newPath = removed + "/" + h.getBizCode() + "/";
|
||||
h.setFilePath(newPath);
|
||||
if(logger.isInfoEnabled()) logger.debug("[FTPDJ] processCode=" + batchHeader.getProcessCode() + ", institutionCode=" + batchHeader.getInstitutionCode() + ", bizCode=" + batchHeader.getBizCode() + ", newPath=" + newPath);
|
||||
}
|
||||
|
||||
private void fileDownProcess(BatchDoc batchDoc, FtpEnv env, FTPFileObject remoteFileInfo) throws Exception {
|
||||
if(logger.isDebugEnabled()) logger.debug("@@@@@@@@@ batchHeader.getJobCode()[" + batchHeader.getJobCode() + "]");
|
||||
|
||||
// batchBody.setPhaseStartTime(DatetimeUtil.getCurrentTimeMillis());
|
||||
// LogUtil.setLogFileStart(batchDoc);
|
||||
|
||||
String receivedFile = batchHeader.getFilePath() + File.separator + env.remoteFile;
|
||||
Path received = Paths.get(receivedFile);
|
||||
Path savePath = Paths.get(StringUtil.realToArchDir(receivedFile));
|
||||
Path intfcCheckFile = Paths.get(savePath.toAbsolutePath() + env.checkFileExt);
|
||||
Path emptyCheckFile = Paths.get(StringUtil.realToRootDir(receivedFile));
|
||||
|
||||
Files.createDirectories(received.getParent());
|
||||
Files.createDirectories(savePath.getParent());
|
||||
Files.createDirectories(emptyCheckFile.getParent());
|
||||
|
||||
if ( Files.exists(intfcCheckFile) ) Files.delete( intfcCheckFile );
|
||||
if ( Files.exists(emptyCheckFile) ) Files.delete( emptyCheckFile );
|
||||
|
||||
if(logger.isDebugEnabled()) logger.debug("received=" + received + "savePath=" + savePath);
|
||||
|
||||
try {
|
||||
|
||||
if(logger.isDebugEnabled()) logger.debug("@@@@@@@@" + this.getClass().getName() + " :: filename=[" + env.remoteFile + "], path=[" + batchHeader.getFilePath() + "]");
|
||||
|
||||
FTPUtil.retrieve(batchDoc,
|
||||
env.ipaddress, env.port, env.userid, env.passwd,
|
||||
env.remotePath ,
|
||||
env.remoteFile,
|
||||
batchHeader.getFilePath(),
|
||||
env.connTimeout,
|
||||
env.setTimeout,
|
||||
env.bandWidth,
|
||||
batchDoc.getLogger(Logger.LOGGER_ADAPTER),
|
||||
env.protocol.val,
|
||||
env.ftpTransferType, env.proxyServer);
|
||||
|
||||
batchHeader.setTotRecCnt(1);
|
||||
batchHeader.setFileSize(remoteFileInfo.getSize());
|
||||
|
||||
Files.move(received, savePath, StandardCopyOption.REPLACE_EXISTING);
|
||||
String checkFileContent = String.format("%-138s@@" , batchHeader.getBizCode()); // Bat에서 읽기 위한 Format
|
||||
Files.writeString(intfcCheckFile, checkFileContent);
|
||||
Files.createFile(emptyCheckFile);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
try {
|
||||
if ( Files.exists(received) ) {
|
||||
Path errorPath = Paths.get(StringUtil.realToErrorDir(receivedFile));
|
||||
Files.createDirectories(errorPath.getParent());
|
||||
Files.move(received, errorPath);
|
||||
}
|
||||
} catch ( Exception ignore) { }
|
||||
throw new Exception("파일수신에 실패하였습니다. -" + e.getMessage());
|
||||
} finally {
|
||||
setLastActivity();
|
||||
//fos.close();
|
||||
}
|
||||
}
|
||||
|
||||
// 정상처리 20241025
|
||||
private void fileDownEndProcess(BatchDoc batchDoc, String fileName, String errMsg) throws Exception {
|
||||
FileOutputStream fos = null;
|
||||
|
||||
batchHeader.setFileName(fileName);
|
||||
//batchHeader.setFileSize(0);
|
||||
//batchHeader.setTotRecCnt(1);
|
||||
if(logger.isInfoEnabled()) logger.debug("@@@@@@@@@fileDownEndProcess batchHeader.getFileName()["+ fileName + "]");
|
||||
|
||||
batchBody.setPhaseStartTime(DatetimeUtil.getCurrentTimeMillis());
|
||||
|
||||
LogUtil.setLogFileStart(batchDoc);
|
||||
|
||||
batchHeader.setTotRecCnt(1);
|
||||
//batchHeader.getJobCode();
|
||||
batchBody.setErrorMsg(errMsg);
|
||||
|
||||
// File 종료시간 설정
|
||||
batchBody.setPhaseEndTime(DatetimeUtil.getCurrentTimeMillis());
|
||||
LogUtil.setLogFileEnd(batchDoc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket getCurrentSocket() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean connect() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationContext getContext() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setControl(Object control) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyMessage() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean idle(long timeout) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentState() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected() throws IOException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkActivity() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRemoteIPAddress() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastActivity() {
|
||||
// TODO Auto-generated method stub
|
||||
lastActivity = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFirstActivity() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastActivity() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -143,10 +143,10 @@ public class SocketServer extends Thread implements SocketService {
|
||||
String ip = channel.socket().getInetAddress().getHostAddress();
|
||||
Integer connCount = ipTable.get( ip );
|
||||
if ( connCount == null ) {
|
||||
ipTable.put( ip, new Integer( 1 ) );
|
||||
ipTable.put( ip, 1);
|
||||
} else if ( connCount.intValue() < context.getConnLimitPerIp() ) {
|
||||
int newCount = connCount.intValue() + 1;
|
||||
ipTable.put( ip, new Integer( newCount ));
|
||||
ipTable.put( ip, newCount);
|
||||
} else {
|
||||
logger.error( CommonLib.getMessage("BECEAIMSA023", new String[]{ context.getAdapterName(), Integer.toString( context.getConnLimitPerIp() ),this.getSocketInfo( channel ) } ) );
|
||||
try {
|
||||
@@ -371,7 +371,7 @@ public class SocketServer extends Thread implements SocketService {
|
||||
int newCount = connCount.intValue() - 1;
|
||||
if ( newCount < 0 ) newCount = 0;
|
||||
|
||||
ipTable.put( ip, new Integer( newCount ) );
|
||||
ipTable.put( ip, newCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,312 @@
|
||||
package com.eactive.eai.agent.web;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.batch.common.CalendarUtil;
|
||||
import com.eactive.eai.batch.common.CommonKeys;
|
||||
import com.eactive.eai.batch.common.LogUtil;
|
||||
import com.eactive.eai.batch.doc.BatchDoc;
|
||||
import com.eactive.eai.batch.message.EAIBatchMsgManager;
|
||||
import com.eactive.eai.batch.osd.OutsideManager;
|
||||
import com.eactive.eai.batch.osd.OutsideVO;
|
||||
import com.eactive.eai.batch.scheduler.JobStatusVO;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageManager;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageVO;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.util.DatetimeUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class FileFetchRequestHandler extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
enum STATUS {
|
||||
QUEUED("Q"), ERROR("E"), RUNNING("S"), FINISHED("T"), UNKNOWN("U");;
|
||||
String code;
|
||||
|
||||
STATUS(String code) { this.code = code; }
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. 기능 : Eai Bat Call
|
||||
* 2. 처리 개요 : 요청 메세지를 받아서 처리 후 메세지 리턴.
|
||||
* 3. 주의사항
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @param response HttpServletResponse
|
||||
**/
|
||||
public void service(HttpServletRequest request, HttpServletResponse response) {
|
||||
JsonRequest reqJson = null;
|
||||
try {
|
||||
logger.info("Servlet starting .......");
|
||||
|
||||
reqJson = getRequestBody(request, response);
|
||||
reqJson.validate();
|
||||
JsonRequest.Action action = reqJson.action;
|
||||
|
||||
JsonResponse jsonResponse;
|
||||
switch ( action ) {
|
||||
case DOWNLOAD -> jsonResponse = getFileEventInfo(reqJson);
|
||||
case STATUS -> jsonResponse = getTransferStatus(reqJson);
|
||||
case UPLOAD -> throw new UnsupportedOperationException("Not supported yet: " + action);
|
||||
default -> throw new IllegalArgumentException("Unsupported command: " + action);
|
||||
}
|
||||
|
||||
sendResponse(response, jsonResponse);
|
||||
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex.getMessage(), ex);
|
||||
sendResponse(response, JsonResponse.getFailureMessage((reqJson == null ? "" : reqJson.jobId), ex));
|
||||
}
|
||||
}
|
||||
|
||||
private JsonRequest getRequestBody(HttpServletRequest request, HttpServletResponse response) {
|
||||
String encoding = request.getCharacterEncoding();
|
||||
if (encoding == null)
|
||||
encoding = StandardCharsets.UTF_8.name();
|
||||
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(), encoding))) {
|
||||
return objectMapper.readValue(reader, JsonRequest.class);
|
||||
} catch (MismatchedInputException e) { // Body 내용이 완전히 비어있는 경우
|
||||
logger.error(e.getMessage());
|
||||
throw new IllegalArgumentException("Empty Body", e);
|
||||
} catch (JsonParseException | JsonMappingException e) { // JSON 문법이 틀렸거나, 클래스 구조와 맞지 않는 경우
|
||||
throw new IllegalArgumentException("Wrong Json format", e);
|
||||
} catch (UnsupportedEncodingException e) { // 지원하지 않는 인코딩(charset)을 요청한 경우
|
||||
throw new IllegalArgumentException("Unsupported Encoding: " + encoding, e);
|
||||
} catch (IOException e) { // 기타 순수 IO 에러 (스트림 끊김 등)
|
||||
throw new RuntimeException("IO Error occurred while reading request body", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendResponse(HttpServletResponse response, JsonResponse jsonResponse) {
|
||||
try {
|
||||
response.setContentType("application/json; charset=UTF-8");
|
||||
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||
response.getWriter().print(jsonResponse.toJsonString());
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
|
||||
private JsonResponse getFileEventInfo(JsonRequest reqJson) throws Exception
|
||||
{
|
||||
String bizCode = reqJson.remoteCode;
|
||||
String fileName = reqJson.remoteFile;
|
||||
|
||||
// 수신한 파일 정보
|
||||
logger.info("[FetchRequestHandler] =========================================================================");
|
||||
logger.info("[FetchRequestHandler] ▶▶▶▶▶▶▶▶▶▶ Local 수신요청 FILE EVENT 발생 !! ◀◀◀◀◀◀◀◀◀◀");
|
||||
logger.info("[FetchRequestHandler] ※ remoteCode : [" + bizCode +"]");
|
||||
logger.info("[FetchRequestHandler] ※ remoteFile : [" + fileName +"]");
|
||||
SchedulerMessageVO codeInfo = SchedulerMessageManager.getInstance().getInfoByteBjobTransDstName(bizCode);
|
||||
String processCode = codeInfo.getProcessCode();
|
||||
String institutionCode = codeInfo.getInstitutionCode();
|
||||
logger.info("[FetchRequestHandler] ※ processCode : [" + codeInfo.getProcessCode()+"]");
|
||||
logger.info("[FetchRequestHandler] ※ institutionCode : [" + codeInfo.getInstitutionCode() +"]");
|
||||
logger.info("[FetchRequestHandler] =========================================================================");
|
||||
|
||||
|
||||
//거래구분 코드 설정
|
||||
int bizCodeStartIndex = 0;
|
||||
int bizCodeEndIndex = 0;
|
||||
OutsideVO organInfo = OutsideManager.getInstance().getOutsideInfo(processCode, institutionCode);
|
||||
if ( organInfo == null ){
|
||||
throw new RuntimeException("미등록 업무구분/기관코드:" + processCode + "/" + institutionCode);
|
||||
}
|
||||
String institutionName = organInfo.getOsdName();
|
||||
String processName = organInfo.getBatchName();
|
||||
bizCodeStartIndex = organInfo.getBizCdStartIdx();
|
||||
bizCodeEndIndex = organInfo.getBizCdEndIdx();
|
||||
logger.info("processName = " + processName);
|
||||
|
||||
|
||||
if (bizCodeStartIndex <= 0 || bizCodeStartIndex >= fileName.length()) bizCodeStartIndex = 0;
|
||||
if (bizCodeEndIndex <= 0 || bizCodeEndIndex > fileName.length()) bizCodeEndIndex = fileName.length();
|
||||
|
||||
logger.info("[FetchRequestHandler] -------------------------------------------------------------------------");
|
||||
logger.info("[FetchRequestHandler] ■ File Event 파싱 정보");
|
||||
logger.info("[FetchRequestHandler] - 업무구분명 : [" + processName +"] (업무구분코드: "+ processCode +")");
|
||||
logger.info("[FetchRequestHandler] - 대외기관명 : [" + institutionName +"] (대외기관코드: "+ institutionCode +")");
|
||||
logger.info("[FetchRequestHandler] - 수신파일명 : [" + fileName +"]");
|
||||
logger.info("[FetchRequestHandler] - 거래구분코드: [" + bizCode +"]");
|
||||
logger.info("[FetchRequestHandler] -------------------------------------------------------------------------");
|
||||
|
||||
|
||||
/*
|
||||
* FileEvent가 SchedulerProcess로 전달할 기본 EAIBatchMsg를 생성한다.
|
||||
* FileEventListener가 입력가능한 값들은 EAIBatchMsg의 항목 중 다음과 같다.
|
||||
* - UUID
|
||||
* - Layer 구분 코드 (한시적)
|
||||
* - ProcessCode: 수신한 서브디렉토리와 동일
|
||||
* - FileName : 송수신 원 파일명
|
||||
* - FilePath : 파일이 실재 존재하는 디렉토리
|
||||
* - RenamedFileName : 저장후 이름이 변경된 파일명
|
||||
*/
|
||||
// BatchMsgDoc 생성
|
||||
BatchDoc batchMsgDoc = EAIBatchMsgManager.createBatchMsgWithUUID(false); //UUID 생성, false:초기화안함
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_FILE_EVENT, CommonKeys.SUB_LAYER_FILE_EVENT); // layer, flowPahse, 시작시간 설정
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessCode(processCode); // 업무코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessName(processName); // 업무명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setProcessType(CommonKeys.PROCESS_REQUEST_RECEIVE); // 업무유형 (요구송신 설정)
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionCode(institutionCode); // 대외기관코드
|
||||
batchMsgDoc.getBatchMsg().getHeader().setInstitutionName(institutionName); // 대외기관명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setFileName(fileName); // 원 파일명
|
||||
batchMsgDoc.getBatchMsg().getHeader().setBizCode(bizCode); // 거래구분코드
|
||||
SchedulerMessageVO info = SchedulerMessageManager.getInstance().getRecvScheduleInfo(bizCode, processCode, institutionCode);
|
||||
if ( info == null ){
|
||||
String errMsg = ExceptionUtil.getErrorCode("BECEAISSC016", new String[] {processCode, institutionCode, bizCode});
|
||||
throw new Exception(errMsg); // 해당 정보에 대한 스케쥴 정보가 존재하지 않습니다. (업무코드: {1}, 대외기관코드: {2}, 거래구분코드: {3})
|
||||
}
|
||||
|
||||
info.setFileName(fileName);
|
||||
//1. 요구수신 스케쥴러 단계 DB로그를 위한 BatchMsg 객체 생성
|
||||
EAIBatchMsgManager.updateBatchMsgWithStageTime(batchMsgDoc, CommonKeys.LAYER_SCHEDULER, CommonKeys.SUB_LAYER_SCHEDULER_QUEUE); // layer, flowPahse, 시작시간 설정
|
||||
|
||||
//2. 요구수신 디렉토리 설정 (수신_Real/업무구분/대외기관/..)
|
||||
//요구수신 기준 디렉토리 --> 배치업무유형코드(ProcessCode) 와 대외기관코드 (InstitutionCode) 로 계산.
|
||||
String strPathName = BatchDirUtil.getResponseRealDir();
|
||||
if ( strPathName.charAt(strPathName.length()-1) != '/' ) {
|
||||
strPathName = strPathName + '/';
|
||||
}
|
||||
|
||||
strPathName = strPathName + processCode + "/" + institutionCode;
|
||||
info.setFilePath(strPathName);
|
||||
|
||||
//3. UUID 설정 및 스케쥴 송수신 시각 설정
|
||||
info.setUUID (batchMsgDoc.getBatchMsg().getHeader().getUUID());
|
||||
info.setSubUUID (batchMsgDoc.getBatchMsg().getBody().getSubUUID());
|
||||
info.setStartTime(DatetimeUtil.getCurrentDate() + "000000000");
|
||||
info.setEndTime (DatetimeUtil.getCurrentDate() + "235900000");
|
||||
|
||||
//4. Job_Queue 테이블에 등록
|
||||
logger.info("[요구수신 스케쥴러] =========================================================================");
|
||||
logger.info("[요구수신 스케쥴러] ■ 요구수신 스케쥴 정보를 Job_Queue 테이블에 추가......");
|
||||
int resultCnt = SchedulerMessageManager.getInstance().insertJobToQueue(info);
|
||||
logger.info("[요구수신 스케쥴러] ==> 배치 Job_Queue 테이블 INSERT 건수: "+ resultCnt);
|
||||
logger.info("[요구수신 스케쥴러] =========================================================================");
|
||||
|
||||
// 단계 종료시간을 추가한다.
|
||||
batchMsgDoc.getBatchMsg().getBody().setPhaseEndTime(CalendarUtil.getCurrentTimeNoDash());
|
||||
|
||||
// 요구송신에 대한 최초 DB로그. StartLog 호출.
|
||||
LogUtil.setStartLog (batchMsgDoc);
|
||||
logger.info("[FetchRequestHandler] ※ Event 파일명 : [" + fileName +"]");
|
||||
|
||||
return new JsonResponse(
|
||||
JsonResponse.RESULT_SUCCESS,
|
||||
STATUS.QUEUED,
|
||||
batchMsgDoc.getBatchMsg().getHeader().getUUID()
|
||||
).setQueuedTime();
|
||||
}
|
||||
|
||||
private JsonResponse getTransferStatus(JsonRequest reqJson) throws Exception {
|
||||
String jobId = reqJson.jobId;
|
||||
SchedulerMessageManager manager = SchedulerMessageManager.getInstance();
|
||||
JobStatusVO vo = manager.getOenJobByKey(jobId, jobId);
|
||||
|
||||
if ( vo == null )
|
||||
throw new RuntimeException("jobId('" + jobId + "')를 찾을수 없습니다.");
|
||||
|
||||
JsonResponse ret = new JsonResponse(
|
||||
JsonResponse.RESULT_SUCCESS,
|
||||
STATUS.QUEUED,
|
||||
jobId
|
||||
);
|
||||
|
||||
ret.status = Arrays.stream(STATUS.values())
|
||||
.filter(status -> status.code.equals(vo.getTranPrcssDstcd()))
|
||||
.findFirst()
|
||||
.orElse(STATUS.UNKNOWN);
|
||||
ret.message = vo.getEAIObstclOccurCausCtnt();
|
||||
ret.queuedAt = vo.getBjobDmndMsgCretnHMS();
|
||||
ret.startedAt = vo.getTranStartHMS();
|
||||
ret.finishedAt = vo.getTranEndHMS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
private static class JsonRequest {
|
||||
enum Action {
|
||||
DOWNLOAD, UPLOAD, STATUS;
|
||||
|
||||
@JsonCreator
|
||||
public static Action from(String value) {
|
||||
return Action.valueOf(value.toUpperCase());
|
||||
}
|
||||
}
|
||||
private Action action;
|
||||
private String jobId;
|
||||
private String remoteCode;
|
||||
private String remoteFile;
|
||||
|
||||
private void validate() {
|
||||
switch (this.action) {
|
||||
case DOWNLOAD, UPLOAD -> {
|
||||
if (remoteCode == null || remoteCode.trim().isEmpty()) throw new RuntimeException("remoteCode is Empty.");
|
||||
if (remoteFile == null || remoteFile.trim().isEmpty()) throw new RuntimeException("remoteFilePath is Empty.");
|
||||
}
|
||||
case STATUS -> {
|
||||
if (jobId == null || jobId.trim().isEmpty()) throw new RuntimeException("jobId is Empty.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
|
||||
private static class JsonResponse {
|
||||
private static final String RESULT_SUCCESS = "success";
|
||||
private static final String RESULT_FAILURE = "failure";
|
||||
|
||||
final String result;
|
||||
STATUS status;
|
||||
final String jobId;
|
||||
String message;
|
||||
String queuedAt;
|
||||
String startedAt;
|
||||
String finishedAt;
|
||||
|
||||
// 생성자를 통해서만 객체를 생성하도록 제한
|
||||
private JsonResponse(String result, STATUS status, String jobId) {
|
||||
this.result = result;
|
||||
this.status = status;
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
private JsonResponse setQueuedTime() { this.queuedAt = DatetimeUtil.getCurrentDateTime(); return this; }
|
||||
private JsonResponse setMessage(String message) { this.message = message; return this; }
|
||||
|
||||
private String toJsonString() {
|
||||
try {
|
||||
return objectMapper.writeValueAsString(this);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("JsonResponse JSON 생성 중 오류 발생", e);
|
||||
}
|
||||
}
|
||||
|
||||
// --- 유틸리티 메서드 ---
|
||||
public static JsonResponse getFailureMessage(String jobId, Exception e) {
|
||||
return new JsonResponse(RESULT_FAILURE, STATUS.ERROR, jobId).setMessage(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,6 +170,11 @@ public class BatchDirUtil
|
||||
// public static final String RESPONSE_RCV_CHK_DIR = "rcv.chk.directory";
|
||||
public static final String RESPONSE_RCV_ROOT_EXT = "rcv.root.ext";
|
||||
|
||||
public static final String RETENTION_DAY_ROOT = "retension.day.root";
|
||||
public static final String RETENTION_DAY_REAL = "retension.day.real";
|
||||
public static final String RETENTION_DAY_ARCH = "retension.day.arch";
|
||||
public static final String RETENTION_DAY_ERROR = "retension.day.error";
|
||||
|
||||
// 응답송신용 디렉토리 프라퍼티 키 정보 20060425 add by khs
|
||||
// public static final String RESPONSE_SND_DIR_INFO = "ResponseSndDirInfo";
|
||||
// public static final String RESPONSE_SND_REAL_DIR = "snd.real.directory";
|
||||
|
||||
@@ -113,7 +113,7 @@ public class StringUtil
|
||||
|
||||
public static String itos(int i)
|
||||
{
|
||||
return (new Integer(i)).toString();
|
||||
return Integer.toString(i);
|
||||
}
|
||||
|
||||
public static String replaceStr(String s, String s1, String s2) throws NullPointerException
|
||||
|
||||
@@ -63,8 +63,8 @@ public class EncryptManager implements Lifecycle
|
||||
{
|
||||
for(int i=65; i<91; i++)
|
||||
{
|
||||
String key = new Character((char)i).toString();
|
||||
String value = new Integer(100 - i).toString();
|
||||
String key = Character.toString((char) i);
|
||||
String value = Integer.toString(100 - i);
|
||||
|
||||
codeTable.put(key, value);
|
||||
codeTable.put(value, key);
|
||||
@@ -72,8 +72,8 @@ public class EncryptManager implements Lifecycle
|
||||
|
||||
for(int i=0; i<10; i++)
|
||||
{
|
||||
String key = new Integer(i).toString();
|
||||
String value = new Integer(9-i).toString();
|
||||
String key = Integer.toString(i);
|
||||
String value = Integer.toString(9 - i);
|
||||
codeTable.put(key, value);
|
||||
}
|
||||
//logger.debug("** if Hashtable : A = : " + codeTable.get("A"));
|
||||
@@ -169,9 +169,9 @@ public class EncryptManager implements Lifecycle
|
||||
/* 암호화 문장 생성 */
|
||||
for(int i=0; i<16; i++)
|
||||
{
|
||||
int m_Msg = new Integer((String)codeTable.get(transferPwd.substring(i, i+1))).intValue();
|
||||
int m_Key = new Integer((String)codeTable.get(encryptSeed.substring(i, i+1))).intValue();
|
||||
encryptMsg += (String)codeTable.get(new Integer((m_Msg + m_Key) % 36).toString());
|
||||
int m_Msg = Integer.parseInt((String) codeTable.get(transferPwd.substring(i, i + 1)));
|
||||
int m_Key = Integer.parseInt((String) codeTable.get(encryptSeed.substring(i, i + 1)));
|
||||
encryptMsg += (String)codeTable.get(Integer.toString((m_Msg + m_Key) % 36));
|
||||
}
|
||||
|
||||
return encryptMsg;
|
||||
@@ -231,9 +231,9 @@ public class EncryptManager implements Lifecycle
|
||||
/* 암호화 문장 생성 */
|
||||
for(int i=0; i<16; i++)
|
||||
{
|
||||
int m_Msg = new Integer((String)codeTable.get(transferPwd.substring(i, i+1))).intValue();
|
||||
int m_Key = new Integer((String)codeTable.get(encryptSeed.substring(i, i+1))).intValue();
|
||||
encryptMsg += (String)codeTable.get(new Integer((m_Msg + m_Key) % 36).toString());
|
||||
int m_Msg = Integer.parseInt((String) codeTable.get(transferPwd.substring(i, i + 1)));
|
||||
int m_Key = Integer.parseInt((String) codeTable.get(encryptSeed.substring(i, i + 1)));
|
||||
encryptMsg += (String)codeTable.get(Integer.toString((m_Msg + m_Key) % 36));
|
||||
}
|
||||
|
||||
return encryptMsg;
|
||||
@@ -258,9 +258,9 @@ public class EncryptManager implements Lifecycle
|
||||
|
||||
for(int i=0; i<16; i++)
|
||||
{
|
||||
int m_Msg = new Integer((String)codeTable.get(encryptMsg.substring(i, i+1))).intValue() + 36;
|
||||
int m_Key = new Integer((String)codeTable.get(seed.substring(i, i+1))).intValue();
|
||||
normalMsg += (String)codeTable.get(new Integer((m_Msg - m_Key) % 36).toString());
|
||||
int m_Msg = Integer.parseInt((String) codeTable.get(encryptMsg.substring(i, i + 1))) + 36;
|
||||
int m_Key = Integer.parseInt((String) codeTable.get(seed.substring(i, i + 1)));
|
||||
normalMsg += (String)codeTable.get(Integer.toString((m_Msg - m_Key) % 36));
|
||||
}
|
||||
|
||||
return normalMsg;
|
||||
@@ -347,9 +347,9 @@ public class EncryptManager implements Lifecycle
|
||||
/* 암호화 문장 생성 */
|
||||
for(int i=0; i<transferPwd.length(); i++)
|
||||
{
|
||||
int m_Msg = new Integer((String)codeTable.get(transferPwd.substring(i, i+1))).intValue();
|
||||
int m_Key = new Integer((String)codeTable.get(encryptSeed.substring(i, i+1))).intValue();
|
||||
encryptMsg += (String)codeTable.get(new Integer((m_Msg + m_Key) % 36).toString());
|
||||
int m_Msg = Integer.parseInt((String) codeTable.get(transferPwd.substring(i, i + 1)));
|
||||
int m_Key = Integer.parseInt((String) codeTable.get(encryptSeed.substring(i, i + 1)));
|
||||
encryptMsg += (String)codeTable.get(Integer.toString((m_Msg + m_Key) % 36));
|
||||
}
|
||||
|
||||
return encryptMsg;
|
||||
|
||||
@@ -24,6 +24,12 @@ public class FTPFileObject {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FTPFileObject{" +
|
||||
"file=" + file +
|
||||
", name='" + name + '\'' +
|
||||
", size=" + size +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class BatchJobPriorityManager implements Serializable
|
||||
}
|
||||
|
||||
public synchronized void setDelaySec(String uuid, long sec){
|
||||
hmDelays.put(uuid, new Long(sec));
|
||||
hmDelays.put(uuid, sec);
|
||||
}
|
||||
|
||||
public synchronized boolean hasDelaySec(String uuid){
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.eactive.eai.batch.scheduler;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class JobStatusVO implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String bjobMsgScheID;
|
||||
private String bjobDmndSubMsgID;
|
||||
private String bjobDmndMsgCretnHMS;
|
||||
private String tranStartHMS;
|
||||
private String tranEndHMS;
|
||||
private String tranPrcssDstcd;
|
||||
private String EAIObstclOccurCausCtnt;
|
||||
//private String sndrcvFileName;
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("bjobMsgScheID = [" + bjobMsgScheID + "]\n");
|
||||
sb.append("bjobDmndSubMsgID = [" + bjobDmndSubMsgID + "]\n");
|
||||
sb.append("bjobDmndMsgCretnHMS = [" + bjobDmndMsgCretnHMS + "]\n");
|
||||
sb.append("tranStartHMS = [" + tranStartHMS + "]\n");
|
||||
sb.append("tranEndHMS = [" + tranEndHMS + "]\n");
|
||||
sb.append("tranPrcssDstcd = [" + tranPrcssDstcd + "]\n");
|
||||
sb.append("EAIObstclOccurCausCtnt = [" + EAIObstclOccurCausCtnt + "]\n");
|
||||
// sb.append("sndrcvFileName = [" + sndrcvFileName + "]\n");
|
||||
return new String(sb);
|
||||
}
|
||||
|
||||
public String getBjobMsgScheID() { return bjobMsgScheID; }
|
||||
public String getBjobDmndSubMsgID() { return bjobDmndSubMsgID; }
|
||||
public String getBjobDmndMsgCretnHMS() { return bjobDmndMsgCretnHMS; }
|
||||
public String getTranStartHMS() { return tranStartHMS; }
|
||||
public String getTranEndHMS() { return tranEndHMS; }
|
||||
public String getTranPrcssDstcd() { return tranPrcssDstcd; }
|
||||
public String getEAIObstclOccurCausCtnt() { return EAIObstclOccurCausCtnt; }
|
||||
//public String getSndrcvFileName() { return sndrcvFileName; }
|
||||
|
||||
public void setBjobMsgScheID (String bjobMsgScheID) { this.bjobMsgScheID = bjobMsgScheID; }
|
||||
public void setBjobDmndSubMsgID (String bjobDmndSubMsgID) { this.bjobDmndSubMsgID = bjobDmndSubMsgID; }
|
||||
public void setBjobDmndMsgCretnHMS (String bjobDmndMsgCretnHMS) { this.bjobDmndMsgCretnHMS = bjobDmndMsgCretnHMS; }
|
||||
public void setTranStartHMS (String tranStartHMS) { this.tranStartHMS = tranStartHMS; }
|
||||
public void setTranEndHMS (String tranEndHMS) { this.tranEndHMS = tranEndHMS; }
|
||||
public void setTranPrcssDstcd (String tranPrcssDstcd) { this.tranPrcssDstcd = tranPrcssDstcd; }
|
||||
public void setEAIObstclOccurCausCtnt(String EAIObstclOccurCausCtnt) { this.EAIObstclOccurCausCtnt = EAIObstclOccurCausCtnt; }
|
||||
//public void setSndrcvFileName (String sndrcvFileName) { this.sndrcvFileName = sndrcvFileName; }
|
||||
}
|
||||
|
||||
@@ -224,9 +224,9 @@ public class ScheduleBasisManager {
|
||||
if ( sDate.length() != 8 )
|
||||
return false;
|
||||
try {
|
||||
int year = new Integer(sDate.substring(0, 4)).intValue();
|
||||
int month = new Integer(sDate.substring(4, 6)).intValue();
|
||||
int day = new Integer(sDate.substring(6, 8)).intValue();
|
||||
int year = Integer.parseInt(sDate.substring(0, 4));
|
||||
int month = Integer.parseInt(sDate.substring(4, 6));
|
||||
int day = Integer.parseInt(sDate.substring(6, 8));
|
||||
|
||||
|
||||
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
|
||||
|
||||
@@ -106,6 +106,7 @@ public class SchedulerMessageDAO extends BaseDAO implements SchedulerMessageQuer
|
||||
SchedulerMessageVO info = null;
|
||||
if (rs.next()) {
|
||||
info = new SchedulerMessageVO();
|
||||
info.setInstitutionCode(StringUtil.nvlTrim(rs.getString("OsidInstiDstcd" ))); // 대외기관 코드
|
||||
info.setScheduleCode (StringUtil.nvlTrim(rs.getString("BjobMsgScheID" ))); // 스케쥴 아이디
|
||||
info.setJobCode (StringUtil.nvlTrim(rs.getString("BjobMsgDstcd" ))); // Job 구분 코드
|
||||
info.setBizCode (StringUtil.nvlTrim(rs.getString("BjobTranDstcdName"))); // 거래구분코드
|
||||
@@ -113,7 +114,6 @@ public class SchedulerMessageDAO extends BaseDAO implements SchedulerMessageQuer
|
||||
info.setEndTime (StringUtil.nvlTrim(rs.getString("SndrcvEndHMS" ))); // 송수신 종료 시간
|
||||
info.setProcessCode (StringUtil.nvlTrim(rs.getString("BjobBzwkDstcd" ))); // 업무구분 코드
|
||||
info.setProcessType (StringUtil.nvlTrim(rs.getString("BjobPtrnDstcd" ))); // 업무유형 구분
|
||||
info.setInstitutionCode(StringUtil.nvlTrim(rs.getString("OsidInstiDstcd" ))); // 대외기관 코드
|
||||
info.setPriority ( rs.getInt ("MsgPrcssPrity" )); // 메시지 처리 우선 순위
|
||||
info.setHolyProcessGb (StringUtil.nvlTrim(rs.getString("HoldyPrcssDstcd" ))); // 공휴일처리구분
|
||||
info.setStartDelayDays ( rs.getInt ("StartDlayNoday" ));
|
||||
@@ -1276,4 +1276,78 @@ public class SchedulerMessageDAO extends BaseDAO implements SchedulerMessageQuer
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public SchedulerMessageVO getInfoByteBjobTransDstName(String bjobTranDstcdName) throws DAOException {
|
||||
|
||||
ResultSet rs = null;
|
||||
int index = 0;
|
||||
|
||||
try {
|
||||
this.connect(SELECT_INFO_BY_JOB_TRANS_DST_NAME);
|
||||
//logger.debug("SchedulerMessageDAO.getScheduleInfo() >>> 수행 SQL 문 : \n"+ SELECT_SEND_SCHEDULE_BY_BIZCODE);
|
||||
|
||||
index = 1;
|
||||
this.preparedStatement.setString(index++, bjobTranDstcdName ); logger.debug("SchedulerMessageDAO.getInfoByteBjobTransDstName() >>> 바인드("+(index-1)+") : ["+ bjobTranDstcdName +"]");
|
||||
|
||||
rs = executeQuery();
|
||||
|
||||
SchedulerMessageVO info = null;
|
||||
if (rs.next()) {
|
||||
info = new SchedulerMessageVO();
|
||||
info.setProcessCode (StringUtil.nvlTrim(rs.getString("BjobBzwkDstcd" ))); // 업무구분 코드
|
||||
info.setInstitutionCode(StringUtil.nvlTrim(rs.getString("OsidInstiDstcd" ))); // 대외기관 코드
|
||||
info.setBizCode (StringUtil.nvlTrim(rs.getString("BjobTranDstcdName"))); // 거래구분코드
|
||||
}
|
||||
|
||||
return info;
|
||||
|
||||
} catch (DAOException ex) {
|
||||
throw ex;
|
||||
} catch(Exception e) {
|
||||
String errMsg = ExceptionUtil.getErrorCode(e, "BECEAISSC001", new String[] {"unknown", "unknown", bjobTranDstcdName});
|
||||
throw new DAOException(errMsg); //해당 스케쥴 정보를 찾을 수 없습니다. (업무구분: %1, 대외기관: %2, 거래구분: %3)
|
||||
} finally {
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public JobStatusVO getOenJobByKey(String bjobDmndMsgID, String bjobDmndSubMsgID) throws DAOException {
|
||||
|
||||
ResultSet rs = null;
|
||||
int index = 0;
|
||||
|
||||
try {
|
||||
this.connect(SELECT_ONE_JOB_BY_KEY);
|
||||
//logger.debug("SchedulerMessageDAO.getScheduleInfo() >>> 수행 SQL 문 : \n"+ SELECT_SEND_SCHEDULE_BY_BIZCODE);
|
||||
|
||||
index = 1;
|
||||
this.preparedStatement.setString(index++, bjobDmndMsgID ); logger.debug("SchedulerMessageDAO.getOenJobByKey() >>> 바인드("+(index-1)+") : ["+ bjobDmndMsgID +"]");
|
||||
this.preparedStatement.setString(index++, bjobDmndMsgID ); logger.debug("SchedulerMessageDAO.getOenJobByKey() >>> 바인드("+(index-1)+") : ["+ bjobDmndSubMsgID+"]");
|
||||
|
||||
rs = executeQuery();
|
||||
|
||||
JobStatusVO jobStatus = null;
|
||||
if (rs.next()) {
|
||||
jobStatus = new JobStatusVO();
|
||||
jobStatus.setBjobMsgScheID (StringUtil.nvlTrim(rs.getString("BjobDmndMsgID" ))); // BATCH작업요청메시지ID
|
||||
jobStatus.setBjobDmndSubMsgID (StringUtil.nvlTrim(rs.getString("BjobDmndSubMsgID" ))); // BATCH작업요청부메시지ID
|
||||
jobStatus.setBjobDmndMsgCretnHMS (StringUtil.nvlTrim(rs.getString("BjobDmndMsgCretnHMS" ))); // BATCH작업요청메시지생성시각
|
||||
jobStatus.setTranStartHMS (StringUtil.nvlTrim(rs.getString("TranStartHMS" ))); // 송수신시작시각
|
||||
jobStatus.setTranEndHMS (StringUtil.nvlTrim(rs.getString("TranEndHMS" ))); // 송수신종료시각
|
||||
jobStatus.setTranPrcssDstcd (StringUtil.nvlTrim(rs.getString("TranPrcssDstcd" ))); // 거래처리구분코드 ('Q', 'S', 'E', 'T')
|
||||
jobStatus.setEAIObstclOccurCausCtnt(StringUtil.nvlTrim(rs.getString("EAIObstclOccurCausCtnt"))); // EAI장애발생원인내용
|
||||
//jobStatus.setSndrcvFileName (StringUtil.nvlTrim(rs.getString("SndrcvFileName" ))); // 송수신파일명(,로 구분)
|
||||
}
|
||||
|
||||
return jobStatus;
|
||||
|
||||
} catch (DAOException ex) {
|
||||
throw ex;
|
||||
} catch(Exception e) {
|
||||
String errMsg = ExceptionUtil.getErrorCode(e, "BECEAISSO001", new String[] {bjobDmndMsgID, bjobDmndSubMsgID});
|
||||
throw new DAOException(errMsg); //해당 스케쥴 정보를 찾을 수 없습니다. (업무구분: %1, 대외기관: %2, 거래구분: %3)
|
||||
} finally {
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -749,5 +749,15 @@ public class SchedulerMessageManager
|
||||
return dao.deleteJobFromProcessing(uuid);
|
||||
}
|
||||
|
||||
|
||||
public SchedulerMessageVO getInfoByteBjobTransDstName(String bjobTranDstcdName) throws Exception
|
||||
{
|
||||
SchedulerMessageDAO dao = (SchedulerMessageDAO)DAOFactory.newInstance().create(SchedulerMessageDAO.class);
|
||||
return dao.getInfoByteBjobTransDstName(bjobTranDstcdName);
|
||||
}
|
||||
|
||||
public JobStatusVO getOenJobByKey(String bjobDmndMsgID, String bjobDmndSubMsgID) throws Exception
|
||||
{
|
||||
SchedulerMessageDAO dao = (SchedulerMessageDAO)DAOFactory.newInstance().create(SchedulerMessageDAO.class);
|
||||
return dao.getOenJobByKey(bjobDmndMsgID, bjobDmndSubMsgID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,4 +625,28 @@ public interface SchedulerMessageQuery
|
||||
+ " MsgPrcssStusCd \n"
|
||||
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBS04";
|
||||
|
||||
public static String SELECT_INFO_BY_JOB_TRANS_DST_NAME =
|
||||
"SELECT A.BjobMsgScheID , \n"
|
||||
+ " A.OsidInstiDstcd, \n"
|
||||
+ " B.BjobBzwkDstcd, \n"
|
||||
+ " B.BjobTranDstcdName \n"
|
||||
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBS01 A,\n"
|
||||
+ " " + Keys.TABLE_OWNER + "TSEAIBJ01 B \n"
|
||||
+ "WHERE A.BjobMsgDstcd = B.BjobMsgDstcd\n"
|
||||
+ "AND A.BjobPtrnDstcd = 'RR' \n"
|
||||
+ "AND LTRIM(RTRIM(B.BjobTranDstcdName)) = ? \n"
|
||||
+ "AND B.ThisMsgUseYn = '1'\n";
|
||||
|
||||
public static final String SELECT_ONE_JOB_BY_KEY =
|
||||
"SELECT AA.BjobDmndMsgID ,\n"
|
||||
+ " AA.BjobDmndSubMsgID ,\n"
|
||||
+ " AA.BjobDmndMsgCretnHMS ,\n"
|
||||
+ " AA.TranStartHMS ,\n"
|
||||
+ " AA.TranEndHMS ,\n"
|
||||
+ " AA.TranPrcssDstcd ,\n"
|
||||
+ " AA.EAIObstclOccurCausCtnt \n"
|
||||
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBJ03 AA \n"
|
||||
+ "WHERE AA.BjobDmndMsgID = ? \n"
|
||||
+ "AND AA.BjobDmndSubMsgID = ? \n";
|
||||
|
||||
}
|
||||
@@ -621,5 +621,4 @@ public interface SchedulerMessageQueryForMariadb
|
||||
+ " MsgQueEtractDmndHMS,\n"
|
||||
+ " MsgPrcssStusCd \n"
|
||||
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBS04";
|
||||
|
||||
}
|
||||
@@ -34,9 +34,9 @@ public interface SchedulerMessageQueryForOracle
|
||||
+ " LTRIM(RTRIM(A.OsidInstiDstcd)) AS OsidInstiDstcd, \n"
|
||||
+ " B.MsgPrcssPrity ,\n"
|
||||
+ " CASE WHEN ( TO_CHAR(SYSDATE,'HH24MI') >= A.SndrcvStartHMS AND \n"
|
||||
+ " TO_CHAR(SYSDATE,'HH24MI') < NVL(RTRIM(A.SndrcvEndHMS), '9999') ) THEN 1 \n" //--스케쥴시작시간 <= 현재시간 < 스케쥴종료시간
|
||||
+ " WHEN ( TO_CHAR(SYSDATE,'HH24MI') < A.SndrcvStartHMS ) THEN 2 \n" //--현재시간 < 스케쥴시작시간 (미래스케쥴)
|
||||
+ " ELSE 3 \n" //--현재시간 > 스케쥴시작시간 (지나간스케쥴)
|
||||
+ " TO_CHAR(SYSDATE,'HH24MI') < NVL(RTRIM(A.SndrcvEndHMS), '9999') ) THEN 1 \n" //--스케쥴시작시간 <= 현재시간 < 스케쥴종료시간
|
||||
+ " WHEN ( TO_CHAR(SYSDATE,'HH24MI') < A.SndrcvStartHMS ) THEN 2 \n" //--현재시간 < 스케쥴시작시간 (미래스케쥴)
|
||||
+ " ELSE 3 \n" //--현재시간 > 스케쥴시작시간 (지나간스케쥴)
|
||||
+ " END FetchPriority ,\n"
|
||||
+ " A.HoldyPrcssDstcd ,\n"
|
||||
+ " A.StartDlayNoday ,\n"
|
||||
@@ -47,7 +47,7 @@ public interface SchedulerMessageQueryForOracle
|
||||
+ "AND B.BjobBzwkDstcd = ? \n"
|
||||
+ "AND LTRIM(RTRIM(A.OsidInstiDstcd)) = ? \n"
|
||||
+ "AND B.BjobTranDstcdName = ? \n"
|
||||
+ "AND A.BjobPtrnDstcd = 'RS'\n"
|
||||
+ "AND A.BjobPtrnDstcd = 'RS'\n"
|
||||
+ "AND A.ThisMsgUseYn = '1' \n"
|
||||
+ "AND B.ThisMsgUseYn = '1' \n"
|
||||
+ "ORDER BY B.MsgPrcssPrity, FetchPriority, A.SndrcvStartHMS, A.SndrcvEndHMS, B.BjobTranDstcdName";
|
||||
@@ -65,9 +65,9 @@ public interface SchedulerMessageQueryForOracle
|
||||
+ " LTRIM(RTRIM(A.OsidInstiDstcd)) AS OsidInstiDstcd, \n"
|
||||
+ " B.MsgPrcssPrity , \n"
|
||||
+ " CASE WHEN ( TO_CHAR(SYSDATE,'HH24MI') >= A.SndrcvStartHMS AND \n"
|
||||
+ " TO_CHAR(SYSDATE,'HH24MI') < NVL(RTRIM(A.SndrcvEndHMS), '9999') ) THEN 1 \n" //--스케쥴시작시간 <= 현재시간 < 스케쥴종료시간
|
||||
+ " WHEN ( TO_CHAR(SYSDATE,'HH24MI') < A.SndrcvStartHMS ) THEN 2 \n" //--현재시간 < 스케쥴시작시간 (미래스케쥴)
|
||||
+ " ELSE 3 \n" //--현재시간 > 스케쥴시작시간 (지나간스케쥴)
|
||||
+ " TO_CHAR(SYSDATE,'HH24MI') < NVL(RTRIM(A.SndrcvEndHMS), '9999') ) THEN 1 \n" //--스케쥴시작시간 <= 현재시간 < 스케쥴종료시간
|
||||
+ " WHEN ( TO_CHAR(SYSDATE,'HH24MI') < A.SndrcvStartHMS ) THEN 2 \n" //--현재시간 < 스케쥴시작시간 (미래스케쥴)
|
||||
+ " ELSE 3 \n" //--현재시간 > 스케쥴시작시간 (지나간스케쥴)
|
||||
+ " END FetchPriority , \n"
|
||||
+ " A.HoldyPrcssDstcd , \n"
|
||||
+ " A.StartDlayNoday , \n"
|
||||
@@ -140,7 +140,7 @@ public interface SchedulerMessageQueryForOracle
|
||||
+ "AND A.BjobBzwkDstcd = E.BjobBzwkDstcd \n"
|
||||
+ "AND A.MsgPrcssPrity > 0 \n" //--suspend 스케쥴 제외
|
||||
+ "AND A.SndrcvStartHMS <= TO_CHAR(SYSTIMESTAMP,'YYYYMMDDHH24MISSFF3') \n"
|
||||
+ "AND NVL(RTRIM(A.SndrcvEndHMS), '99991231') > TO_CHAR(SYSTIMESTAMP,'YYYYMMDDHH24MISSFF3') \n" //--종료시간이 없으면 종료시간 체크 안함
|
||||
+ "AND NVL(RTRIM(A.SndrcvEndHMS), '99991231') > TO_CHAR(SYSTIMESTAMP,'YYYYMMDDHH24MISSFF3') \n" //--종료시간이 없으면 종료시간 체크 안함
|
||||
+ "ORDER BY A.BjobBzwkDstcd, A.MsgPrcssPrity, C.BjobTranDstcdName, A.SndrcvFileName, A.BjobDmndMsgCretnHMS, A.SndrcvStartHMS";
|
||||
|
||||
//3. Timer Event 발생시 작업대기목록 테이블에서 수행할(현재시간에 걸리는) 전체 작업목록을 조회
|
||||
@@ -187,17 +187,17 @@ public interface SchedulerMessageQueryForOracle
|
||||
+ "AND A.BjobBzwkDstcd = E.BjobBzwkDstcd \n"
|
||||
// + "AND A.MsgPrcssPrity > '0' \n" //--suspend 스케쥴 제외
|
||||
+ "AND A.SndrcvStartHMS <= TO_CHAR(SYSTIMESTAMP,'YYYYMMDDHH24MISSFF3') \n"
|
||||
+ "AND NVL(RTRIM(A.SndrcvEndHMS), '99991231') > TO_CHAR(SYSTIMESTAMP,'YYYYMMDDHH24MISSFF3') \n" //--종료시간이 없으면 종료시간 체크 안함
|
||||
+ "AND NVL(RTRIM(A.SndrcvEndHMS), '99991231') > TO_CHAR(SYSTIMESTAMP,'YYYYMMDDHH24MISSFF3') \n" //--종료시간이 없으면 종료시간 체크 안함
|
||||
+ "ORDER BY A.BjobBzwkDstcd, A.MsgPrcssPrity, C.BjobTranDstcdName, A.SndrcvFileName, A.BjobDmndMsgCretnHMS, A.SndrcvStartHMS";
|
||||
|
||||
|
||||
|
||||
//4. 위 3번 쿼리에 의해 조회된 작업목록을 수행하기 전에 해당 작업의 연결정보가 현재 사용중인지
|
||||
//체크하기 위해 작업진행목록 테이블에서 전체 연결정보를 조회
|
||||
public static final String SELECT_EXECUTING_SYSTEMCONNID_FROM_PROCESSING =
|
||||
"SELECT SysLnkgDstcd \n"
|
||||
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBS04 \n"
|
||||
+ "WHERE MsgPrcssStusCd IN ('S','I','C')";
|
||||
|
||||
|
||||
// 4-1. 위 3번 쿼리에 의해 조회된 작업목록을 수행하기 전에 해당 작업의 앞선 우선순위 작업이 수행중인지 확인하기 위한 쿼리
|
||||
//2009.8.14 by kscheon
|
||||
public static final String SELECT_EXECUTING_JOB_FROM_PROCESSING =
|
||||
@@ -297,19 +297,19 @@ public interface SchedulerMessageQueryForOracle
|
||||
+ " A.RqstRecvReTralIntvalTtm, \n"
|
||||
+ " NVL(C.RecvFileEndCnt , 0) RecvFileEndCnt , \n"
|
||||
+ " NVL(C.RecvFileFailCnt, 0) RecvFileFailCnt, \n"
|
||||
+ " NVL(C.RecentExecTime , '') RecentExecTime \n"
|
||||
+ " NVL(C.RecentExecTime , '') RecentExecTime \n"
|
||||
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBJ01 B, \n"
|
||||
+ " " + Keys.TABLE_OWNER + "TSEAIBS01 A \n"
|
||||
+ " " + Keys.TABLE_OWNER + "TSEAIBS01 A \n"
|
||||
+ " LEFT OUTER JOIN ( SELECT BjobMsgScheID, \n"
|
||||
+ " SUM(CASE TranPrcssDstcd WHEN 'T' THEN 1 "
|
||||
+ " ELSE 0 END) AS RecvFileEndCnt ,\n" // --파일전송 완료 건수
|
||||
+ " SUM(CASE TranPrcssDstcd WHEN 'T'THEN 0 "
|
||||
+ " ELSE 1 END) AS RecvFileFailCnt,\n" // --파일전송 미완료 건수
|
||||
+ " MAX(BjobDmndMsgCretnHMS) RecentExecTime \n" // --최근 수행 시간
|
||||
+ " ELSE 1 END) AS RecvFileFailCnt,\n" // --파일전송 미완료 건수
|
||||
+ " MAX(BjobDmndMsgCretnHMS) RecentExecTime \n" // --최근 수행 시간
|
||||
+ " FROM " + Keys.TABLE_OWNER + "TSEAIBJ03 \n"
|
||||
+ " WHERE BjobPtrnDstcd = 'RR' \n" // --요구수신만
|
||||
+ " WHERE BjobPtrnDstcd = 'RR' \n" // --요구수신만
|
||||
+ " AND BjobDmndMsgCretnHMS LIKE TO_CHAR(SYSDATE,'YYYYMMDD')||'%' \n"
|
||||
+ " GROUP BY BjobMsgScheID ) C "
|
||||
+ " GROUP BY BjobMsgScheID ) C "
|
||||
+ "on A.BjobMsgScheID = C.BjobMsgScheID \n"
|
||||
+ "WHERE A.BjobMsgDstcd = B.BjobMsgDstcd \n"
|
||||
+ "AND A.BjobPtrnDstcd = 'RR' --요구수신만 \n"
|
||||
@@ -318,15 +318,15 @@ public interface SchedulerMessageQueryForOracle
|
||||
+ "AND A.SndrcvStartHMS <= TO_CHAR(SYSDATE,'HH24MI') \n"
|
||||
+ "AND NVL(RTRIM(A.SndrcvEndHMS), '9999') > TO_CHAR(SYSDATE,'HH24MI') \n"
|
||||
+ "AND NOT EXISTS ( SELECT X.BjobMsgScheID \n"
|
||||
+ " FROM " + Keys.TABLE_OWNER + "TSEAIBS03 X \n" //--대기목록 테이블에 존재하지 않고
|
||||
+ " FROM " + Keys.TABLE_OWNER + "TSEAIBS03 X \n" //--대기목록 테이블에 존재하지 않고
|
||||
+ " WHERE X.BjobMsgScheID = A.BjobMsgScheID \n"
|
||||
+ " AND X.SndrcvEndHMS >= TO_CHAR(SYSDATE,'YYYYMMDD') ) \n" //--미래의 스케쥴이
|
||||
+ " AND X.SndrcvEndHMS >= TO_CHAR(SYSDATE,'YYYYMMDD') ) \n" //--미래의 스케쥴이
|
||||
+ "AND NOT EXISTS ( SELECT Y.BjobMsgScheID \n"
|
||||
+ " FROM " + Keys.TABLE_OWNER + "TSEAIBS04 Y \n" //--진행목록 테이블에 존재하지 않고
|
||||
+ " WHERE Y.BjobMsgScheID = A.BjobMsgScheID ) \n"
|
||||
+ "ORDER BY A.SndrcvStartHMS, B.BjobTranDstcdName, A.SndrcvEndHMS";
|
||||
|
||||
|
||||
|
||||
//10. 스케줄 아이디에 해당되는 스케줄 정보 조회(요구수신)
|
||||
public static String SELECT_SEND_SCHEDULE_BY_SCHEDULEID =
|
||||
"SELECT A.BjobMsgScheID , \n"
|
||||
@@ -370,10 +370,10 @@ public interface SchedulerMessageQueryForOracle
|
||||
+ " AND B.BjobBzwkDstcd = D.BjobBzwkDstcd \n"
|
||||
+ " AND LTRIM(RTRIM(A.OsidInstiDstcd)) = LTRIM(RTRIM(D.OsidInstiDstcd )) \n"
|
||||
+ " AND LTRIM(RTRIM(A.BjobMsgScheID)) = ? \n";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 13. 스케줄 아이디에 해당되는 스케줄 정보 조회(요구송신)
|
||||
public static String SELECT_REQ_SEND_SCHEDULE_BY_SCHEDULEID =
|
||||
"SELECT A.BjobMsgScheID , \n"
|
||||
@@ -393,15 +393,15 @@ public interface SchedulerMessageQueryForOracle
|
||||
+ " " + Keys.TABLE_OWNER + "TSEAIBS01 A \n"
|
||||
+ " LEFT OUTER JOIN ( SELECT BjobMsgScheID, \n"
|
||||
+ " SUM(CASE TranPrcssDstcd WHEN 'T'THEN 0 "
|
||||
+ " ELSE 1 END) AS RecvFileFailCnt\n" //--파일전송 미완료 건수
|
||||
+ " ELSE 1 END) AS RecvFileFailCnt\n" //--파일전송 미완료 건수
|
||||
+ " FROM " + Keys.TABLE_OWNER + "TSEAIBJ03 \n"
|
||||
+ " WHERE BjobPtrnDstcd = 'RS' \n" //--요구송신만
|
||||
+ " AND BjobDmndMsgCretnHMS LIKE TO_CHAR(SYSDATE,'YYYYMMDD')||'%' \n"
|
||||
+ " GROUP BY BjobMsgScheID ) C \n"
|
||||
+ " GROUP BY BjobMsgScheID ) C \n"
|
||||
+ " on A.BjobMsgScheID = C.BjobMsgScheID \n"
|
||||
+ "WHERE A.BjobMsgDstcd = B.BjobMsgDstcd \n"
|
||||
+ "AND RTRIM(A.BjobMsgScheID) = ? \n"
|
||||
+ "AND A.BjobPtrnDstcd = 'RS'\n" //--요구송신만
|
||||
+ "AND A.BjobPtrnDstcd = 'RS'\n" //--요구송신만
|
||||
+ "AND A.ThisMsgUseYn = '1' \n"
|
||||
+ "AND B.ThisMsgUseYn = '1' \n";
|
||||
|
||||
@@ -417,7 +417,7 @@ public interface SchedulerMessageQueryForOracle
|
||||
/**
|
||||
* BATCH작업 메시지일정 ID를 조회하는 쿼리
|
||||
*/
|
||||
public static final String GET_BJOBMSGSCHEID =
|
||||
public static final String GET_BJOBMSGSCHEID =
|
||||
" SELECT BjobBzwkDstcd|| ? ||BjobTranDstcdName|| "
|
||||
+ " ( "
|
||||
+ " SELECT "
|
||||
@@ -438,7 +438,7 @@ public interface SchedulerMessageQueryForOracle
|
||||
/**
|
||||
* BATCH작업 일정 정보를 등록하는 쿼리
|
||||
*/
|
||||
public static final String ADD_JOB_SCH_INFO =
|
||||
public static final String ADD_JOB_SCH_INFO =
|
||||
"INSERT INTO "+Keys.TABLE_OWNER +"TSEAIBS01 ( "
|
||||
+ " BjobMsgScheID "
|
||||
+ " ,BjobMsgDstcd "
|
||||
@@ -490,7 +490,7 @@ public interface SchedulerMessageQueryForOracle
|
||||
/**
|
||||
* BATCH작업 일정 정보를 등록하는 쿼리
|
||||
*/
|
||||
public static final String SELECT_LOG_MASTER_BY_KEYS =
|
||||
public static final String SELECT_LOG_MASTER_BY_KEYS =
|
||||
" SELECT A.BjobDmndMsgID , \n"
|
||||
+ " A.BjobDmndSubMsgID , \n"
|
||||
+ " A.TelgmReTralCnt , \n"
|
||||
@@ -530,7 +530,7 @@ public interface SchedulerMessageQueryForOracle
|
||||
" AND BjobDmndSubMsgID = ? \n" +
|
||||
" AND SndrcvFileName = ? \n";
|
||||
|
||||
// public static final String SELECT_STAGE_LOGS_BY_KEYS =
|
||||
// public static final String SELECT_STAGE_LOGS_BY_KEYS =
|
||||
// "SELECT B.BjobDmndMsgID , \n"
|
||||
// + " B.BjobDmndSubMsgID , \n"
|
||||
// + " B.BjobStgeID , \n"
|
||||
@@ -570,8 +570,8 @@ public interface SchedulerMessageQueryForOracle
|
||||
// + " WHERE B.BjobDmndMsgID LIKE ? ||'%' \n"
|
||||
// + " AND B.BjobDmndSubMsgID LIKE ? ||'%' \n"
|
||||
// + " ORDER BY B.BjobDmndMsgID, B.BjobDmndSubMsgID, B.ThisStgeStartHMS, B.BjobMsgDstcd";
|
||||
|
||||
public static final String SELECT_SCHEDULE_BASIS =
|
||||
|
||||
public static final String SELECT_SCHEDULE_BASIS =
|
||||
"SELECT A.BjobMsgScheID , \n"
|
||||
+ " B.BjobBzwkDstcd , \n"
|
||||
+ " C.BjobBzwkName , \n"
|
||||
@@ -585,10 +585,10 @@ public interface SchedulerMessageQueryForOracle
|
||||
+ " B.ThisMsgChrgIDs , \n"
|
||||
+ " A.SndrcvStartHMS , \n"
|
||||
+ " A.SndrcvEndHMS \n"
|
||||
+ "FROM "+Keys.TABLE_OWNER +"TSEAIBS05 A, \n"
|
||||
+ " "+Keys.TABLE_OWNER +"TSEAIBJ01 B, \n"
|
||||
+ " "+Keys.TABLE_OWNER +"TSEAIBJ02 C, \n"
|
||||
+ " "+Keys.TABLE_OWNER +"TSEAIBJ06 D \n"
|
||||
+ "FROM "+Keys.TABLE_OWNER +"TSEAIBS05 A, \n"
|
||||
+ " "+Keys.TABLE_OWNER +"TSEAIBJ01 B, \n"
|
||||
+ " "+Keys.TABLE_OWNER +"TSEAIBJ02 C, \n"
|
||||
+ " "+Keys.TABLE_OWNER +"TSEAIBJ06 D \n"
|
||||
+ "WHERE A.BjobMsgDstcd = B.BjobMsgDstcd \n"
|
||||
+ "AND B.BjobBzwkDstcd = C.BjobBzwkDstcd \n"
|
||||
+ "AND B.BjobBzwkDstcd = D.BjobBzwkDstcd \n"
|
||||
@@ -621,5 +621,4 @@ public interface SchedulerMessageQueryForOracle
|
||||
+ " MsgQueEtractDmndHMS,\n"
|
||||
+ " MsgPrcssStusCd \n"
|
||||
+ "FROM " + Keys.TABLE_OWNER + "TSEAIBS04";
|
||||
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public class TelegramDAO extends BaseDAO implements TelegramQuery
|
||||
|
||||
rs = this.executeQuery();
|
||||
|
||||
TelegramVO telegramVO = new TelegramVO(keys[i], new Integer(fieldsCount[i]).intValue());
|
||||
TelegramVO telegramVO = new TelegramVO(keys[i], Integer.parseInt(fieldsCount[i]));
|
||||
while(rs.next())
|
||||
{
|
||||
// telegramitem 순서값은 런타임시에는 사용하지 않는다. 대신 TelegramVO에서 item이 추가될때 순서를 부여한다.
|
||||
|
||||
@@ -287,7 +287,7 @@ public class TelegramManager implements Lifecycle
|
||||
}
|
||||
else
|
||||
{
|
||||
int delim = new Integer(length_token).intValue();
|
||||
int delim = Integer.parseInt(length_token);
|
||||
result[i]=telegram.substring(beginIndex, beginIndex+=delim);
|
||||
logger.debug("> 수신 전문필드 파싱... Index: ["+ i +"], Type: ["+ type_token +"], Length: ["+ length_token +"], Name: ["+ telegramVO.getTelegramItem(i+1).getFieldName() +"], Value: ["+ result[i] +"]");
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public class TelegramManager implements Lifecycle
|
||||
}
|
||||
else
|
||||
{
|
||||
int delim = new Integer(length_token).intValue();
|
||||
int delim = Integer.parseInt(length_token);
|
||||
result[i]=telegram.substring(beginIndex, beginIndex+=delim);
|
||||
logger.debug("> 수신 전문필드 파싱... Index: ["+ i +"], Length: ["+ length_token +"], Name: ["+ telegramVO.getTelegramItem(i+1).getFieldName() +"], Value: ["+ result[i] +"]");
|
||||
}
|
||||
@@ -464,7 +464,7 @@ public class TelegramManager implements Lifecycle
|
||||
while(i < lengths.length)
|
||||
{
|
||||
if (!lengths[i].trim().toUpperCase().equals("XX"))
|
||||
totalLength += new Integer(lengths[i]).intValue();
|
||||
totalLength += Integer.parseInt(lengths[i]);
|
||||
i++;
|
||||
}
|
||||
return totalLength;
|
||||
@@ -542,7 +542,7 @@ public class TelegramManager implements Lifecycle
|
||||
else
|
||||
{
|
||||
// 정의된 필드의 길이
|
||||
int fieldLen = new Integer(fieldLength).intValue();
|
||||
int fieldLen = Integer.parseInt(fieldLength);
|
||||
|
||||
// 정의된 필드의 길이보다 큰 경우 예외 처리
|
||||
if (fieldContent.length() > fieldLen)
|
||||
|
||||
@@ -146,7 +146,7 @@ public class TelegramVO implements Serializable
|
||||
String lengthsarray[] = new String[itemVOs.size()];
|
||||
for(int i=0; i<itemVOs.size(); i++)
|
||||
{
|
||||
TelegramItemVO itemVo = itemVOs.get(new Integer(i+1));
|
||||
TelegramItemVO itemVo = itemVOs.get(i + 1);
|
||||
lengthsarray[i] = itemVo.getFieldLength();
|
||||
}
|
||||
return lengthsarray;
|
||||
@@ -164,7 +164,7 @@ public class TelegramVO implements Serializable
|
||||
String typessarray[] = new String[itemVOs.size()];
|
||||
for(int i=0; i<itemVOs.size(); i++)
|
||||
{
|
||||
TelegramItemVO itemVo = (TelegramItemVO)itemVOs.get(new Integer(i+1));
|
||||
TelegramItemVO itemVo = (TelegramItemVO)itemVOs.get(i + 1);
|
||||
typessarray[i] = itemVo.getFieldType();
|
||||
}
|
||||
return typessarray;
|
||||
@@ -175,7 +175,7 @@ public class TelegramVO implements Serializable
|
||||
String idsarray[] = new String[itemVOs.size()];
|
||||
for(int i=0; i<itemVOs.size(); i++)
|
||||
{
|
||||
TelegramItemVO itemVo = (TelegramItemVO)itemVOs.get(new Integer(i+1));
|
||||
TelegramItemVO itemVo = (TelegramItemVO)itemVOs.get(i + 1);
|
||||
idsarray[i] = itemVo.getFieldID();
|
||||
}
|
||||
return idsarray;
|
||||
@@ -186,7 +186,7 @@ public class TelegramVO implements Serializable
|
||||
String namessarray[] = new String[itemVOs.size()];
|
||||
for(int i=0; i<itemVOs.size(); i++)
|
||||
{
|
||||
TelegramItemVO itemVo = (TelegramItemVO)itemVOs.get(new Integer(i+1));
|
||||
TelegramItemVO itemVo = (TelegramItemVO)itemVOs.get(i + 1);
|
||||
namessarray[i] = itemVo.getFieldName();
|
||||
}
|
||||
return namessarray;
|
||||
@@ -201,7 +201,7 @@ public class TelegramVO implements Serializable
|
||||
* @return 필드객체-TelegramItemVO
|
||||
**/
|
||||
public TelegramItemVO getTelegramItem(int index) {
|
||||
TelegramItemVO itemVo = (TelegramItemVO)itemVOs.get(new Integer(index));
|
||||
TelegramItemVO itemVo = (TelegramItemVO)itemVOs.get(index);
|
||||
return itemVo;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ public class TelegramVO implements Serializable
|
||||
this.telegramFieldLengths[seqNo] = telegramItemVO.getFieldLength();
|
||||
|
||||
// 필드를 HashMap에 추가한다.
|
||||
itemVOs.put(new Integer(seqNo+1), telegramItemVO);
|
||||
itemVOs.put(seqNo + 1, telegramItemVO);
|
||||
|
||||
// 디버깅을 위하여 필드를 추가하고 현재 필드의 갯수를 반환한다.
|
||||
return this.getFieldSize();
|
||||
|
||||
@@ -25,11 +25,10 @@ public interface Keys
|
||||
public static final String SERVER_KEY = "inst.Name";
|
||||
|
||||
public static final String TABLE_OWNER = System.getProperty(TABLE_OWNER_KEY)+".";
|
||||
public static final String BAP01_JOB_QUEUE = "jms/qu01Bap11Svr01JobQueue"; // subBap11JmsSvr01
|
||||
public static final String BAP01_TIMER_QUEUE = "jms/qu01Bap11Svr01TimerQueue"; // subBap11JmsSvr01
|
||||
public static final String BAP02_JOB_QUEUE = "jms/qu01Bap21Svr01JobQueue"; // subBap21JmsSvr01
|
||||
public static final String BAP02_TIMER_QUEUE = "jms/qu01Bap21Svr01TimerQueue"; // subBap21JmsSvr01
|
||||
public static final String BAP01_JOB_QUEUE = "com.eactive.eai.common.jobQueue";
|
||||
public static final String BAP01_TIMER_QUEUE = "com.eactive.eai.common.timerQueue";
|
||||
public static final String BAP02_JOB_QUEUE = "com.eactive.eai.common.jobQueue";
|
||||
public static final String BAP02_TIMER_QUEUE = "com.eactive.eai.common.timerQueue";
|
||||
|
||||
public static final String CONNECT_FACTORY = "jms/cft01BapConnectionFactory";
|
||||
|
||||
public static final String CONNECT_FACTORY = "vm://localhost?broker.persistent=false&broker.useJmx=false";
|
||||
}
|
||||
|
||||
@@ -37,74 +37,74 @@ public class PreparedStatementProxy implements PreparedStatement {
|
||||
|
||||
public void setBoolean(int parameterIndex, boolean x)
|
||||
throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), new Boolean(x));
|
||||
hashtable.put(parameterIndex, x);
|
||||
ps.setBoolean(parameterIndex, x);
|
||||
}
|
||||
|
||||
public void setByte(int parameterIndex, byte x) throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), new Byte(x));
|
||||
hashtable.put(parameterIndex, x);
|
||||
ps.setByte(parameterIndex, x);
|
||||
}
|
||||
|
||||
public void setShort(int parameterIndex, short x) throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), new Short(x));
|
||||
hashtable.put(parameterIndex, x);
|
||||
ps.setShort(parameterIndex, x);
|
||||
}
|
||||
|
||||
public void setInt(int parameterIndex, int x) throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), new Integer(x));
|
||||
hashtable.put(parameterIndex, x);
|
||||
ps.setInt(parameterIndex, x);
|
||||
}
|
||||
|
||||
public void setLong(int parameterIndex, long x) throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), new Long(x));
|
||||
hashtable.put(parameterIndex, x);
|
||||
ps.setLong(parameterIndex, x);
|
||||
}
|
||||
|
||||
public void setFloat(int parameterIndex, float x) throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), new Float(x));
|
||||
hashtable.put(parameterIndex, x);
|
||||
ps.setFloat(parameterIndex, x);
|
||||
}
|
||||
|
||||
public void setDouble(int parameterIndex, double x)
|
||||
throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), new Double(x));
|
||||
hashtable.put(parameterIndex, x);
|
||||
ps.setDouble(parameterIndex, x);
|
||||
}
|
||||
|
||||
public void setBigDecimal(int parameterIndex, BigDecimal x)
|
||||
throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), x);
|
||||
hashtable.put(parameterIndex, x);
|
||||
ps.setBigDecimal(parameterIndex, x);
|
||||
}
|
||||
|
||||
public void setString(int parameterIndex, String x)
|
||||
throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), "'" + x + "'");
|
||||
hashtable.put(parameterIndex, "'" + x + "'");
|
||||
ps.setString(parameterIndex, x);
|
||||
}
|
||||
|
||||
public void setBytes(int parameterIndex, byte[] x)
|
||||
throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), new String(x));
|
||||
hashtable.put(parameterIndex, new String(x));
|
||||
ps.setBytes(parameterIndex, x);
|
||||
}
|
||||
|
||||
public void setDate(int parameterIndex, java.sql.Date x)
|
||||
throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), x);
|
||||
hashtable.put(parameterIndex, x);
|
||||
ps.setDate(parameterIndex, x);
|
||||
}
|
||||
|
||||
public void setTime(int parameterIndex, java.sql.Time x)
|
||||
throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), x);
|
||||
hashtable.put(parameterIndex, x);
|
||||
ps.setTime(parameterIndex, x);
|
||||
}
|
||||
|
||||
public void setTimestamp(int parameterIndex, java.sql.Timestamp x)
|
||||
throws SQLException {
|
||||
hashtable.put(new Integer(parameterIndex), x);
|
||||
hashtable.put(parameterIndex, x);
|
||||
ps.setTimestamp(parameterIndex, x);
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ public class PreparedStatementProxy implements PreparedStatement {
|
||||
|
||||
String sqlTmp = new String(sql);
|
||||
for (int i = 1; i < (hashtable.size() + 1); i++) {
|
||||
str = hashtable.get(new Integer(i)).toString();
|
||||
str = hashtable.get(i).toString();
|
||||
index = sqlTmp.indexOf("?");
|
||||
sqlTmp = sqlTmp.substring(0, index) + str
|
||||
+ sqlTmp.substring(index + 1, sqlTmp.length());
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.eactive.eai.common.scheduler;
|
||||
|
||||
import com.eactive.eai.batch.common.BatchDirUtil;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.DirectoryNotEmptyException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.LinkOption;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class CleanUpStorage implements Job {
|
||||
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
private static final String PROPERTY_GROUP = BatchDirUtil.RESPONSE_RCV_DIR_INFO;
|
||||
private static final String DIR_ROOT = BatchDirUtil.RESPONSE_RCV_ROOT_DIR;
|
||||
private static final String DIR_RUNNING = BatchDirUtil.RESPONSE_RCV_REAL_DIR;
|
||||
private static final String DIR_ARCH = BatchDirUtil.RESPONSE_RCV_ARCH_DIR;
|
||||
private static final String DIR_ERROR = BatchDirUtil.RESPONSE_RCV_ERROR_DIR;
|
||||
|
||||
public static final String RETENTION_DAY_ROOT = BatchDirUtil.RETENTION_DAY_ROOT;
|
||||
public static final String RETENTION_DAY_REAL = BatchDirUtil.RETENTION_DAY_REAL;
|
||||
public static final String RETENTION_DAY_ARCH = BatchDirUtil.RETENTION_DAY_ARCH;
|
||||
public static final String RETENTION_DAY_ERROR = BatchDirUtil.RETENTION_DAY_ERROR;
|
||||
|
||||
private static final PropertyKeys[] keys = new PropertyKeys[] {
|
||||
new PropertyKeys(DIR_ROOT, RETENTION_DAY_ROOT),
|
||||
new PropertyKeys(DIR_RUNNING, RETENTION_DAY_REAL),
|
||||
new PropertyKeys(DIR_ARCH, RETENTION_DAY_ARCH),
|
||||
new PropertyKeys(DIR_ERROR, RETENTION_DAY_ERROR),
|
||||
};
|
||||
|
||||
private static class PropertyKeys {
|
||||
String dirKey;
|
||||
String retentionKey;
|
||||
|
||||
PropertyKeys(String dir, String retention) { this.dirKey = dir; this.retentionKey = retention; }
|
||||
}
|
||||
|
||||
private static class FolderInfo {
|
||||
String path;
|
||||
int retentionDay;
|
||||
|
||||
FolderInfo(String path, int retentionDay) { this.path = path; this.retentionDay = retentionDay; }
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
logger.info("=== Starting " + this.getClass().getSimpleName() + " ===");
|
||||
List<FolderInfo> folders = makeFolderInfos();
|
||||
for ( FolderInfo folder : folders)
|
||||
deleteExpiredFiles(folder);
|
||||
logger.info("=== Finished " + this.getClass().getSimpleName() + " ===");
|
||||
}
|
||||
|
||||
private void deleteExpiredFiles(FolderInfo folderInfo) {
|
||||
Path directory = Paths.get(folderInfo.path).toAbsolutePath().normalize();
|
||||
|
||||
if (!Files.isDirectory(directory)) { logger.error("Can't find directory: '"+directory+"'"); return; }
|
||||
if (folderInfo.retentionDay < 1) {
|
||||
logger.error("Invalid retention day: path='"+directory+"', retentionDay=" + folderInfo.retentionDay);
|
||||
return;
|
||||
}
|
||||
|
||||
Instant cutoffTime = Instant.now().minus(folderInfo.retentionDay, ChronoUnit.DAYS);
|
||||
|
||||
try (Stream<Path> stream = Files.walk(directory)) {
|
||||
stream.sorted(Comparator.comparingInt(Path::getNameCount).reversed())
|
||||
.filter(path -> !path.equals(directory))
|
||||
.forEach(path -> {
|
||||
try {
|
||||
if (Files.isDirectory(path, LinkOption.NOFOLLOW_LINKS)) {
|
||||
Files.delete(path);
|
||||
logger.info("Deleted empty directory: '"+path+"'");
|
||||
} else if (!Files.getLastModifiedTime(path).toInstant().isAfter(cutoffTime)) {
|
||||
Files.delete(path);
|
||||
logger.info("Deleted expired file: '"+path+"'");
|
||||
}
|
||||
} catch (NoSuchFileException ignored) { // 다른 작업에서 이미 삭제한 경우이므로 무시
|
||||
} catch (DirectoryNotEmptyException ignored) { // 보존 대상 파일이 남아 있는 디렉터리는 유지
|
||||
} catch (IOException e) {
|
||||
logger.error("Failed to delete: '"+path+"'", e);
|
||||
}
|
||||
});
|
||||
} catch (IOException | UncheckedIOException e) {
|
||||
logger.error("Failed to clean directory: '"+directory+"'", e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<FolderInfo> makeFolderInfos() {
|
||||
List<FolderInfo> ret = new ArrayList<>();
|
||||
for ( PropertyKeys key : keys ) {
|
||||
String dirString = PropManager.getInstance().getProperty(PROPERTY_GROUP, key.dirKey);
|
||||
String retention = PropManager.getInstance().getProperty(PROPERTY_GROUP, key.retentionKey);
|
||||
|
||||
if ( isInvalidProperty(key.dirKey, dirString) ) continue;
|
||||
if ( isInvalidProperty(key.retentionKey, retention) ) continue;
|
||||
|
||||
if (!Files.exists( Paths.get(dirString)) ) {
|
||||
logger.error("Can't find dir '"+dirString+"' for '"+key.dirKey+"'");
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
int retentionDays = Integer.parseInt(retention);
|
||||
ret.add(new FolderInfo(dirString, retentionDays));
|
||||
} catch (NumberFormatException e) {
|
||||
logger.error("Invalid retention days '"+retention+"' for '"+key.retentionKey+"'");
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private boolean isInvalidProperty(String key, String value) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
logger.warn("Can't find property :: Group="+PROPERTY_GROUP+", Key=" + key);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.eactive.eai.common.util;
|
||||
|
||||
import org.springframework.jndi.JndiObjectFactoryBean;
|
||||
|
||||
import com.eactive.eai.rms.client.util.ContainerUtil;
|
||||
|
||||
public class JndiObjectFactoryBeanForElink extends JndiObjectFactoryBean {
|
||||
public void setJndiName(String jndiName) {
|
||||
super.setJndiName(jndiName);
|
||||
|
||||
if (ContainerUtil.get() == ContainerUtil.TOMCAT) {
|
||||
super.setResourceRef(true);
|
||||
} else if (ContainerUtil.get() == ContainerUtil.WEBLOGIC) {
|
||||
super.setResourceRef(false);
|
||||
} else if (ContainerUtil.get() == ContainerUtil.JBOSS) {
|
||||
super.setResourceRef(false);
|
||||
} else if (ContainerUtil.get() == ContainerUtil.WEBSPHERE) {
|
||||
super.setResourceRef(false);
|
||||
} else {
|
||||
super.setResourceRef(false);
|
||||
}
|
||||
}
|
||||
public String getJndiName() {
|
||||
return super.getJndiName();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -178,7 +178,6 @@ public class Logger implements LogKeys, Serializable {
|
||||
HashMap<String, RollingFileAppender<ILoggingEvent>> fa = new HashMap<String, RollingFileAppender<ILoggingEvent>>();
|
||||
|
||||
for(int i=0;i<appenderNameList.length;i++) {
|
||||
|
||||
RollingFileAppender<ILoggingEvent> appender = addFileAppender(appenderNameList[i]);
|
||||
if ( appender == null ) {
|
||||
continue;
|
||||
@@ -201,16 +200,12 @@ public class Logger implements LogKeys, Serializable {
|
||||
if (StringUtils.isNotBlank(encoding)) {
|
||||
fple.setCharset(Charset.forName(encoding));
|
||||
}
|
||||
|
||||
fple.start();
|
||||
|
||||
appender.setEncoder( fple );
|
||||
appender.start();
|
||||
|
||||
fa.put( appenderNameList[i], appender );
|
||||
}
|
||||
|
||||
|
||||
//========================================================
|
||||
//3. 프라퍼티에 설정된 모든 파일 Logger 생성
|
||||
//========================================================
|
||||
@@ -320,7 +315,7 @@ public class Logger implements LogKeys, Serializable {
|
||||
}
|
||||
logger = (ch.qos.logback.classic.Logger)fileLogger.getLoggerImpl();//(ch.qos.logback.classic.Logger) LoggerFactory.getLogger(loggerName);
|
||||
try {
|
||||
logger.setAdditive(new Boolean(aditivity).booleanValue());
|
||||
logger.setAdditive(Boolean.parseBoolean(aditivity));
|
||||
} catch(Exception e) {
|
||||
logger.setAdditive(false);
|
||||
}
|
||||
@@ -402,7 +397,7 @@ public class Logger implements LogKeys, Serializable {
|
||||
appender.setRollingPolicy( rollingPolicy );
|
||||
try {
|
||||
String append = props.getProperty(APPENDER_FILE_APPEND);
|
||||
appender.setAppend(new Boolean(append).booleanValue());
|
||||
appender.setAppend(Boolean.parseBoolean(append));
|
||||
} catch(Exception e) {
|
||||
appender.setAppend(true);
|
||||
}
|
||||
@@ -893,7 +888,7 @@ public class Logger implements LogKeys, Serializable {
|
||||
rollingPolicy.setMaxHistory(Integer.parseInt(maxBackupIndex));
|
||||
rollingPolicy.start();
|
||||
try {
|
||||
appender.setAppend(new Boolean(fileAppend).booleanValue());
|
||||
appender.setAppend(Boolean.parseBoolean(fileAppend));
|
||||
} catch(Exception e) {
|
||||
appender.setAppend(true);
|
||||
}
|
||||
@@ -902,7 +897,7 @@ public class Logger implements LogKeys, Serializable {
|
||||
appender.setRollingPolicy( rollingPolicy );
|
||||
|
||||
try {
|
||||
appender.setAppend(new Boolean(fileAppend).booleanValue());
|
||||
appender.setAppend(Boolean.parseBoolean(fileAppend));
|
||||
} catch(Exception e) {
|
||||
appender.setAppend(true);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class CodeConversion
|
||||
throw new Exception("Maximun COMP Length Over["+src+"]");
|
||||
}
|
||||
|
||||
int iKey = new Integer(src).intValue();
|
||||
int iKey = Integer.parseInt(src);
|
||||
|
||||
// System.out.println("HEX[0x"+ Integer.toHexString(iKey)+"]");
|
||||
|
||||
@@ -120,8 +120,8 @@ public class CodeConversion
|
||||
int upper = iKey >> 8 & 0xff;
|
||||
|
||||
comp = new byte[2];
|
||||
comp[0] = new Integer(upper).byteValue();
|
||||
comp[1] = new Integer(lower).byteValue();
|
||||
comp[0] = (byte) upper;
|
||||
comp[1] = (byte) lower;
|
||||
}
|
||||
else {
|
||||
int byte1 = iKey >> 24 & 0xffff;
|
||||
@@ -129,10 +129,10 @@ public class CodeConversion
|
||||
int byte3 = iKey >> 8 & 0xffff;
|
||||
int byte4 = iKey & 0xffff;
|
||||
comp = new byte[4];
|
||||
comp[0] = new Integer(byte1).byteValue();
|
||||
comp[1] = new Integer(byte2).byteValue();
|
||||
comp[2] = new Integer(byte3).byteValue();
|
||||
comp[3] = new Integer(byte4).byteValue();
|
||||
comp[0] = (byte) byte1;
|
||||
comp[1] = (byte) byte2;
|
||||
comp[2] = (byte) byte3;
|
||||
comp[3] = (byte) byte4;
|
||||
|
||||
}
|
||||
} catch(Exception e) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import javax.sql.DataSource;
|
||||
import com.eactive.eai.adapter.socket.config.SocketAdapterManager;
|
||||
import com.eactive.eai.batch.code.CodeMessageManager;
|
||||
import com.eactive.eai.batch.scheduler.SchedulerMessageManager;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.lifecycle.Lifecycle;
|
||||
@@ -124,6 +125,15 @@ public class AppInitializer implements InitializingBean, DisposableBean {
|
||||
}
|
||||
|
||||
|
||||
logger.debug("CodeMessageManager 메모리 로딩 시작 ------------------------------------------");
|
||||
try {
|
||||
CodeMessageManager.getInstance().start();
|
||||
} catch(LifecycleException e) {
|
||||
logger.error( e.getMessage(), e);
|
||||
throw new RuntimeException(ExceptionUtil.getErrorCode(e,"BFCEAICWB001"));
|
||||
}
|
||||
logger.debug("CodeMessageManager 메모리 로딩 종료 ------------------------------------------");
|
||||
|
||||
logger.debug("Property 메모리 로딩 시작 ------------------------------------------");
|
||||
try {
|
||||
PropManager.getInstance().start();
|
||||
@@ -132,7 +142,7 @@ public class AppInitializer implements InitializingBean, DisposableBean {
|
||||
throw new RuntimeException(ExceptionUtil.getErrorCode(e,"BFCEAICWB001"));
|
||||
}
|
||||
logger.debug("Property 메모리 로딩 종료 ------------------------------------------");
|
||||
|
||||
|
||||
logger.debug("Logger 메모리 로딩 시작 ------------------------------------------");
|
||||
try {
|
||||
Logger.doConfigure();
|
||||
@@ -147,22 +157,22 @@ public class AppInitializer implements InitializingBean, DisposableBean {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
try {
|
||||
Class clazz = Class
|
||||
.forName("com.eactive.eai.rms.client.context.MonitoringContextFactory");
|
||||
Object factory = clazz.newInstance();
|
||||
Method method = clazz.getMethod("create");
|
||||
method.invoke(factory);
|
||||
System.out.println("RMSCLIENT AGENT STARTED ~~ !!!!");
|
||||
logger.warn("EMSCLIENT AGENT STARTED ~~ !!!!");
|
||||
} catch (InvocationTargetException e) {
|
||||
System.out.println("RMSCLIENT AGENT CANNOT START ~~ !!!! - "+e.getTargetException().toString());
|
||||
logger.error("RMSCLIENT AGENT CANNOT START ~~ !!!! - "+e.getTargetException().toString(),e.getTargetException());
|
||||
e.getTargetException().printStackTrace();
|
||||
} catch (Throwable e) {
|
||||
System.out.println("RMSCLIENT AGENT CANNOT START ~~ !!!! - "+e.toString());
|
||||
logger.error("RMSCLIENT AGENT CANNOT START ~~ !!!! - "+e.toString(),e);
|
||||
}
|
||||
// try {
|
||||
// Class clazz = Class
|
||||
// .forName("com.eactive.eai.rms.client.context.MonitoringContextFactory");
|
||||
// Object factory = clazz.newInstance();
|
||||
// Method method = clazz.getMethod("create");
|
||||
// method.invoke(factory);
|
||||
// System.out.println("RMSCLIENT AGENT STARTED ~~ !!!!");
|
||||
// logger.warn("EMSCLIENT AGENT STARTED ~~ !!!!");
|
||||
// } catch (InvocationTargetException e) {
|
||||
// System.out.println("RMSCLIENT AGENT CANNOT START ~~ !!!! - "+e.getTargetException().toString());
|
||||
// logger.error("RMSCLIENT AGENT CANNOT START ~~ !!!! - "+e.getTargetException().toString(),e.getTargetException());
|
||||
// e.getTargetException().printStackTrace();
|
||||
// } catch (Throwable e) {
|
||||
// System.out.println("RMSCLIENT AGENT CANNOT START ~~ !!!! - "+e.toString());
|
||||
// logger.error("RMSCLIENT AGENT CANNOT START ~~ !!!! - "+e.toString(),e);
|
||||
// }
|
||||
|
||||
logger.debug("LifeCycle 관련 클래스 메모리 로딩 시작 ------------------------------------------");
|
||||
LifecycleManager manager = LifecycleManager.getInstance();
|
||||
|
||||
@@ -183,10 +183,8 @@ public class ReqRecvEventListener extends Process{
|
||||
LogUtil.setStartLog (batchMsgDoc);
|
||||
logger.info("[Req Recv File Event] ※ Event 파일명 : [" + fileName +"]");
|
||||
}
|
||||
|
||||
|
||||
private void catchException(Exception ex)
|
||||
{
|
||||
private void catchException(Exception ex) {
|
||||
try {
|
||||
// 파일로그 처리
|
||||
String errMsg = ExceptionUtil.getErrorCode(ex, "BECEAIIFE007");
|
||||
@@ -201,6 +199,7 @@ public class ReqRecvEventListener extends Process{
|
||||
logger.error("[Req Recv File Event] ★★★★★ 수신 요청 File Event Listner 예외 처리 중 에러 !! ★★★★★", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchDoc clientRequestwithReturn(
|
||||
BatchDoc batchDoc) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user