This commit is contained in:
Rinjae
2025-09-05 18:57:45 +09:00
commit aacc1a389e
1229 changed files with 167963 additions and 0 deletions
@@ -0,0 +1,693 @@
package com.eactive.eai.flowcontroller;
import java.nio.charset.Charset;
import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.adapter.Keys;
import com.eactive.eai.common.EAIKeys;
import com.eactive.eai.common.EAITable;
import com.eactive.eai.common.exception.ExceptionHandler;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.message.EAIMessage;
import com.eactive.eai.common.message.EAIMessageKeys;
import com.eactive.eai.common.message.MessageType;
import com.eactive.eai.common.property.PropManager;
import com.eactive.eai.common.routing.IFRouter;
import com.eactive.eai.common.routing.Process;
import com.eactive.eai.common.routing.RouteKeys;
import com.eactive.eai.common.server.EAIServerManager;
import com.eactive.eai.common.util.B2BExtractor;
import com.eactive.eai.common.util.B2BServiceMapper;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageUtil;
import com.eactive.eai.common.util.ObjectUtil;
import com.eactive.eai.common.util.ServiceUtil;
import com.eactive.eai.control.LogSender;
import com.eactive.eai.message.StandardMessage;
import com.eactive.eai.message.service.InterfaceMapper;
import com.eactive.eai.transformer.function.util.CodeConversion;
import com.ext.eai.common.stdmessage.STDMessageKeys;
public class B2BFCProcess extends Process {
private String adptrMsgPtrnCd;
private int logPssSeq;
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
private java.util.Properties callProp;
private EAIMessage resEaiMsg;
private com.eactive.eai.common.message.EAIMessage reqEaiMsg;
static Logger esbLogger = Logger.getLogger(Logger.LOGGER_ESBFW);
private int svrLogLevel;
private static ThreadLocal local = new ThreadLocal();
static final long serialVersionUID = 1L;
private String guidLogPrefix = "";
public EAIMessage clientReturn() {
if (svrLogLevel >= 1) {
try {
long msgSndTm = System.currentTimeMillis();
Long threadData = (Long) local.get();
long processTm = msgSndTm - threadData.longValue();
if (esbLogger.isInfo())
esbLogger.info(
guidLogPrefix + " End... - 경과시간 : " + processTm + "(ms) - EAI Server Log Level is INFO");
} catch (Exception e) {
logger.warn("clientReturn", e);
}
}
return resEaiMsg;
}
public void callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp) {
this.reqEaiMsg = reqEaiMsg;
this.callProp = callProp;
if (this.reqEaiMsg == null)
return;
svrLogLevel = this.reqEaiMsg.getSvrLogLvl();
guidLogPrefix = "B2BFCProcess] GUID[" + getGuid(reqEaiMsg) + "] UUID[" + this.reqEaiMsg.getSvcOgNo() + "] ";
if (svrLogLevel >= 1) {
try {
long msgRcvTm = System.currentTimeMillis();
local.set(new Long(msgRcvTm));
if (esbLogger.isInfo()) {
esbLogger.info(guidLogPrefix + " started... - EAI Server Log Level is INFO");
}
} catch (Exception e) {
logger.warn("callService", e);
}
}
try {
flow();
} catch (Exception e) {
printExceptionMessage(e);
if (isSourceAsync()) {
logSenderCtrlSend();
callExceptionHandler();
}
}
}
public void flow() throws Exception {
if (!isRealCall()) {
return;
}
init();
// B2BOutboud Mapping
setRoute();
setAdptrInstiCode();
ifRouterProcess();
setGUID();
// ASYNC-SYNC
if (checkServiceMsgSize()) {
setCurrentService();
ifRouterProcessResponse();
}
}
public void ifRouterProcess() throws Exception {
try {
EAIMessage reqMsg = (EAIMessage) ObjectUtil.deepCopy(this.reqEaiMsg);
this.resEaiMsg = IFRouter.process(reqMsg, this.callProp);
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBR001";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
logger.error(guidLogPrefix + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
// ----------------------------------------------------
// 기동시스템이 Async 거래의 OUtbound에서 오류가 발생할 경우
// ExceptionHandler를 통해 응답메시지를 전송한다.
// ---------------------------------------------------
if (EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp())) {
if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())) {
try {
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.resEaiMsg.getStandardMessage().setBizData(bizData, inboundCharset);
ExceptionHandler.handle(this.resEaiMsg);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " ExceptionHandler Call Error :" + e.getMessage());
}
}
}
}
public void ifRouterProcessResponse() throws Exception {
try {
String returnServiceId = this.resEaiMsg.getMapper().getReturnServiceId(this.resEaiMsg.getStandardMessage());
this.resEaiMsg.getMapper().setServiceId(this.resEaiMsg.getStandardMessage(), returnServiceId);
this.resEaiMsg = IFRouter.process(this.resEaiMsg, this.callProp);
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBR100";
String orgErrorCode = ExceptionUtil.getErrorCode(e, rspErrorCode);
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, orgErrorCode, msgArgs);
logger.error(guidLogPrefix + " " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
this.logPssSeq = com.eactive.eai.common.logger.Keys.LOG_SEQ_4;
LogSender.send(this.logPssSeq, this.resEaiMsg, null);
}
}
public void logSenderCtrlSend() {
String telgmDmndDstcd = reqEaiMsg.getMapper().getSendRecvDivision(reqEaiMsg.getStandardMessage()); // S|R
if (STDMessageKeys.SEND_RECV_CD_RECV.equals(telgmDmndDstcd)) {
this.logPssSeq = com.eactive.eai.common.logger.Keys.LOG_SEQ_4;
} else {
this.logPssSeq = com.eactive.eai.common.logger.Keys.LOG_SEQ_2;
}
try {
LogSender.send(this.logPssSeq, this.resEaiMsg, null);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " AA Exception Logging Error :" + e.getMessage());
}
}
public boolean checkServiceMsgSize() {
if (MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) && reqEaiMsg.getSvcMsgs().size() > 1) {
return true;
} else {
return false;
}
}
public void setCurrentService() throws Exception {
String keyMgtMsgVl = resEaiMsg.getCurrentSvcMsg().getKeyMgtMsgVl();
if (logger.isDebug()) {
logger.debug(guidLogPrefix + " AS 응답 keyMgtMsgVl[" + keyMgtMsgVl + "]");
}
resEaiMsg.setSvcPssSeq(resEaiMsg.getSvcPssSeq() + 1);
resEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
// AS 응답거래 라우팅
try {
// Service Routing
String[] b2bKeys = B2BExtractor.getB2BRouteKeyValues(this.resEaiMsg.getEAISvcCd(),
this.resEaiMsg.getSvcPssSeq(),
this.resEaiMsg.getStandardMessage().getBizData(), getInboundCharset());
String mappedKey = "DEFAULT";
if (b2bKeys != null && b2bKeys.length > 0) {
for (int i = 0; i < b2bKeys.length; i++) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " AS 응답거래 : B2B RouteKey [" + b2bKeys[i] + "]");
EAIMessage mappedEaiMsg = B2BServiceMapper.setB2BService(b2bKeys[i], this.resEaiMsg);
if (mappedEaiMsg != null) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " AS 응답거래 : EAISVCCD[" + this.resEaiMsg.getEAISvcCd()
+ "] B2B RouteKey [" + b2bKeys[i] + "]의 서비스메시지를 매핑함");
this.resEaiMsg = mappedEaiMsg;
mappedKey = b2bKeys[i];
break;
}
}
} else {
if (logger.isDebug())
logger.debug(guidLogPrefix + " AS 응답거래 : 조회된 서비스 라우팅 키가 없습니다.");
// 기동이 내부표준이 아닌 경우 기관코드로 라우팅 하도록 수정
if (!com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.resEaiMsg.getStdMsgUsgCls())) {
String instCd = this.resEaiMsg.getMapper().getInstCode(this.resEaiMsg.getStandardMessage());
if (instCd == null || instCd.trim().length() == 0) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " AS 응답거래 : 내부표준의 대외기관코드의 값이 없음");
} else {
String extBizCode = this.resEaiMsg.getExtBizCd();
if (logger.isDebug())
logger.debug(guidLogPrefix + " AS 응답거래 : B2B RouteKey 인터페이스 대외업무구분코드 [" + extBizCode + "]");
if (logger.isDebug())
logger.debug(guidLogPrefix + " AS 응답거래 : B2B RouteKey 내부표준의 대외기관코드 [" + instCd + "]");
EAIMessage mappedEaiMsg = B2BServiceMapper.setB2BService( (extBizCode+instCd), this.resEaiMsg);
if (mappedEaiMsg != null) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " AS 응답거래 : EAISVCCD[" + this.resEaiMsg.getEAISvcCd()
+ "] B2B RouteKey [" + extBizCode + instCd + "]의 서비스메시지를 매핑함");
this.reqEaiMsg = mappedEaiMsg;
mappedKey = extBizCode + instCd;
}
}
}
}
// Adapter Routing
if (logger.isDebug())
logger.debug(guidLogPrefix + " AS 응답거래 : B2B Service RouteKey [" + mappedKey + "]");
String[] adapterRouteKeys = B2BExtractor.getB2BAdapterRouteKeyValues(this.resEaiMsg.getEAISvcCd(),
this.resEaiMsg.getSvcPssSeq(),
this.resEaiMsg.getStandardMessage().getBizData()
, getInboundCharset());
if (adapterRouteKeys != null && adapterRouteKeys.length > 0) {
for (int i = 0; i < adapterRouteKeys.length; i++) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " AS 응답거래 : B2B Adapter RouteKey [" + adapterRouteKeys[i] + "]");
EAIMessage mappedEaiMsg = B2BServiceMapper.setB2BAdapter(mappedKey, adapterRouteKeys[i],
this.resEaiMsg, this.callProp);
if (mappedEaiMsg != null) {
if (logger.isDebug()) {
logger.debug(guidLogPrefix + " AS 응답거래 : EAISVCCD[" + this.resEaiMsg.getEAISvcCd()
+ "] B2B Adapter RouteKey [" + adapterRouteKeys[i] + "]의 어댑터를 매핑함");
}
this.resEaiMsg = mappedEaiMsg;
break;
} else {
if (logger.isDebug()) {
logger.debug(guidLogPrefix + " AS 응답거래 : EAISVCCD[" + this.resEaiMsg.getEAISvcCd()
+ "] B2B Adapter RouteKey [" + adapterRouteKeys[i] + "] Not Found");
}
}
}
} else {
if (logger.isDebug())
logger.debug(guidLogPrefix + " AS 응답거래 : 조회된 어댑터 라우팅 키가 없습니다.");
}
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " AS 응답거래 : B2B Serice Routing Set Error :" + e.getMessage());
String[] msgArgs = new String[1];
msgArgs[0] = this.resEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBR002";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + " AS 응답거래 : " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
// 기동이 표준인 경우만
if (com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls())) {
setReturnType(resEaiMsg, STDMessageKeys.SEND_RECV_CD_RECV);
}
}
public boolean isOutboundCall() {
return true;
}
public void init() throws Exception {
try {
String guid = this.reqEaiMsg.getMapper().getGuid(this.reqEaiMsg.getStandardMessage());
String guidseq = this.reqEaiMsg.getMapper().getGuidSeq(this.reqEaiMsg.getStandardMessage());
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ Current GUID [" + guid + "][" + guidseq + "]");
this.reqEaiMsg.getMapper().nextGuidSeq(this.reqEaiMsg.getStandardMessage());
guidseq = this.reqEaiMsg.getMapper().getGuidSeq(this.reqEaiMsg.getStandardMessage());
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ ADD PATHSEQ GUID [" + guid + "][" + guidseq + "]");
this.resEaiMsg = this.reqEaiMsg;
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBR003";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + " " + rspErrorMsg, e);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
EAIServerManager eaiServerManager = EAIServerManager.getInstance();
String srcAdapterGroupName = reqEaiMsg.getSngSysItfTp();
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(srcAdapterGroupName);
if (eaiServerManager.isTASEnabledEAIServer() && EAIMessageKeys.TRANTYPE_FROMTAS.equals(reqEaiMsg.getTranType())
&& inAdptGrpVO == null) {
logger.info(guidLogPrefix + "- TAS 기동거래 [" + srcAdapterGroupName + "] = " + MessageType.ASC);
} else {
if (inAdptGrpVO == null) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF003";
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs) + "(어댑터그룹 미등록/미사용 - "
+ srcAdapterGroupName + ")";
if (logger.isError())
logger.error(guidLogPrefix + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
}
}
public void printExceptionMessage(Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " ExceptionPath : " + e.getMessage());
}
public boolean isSourceAsync() {
if (EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp())) {
return true;
} else {
return false;
}
}
public void callExceptionHandler() {
try {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(this.reqEaiMsg.getSngSysItfTp());
String inAdapterMsgType = inAdptGrpVO.getMessageType();
if (EAITable.EBCDIC_TYPE.equals(inAdapterMsgType)) {
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
byte[] asc = CodeConversion.meToMixedAsc(bizData.getBytes());
try {
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.reqEaiMsg.getStandardMessage().setBizData(new String(asc), inboundCharset);
} catch (Exception e) {
logger.error("setBizData error", e);
}
}
ExceptionHandler.handle(this.reqEaiMsg);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " ExceptionHandler Call Error", e);
}
}
public boolean isRealCall() {
if (this.callProp != null) {
String mode = this.callProp.getProperty(EAIKeys.CALL_MODE_KEY);
if (mode != null && EAIKeys.CALL_MODE_WARMUP.equals(mode)) {
logger.warn(guidLogPrefix + " Warming Up Called");
return false;
} else {
return true;
}
} else {
return true;
}
}
private String getInboundCharset() {
String srcAdapterGroupName = reqEaiMsg.getSngSysItfTp();
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(srcAdapterGroupName);
String charset = StringUtils.defaultIfBlank(inAdptGrpVO.getMessageEncode(), Charset.defaultCharset().name());
return charset;
}
public void setRoute() throws Exception {
String adapterGroupName;
try {
// Service Routing
String[] b2bKeys = B2BExtractor.getB2BRouteKeyValues(this.reqEaiMsg.getEAISvcCd(),
this.reqEaiMsg.getSvcPssSeq()
, this.reqEaiMsg.getStandardMessage().getBizData(), getInboundCharset());
String mappedKey = "DEFAULT";
if (b2bKeys != null && b2bKeys.length > 0) {
for (int i = 0; i < b2bKeys.length; i++) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " B2B RouteKey [" + b2bKeys[i] + "]");
EAIMessage mappedEaiMsg = B2BServiceMapper.setB2BService(b2bKeys[i], this.reqEaiMsg);
if (mappedEaiMsg != null) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " EAISVCCD[" + this.reqEaiMsg.getEAISvcCd()
+ "] B2B RouteKey [" + b2bKeys[i] + "]의 서비스메시지를 매핑함");
this.reqEaiMsg = mappedEaiMsg;
mappedKey = b2bKeys[i];
break;
}
}
} else {
if (logger.isDebug())
logger.debug(guidLogPrefix + " 조회된 서비스 라우팅 키가 없습니다.");
// 기동이 내부 표준인 경우 기관코드로 라우팅 하도록 수정
if (com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls())) {
String instCd = this.reqEaiMsg.getMapper().getInstCode(this.reqEaiMsg.getStandardMessage());
if (instCd == null || instCd.trim().length() == 0) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " 내부표준의 대외기관코드의 값이 없음");
} else {
String extBizCode = this.reqEaiMsg.getExtBizCd();
if (logger.isDebug()) {
logger.debug(guidLogPrefix + " B2B RouteKey 인터페이스의 대외업무구분코드 [" + extBizCode + "]");
logger.debug(guidLogPrefix + " B2B RouteKey 내부표준의 대외기관코드 [" + instCd + "]");
}
EAIMessage mappedEaiMsg = B2BServiceMapper.setB2BService(extBizCode + instCd, this.reqEaiMsg);
if (mappedEaiMsg != null) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " EAISVCCD[" + this.reqEaiMsg.getEAISvcCd()
+ "] B2B RouteKey [" + instCd + "]의 서비스메시지를 매핑함");
this.reqEaiMsg = mappedEaiMsg;
mappedKey = extBizCode + instCd;
}
}
}
}
// EAI서비스코드 앞 3자리와 he03의 PSVSYSBZWKDSTCD 의 앞 3자리가 다른경우 추출
PropManager pMan = PropManager.getInstance();
String differenceLog = pMan.getProperty("DIFFERENCE", "LOG_YN", "Y");
if ("Y".equals(differenceLog)) {
if (this.reqEaiMsg != null && this.reqEaiMsg.getCurrentSvcMsg() != null) {
String eaiSvcName = this.reqEaiMsg.getEAISvcCd();
String instCd = getInstCode(this.reqEaiMsg);
String biz = this.reqEaiMsg.getCurrentSvcMsg().getPsvBwkSysNm();
String keys = "";
String apcode = "";
if (eaiSvcName != null && eaiSvcName.trim().length() >= 3) {
apcode = eaiSvcName.trim().substring(0, 3);
}
if (b2bKeys != null && b2bKeys.length > 0) {
for (String k : b2bKeys) {
keys += "," + k;
}
}
keys = "[" + keys + "]";
if (biz != null) {
biz = biz.trim();
}
if (apcode != null && biz != null) {
if (!biz.equals(apcode)) {
logger.error("B2BFCProcess] difference apcode set apcode=" + apcode + ", bwksysnm=" + biz
+ ", eaisvcname=" + eaiSvcName + ", keys=" + keys + ", instCd=" + instCd);
}
} else {
logger.error("B2BFCProcess] difference apcode set apcode=" + apcode + ", bwksysnm=" + biz
+ ", eaisvcname=" + eaiSvcName + ", keys=" + keys + ", instCd=" + instCd);
}
}
}
// Adapter Routing
if (logger.isDebug())
logger.debug(guidLogPrefix + " B2B Service RouteKey [" + mappedKey + "]");
String[] adapterRouteKeys = B2BExtractor.getB2BAdapterRouteKeyValues(this.reqEaiMsg.getEAISvcCd(),
this.reqEaiMsg.getSvcPssSeq()
, this.reqEaiMsg.getStandardMessage().getBizData()
, getInboundCharset());
if (adapterRouteKeys != null && adapterRouteKeys.length > 0) {
for (int i = 0; i < adapterRouteKeys.length; i++) {
if (logger.isDebug()) {
logger.debug(guidLogPrefix + " B2B Adapter RouteKey [" + adapterRouteKeys[i] + "]");
}
EAIMessage mappedEaiMsg = B2BServiceMapper.setB2BAdapter(mappedKey, adapterRouteKeys[i],
this.reqEaiMsg, this.callProp);
if (mappedEaiMsg != null) {
if (logger.isDebug()) {
logger.debug(guidLogPrefix + " EAISVCCD[" + this.reqEaiMsg.getEAISvcCd()
+ "] B2B Adapter RouteKey [" + adapterRouteKeys[i] + "]의 어댑터를 매핑함 - "
+ callProp.getProperty(Keys.OUT_ADAPTER_GROUP_NAME));
}
this.reqEaiMsg = mappedEaiMsg;
break;
} else {
if (logger.isDebug())
logger.debug(guidLogPrefix + " EAISVCCD[" + this.reqEaiMsg.getEAISvcCd()
+ "] B2B Adapter RouteKey [" + adapterRouteKeys[i] + "] Not Found");
}
}
} else {
if (logger.isDebug())
logger.debug(guidLogPrefix + " 조회된 어댑터 라우팅 키가 없습니다.");
}
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " B2B Serice Routing Set Error :" + e.getMessage());
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBR002";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + " " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
try {
adapterGroupName = reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp();
EAIServerManager eaiServerManager = EAIServerManager.getInstance();
if (eaiServerManager.isTASEnabledEAIServer()
&& EAIMessageKeys.TRANTYPE_TAS.equals(reqEaiMsg.getTranType())) {
PropManager manager = PropManager.getInstance();
Properties prop = manager.getProperties(RouteKeys.SIM);
if (reqEaiMsg.getCurrentSvcMsg().isSyncItfTp()) {
adapterGroupName = prop.getProperty(RouteKeys.SIM_ADAPTER_SYNC, "_SIM_OU_HTT_SyC");
} else {
adapterGroupName = prop.getProperty(RouteKeys.SIM_ADAPTER_ASYNC, "_SIM_OU_HTT_AsC");
}
} else {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
if (adptGrpVO == null) {
throw new Exception("수동어댑터[" + adapterGroupName + "]가 사용 중이 아님");
}
this.adptrMsgPtrnCd = adptGrpVO.getAdptrMsgPtrnCd();
}
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBR003";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + " " + rspErrorMsg, e);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
// AA가 아니고 기동이 KB표준이 아닌 경우 Adapter의 timeout값을 설정한다.
try {
String svcTsmtUsgTp = this.reqEaiMsg.getSvcTsmtUsgTp(); // 기동 호출방식
String psvItfTp = this.reqEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 수동 호출방식
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
if (!(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
&& !(com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls()))) {
// SA 또는 SNA Adapter일 경우에 는 SA Timeout값을 설정
if ((EAIMessageKeys.SYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
|| Keys.TYPE_SNA.equals(adptGrpVO.getType())) {
int saTimeoutSec = this.reqEaiMsg.getCurrentSvcMsg().getTmoVl();
if (logger.isDebug())
logger.debug("BaseFCProcess] SA TimeoutValue [" + saTimeoutSec + "]");
setTimeout(this.reqEaiMsg, "" + saTimeoutSec);
} else {
int timeout = ServiceUtil.getTimeoutValue(adapterGroupName);
if (logger.isDebug())
logger.debug("BaseFCProcess] Target Adapter TimeoutValue [" + timeout + "]");
if (timeout > 0) {
if (logger.isDebug())
logger.debug("BaseFCProcess] Set Adapter TimeoutValue [" + timeout + "] to KBMessage");
setTimeout(this.reqEaiMsg, "" + timeout);
}
}
}
} catch (Exception e) {
if (logger.isWarn()) {
logger.warn("BaseFCProcess] Get Adapter TimeoutValue Error - " + e.getMessage(), e);
}
}
}
public void setAdptrInstiCode() throws Exception {
String groupName = reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp();
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(groupName);
if (adptGrpVO != null) {
String adptrInstiCode = adptGrpVO.getAdptrInstiCode();
if (adptrInstiCode != null && !"".equals(adptrInstiCode)) {
reqEaiMsg.setAdptrInstiCode(adptrInstiCode);
}
}
}
public void setGUID() throws Exception {
InterfaceMapper mapper = this.resEaiMsg.getMapper();
StandardMessage standardMessage = this.resEaiMsg.getStandardMessage();
String guid = mapper.getGuid(standardMessage);
String guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ Current GUID [" + guid + "][" + guidseq + "]");
mapper.nextGuidSeq(standardMessage);
guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ ADD PATHSEQ GUID [" + guid + "][" + guidseq + "]");
String svcTsmtUsgTp = this.reqEaiMsg.getSvcTsmtUsgTp(); // 기동 호출방식
String psvItfTp = this.reqEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 수동 호출방식
if ((!(com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.adptrMsgPtrnCd))
&& !(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp)))
|| ((com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.adptrMsgPtrnCd))
&& (EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp)
&& EAIMessageKeys.SYNC_SVC.equals(psvItfTp)))) {
String prcssRtdTranCd = mapper.getReturnServiceId(standardMessage);
if (prcssRtdTranCd != null && prcssRtdTranCd.length() >= 14) {
String telgmRecvTranCd = prcssRtdTranCd.substring(4, 14);
mapper.setServiceId(standardMessage, telgmRecvTranCd);
} else {
if (logger.isInfo()) {
logger.info(guidLogPrefix + "- PrcssRtdTranCd Length < 14 [" + prcssRtdTranCd + "]");
}
}
}
if (!(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
&& (com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls()))
&& (STDMessageKeys.RECOVER_YN_YES
.equals(this.reqEaiMsg.getMapper().getRecoverYn(this.reqEaiMsg.getStandardMessage())))) {
String reqOgtranGuIdNo = this.reqEaiMsg.getMapper().getOrgGuid(this.reqEaiMsg.getStandardMessage());
mapper.setOrgGuid(standardMessage, reqOgtranGuIdNo);
if (logger.isInfo()) {
logger.info(guidLogPrefix + " OgtranGuIdNo 복원 " + this.reqEaiMsg.getSvcOgNo() + " OgtranGuIdNo ["
+ mapper.getOrgGuid(standardMessage) + "]");
}
}
}
}
@@ -0,0 +1,473 @@
package com.eactive.eai.flowcontroller;
import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.adapter.Keys;
import com.eactive.eai.common.EAIKeys;
import com.eactive.eai.common.EAITable;
import com.eactive.eai.common.exception.ExceptionHandler;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.message.EAIMessage;
import com.eactive.eai.common.message.EAIMessageKeys;
import com.eactive.eai.common.message.MessageType;
import com.eactive.eai.common.property.PropManager;
import com.eactive.eai.common.routing.IFRouter;
import com.eactive.eai.common.routing.Process;
import com.eactive.eai.common.routing.RouteKeys;
import com.eactive.eai.common.server.EAIServerManager;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageUtil;
import com.eactive.eai.common.util.ObjectUtil;
import com.eactive.eai.common.util.ServiceUtil;
import com.eactive.eai.control.LogSender;
import com.eactive.eai.message.StandardMessage;
import com.eactive.eai.message.service.InterfaceMapper;
import com.eactive.eai.transformer.function.util.CodeConversion;
import com.ext.eai.common.stdmessage.STDMessageKeys;
public class BaseFCProcess extends Process {
public String adptrMsgPtrnCd;
public java.lang.String adapterGroupName;
public int logPssSeq;
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
public java.util.Properties callProp;
public EAIMessage resEaiMsg;
public com.eactive.eai.common.message.EAIMessage reqEaiMsg;
static Logger esbLogger = Logger.getLogger(Logger.LOGGER_ESBFW);
private int svrLogLevel;
private static ThreadLocal local = new ThreadLocal();
String guidLogPrefix = "";
static final long serialVersionUID = 1L;
public EAIMessage clientReturn() {
if (svrLogLevel >= 1) {
try {
long msgSndTm = System.currentTimeMillis();
Long threadData = (Long) local.get();
long processTm = msgSndTm - threadData.longValue();
if (esbLogger.isInfo())
esbLogger.info(
guidLogPrefix + "End... - 경과시간 : " + processTm + "(ms) - EAI Server Log Level is INFO");
} catch (Exception e) {
logger.warn("clientReturn", e);
}
}
return resEaiMsg;
}
public void callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp) {
this.reqEaiMsg = reqEaiMsg;
this.callProp = callProp;
if (this.reqEaiMsg == null)
return;
svrLogLevel = this.reqEaiMsg.getSvrLogLvl();
guidLogPrefix = "BaseFCProcess] GUID[" + getGuid(reqEaiMsg) + "] UUID[" + this.reqEaiMsg.getSvcOgNo() + "] ";
if (svrLogLevel >= 1) {
try {
long msgRcvTm = System.currentTimeMillis();
local.set(new Long(msgRcvTm));
if (esbLogger.isInfo())
esbLogger.info(guidLogPrefix + " started... - EAI Server Log Level is INFO");
} catch (Exception e) {
logger.warn("callService", e);
}
}
try {
flow();
} catch (Exception e) {
printExceptionMessage(e);
if (isSourceAsync()) {
logSenderCtrlSend();
callExceptionHandler();
}
return;
}
}
public void flow() throws Exception {
if (!isRealCall()) {
return;
}
// 초기화
init();
// Outbound 프로세스 호출
ifRouterProcess();
// GUID설정
setGUID();
// ASYNC-SYNC모델
if (checkServiceMsgSize()) {
// ServiceMessage설정
setCurrentService();
// 응답메시지전송
ifRouterProcessResponse();
}
}
public void ifRouterProcess() throws Exception {
try {
// this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
EAIMessage reqMsg = (EAIMessage) ObjectUtil.deepCopy(this.reqEaiMsg);
this.resEaiMsg = IFRouter.process(reqMsg, this.callProp);
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF001";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + rspErrorMsg, e);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
// ----------------------------------------------------
// 기동시스템이 Async 거래의 OUtbound에서 오류가 발생할 경우
// ExceptionHandler를 통해 응답메시지를 전송한다.
// ----------------------------------------------------
if (EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp())) {
if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())) {
try {
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.resEaiMsg.getStandardMessage().setBizData(bizData, inboundCharset);
ExceptionHandler.handle(this.resEaiMsg);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + "ExceptionHandler Call Error :" + e.getMessage());
}
}
}
}
public void ifRouterProcessResponse() throws Exception {
try {
// 20220405
// AS거래에서 처리결과수신서비스ID를 서비스ID로 넣어준다.
String returnServiceId = this.resEaiMsg.getMapper().getReturnServiceId(this.resEaiMsg.getStandardMessage());
this.resEaiMsg.getMapper().setServiceId(this.resEaiMsg.getStandardMessage(), returnServiceId);
this.resEaiMsg = IFRouter.process(this.resEaiMsg, this.callProp);
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF100";
String orgErrorCode = ExceptionUtil.getErrorCode(e, rspErrorCode);
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, orgErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
this.logPssSeq = 400;
LogSender.send(this.logPssSeq, this.resEaiMsg, null);
}
}
public void logSenderCtrlSend() {
String telgmDmndDstcd = reqEaiMsg.getMapper().getSendRecvDivision(reqEaiMsg.getStandardMessage());
if (STDMessageKeys.SEND_RECV_CD_RECV.equals(telgmDmndDstcd)) {
this.logPssSeq = 400;
} else {
this.logPssSeq = 200;
}
try {
LogSender.send(this.logPssSeq, this.resEaiMsg, null);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + "AA Exception Logging Error :" + e.getMessage());
}
}
public boolean checkServiceMsgSize() {
// Outbound Error일 경우
if (MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) && reqEaiMsg.getSvcMsgs().size() > 1) {
return true;
} else {
return false;
}
}
public void setCurrentService() throws Exception {
if (logger.isDebug())
logger.debug(guidLogPrefix + "ASYNC-SYNC CALLED");
// ---------------------------------------------------------------
// AS의 경우 다음 서비스메시지(AS 응답)에 키관리메시지내용을 복사한다.
// ---------------------------------------------------------------
String keyMgtMsgVl = resEaiMsg.getCurrentSvcMsg().getKeyMgtMsgVl();
if (logger.isDebug())
logger.debug(guidLogPrefix + "AS 응답 keyMgtMsgVl[" + keyMgtMsgVl + "]");
resEaiMsg.setSvcPssSeq(resEaiMsg.getSvcPssSeq() + 1);
resEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
// ---------------------------------------------------------------
// 기동이 표준인 경우만
if (com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls())) {
// resEaiMsg = ExtMessageConverter.setAsyncSyncResponseForStandard(guidLogPrefix, reqEaiMsg, resEaiMsg);
setReturnType(resEaiMsg, STDMessageKeys.SEND_RECV_CD_RECV);
}
}
public boolean isOutboundCall() {
return true;
}
public void init() throws Exception {
// -------------------------------------------
// eLink 내부에서는 GUID 진행번호를 분리
// ExtMessage 에서는 분리
// STDMessage 에서는 사이트에 맞게 변경처리
// -------------------------------------------
InterfaceMapper mapper = this.reqEaiMsg.getMapper();
StandardMessage standardMessage = this.reqEaiMsg.getStandardMessage();
String guid = mapper.getGuid(standardMessage);
String guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ Current GUID [" + guid + "][" + guidseq + "]");
mapper.nextGuidSeq(standardMessage);
guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ ADD PATHSEQ GUID [" + guid + "][" + guidseq + "]");
this.resEaiMsg = this.reqEaiMsg;
this.adapterGroupName = reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp();
EAIServerManager eaiServerManager = EAIServerManager.getInstance();
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(this.adapterGroupName);
// 등록된 어댑터가 실제 존재하지 않는 경우 : 2009.04.03
if (adptGrpVO == null) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF003";
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs) + "(어댑터그룹 미등록/미사용 - "
+ this.adapterGroupName + ")";
if (logger.isError())
logger.error(guidLogPrefix + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
String adapterType = adptGrpVO.getType();
if (eaiServerManager.isTASEnabledEAIServer() && EAIMessageKeys.TRANTYPE_TAS.equals(reqEaiMsg.getTranType())
// RESTAdapter는 교체하지 않는다
&& !StringUtils.equals(adapterType, "RST")) {
// this.adptrMsgPtrnCd = com.eactive.eai.adapter.Keys.IF_NONSTANDARD;
// adapterType = Keys.TYPE_NET2;
PropManager manager = PropManager.getInstance();
Properties prop = manager.getProperties(RouteKeys.SIM);
if (reqEaiMsg.getCurrentSvcMsg().isSyncItfTp()) {
this.adapterGroupName = prop.getProperty(RouteKeys.SIM_ADAPTER_SYNC, "_SIM_OU_HTT_SyC");
} else {
this.adapterGroupName = prop.getProperty(RouteKeys.SIM_ADAPTER_ASYNC, "_SIM_OU_HTT_AsC");
}
} else {
// AdapterManager adapterManager = AdapterManager.getInstance();
// AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(this.adapterGroupName);
// failover 사용시에는 제거 되어야됨
// if(adptGrpVO.nextAdapterVO() == null) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFBF002";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs)
// + ","+this.adapterGroupName;
// if (logger.isError()) logger.error( guidLogPrefix + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new Exception(rspErrorCode);
// }
this.adptrMsgPtrnCd = adptGrpVO.getAdptrMsgPtrnCd();
adapterType = adptGrpVO.getType();
}
String svcTsmtUsgTp = ""; // 기동 호출방식
String psvItfTp = ""; // 수동 호출방식
// 2009.03.11
// AA가 아니고 기동이 표준이 아닌 경우
// Adapter의 timeout값을 설정한다.
try {
svcTsmtUsgTp = this.reqEaiMsg.getSvcTsmtUsgTp(); // 기동 호출방식
psvItfTp = this.reqEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 수동 호출방식
if (!(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
&& !(com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls()))) {
// SA 또는 SNA Adapter일 경우에 는 SA Timeout값을 설정
if ((EAIMessageKeys.SYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
|| Keys.TYPE_SNA.equals(adapterType)) {
int saTimeoutSec = this.reqEaiMsg.getCurrentSvcMsg().getTmoVl();
if (logger.isDebug())
logger.debug(guidLogPrefix + " SA TimeoutValue [" + saTimeoutSec + "]");
// this.reqEaiMsg.getKbMsg().getKBHeader().setGnrzToutCrtcNmvl(""+saTimeoutSec);
this.reqEaiMsg.getMapper().setTimeout(this.reqEaiMsg.getStandardMessage(), "" + saTimeoutSec);
} else {
int timeout = ServiceUtil.getTimeoutValue(adapterGroupName);
if (logger.isDebug())
logger.debug(guidLogPrefix + " Target Adapter TimeoutValue [" + timeout + "]");
if (timeout > 0) {
if (logger.isDebug())
logger.debug(guidLogPrefix + "Set Adapter TimeoutValue [" + timeout + "] to STDMessage");
// this.reqEaiMsg.getKbMsg().getKBHeader().setGnrzToutCrtcNmvl(""+timeout);
this.reqEaiMsg.getMapper().setTimeout(this.reqEaiMsg.getStandardMessage(), "" + timeout);
}
}
}
} catch (Exception e) {
if (logger.isWarn()) {
logger.warn(guidLogPrefix + "Get Adapter TimeoutValue Error - " + e.getMessage(), e);
}
}
// -----------------------------------------------------
// TheK 요건 : SNA송신 비동기 응답거래시 수신거래코드를 EAI에서 매핑함 (20190522)
String srcAdapterGroupName = reqEaiMsg.getSngSysItfTp();
// AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(srcAdapterGroupName);
String inAdapterMsgType = MessageType.ASC;
if (eaiServerManager.isTASEnabledEAIServer() && EAIMessageKeys.TRANTYPE_FROMTAS.equals(reqEaiMsg.getTranType())
&& inAdptGrpVO == null) {
logger.info(guidLogPrefix + "- TAS 기동거래 [" + srcAdapterGroupName + "] = " + MessageType.ASC);
} else {
if (inAdptGrpVO == null) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF003";
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs) + "(어댑터그룹 미등록/미사용 - "
+ srcAdapterGroupName + ")";
if (logger.isError())
logger.error(guidLogPrefix + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
inAdapterMsgType = inAdptGrpVO.getMessageType();
}
}
public void printExceptionMessage(Exception e) {
// Exception e = this.context.getExceptionInfo().getException();
if (logger.isError())
logger.error(guidLogPrefix + "ExceptionPath : " + e.getMessage(), e);
}
public boolean isSourceAsync() {
if (EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp())) {
return true;
} else {
return false;
}
}
public void callExceptionHandler() {
try {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(this.reqEaiMsg.getSngSysItfTp());
String inAdapterMsgType = inAdptGrpVO.getMessageType();
if (EAITable.EBCDIC_TYPE.equals(inAdapterMsgType)) {
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
byte[] asc = CodeConversion.meToMixedAsc(bizData.getBytes());
try {
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.reqEaiMsg.getStandardMessage().setBizData(new String(asc), inboundCharset);
} catch (Exception e) {
logger.error("setBizData error", e);
}
}
ExceptionHandler.handle(this.reqEaiMsg);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + "ExceptionHandler Call Error", e);
}
}
public boolean isRealCall() {
if (this.callProp != null) {
String mode = this.callProp.getProperty(EAIKeys.CALL_MODE_KEY);
if (mode != null && EAIKeys.CALL_MODE_WARMUP.equals(mode)) {
logger.warn(guidLogPrefix + "Warming Up Called");
return false;
} else {
return true;
}
} else {
return true;
}
}
public void setGUID() throws Exception {
InterfaceMapper mapper = this.resEaiMsg.getMapper();
StandardMessage standardMessage = this.resEaiMsg.getStandardMessage();
String guid = mapper.getGuid(standardMessage);
String guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ Current GUID [" + guid + "][" + guidseq + "]");
mapper.nextGuidSeq(standardMessage);
guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ ADD PATHSEQ GUID [" + guid + "][" + guidseq + "]");
String svcTsmtUsgTp = this.reqEaiMsg.getSvcTsmtUsgTp(); // 기동 호출방식
String psvItfTp = this.reqEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 수동 호출방식
if ((!(com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.adptrMsgPtrnCd))
&& !(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp)))
|| ((com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.adptrMsgPtrnCd))
&& (EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp)
&& EAIMessageKeys.SYNC_SVC.equals(psvItfTp)))) {
String prcssRtdTranCd = mapper.getReturnServiceId(standardMessage);
if (prcssRtdTranCd != null && prcssRtdTranCd.length() >= 14) {
// String cicsTrncd = prcssRtdTranCd.substring(0, 4);
String telgmRecvTranCd = prcssRtdTranCd.substring(4, 14);
mapper.setServiceId(standardMessage, telgmRecvTranCd);
} else {
if (logger.isInfo()) {
logger.info(guidLogPrefix + "- PrcssRtdTranCd Length < 14 [" + prcssRtdTranCd + "]");
}
}
}
if (!(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
&& (com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls()))
&& (STDMessageKeys.RECOVER_YN_YES
.equals(this.reqEaiMsg.getMapper().getRecoverYn(this.reqEaiMsg.getStandardMessage())))) {
String reqOgtranGuIdNo = this.reqEaiMsg.getMapper().getOrgGuid(this.reqEaiMsg.getStandardMessage());
mapper.setOrgGuid(standardMessage, reqOgtranGuIdNo);
if (logger.isInfo()) {
logger.info(guidLogPrefix + " OgtranGuIdNo 복원 " + this.reqEaiMsg.getSvcOgNo() + " OgtranGuIdNo ["
+ mapper.getOrgGuid(standardMessage) + "]");
}
}
}
}
@@ -0,0 +1,531 @@
package com.eactive.eai.flowcontroller;
import java.util.Properties;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.adapter.Keys;
import com.eactive.eai.common.EAIKeys;
import com.eactive.eai.common.EAITable;
import com.eactive.eai.common.exception.ExceptionHandler;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.message.EAIMessage;
import com.eactive.eai.common.message.EAIMessageKeys;
import com.eactive.eai.common.property.PropManager;
import com.eactive.eai.common.routing.IFRouter;
import com.eactive.eai.common.routing.Process;
import com.eactive.eai.common.routing.RouteKeys;
import com.eactive.eai.common.server.EAIServerManager;
import com.eactive.eai.common.util.C2RServiceMapper;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageUtil;
import com.eactive.eai.common.util.ObjectUtil;
import com.eactive.eai.common.util.ServiceUtil;
import com.eactive.eai.control.LogSender;
import com.eactive.eai.message.StandardMessage;
import com.eactive.eai.message.service.InterfaceMapper;
import com.eactive.eai.transformer.function.util.CodeConversion;
import com.ext.eai.common.stdmessage.STDMessageKeys;
public class C2RFCProcess extends Process {
public String adptrMsgPtrnCd;
public java.lang.String adapterGroupName;
public int logPssSeq;
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
public java.util.Properties callProp;
public EAIMessage resEaiMsg;
public com.eactive.eai.common.message.EAIMessage reqEaiMsg;
static Logger esbLogger = Logger.getLogger(Logger.LOGGER_ESBFW);
private int svrLogLevel;
private static ThreadLocal local = new ThreadLocal(); // 경과시간 동기화를 위한 ThreadLocal
static final long serialVersionUID = 1L;
String guidLogPrefix = "";
public C2RFCProcess() {
}
public EAIMessage clientReturn() {
if (svrLogLevel >= 1) {
try {
long msgSndTm = System.currentTimeMillis();
Long threadData = (Long) local.get();
long processTm = msgSndTm - threadData.longValue();
if (esbLogger.isInfo())
esbLogger.info(guidLogPrefix + " End... - elapse time : " + processTm
+ "(ms) - EAI Server Log Level is INFO");
} catch (Exception e) {
}
}
return resEaiMsg;
}
public void callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp) {
this.reqEaiMsg = reqEaiMsg;
this.callProp = callProp;
if (this.reqEaiMsg == null)
return;
svrLogLevel = this.reqEaiMsg.getSvrLogLvl();
guidLogPrefix = "B2BFCProcess] GUID[" + getGuid(reqEaiMsg) + "] UUID[" + this.reqEaiMsg.getSvcOgNo() + "] ";
if (svrLogLevel >= 1) {
try {
long msgRcvTm = System.currentTimeMillis();
local.set(new Long(msgRcvTm));
if (esbLogger.isInfo())
esbLogger.info(guidLogPrefix + " started... - EAI Server Log Level is INFO");
} catch (Exception e) {
}
}
try {
flow();
} catch (Exception e) {
printExceptionMessage(e);
if (isSourceAsync()) {
logSenderCtrlSend();
callExceptionHandler();
}
return;
}
}
public void flow() throws Exception {
// isRealCall
if (!isRealCall()) {
return;
}
// 초기화
init();
// B2BOutboud Mapping
setRoute();
// Outbound 프로세스 호출
ifRouterProcess();
// GUID설정
setGUID();
// ASYNC-SYNC모델
if (checkServiceMsgSize()) {
// ServiceMessage설정
setCurrentService();
// 응답메시지전송
ifRouterProcess1();
}
clientReturn();
}
public void ifRouterProcess() throws Exception {
try {
// call by ref 문제로 deepCopy로 해결 - 200 변환에 의해 변경되는 문제
EAIMessage reqMsg = (EAIMessage) ObjectUtil.deepCopy(this.reqEaiMsg);
this.resEaiMsg = IFRouter.process(reqMsg, this.callProp);
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBR001";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + " " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
// ----------------------------------------------------
// 기동시스템이 Async 거래의 OUtbound에서 오류가 발생할 경우
// ExceptionHandler를 통해 응답메시지를 전송한다.
// ----------------------------------------------------
if (EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp())) {
if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())) {
try {
// 변경없이 요청 EAI메시지를 전달하도록 수정
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
try {
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.resEaiMsg.getStandardMessage().setBizData(bizData, inboundCharset);
} catch (Exception e) {
logger.error("setBizData error", e);
}
ExceptionHandler.handle(this.resEaiMsg);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " ExceptionHandler Call Error :" + e.getMessage());
}
}
}
}
public void ifRouterProcess1() throws Exception {
try {
// 신보/기보 때문에 추가함 2013-01-03
// AS거래에서 처리결과수신서비스ID를 서비스ID로 넣어준다.
// this.resEaiMsg.getStdMsg().getSTDCommon().setSrvcId(this.resEaiMsg.getStdMsg().getSTDCommon().getProcsRsltRcmsSrvcId());
this.resEaiMsg = IFRouter.process(this.resEaiMsg, this.callProp);
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBR100";
String orgErrorCode = ExceptionUtil.getErrorCode(e, rspErrorCode);
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, orgErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + " " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
// AS 응답송신 중 에러가 밸생할 경우 400 에러로그를 남기도록 수정
this.logPssSeq = 400;
LogSender.send(this.logPssSeq, this.resEaiMsg, null);
}
}
public void logSenderCtrlSend() {
String returnType = getReturnType(reqEaiMsg); // S|R
if (STDMessageKeys.SEND_RECV_CD_RECV.equals(returnType)) {
this.logPssSeq = 400;
} else {
this.logPssSeq = 200;
}
try {
LogSender.send(this.logPssSeq, this.resEaiMsg, null);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " AA Exception Logging Error :" + e.getMessage());
}
}
public boolean checkServiceMsgSize() {
// Outbound Error일 경우
if (MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) && reqEaiMsg.getSvcMsgs().size() > 1) {
return true;
} else {
return false;
}
}
public void setCurrentService() throws Exception {
if (logger.isDebug())
logger.debug(guidLogPrefix + " ASYNC-SYNC CALLED");
// AS의 경우 다음 서비스메시지(AS 응답)에 키관리메시지내용을 복사한다.
String keyMgtMsgVl = resEaiMsg.getCurrentSvcMsg().getKeyMgtMsgVl();
if (logger.isDebug())
logger.debug(guidLogPrefix + " AS Response keyMgtMsgVl[" + keyMgtMsgVl + "]");
resEaiMsg.setSvcPssSeq(resEaiMsg.getSvcPssSeq() + 1);
resEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
// AS 응답거래 라우팅
try {
String srvcId = getServiceId(this.resEaiMsg); // 서비스ID
String psvItfTp = this.resEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 수동 호출방식
if (srvcId == null || srvcId.trim().length() == 0 || srvcId.trim().length() <= 3) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " STDMessage ServiceId not found");
} else {
// String reqSysCode = this.resEaiMsg.getExtMsg().getFullHeaderString("systemHeader.DMND_SYS_CD"); // 요청시스템코드(서비스ID 앞의 3자리 시용에서 요청시스템코드로 변경함)
String reqSysCode = getReqSysCode(this.resEaiMsg);
String type = "";
if (EAIMessageKeys.ASYNC_SVC.equals(psvItfTp)) {
type = "A";
} else {
type = "S";
}
String key = reqSysCode + type;
if (logger.isDebug())
logger.debug(guidLogPrefix + " C2R RouteKey STDMessage ServiceID [" + srvcId + "]");
if (logger.isDebug())
logger.debug(
guidLogPrefix + " C2R RouteKey STDMessage systemHeader.DMND_SYS_CD [" + reqSysCode + "]");
if (logger.isDebug())
logger.debug(guidLogPrefix + " C2R RouteKey STDMessage Sync/Async [" + type + "]");
EAIMessage mappedEaiMsg = C2RServiceMapper.setC2RService(key, this.resEaiMsg);
if (mappedEaiMsg != null) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " EAISVCCD[" + this.resEaiMsg.getEAISvcCd() + "] C2R RouteKey ["
+ key + "] ServiceMessage mapping");
this.resEaiMsg = mappedEaiMsg;
}
}
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " AS Response : B2B Serice Routing Set Error :" + e.getMessage());
String[] msgArgs = new String[1];
msgArgs[0] = this.resEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBR002";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + " AS Response : " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
// 기동이 표준인 경우만
if (com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls())) {
// resEaiMsg = ExtMessageConverter.setAsyncSyncResponseForStandard(guidLogPrefix, reqEaiMsg, resEaiMsg);
setReturnType(resEaiMsg, STDMessageKeys.SEND_RECV_CD_RECV);
}
}
public boolean isOutboundCall() {
return true;
}
public void init() throws Exception {
try {
InterfaceMapper mapper = this.reqEaiMsg.getMapper();
StandardMessage standardMessage = this.reqEaiMsg.getStandardMessage();
String guid = getGuid(reqEaiMsg);
String guidseq = getGuidSeq(reqEaiMsg);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ Current GUID [" + guid + "][" + guidseq + "]");
mapper.nextGuidSeq(standardMessage);
guidseq = getGuidSeq(reqEaiMsg);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ ADD PATHSEQ GUID [" + guid + "][" + guidseq + "]");
this.resEaiMsg = this.reqEaiMsg;
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBR003";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + " " + rspErrorMsg, e);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
}
public void printExceptionMessage(Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " ExceptionPath : " + e.getMessage());
}
public boolean isSourceAsync() {
if (EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp())) {
return true;
} else {
return false;
}
}
public void callExceptionHandler() {
try {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(this.reqEaiMsg.getSngSysItfTp());
String inAdapterMsgType = inAdptGrpVO.getMessageType();
if (EAITable.EBCDIC_TYPE.equals(inAdapterMsgType)) {
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
byte[] asc = CodeConversion.meToMixedAsc(bizData.getBytes());
try {
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.reqEaiMsg.getStandardMessage().setBizData(new String(asc), inboundCharset);
} catch (Exception e) {
logger.error("setBizData error", e);
}
}
ExceptionHandler.handle(this.reqEaiMsg);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " ExceptionHandler Call Error :" + e.getMessage());
}
}
public boolean isRealCall() {
if (this.callProp != null) {
String mode = this.callProp.getProperty(EAIKeys.CALL_MODE_KEY);
if (mode != null && EAIKeys.CALL_MODE_WARMUP.equals(mode)) {
System.out.println(guidLogPrefix + " Warming Up Called");
return false;
} else {
return true;
}
} else {
return true;
}
}
public void setRoute() throws Exception {
try {
String srvcId = getServiceId(this.reqEaiMsg);
String psvItfTp = this.reqEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 수동 호출방식
if (srvcId == null || srvcId.trim().length() == 0 || srvcId.trim().length() <= 3) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " STDMessage ServiceID not found");
} else {
// String reqSysCode = this.resEaiMsg.getExtMsg().getFullHeaderString("systemHeader.DMND_SYS_CD"); // 요청시스템코드(서비스ID 앞의 3자리 시용에서 요청시스템코드로 변경함)
String reqSysCode = getReqSysCode(this.resEaiMsg);
String type = "";
if (EAIMessageKeys.ASYNC_SVC.equals(psvItfTp)) {
type = "A";
} else {
type = "S";
}
String key = reqSysCode + type;
if (logger.isDebug())
logger.debug(guidLogPrefix + " C2R RouteKey STDMessage ServiceID [" + srvcId + "]");
if (logger.isDebug())
logger.debug(
guidLogPrefix + " C2R RouteKey STDMessage systemHeader.DMND_SYS_CD [" + reqSysCode + "]");
if (logger.isDebug())
logger.debug(guidLogPrefix + " C2R RouteKey STDMessage Sync/Async [" + type + "]");
EAIMessage mappedEaiMsg = C2RServiceMapper.setC2RService(key, this.reqEaiMsg);
if (mappedEaiMsg != null) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " EAISVCCD[" + this.reqEaiMsg.getEAISvcCd() + "] C2R RouteKey ["
+ key + "] ServiceMessage mapping");
this.reqEaiMsg = mappedEaiMsg;
}
}
} catch (Exception e) {
// TO-DO
if (logger.isError())
logger.error(guidLogPrefix + " B2B Serice Routing Set Error :" + e.getMessage());
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBR002";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + " " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
try {
this.adapterGroupName = reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp();
EAIServerManager eaiServerManager = EAIServerManager.getInstance();
if (eaiServerManager.isTASEnabledEAIServer()
&& EAIMessageKeys.TRANTYPE_TAS.equals(reqEaiMsg.getTranType())) {
// this.adptrMsgPtrnCd = com.eactive.eai.adapter.Keys.IF_NONSTANDARD;
PropManager manager = PropManager.getInstance();
Properties prop = manager.getProperties(RouteKeys.SIM);
if (reqEaiMsg.getCurrentSvcMsg().isSyncItfTp()) {
this.adapterGroupName = prop.getProperty(RouteKeys.SIM_ADAPTER_SYNC, "_SIM_OU_HTT_SyC");
} else {
this.adapterGroupName = prop.getProperty(RouteKeys.SIM_ADAPTER_ASYNC, "_SIM_OU_HTT_AsC");
}
} else {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(this.adapterGroupName);
// 등록된 어댑터가 실제 존재하지 않는 경우 : 2009.04.03
if (adptGrpVO == null) {
throw new Exception("수동어댑터[" + this.adapterGroupName + "]가 사용 중이 아님");
}
this.adptrMsgPtrnCd = adptGrpVO.getAdptrMsgPtrnCd();
}
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBR003";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + " " + rspErrorMsg, e);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
// 2009.03.11
// AA가 아니고 기동이 표준이 아닌 경우
// Adapter의 timeout값을 설정한다.
try {
String svcTsmtUsgTp = this.reqEaiMsg.getSvcTsmtUsgTp(); // 기동 호출방식
String psvItfTp = this.reqEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 수동 호출방식
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(this.adapterGroupName);
if (!(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
&& !(com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls()))) {
// SA 또는 SNA Adapter일 경우에 는 SA Timeout값을 설정
if ((EAIMessageKeys.SYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
|| Keys.TYPE_SNA.equals(adptGrpVO.getType())) {
int saTimeoutSec = this.reqEaiMsg.getCurrentSvcMsg().getTmoVl();
if (logger.isDebug())
logger.debug("BaseFCProcess] SA TimeoutValue [" + saTimeoutSec + "]");
setTimeout(this.reqEaiMsg, "" + saTimeoutSec);
} else {
int timeout = ServiceUtil.getTimeoutValue(adapterGroupName);
if (logger.isDebug())
logger.debug("BaseFCProcess] Target Adapter TimeoutValue [" + timeout + "]");
if (timeout > 0) {
if (logger.isDebug())
logger.debug("BaseFCProcess] Set Adapter TimeoutValue [" + timeout + "] to STDMessage");
setTimeout(this.reqEaiMsg, "" + timeout);
}
}
}
} catch (Exception e) {
if (logger.isWarn()) {
logger.warn("BaseFCProcess] Get Adapter TimeoutValue Error - " + e.getMessage(), e);
}
}
}
public void setGUID() throws Exception {
InterfaceMapper mapper = this.resEaiMsg.getMapper();
StandardMessage standardMessage = this.resEaiMsg.getStandardMessage();
String guid = mapper.getGuid(standardMessage);
String guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ Current GUID [" + guid + "][" + guidseq + "]");
mapper.nextGuidSeq(standardMessage);
guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ ADD PATHSEQ GUID [" + guid + "][" + guidseq + "]");
String svcTsmtUsgTp = this.reqEaiMsg.getSvcTsmtUsgTp(); // 기동 호출방식
String psvItfTp = this.reqEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 수동 호출방식
// ------------------------------------------------------
// AA거래 가 아니고 (SS, AS, SA 일 때 모두 처리한다)
// 기동이 KB내부표준이고
// 원거래 복원여부가 ‘1’인 경우에
// => 원거래 GUID를 EAI에서 기동에서 수신된 원거래 GUID로 복원한다.
// ------------------------------------------------------
if (!(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
&& (com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls()))
&& (STDMessageKeys.RECOVER_YN_YES.equals(getRecoverYn(this.reqEaiMsg)) ) ) {
String reqOgtranGuIdNo = getOrgGuid(this.reqEaiMsg);
mapper.setOrgGuid(standardMessage, reqOgtranGuIdNo);
if (logger.isInfo()) {
logger.info(guidLogPrefix + " OgtranGuIdNo 복원 " + this.reqEaiMsg.getSvcOgNo() + " OgtranGuIdNo ["
+ mapper.getOrgGuid(standardMessage) + "]");
}
}
}
}
@@ -0,0 +1,524 @@
package com.eactive.eai.flowcontroller;
import java.util.Properties;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.adapter.Keys;
import com.eactive.eai.common.EAIKeys;
import com.eactive.eai.common.EAITable;
import com.eactive.eai.common.exception.ExceptionHandler;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.message.EAIMessage;
import com.eactive.eai.common.message.EAIMessageKeys;
import com.eactive.eai.common.message.MessageType;
import com.eactive.eai.common.property.PropManager;
import com.eactive.eai.common.routing.IFRouter;
import com.eactive.eai.common.routing.Process;
import com.eactive.eai.common.routing.RouteKeys;
import com.eactive.eai.common.server.EAIServerManager;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageUtil;
import com.eactive.eai.common.util.ObjectUtil;
import com.eactive.eai.common.util.ServiceUtil;
import com.eactive.eai.control.LogSender;
import com.eactive.eai.message.StandardMessage;
import com.eactive.eai.message.service.InterfaceMapper;
import com.eactive.eai.transformer.function.util.CodeConversion;
import com.ext.eai.common.stdmessage.STDMessageKeys;
public class CompFCProcess extends Process {
public String adptrMsgPtrnCd;
public java.lang.String adapterGroupName;
public int logPssSeq;
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
public java.util.Properties callProp;
public EAIMessage resEaiMsg;
public com.eactive.eai.common.message.EAIMessage reqEaiMsg;
static Logger esbLogger = Logger.getLogger(Logger.LOGGER_ESBFW);
private int svrLogLevel;
private static ThreadLocal local = new ThreadLocal(); // 경과시간 동기화를 위한 ThreadLocal
String guidLogPrefix = "";
static final long serialVersionUID = 1L;
public EAIMessage clientReturn() {
if (svrLogLevel >= 1) {
try {
long msgSndTm = System.currentTimeMillis();
Long threadData = (Long) local.get();
long processTm = msgSndTm - threadData.longValue();
if (esbLogger.isInfo())
esbLogger.info(
guidLogPrefix + "End... - 경과시간 : " + processTm + "(ms) - EAI Server Log Level is INFO");
} catch (Exception e) {
logger.warn("clientReturn", e);
}
}
return resEaiMsg;
}
public void callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp) {
this.reqEaiMsg = reqEaiMsg;
this.callProp = callProp;
if (this.reqEaiMsg == null)
return;
svrLogLevel = this.reqEaiMsg.getSvrLogLvl();
// guidLogPrefix = "BaseFCProcess] GUID["+reqEaiMsg.getKbMsg().getKBHeader().getGuIdNo()+"] UUID["+this.reqEaiMsg.getSvcOgNo()+"] ";
guidLogPrefix = "BaseFCProcess] GUID[" + getGuid(reqEaiMsg) + "] UUID[" + this.reqEaiMsg.getSvcOgNo() + "] ";
if (svrLogLevel >= 1) {
try {
long msgRcvTm = System.currentTimeMillis();
local.set(new Long(msgRcvTm));
if (esbLogger.isInfo())
esbLogger.info(guidLogPrefix + " started... - EAI Server Log Level is INFO");
} catch (Exception e) {
logger.warn("callService", e);
}
}
try {
flow();
} catch (Exception e) {
printExceptionMessage(e);
if (isSourceAsync()) {
logSenderCtrlSend();
callExceptionHandler();
}
return;
}
}
public void flow() throws Exception {
// isRealCall
if (!isRealCall()) {
return;
}
// 초기화
init();
// Outbound 프로세스 호출
ifRouterProcess();
// GUID설정
setGUID();
// if (checkServiceMsgSize()){
// callMultiProcess();
// }
}
// public void callMultiProcess() throws Exception{
//
// if (logger.isDebug()) logger.debug( guidLogPrefix + "ASYNC-SYNC CALLED");
// //---------------------------------------------------------------
// // AS의 경우 다음 서비스메시지(AS 응답)에 키관리메시지내용을 복사한다.
// //---------------------------------------------------------------
// String keyMgtMsgVl = resEaiMsg.getCurrentSvcMsg().getKeyMgtMsgVl();
// if(logger.isDebug()) logger.debug( guidLogPrefix + "AS 응답 keyMgtMsgVl["+keyMgtMsgVl+"]");
//
// EAIMessage newReqEaiMsg = SerializationUtils.clone(this.reqEaiMsg);
// newReqEaiMsg.setSvcPssSeq( newReqEaiMsg.getSvcPssSeq() + 1 );
// newReqEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
// //---------------------------------------------------------------
//
// // 기동이 표준인 경우만
//// if(com.eactive.eai.adapter.Keys.IF_STANDARD.equals(newReqEaiMsg.getStdMsgUsgCls())){
//// resEaiMsg = ExtMessageConverter.setAsyncSyncResponseForStandard(guidLogPrefix, reqEaiMsg, resEaiMsg);
//// }
//
// try {
// this.resEaiMsg = IFRouter.process(newReqEaiMsg, this.callProp);
// } catch(Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFBF100";
// String orgErrorCode = ExceptionUtil.getErrorCode(e, rspErrorCode);
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, orgErrorCode, msgArgs);
// if (logger.isError()) logger.error(guidLogPrefix + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// //throw new RuntimeException(rspErrorCode);
// // 2009.11.26 : 정길영과장 요청
// // AS 응답송신 중 에러가 밸생할 경우 400 에러로그를 남기도록 수정
// this.logPssSeq = 400;
// LogSender.send(this.logPssSeq, this.resEaiMsg, null);
// }
// }
public void ifRouterProcess() throws Exception {
try {
String keyMgtMsgVl = null;
JSONObject totalResDataObject = new JSONObject();
for (int i = 0; i < reqEaiMsg.getSvcMsgs().size(); i++) {
EAIMessage reqMsg = (EAIMessage) ObjectUtil.deepCopy(this.reqEaiMsg);
reqMsg.setSvcPssSeq(i + 1);
if (keyMgtMsgVl != null)
reqMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
this.resEaiMsg = IFRouter.process(reqMsg, this.callProp);
// byte[] resBytes = (byte[]) this.resEaiMsg.getExtMsg().getBizData()[0];
String bizData = this.resEaiMsg.getStandardMessage().getBizData();
// ServiceMessage svcMsg = reqMsg.getSvcMsg(i);
// String encode = null;
// if("1".equals(svcMsg.getBsRspCnvEn()) && StringUtils.isNotBlank(svcMsg.getBsRspCnvMsgID())) {
// Layout layout = TransformManager.getManager().getTransform(svcMsg.getBsRspCnvMsgID()).getSourceLayout(0);
// if("UJSON".equals(layout.getLayoutType().getName())) {
// encode = "utf-8";
// } else {
// encode = "euc-kr";
// }
// }
//
// if(StringUtils.isBlank(encode)) {
// AdapterGroupVO gvo = AdapterManager.getInstance().getAdapterGroupVO(svcMsg.getPsvSysItfTp());
// encode = MessageUtil.isUTF8(gvo.getMessageType()) ? "utf-8": "ms949";
// }
// String resString = new String(resBytes, encode);
// totalResDataObject.putAll((JSONObject)JSONValue.parse(resString));
totalResDataObject.putAll((JSONObject) JSONValue.parse(bizData));
keyMgtMsgVl = resEaiMsg.getCurrentSvcMsg().getKeyMgtMsgVl();
}
AdapterGroupVO gvo = AdapterManager.getInstance().getAdapterGroupVO(this.adapterGroupName);
// String encode = MessageUtil.isUTF8(gvo.getMessageType()) ? "utf-8" : "ms949";
// this.resEaiMsg.getExtMsg().getBizData()[0] = totalResDataObject.toJSONString().getBytes(encode);
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF001";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
}
public void ifRouterProcessResponse() throws Exception {
try {
this.reqEaiMsg.setSvcPssSeq(2);
this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
// this.resEaiMsg.getExtMsg().setSendRecv(STDMessageKeys.SEND_RECV_CD_SEND);
setReturnType(this.resEaiMsg, STDMessageKeys.SEND_RECV_CD_SEND);
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF100";
String orgErrorCode = ExceptionUtil.getErrorCode(e, rspErrorCode);
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, orgErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
// 2009.11.26 : 정길영과장 요청
// AS 응답송신 중 에러가 밸생할 경우 400 에러로그를 남기도록 수정
this.logPssSeq = 400;
LogSender.send(this.logPssSeq, this.resEaiMsg, null);
}
}
public void logSenderCtrlSend() {
// String telgmDmndDstcd = kbmessage.getKBHeader().getTelgmDmndDstcd();
String returnType = getReturnType(reqEaiMsg);
if (STDMessageKeys.SEND_RECV_CD_RECV.equals(returnType)) {
this.logPssSeq = 400;
} else {
this.logPssSeq = 200;
}
try {
LogSender.send(this.logPssSeq, this.resEaiMsg, null);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + "AA Exception Logging Error :" + e.getMessage());
}
}
public boolean checkServiceMsgSize() {
// Outbound Error일 경우
if (MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) && reqEaiMsg.getSvcMsgs().size() > 1) {
return true;
} else {
return false;
}
}
public void setCurrentService() throws Exception {
if (logger.isDebug())
logger.debug(guidLogPrefix + "ASYNC-SYNC CALLED");
// ---------------------------------------------------------------
// AS의 경우 다음 서비스메시지(AS 응답)에 키관리메시지내용을 복사한다.
// ---------------------------------------------------------------
String keyMgtMsgVl = resEaiMsg.getCurrentSvcMsg().getKeyMgtMsgVl();
if (logger.isDebug())
logger.debug(guidLogPrefix + "AS 응답 keyMgtMsgVl[" + keyMgtMsgVl + "]");
resEaiMsg.setSvcPssSeq(resEaiMsg.getSvcPssSeq() + 1);
resEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
// ---------------------------------------------------------------
// 기동이 표준인 경우만
if (com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls())) {
// resEaiMsg = ExtMessageConverter.setAsyncSyncResponseForStandard(guidLogPrefix, reqEaiMsg, resEaiMsg);
setReturnType(resEaiMsg, STDMessageKeys.SEND_RECV_CD_RECV);
}
}
public boolean isOutboundCall() {
return true;
}
public void init() throws Exception {
InterfaceMapper mapper = this.reqEaiMsg.getMapper();
StandardMessage standardMessage = this.reqEaiMsg.getStandardMessage();
String guid = mapper.getGuid(standardMessage);
String guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ Current GUID [" + guid + "][" + guidseq + "]");
mapper.nextGuidSeq(standardMessage);
guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ ADD PATHSEQ GUID [" + guid + "][" + guidseq + "]");
String adapterType = "";
this.resEaiMsg = this.reqEaiMsg;
this.adapterGroupName = reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp();
EAIServerManager eaiServerManager = EAIServerManager.getInstance();
if (eaiServerManager.isTASEnabledEAIServer() && EAIMessageKeys.TRANTYPE_TAS.equals(reqEaiMsg.getTranType())) {
// this.adptrMsgPtrnCd = com.eactive.eai.adapter.Keys.IF_NONSTANDARD;
// adapterType = Keys.TYPE_NET2;
PropManager manager = PropManager.getInstance();
Properties prop = manager.getProperties(RouteKeys.SIM);
if (reqEaiMsg.getCurrentSvcMsg().isSyncItfTp()) {
this.adapterGroupName = prop.getProperty(RouteKeys.SIM_ADAPTER_SYNC, "_SIM_OU_HTT_SyC");
} else {
this.adapterGroupName = prop.getProperty(RouteKeys.SIM_ADAPTER_ASYNC, "_SIM_OU_HTT_AsC");
}
} else {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(this.adapterGroupName);
// 등록된 어댑터가 실제 존재하지 않는 경우 : 2009.04.03
if (adptGrpVO == null) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF003";
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs) + "(어댑터그룹 미등록/미사용 - "
+ this.adapterGroupName + ")";
if (logger.isError())
logger.error(guidLogPrefix + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
// failover 사용시에는 제거 되어야됨
// if(adptGrpVO.nextAdapterVO() == null) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFBF002";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs)
// + ","+this.adapterGroupName;
// if (logger.isError()) logger.error( guidLogPrefix + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new Exception(rspErrorCode);
// }
this.adptrMsgPtrnCd = adptGrpVO.getAdptrMsgPtrnCd();
adapterType = adptGrpVO.getType();
}
String svcTsmtUsgTp = ""; // 기동 호출방식
String psvItfTp = ""; // 수동 호출방식
// 2009.03.11
// AA가 아니고 기동이 표준이 아닌 경우
// Adapter의 timeout값을 설정한다.
try {
svcTsmtUsgTp = this.reqEaiMsg.getSvcTsmtUsgTp(); // 기동 호출방식
psvItfTp = this.reqEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 수동 호출방식
if (!(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
&& !(com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls()))) {
// SA 또는 SNA Adapter일 경우에 는 SA Timeout값을 설정
if ((EAIMessageKeys.SYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
|| Keys.TYPE_SNA.equals(adapterType)) {
int saTimeoutSec = this.reqEaiMsg.getCurrentSvcMsg().getTmoVl();
if (logger.isDebug())
logger.debug(guidLogPrefix + " SA TimeoutValue [" + saTimeoutSec + "]");
// this.reqEaiMsg.getKbMsg().getKBHeader().setGnrzToutCrtcNmvl(""+saTimeoutSec);
setTimeout(this.reqEaiMsg, "" + saTimeoutSec);
} else {
int timeout = ServiceUtil.getTimeoutValue(adapterGroupName);
if (logger.isDebug())
logger.debug(guidLogPrefix + " Target Adapter TimeoutValue [" + timeout + "]");
if (timeout > 0) {
if (logger.isDebug())
logger.debug(guidLogPrefix + "Set Adapter TimeoutValue [" + timeout + "] to STDMessage");
// this.reqEaiMsg.getKbMsg().getKBHeader().setGnrzToutCrtcNmvl(""+timeout);
setTimeout(this.reqEaiMsg, "" + timeout);
}
}
}
} catch (Exception e) {
if (logger.isWarn()) {
logger.warn(guidLogPrefix + "Get Adapter TimeoutValue Error - " + e.getMessage(), e);
}
}
// -----------------------------------------------------
// TheK 요건 : SNA송신 비동기 응답거래시 수신거래코드를 EAI에서 매핑함 (20190522)
String srcAdapterGroupName = reqEaiMsg.getSngSysItfTp();
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(srcAdapterGroupName);
String inAdapterMsgType = MessageType.ASC;
if (eaiServerManager.isTASEnabledEAIServer() && EAIMessageKeys.TRANTYPE_FROMTAS.equals(reqEaiMsg.getTranType())
&& inAdptGrpVO == null) {
logger.info(guidLogPrefix + "- TAS 기동거래 [" + srcAdapterGroupName + "] = " + MessageType.ASC);
} else {
if (inAdptGrpVO == null) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF003";
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs) + "(어댑터그룹 미등록/미사용 - "
+ srcAdapterGroupName + ")";
if (logger.isError())
logger.error(guidLogPrefix + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
inAdapterMsgType = inAdptGrpVO.getMessageType();
}
}
public void printExceptionMessage(Exception e) {
// Exception e = this.context.getExceptionInfo().getException();
if (logger.isError())
logger.error(guidLogPrefix + "ExceptionPath : " + e.getMessage(), e);
}
public boolean isSourceAsync() {
if (EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp())) {
return true;
} else {
return false;
}
}
public void callExceptionHandler() {
try {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(this.reqEaiMsg.getSngSysItfTp());
String inAdapterMsgType = inAdptGrpVO.getMessageType();
if (EAITable.EBCDIC_TYPE.equals(inAdapterMsgType)) {
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
byte[] asc = CodeConversion.meToMixedAsc(bizData.getBytes());
try {
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.reqEaiMsg.getStandardMessage().setBizData(new String(asc), inboundCharset);
} catch (Exception e) {
logger.error("setBizData error", e);
}
}
ExceptionHandler.handle(this.reqEaiMsg);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + "ExceptionHandler Call Error", e);
}
}
public boolean isRealCall() {
if (this.callProp != null) {
String mode = this.callProp.getProperty(EAIKeys.CALL_MODE_KEY);
if (mode != null && EAIKeys.CALL_MODE_WARMUP.equals(mode)) {
logger.warn(guidLogPrefix + "Warming Up Called");
return false;
} else {
return true;
}
} else {
return true;
}
}
// private String getAdapterType(String adapterGroupName) {
// AdapterManager adapterManager = AdapterManager.getInstance();
// AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(this.adapterGroupName);
// return adptGrpVO.getType();
// }
public void setGUID() throws Exception {
InterfaceMapper mapper = this.resEaiMsg.getMapper();
StandardMessage standardMessage = this.resEaiMsg.getStandardMessage();
String guid = mapper.getGuid(standardMessage);
String guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ Current GUID [" + guid + "][" + guidseq + "]");
mapper.nextGuidSeq(standardMessage);
guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ ADD PATHSEQ GUID [" + guid + "][" + guidseq + "]");
String svcTsmtUsgTp = this.reqEaiMsg.getSvcTsmtUsgTp(); // 기동 호출방식
String psvItfTp = this.reqEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 수동 호출방식
if ((!(com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.adptrMsgPtrnCd))
&& !(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp)))
|| ((com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.adptrMsgPtrnCd))
&& (EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp)
&& EAIMessageKeys.SYNC_SVC.equals(psvItfTp)))) {
String prcssRtdTranCd = mapper.getReturnServiceId(standardMessage);
if (prcssRtdTranCd != null && prcssRtdTranCd.length() >= 14) {
String cicsTrncd = prcssRtdTranCd.substring(0, 4);
String telgmRecvTranCd = prcssRtdTranCd.substring(4, 14);
mapper.setServiceId(standardMessage, telgmRecvTranCd);
} else {
if (logger.isInfo()) {
logger.info(guidLogPrefix + "- PrcssRtdTranCd Length < 14 [" + prcssRtdTranCd + "]");
}
}
}
if (!(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
&& (com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls()))
&& (STDMessageKeys.RECOVER_YN_YES
.equals(getRecoverYn(this.reqEaiMsg)) ) ) {
String reqOgtranGuIdNo = getOrgGuid(this.reqEaiMsg);
mapper.setOrgGuid(standardMessage, reqOgtranGuIdNo);
if (logger.isInfo()) {
logger.info(guidLogPrefix + " OgtranGuIdNo 복원 " + this.reqEaiMsg.getSvcOgNo() + " OgtranGuIdNo ["
+ mapper.getOrgGuid(standardMessage) + "]");
}
}
}
}
@@ -0,0 +1,919 @@
//package com.eactive.eai.flowcontroller;
//
//import com.bea.control.ServiceBrokerControl;
//import com.bea.jpd.JpdContext;
//import com.bea.wli.jpd.CallbackInterface;
//import com.eactive.eai.common.EAIKeys;
//import com.eactive.eai.common.exception.ExceptionUtil;
//import com.eactive.eai.common.message.*;
//import com.eactive.eai.common.routing.IFRouter;
//import com.eactive.eai.common.routing.RoutingVO;
//import com.eactive.eai.common.util.Logger;
//import com.eactive.eai.common.util.MessageUtil;
//import com.eactive.eai.util.JpdExceptionUtil;
//import com.eactive.eai.adapter.Keys;
//import com.eactive.eai.common.EAITable;
//import com.eactive.eai.common.exception.ExceptionHandler;
//import com.eactive.eai.common.kesa.KESAMessage;
//import com.eactive.eai.common.routing.RoutingManager;
//import com.eactive.eai.transformer.function.util.CodeConversion;
//import com.eactive.eai.transformer.transform.TransformManager;
//import java.util.HashMap;
//import java.util.Vector;
//import com.bea.wli.common.Protocol;
//import com.eactive.eai.control.LogSender;
//import com.eactive.eai.control.Transform;
//import com.eactive.eai.common.kbmessage.*;
//
///**
// * @jpd:process process::
// * <process name="CompMRFCProcess">
// * <clientRequest name="복합거래-MR-프로세스" method="callService" returnMethod="clientReturn">
// * <onException name="OnException" executeOnRollback="true">
// * <perform name="에러처리" method="printExceptionMessage"/>
// * <finish name="Finish"/>
// * </onException>
// * <decision name="WarmUp">
// * <if name="isRealCall" conditionMethod="isRealCall"/>
// * <default name="Default">
// * <finish name="Finish"/>
// * </default>
// * </decision>
// * <perform name="초기화" method="init"/>
// * <whileDo name="호출할 다음 메시지 유무 판단" conditionMethod="existNextSvc">
// * <decision name="요청메시지와 결과 메시지 병합 여부 판단">
// * <if name="FC타입" conditionMethod="isFCType">
// * <controlSend name="다음 요청 메세지 변환" method="transformCtrlTransformComp1"/>
// * </if>
// * <default name="Default"/>
// * </decision>
// * <decision name="Outbound호출 여부 판단">
// * <if name="Outbound호출 여부 판단" conditionMethod="isCallOutBound">
// * <controlSend name="Outbound 호출" method="ifRouterProcess11"/>
// * <perform name="응답메시지 설정" method="setResMessage"/>
// * </if>
// * <default name="Default"/>
// * </decision>
// * </whileDo>
// * <decision name="보상거래처리여부">
// * <if name="정상처리" conditionMethod="isBsResponse">
// * <controlSend name="정상거래처리메시지변환" method="transformCtrlTransformComp"/>
// * <perform name="정상응답메시지설정" method="setResponseMessage"/>
// * </if>
// * <if name="보상거래처리" conditionMethod="isCompensation">
// * <whileDo name="보상거래처리" conditionMethod="existNextCom">
// * <controlSend name="보상거래처리" method="ifRouterProcess4"/>
// * <perform name="보상처리응답메시지설정" method="setCompensationResult"/>
// * </whileDo>
// * </if>
// * <default name="오류처리">
// * <perform name="오류응답메시지설정" method="setErrorMessage"/>
// * </default>
// * </decision>
// * </clientRequest>
// * </process>::
// */
//
//@Protocol(httpSoap=false)
//@com.bea.wli.jpd.Process(process = "<process name=\"CompMRFCProcess\"> "+" <clientRequest name=\"복합거래-MR-프로세스\" method=\"callService\" returnMethod=\"clientReturn\"> "+" <onException name=\"OnException\" executeOnRollback=\"true\"> "+" <perform name=\"에러처리\" method=\"printExceptionMessage\"/> "+" <finish name=\"Finish\"/> "+" </onException> "+" <decision name=\"WarmUp\"> "+" <if name=\"isRealCall\" conditionMethod=\"isRealCall\"/> "+" <default name=\"Default\"> "+" <finish name=\"Finish\"/> "+" </default> "+" </decision> "+" <perform name=\"초기화\" method=\"init\"/> "+" <whileDo name=\"호출할 다음 메시지 유무 판단\" conditionMethod=\"existNextSvc\"> "+" <decision name=\"요청메시지와 결과 메시지 병합 여부 판단\"> "+" <if name=\"FC타입\" conditionMethod=\"isFCType\"> "+" <controlSend name=\"다음 요청 메세지 변환\" method=\"transformCtrlTransformComp1\"/> "+" </if> "+" <default name=\"Default\"/> "+" </decision> "+" <decision name=\"Outbound호출 여부 판단\"> "+" <if name=\"Outbound호출 여부 판단\" conditionMethod=\"isCallOutBound\"> "+" <controlSend name=\"Outbound 호출\" method=\"ifRouterProcess11\"/> "+" <perform name=\"응답메시지 설정\" method=\"setResMessage\"/> "+" </if> "+" <default name=\"Default\"/> "+" </decision> "+" </whileDo> "+" <decision name=\"보상거래처리여부\"> "+" <if name=\"정상처리\" conditionMethod=\"isBsResponse\"> "+" <controlSend name=\"정상거래처리메시지변환\" method=\"transformCtrlTransformComp\"/> "+" <perform name=\"정상응답메시지설정\" method=\"setResponseMessage\"/> "+" </if> "+" <if name=\"보상거래처리\" conditionMethod=\"isCompensation\"> "+" <whileDo name=\"보상거래처리\" conditionMethod=\"existNextCom\"> "+" <controlSend name=\"보상거래처리\" method=\"ifRouterProcess4\"/> "+" <perform name=\"보상처리응답메시지설정\" method=\"setCompensationResult\"/> "+" </whileDo> "+" </if> "+" <default name=\"오류처리\"> "+" <perform name=\"오류응답메시지설정\" method=\"setErrorMessage\"/> "+" </default> "+" </decision> "+" </clientRequest> "+"</process>")
//public class CompMRFCProcess implements com.bea.jpd.ProcessDefinition
//{
// public java.lang.Object reqOutMsg;
//
// public int nextSvcSeq;
//
// public String tranName;
//
// public java.lang.Object outObject;
//
//// public java.lang.Object[] scrObjects;
//
// public java.lang.String comTranName;
//
// public java.lang.String kesaCd;
// public int logPssSeq;
//
// static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
//
// public java.util.Properties callProp;
//
// public EAIMessage resEaiMsg;
//
// public EAIMessage compEaiMsg;
//
// public EAIMessage compResEaiMsg;
//
// public com.eactive.eai.common.message.EAIMessage reqEaiMsg;
//
// public int svcMsgSize; //서비스 메시지 수
//
// public int callCount; //아웃바운드가 호출된 카운트
//
// public int count; //보상처리 거래 카운트
//
// public int resultCount; //요청 응답 메시지와 변환을 위한 레이아웃 목록 배열의 인덱스
//
// public int compListIdx; //보상처리 거래 등록 배열의 인덱스
//
// public int[] compList; //보상거래 처리가 등록된 서비스 목록
//
// public String reqUUID;
//
// public String keyMgtMsgVl ;
//
// public boolean existNextSvcMsg;
//
// public String[] reqLayoutNames; //처리된 결과와 요청 메시지를 병합변환 하기 위한 레이아웃 리스트
//
// public java.lang.Object[] reqScrObjects; //처리된 결과와 요청 메시지를 병합변환 하기 위한 데이터 리스트
//
// public java.lang.Object[] transSourceMsg; //실제 호출된 Outbound 수 만큼의 소스 메시지를 저장하기 위한 리스트
//
// public java.lang.String[] transLayoutNames;
//
// private final static String OUTBOUND_FC_TYPE = "F";
//
// public boolean isFC; //마지막 서비스 메시지가 FC인지 설정하는 플래그
//
// public HashMap resultScrLayouts;
//
// public int sourceCount;
//
// /**
// * for Server Log Level - by kscheon
// * start
// */
// static Logger esbLogger = Logger.getLogger(Logger.LOGGER_ESBFW);
// private int svrLogLevel;
// private static ThreadLocal local = new ThreadLocal(); //경과시간 동기화를 위한 ThreadLocal
// /**
// * for Server Log Level - by kscheon
// * end
// */
//
// static final long serialVersionUID = 1L;
//
// @com.bea.wli.jpd.Callback()
// public Callback callback;
//
// /*
// * 이 주석 위의 영역에는 디자인 뷰에서 만든 변수 선언이 포함되어 있습니다.
// * 이 주석 아래의 영역에는 디자인 뷰에서 만든 컨트롤 선언이 포함되어 있습니다.
// *
// * 이 영역의 코드는 자동으로 생성됩니다.
// *
// * 이 코드 영역에서는 양방향 편집이 완전히 지원됩니다.
// * 경고: 애플리케이션에서 이미 사용하고 있는 프로세스 변수와 컨트롤 선언을 변경하는
// * 경우 사용 중인 모든 위치에서 해당 선언을 업데이트하지 않으면 애플리케이션에서
// * 오류가 발생할 수 있습니다.
// */
//
// /**
// * @common:context
// */
// @com.bea.wli.jpd.Context()
// JpdContext context; //(..컨트롤 삽입 표식 - 이 라인을 수정하지 마십시오.)
//
// /*
// * 이 주석 아래의 영역에는 프로세스 언어의 통신 노드에서 참조하는 java 메소드가 포함되어 있습니다.
// *
// * 이 영역의 코드는 자동으로 생성됩니다.
// *
// * 이 코드 영역에서는 양방향 편집이 부분적으로 지원됩니다.
// * 경고: 메소드 본문에 코드를 추가할 수 있지만 보호 섹션 블록 주석의 외부
// * 합니다. 이 주석 내의 코드를 수정하면 이 코드를 생성한 디자인 뷰 빌더에서
// * 정보를 볼 수 없습니다.
// */
//
//
// public EAIMessage clientReturn()
// {
//
// /**
// * ServerLog Level이 info인경우 로깅 - by kscheon
// * start
// */
// if(svrLogLevel >= 1) {
// try{
// long msgSndTm = System.currentTimeMillis();
//
// Long threadData = (Long)local.get();
// long processTm = msgSndTm - threadData.longValue();
// if (esbLogger.isInfo()) esbLogger.info("CompMRFCProcess] End... - 경과시간 : " + processTm + "(ms) - EAI Server Log Level is INFO");
// } catch (Exception e) {
// }
// }
// /**
// * ServerLog Level이 info인경우 로깅 - by kscheon
// * end
// */
//
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // return
// return resEaiMsg;
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }
//
//
//
//
// public void callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp)
// {
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // parameter assignment
// this.reqEaiMsg = reqEaiMsg;
// this.callProp = callProp;
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
//
// if(this.reqEaiMsg == null) return;
// /**
// * ServerLog Level이 info인경우 로깅 - by kscheon
// * start
// */
// svrLogLevel = this.reqEaiMsg.getSvrLogLvl();
//
//
// if(svrLogLevel >= 1) {
// try{
// long msgRcvTm = System.currentTimeMillis();
// local.set(new Long(msgRcvTm));
//
// if (esbLogger.isInfo()) esbLogger.info("CompMRFCProcess] started... - EAI Server Log Level is INFO");
// }catch(Exception e){
// }
// }
// /**
// * ServerLog Level이 info인경우 로깅 - by kscheon
// * end
// */
//
// }
//
// public void ifRouterProcess4() throws Exception
// {
// logger.debug("CompMRFCProcess] 보상거래를 호출합니다");
// String compEaisvcCd = this.reqEaiMsg.getCurrentSvcMsg().getCpnsSvcPssCd();
// Object[] compObj = new Object[1];
// if (compEaisvcCd !=null) {
// try {
// compEaiMsg = EAIMessageManager.getInstance().getEAIMessage(compEaisvcCd);
// compEaiMsg.setSvcOgNo(reqUUID);
// compEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
//
//// compEaiMsg.setBizMsg(this.reqEaiMsg.getBizMsg());
// compObj[0] = reqScrObjects[0];
// compEaiMsg.setBizMsg(compObj);
//
// compEaiMsg = MessageUtil.makeCompEAIMessage(compEaiMsg, reqEaiMsg);
//
// compResEaiMsg = compEaiMsg;
// callProp.setProperty(EAIKeys.CALL_COMP_KEY, EAIKeys.CALL_COMP_VALUE); //보상거래 프로퍼티 설정
// callProp.setProperty(EAIKeys.CALL_COMP_SVC_SEQ, ""+this.reqEaiMsg.getSvcPssSeq());
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFMR005";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// //this.resEaiMsg.setRspErrCd(rspErrorCode);
// // this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// //throw new RuntimeException(rspErrorCode);
// }
// } else {
// String[] msgArgs = new String[2];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// msgArgs[1] = ""+this.reqEaiMsg.getSvcPssSeq();
// String rspErrorCode = "RECEAIFMR006";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] "+rspErrorMsg);
// // this.resEaiMsg.setRspErrCd(rspErrorCode);
// // this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// // throw new RuntimeException(rspErrorCode);
// }
// try{
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.compResEaiMsg = IFRouter.process(this.compEaiMsg, this.callProp);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// } catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFMR007";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.compResEaiMsg.setRspErrCd(rspErrorCode);
// this.compResEaiMsg.setRspErrMsg(rspErrorMsg);
// // throw new RuntimeException(rspErrorCode);
//
// }
// logger.debug("CompMRFCProcess] 보상거래를 호출을 마칩니다.");
// }
//
// public void transformCtrlTransformComp() throws Exception
// {
// try {
// this.tranName = this.reqEaiMsg.getSvcMsg(svcMsgSize -1).getBsRspCnvMsgID();
// logger.debug("CompMRFCProcess] 정상응답 변환을 위한 변환 이름 - "+ tranName);
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.outObject = Transform.transformComp(this.kesaCd, true, this.tranName, this.transSourceMsg, this.transLayoutNames);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFMR004";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new Exception(rspErrorCode);
// }
// }
//
// public void ifRouterProcess() throws Exception
// {
// logger.debug("CompMRFCProcess] 아웃바운드를 호출합니다. - " +this.reqEaiMsg.getCurrentSvcMsg().getOutbRtnNm());
// try{
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }catch (Exception e) {
// String[] msgArgs = new String[2];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// msgArgs[1] = ""+this.reqEaiMsg.getCurrentSvcMsg().getSvcPssSeq();
// String rspErrorCode = "RECEAIFMR002";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// //throw new Exception(rspErrorCode);
// }
//
// logger.debug("CompMRFCProcess] 아웃바운드를 호출 수행을 마칩니다..");
// }
//
// public void transformCtrlTransformComp1() throws Exception
// {
// logger.debug("CompMRFCProcess] FC 타입에 대한 다음메시지 변환을 수행합니다. ");
// tranName = this.reqEaiMsg.getCurrentSvcMsg().getCnvMsgID();
// reqScrObjects[1] = this.resEaiMsg.getBizMsg()[0];
// //layerNames[0]의 데이터는 이전 처리된 서비스메시지의 변환에서 추출함 - init 메소드에서 설정 했음
//
// this.resEaiMsg.setRspErrCd(EAIMessageKeys.EAI_DEFAULT_CODE);
//
// try{
// reqLayoutNames[1] = getLayoutName (this.resEaiMsg.getCurrentSvcMsg().getBsRspCnvMsgID(), this.resEaiMsg.getCurrentSvcMsg().getBsRspCnvEn());
// if(logger.isDebug()) {
// logger.debug("CompMRFCProcess] this.resEaiMsg.getCurrentSvcMsg().getSvcPssSeq() = " +this.resEaiMsg.getSvcPssSeq());
// logger.debug("CompMRFCProcess] reqLayoutNames[0] = " +reqLayoutNames[0]);
// logger.debug("CompMRFCProcess] reqLayoutNames[1] = " +reqLayoutNames[1]);
// }
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFMR009";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// }
// try {
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.reqOutMsg = Transform.transformComp(this.kesaCd, true, this.tranName, this.reqScrObjects, this.reqLayoutNames);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFMR011";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// }
//
// callCount++;
// }
//
// public void ifRouterProcess1() throws Exception
// {
// logger.debug("CompMRFCProcess] 아웃바운드를 호출합니다. - " +this.reqEaiMsg.getCurrentSvcMsg().getOutbRtnNm());
//
// try{
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }catch (Exception e) {
// String[] msgArgs = new String[2];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// msgArgs[1] = ""+this.reqEaiMsg.getCurrentSvcMsg().getSvcPssSeq();
// String rspErrorCode = "RECEAIFMR002";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// //throw new Exception(rspErrorCode);
// }
//
// logger.debug("CompMRFCProcess] 아웃바운드를 호출 수행을 마칩니다..");
// }
//
// public void ifRouterProcess11() throws Exception
// {
// logger.debug("CompMRFCProcess] 아웃바운드를 호출합니다. - " +this.reqEaiMsg.getCurrentSvcMsg().getOutbRtnNm());
//
// try{
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }catch (Exception e) {
// String[] msgArgs = new String[2];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// msgArgs[1] = ""+this.reqEaiMsg.getCurrentSvcMsg().getSvcPssSeq();
// String rspErrorCode = "RECEAIFMR002";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// //throw new Exception(rspErrorCode);
// }
//
// logger.debug("CompMRFCProcess] 아웃바운드를 호출 수행을 마칩니다..");
// }
//
// @CallbackInterface()
// public interface Callback extends ServiceBrokerControl //(..영역 끝 표식 - 이 라인을 수정하지 마십시오.)
// {
// }
//
// /*
// * 이 주석 아래에 삽입한 코드는 디자인 뷰에서 만든 수행 또는 조건 노드에 해당하는
// * 메소드용입니다.
// *
// * 여기에서 코드를 수정하거나 새로 추가하십시오.
// */
//
//
//
// public boolean checkServiceMsgSize()
// {
// // Outbound Error일 경우
// if( MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) &&
// reqEaiMsg.getSvcMsgs().size() > 1 ) {
// return true;
// }
// else {
// return false;
// }
// }
//
//
// public boolean isOutboundCall()
// {
// return true;
// }
//
//
// public void init() throws Exception
// {
// this.resEaiMsg = this.reqEaiMsg;
//
// callCount = 1;
// count = 0;
// compListIdx = 0;
// resultCount = 0;
// sourceCount = 0;
//
// existNextSvcMsg = true;
// isFC = false;
//
// this.reqUUID = this.reqEaiMsg.getSvcOgNo(); //보상거래에 원래의 UUID 설정을 위해 저장
//
// //-----------------------------------------------
// // KBMessage 표준으로 변경함 2008.05.08
// //-----------------------------------------------
// //this.kesaCd = this.reqEaiMsg.getKesaMsg().getCService();
// this.kesaCd = this.reqEaiMsg.getKbMsg().getKBCommon().getTelgmRecvTranCd();
// //-----------------------------------------------
// this.keyMgtMsgVl = this.reqEaiMsg.getCurrentSvcMsg().getKeyMgtMsgVl();
//
// try {
// this.svcMsgSize = this.reqEaiMsg.getSvcMsgs().size();
// }catch (Exception e) {
// logger.error ("CompMRFCProcess] 요청 메시지에서 서비스메시지를 가져올 수 없습니다.");
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFMR001";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
// }
// TransformManager manager = null;
// try{
// manager = TransformManager.getManager();
// com.eactive.eai.transformer.transform.Transform transform = manager.getTransform(this.reqEaiMsg.getCurrentSvcMsg().getCnvMsgID());
// reqLayoutNames = new String[2]; //요청메시지와 응답메시지 변환을 위한 소스 레이아웃
// reqLayoutNames[0] = transform.getSourceLayout(0).getName();
// logger.debug("CompMRFCProcess] layerNames[0] - "+reqLayoutNames[0]);
//
// reqScrObjects = new Object[2];
// reqScrObjects[0] = this.reqEaiMsg.getBizMsg()[0];
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFMR009";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// }
//
// try{
// String outName = this.reqEaiMsg.getSvcMsg(svcMsgSize-1).getOutbRtnNm();
// RoutingManager rm = RoutingManager.getInstance();
// RoutingVO vo = rm.getRoutingVO(outName);
// String layerDstcd = vo.getLayerDstcd();
//
// if (!OUTBOUND_FC_TYPE.equals(layerDstcd) ) {
// logger.error("CompMRFCProcess] 결과 메시지를 변환하기 위한 서비스 메시지가 등록되어 있지 않습니다.");
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFMR012";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new Exception(rspErrorCode);
// } else {
// this.resultScrLayouts = new HashMap();
//
// String resultTransform = this.reqEaiMsg.getSvcMsg(svcMsgSize-1).getBsRspCnvMsgID();
//
// manager = TransformManager.getManager();
// com.eactive.eai.transformer.transform.Transform transform = manager.getTransform(resultTransform);
// String sourceLayout = "";
//
// if (transform == null) {
// String[] msgArgs = new String[1];
// msgArgs[0] = resultTransform;
// String rspErrorCode = "RECEAIFMR008";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] " +rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
// } else {
// sourceCount = transform.getSourceLayoutCount();
// transSourceMsg = new Object[sourceCount];
// transLayoutNames = new String[sourceCount];
//
// for (int i=0; i<sourceCount; i++) {
// sourceLayout = transform.getSourceLayout(i).getName();
// resultScrLayouts.put(sourceLayout, sourceLayout);
// //결과 변환규칙에 요청메시지의 레이아웃이 존재하면
// if (sourceLayout.equals(reqLayoutNames[0])) {
// transSourceMsg[resultCount] = reqScrObjects[0];
// transLayoutNames[resultCount] = sourceLayout;
// resultCount++;
// }
// }
// }
// }
// } catch (Exception e) {
// logger.error("CompMRFCProcess] 결과 메시지를 변환하기 위한 서비스 메시지가 등록되어 있지 않습니다.");
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFMR012";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] " + rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new Exception(rspErrorCode);
// }
// }
//
// public void printExceptionMessage() throws Exception
// {
// Exception e = this.context.getExceptionInfo().getException();
// if (logger.isError()) logger.error("CompMRFCProcess] ExceptionPath : "+e.getMessage());
// e.printStackTrace();
// }
//
// public boolean isSourceAsync()
// {
// if(EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp()) ) {
// return true;
// }
// else {
// return false;
// }
//
// }
//
// public boolean isRealCall()
// {
// if(this.callProp != null) {
// String mode = this.callProp.getProperty(EAIKeys.CALL_MODE_KEY);
// if(mode != null && EAIKeys.CALL_MODE_WARMUP.equals(mode)) {
// logger.debug("CompMRFCProcess] Warming Up Called");
// return false;
// }
// else {
// return true;
// }
// }
// else {
// return true;
// }
// }
//
//
// public boolean isCompensation()
// {
//
// if (this.compList != null ) { //보상거래가 등록된 서비스가 하나라도 있으면
// logger.debug("CompMRFCProcess] 등록된 보상거래 서비스가 있습니다");
// return true;
// }
// else {
// logger.debug("CompMRFCProcess] 등록된 보상거래 서비스가 없습니다");
// return false;
// }
// }
//
//
// public boolean existNextCom()
// {
// logger.debug("CompMRFCProcess] 실행할 보상거래가 있는지 확인합니다.");
// if (compListIdx > 0 ) {
// if (compListIdx == count) {
// logger.debug("CompMRFCProcess] 실행할 보상거래가 없습니다.- compListIdx == count [ " +compListIdx + " ] ");
// return false;
// }else if (this.compList[count] >0) { //보상거래 처리가 등록된 서비스 메시지 이면 보상거래 처
// logger.debug("CompMRFCProcess] 실행할 보상거래가 있습니다. [ this.compList[" +count+" ] - "+ this.compList[count]);
// this.reqEaiMsg.setSvcPssSeq(this.compList[count]); //보상거래를 위해 처리된 순서대로 서비스메시지를 설정
// count++;
// return true;
// } else {
// logger.debug("CompMRFCProcess] 실행할 보상거래가 없습니다. [ " + this.compList[count] + "- " +count+" ] ");
// return false;
// }
//
// } else {
// logger.debug("CompMRFCProcess] 실행할 보상거래가 없습니다.");
// return false;
// }
//
// }
//
// public boolean existNextSvc()
// {
// logger.debug("CompMRFCProcess] 다음 서비스 메시지를 확인합니다. ." );
// if (!existNextSvcMsg) {
// logger.debug("CompMRFCProcess] 호출할 다음 서비스 메시지가 없습니다." );
// return false;
// }
// logger.debug("CompMRFCProcess] callCount : "+callCount);
// if (callCount == this.svcMsgSize){ //MR의 경우 마지막 서비스 메시지는 결과메시지를 설정함
// return false;
// }
// else {
// this.reqEaiMsg.setSvcPssSeq(callCount);
// this.reqEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
// return true;
// }
// }
//
//
// public void setErrorMessage() throws Exception
// {
// logger.debug("CompMRFCProcess ] 오류 응답 메시지를 수신했습니다. "+ this.resEaiMsg.getBizMsg()[0].toString());
//
// }
//
// public void setResponseMessage() throws Exception
// {
// logger.debug("CompMRFCProcess ] 정상 응답 메시지를 수신했습니다. "+ this.resEaiMsg.getBizMsg()[0].toString());
// Object[] obj = new Object[1];
// obj[0] = this.outObject;
// this.resEaiMsg.setBizMsg(obj);
// this.resEaiMsg.setSvcPssSeq(this.svcMsgSize);
// this.resEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
// }
//
//
// public boolean isBsResponse()
// {
// // 업무오류와 정상코드가 동일하므로 제거해야함 : 2008.06.03
// //if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) || EAIMessageKeys.BWK_ERRMSG_CODE.equals(resEaiMsg.getRspErrCd())){
// if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())){
// logger.debug("CompMRFCProcess ] 오류 응답 메시지를 수신했습니다. ");
// return false;
// }
// else {
// logger.debug("CompMRFCProcess ] 정상 응답 메시지를 수신했습니다. ");
// return true;
// }
// }
//
// private String getLayoutName (String transformName, String yn) throws Exception{
// TransformManager manager = TransformManager.getManager();
// com.eactive.eai.transformer.transform.Transform transform = manager.getTransform(transformName);
// String layoutName = "";
// if (transform == null) {
// String[] msgArgs = new String[1];
// msgArgs[0] = transformName;
// String rspErrorCode = "RECEAIFMR008";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] " +rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
// } else {
// if(logger.isDebug()) {
// logger.debug("CompMRFCProcess] transformName =" + transformName);
// logger.debug("CompMRFCProcess] yn =" + yn );
// }
// if("1".equals(yn)) {
// layoutName = transform.getTargetLayout().getName();
// }
// else {
// layoutName = transform.getSourceLayout(0).getName();
// }
// }
//
// return layoutName;
//
// }
//
//
// public void setCompensationResult() throws Exception
// {
// //보강거래 처리에서 오류가 발생한경우에 대한 처리절차 추가 필요
// if(!MessageUtil.checkRspErrCd(this.compResEaiMsg.getRspErrCd())) { //보상거래 처리시 오류가 발생한 경우
// logger.error("CompMRFCProcess ] 보상거래 처리시 오류가 발생했습니다 - " + this.compResEaiMsg.getRspErrCd() +" - " + this.compResEaiMsg.getRspErrMsg());
// } else {
// logger.info ( "CompMRFCProcess ] 보상거래 처리가 정상적으로 처리되었습니다. - [ "+ this.compEaiMsg.getEAISvcCd()+" ] ");
// }
//
// }
//
// public boolean isFCType()
// {
// logger.debug("CompMRFCProcess ] 다음 서비스 메시지가 FC타입인지 확인합니다.");
// String outName = this.reqEaiMsg.getCurrentSvcMsg().getOutbRtnNm();
// RoutingManager rm = RoutingManager.getInstance();
// RoutingVO vo = rm.getRoutingVO(outName);
// String layerDstcd = vo.getLayerDstcd();
//
// if (OUTBOUND_FC_TYPE.equals(layerDstcd) ) {
// if (outName.equals(this.reqEaiMsg.getFlwCntlRtnNm())){ //자기 자신의 FC와 동일한지 확인
// logger.debug("CompMRFCProcess ] 다음 서비스 메시지가 FC타입입니다..");
// this.isFC = true;
// return true;
// }
// else {
// String[] msgArgs = new String[2];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// msgArgs[1] = ""+this.reqEaiMsg.getSvcPssSeq();
// String rspErrorCode = "RECEAIFMR010";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] " +rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// logger.error("CompMRFCProcess ] FC 설정이 잘못 되었습니다.");
// return false;
// }
// }
// else {
// logger.debug("CompMRFCProcess ] 다음 서비스 메시지가 FC타입이 아닙니다.");
// return false;
// }
// }
//
//
// public boolean isCallOutBound()
// {
// if (isFC) {
// // 업무오류와 정상코드가 동일하므로 제거해야함 : 2008.06.03
// //if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) || EAIMessageKeys.BWK_ERRMSG_CODE.equals(resEaiMsg.getRspErrCd())){
// if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())){
// logger.debug("CompMRFCProcess ] 다음 요청메시지 변환 중 오류가 발생했습니다. ");
// existNextSvcMsg = false;
// return false;
// }
// else {
// logger.debug("CompMRFCProcess ] 다음 요청메시지 변환이 정상 적으로 수행 되었습니다.");
// Object obj[] = new Object[1];
// obj[0] = reqOutMsg;
// this.reqEaiMsg.setBizMsg(obj);
//
// this.reqEaiMsg.setSvcPssSeq(this.reqEaiMsg.getCurrentSvcMsg().getNxtSvcPssSeq());
// this.reqEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
//
// isFC = false;
// return true;
// }
// } else {
// return true;
// }
// }
//
//
//
// public void setResMessage() throws Exception
// {
// logger.debug("CompMRFCProcess] 응답메시지를 응답 메시지 리스트에 설정합니다. - [ "+ (callCount) +" ] 번째 호출입니다." );
//
// try {
//
// // 업무오류와 정상코드가 동일하므로 제거해야함 : 2008.06.03
// //if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) || EAIMessageKeys.BWK_ERRMSG_CODE.equals(resEaiMsg.getRspErrCd())){
// if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())){
// logger.debug("CompMRFCProcess] 오류응답 메시지를 수신했습니다. ");
// existNextSvcMsg = false;
//
// //String tranClassify = this.resEaiMsg.getKesaMsg().getCTranClassify();
// String telgmDmndDstcd = this.resEaiMsg.getKbMsg().getKBHeader().getTelgmDmndDstcd();
// if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())) {
//
// //if (EAIKeys.TR_RES.equals(tranClassify) || EAIKeys.TR_CANCEL_RES.equals(tranClassify) || EAIKeys.TR_NET_RES.equals(tranClassify) || EAIKeys.TR_SYSTEMINFO_RES.equals(tranClassify)){
// if(KBMessageKeys.TELGMDMNDDSTCD_RECV.equals(telgmDmndDstcd)) {
// if (this.reqEaiMsg.getCurrentSvcMsg().getCpnsSvcPssCd() != null && this.reqEaiMsg.getCurrentSvcMsg().getCpnsSvcPssCd().length() > 0) {
// if (this.compList == null ){
// logger.debug("CompMRFCProcess ] 보상거래를 위한 목록을 생성합니다.");
// this.compList = new int[svcMsgSize];
// }
// this.compList[compListIdx] = this.reqEaiMsg.getCurrentSvcMsg().getSvcPssSeq();
// logger.debug("CompMRFCProcess ] 보상거래를 위한 목록에 등록 합니다.- " +this.reqEaiMsg.getCurrentSvcMsg().getSvcPssSeq());
// compListIdx++;
// }
// }
//
// }
// } else {
//
// if (this.reqEaiMsg.getCurrentSvcMsg().getCpnsSvcPssCd() != null && this.reqEaiMsg.getCurrentSvcMsg().getCpnsSvcPssCd().length() > 0) {
// if (this.compList == null ){
// logger.debug("CompMRFCProcess] 보상거래를 위한 목록을 생성합니다.");
// this.compList = new int[svcMsgSize];
// }
// this.compList[compListIdx] = this.reqEaiMsg.getCurrentSvcMsg().getSvcPssSeq();
// logger.debug("CompMRFCProcess] 보상거래를 위한 목록에 등록 합니다.- " +this.reqEaiMsg.getCurrentSvcMsg().getSvcPssSeq());
// compListIdx++;
// }
//
// String layoutName = getLayoutName (reqEaiMsg.getCurrentSvcMsg().getBsRspCnvMsgID(), reqEaiMsg.getCurrentSvcMsg().getBsRspCnvEn());
//
// if (this.resultScrLayouts.get(layoutName) != null ){
// if(logger.isDebug()) logger.debug("CompMRFCProcess] 응답메시지 설정 - "+ layoutName);
// transSourceMsg[resultCount] = this.resEaiMsg.getBizMsg()[0];
// transLayoutNames[resultCount] = layoutName;
// resultCount++;
// }
// }
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFMR003";
// e.printStackTrace();
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompMRFCProcess] " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// //throw new Exception(rspErrorCode);
// }
// callCount++; //호출카운트 증가
// }
//}
@@ -0,0 +1,961 @@
package com.eactive.eai.flowcontroller;
//package com.eactive.eai.flowcontroller;
//
//import com.bea.control.ServiceBrokerControl;
//import com.bea.jpd.JpdContext;
//import com.bea.data.RawData;
//import com.bea.wli.control.broker.MessageBroker;
//import com.bea.wli.jpd.Callback;
//import com.bea.wli.jpd.CallbackInterface;
//import com.bea.xml.XmlObjectList;
//import org.apache.beehive.controls.api.bean.Control;
//import org.apache.beehive.controls.api.events.EventHandler;
//import org.apache.xmlbeans.XmlObject;
//import com.eactive.eai.adapter.AdapterGroupVO;
//import com.eactive.eai.adapter.AdapterManager;
//import com.eactive.eai.adapter.AdapterVO;
//import com.eactive.eai.common.EAIKeys;
//import com.eactive.eai.common.exception.ExceptionUtil;
//import com.eactive.eai.common.message.*;
//import com.eactive.eai.common.property.PropManager;
//import com.eactive.eai.common.routing.IFRouter;
//import com.eactive.eai.common.routing.RoutingVO;
//import com.eactive.eai.common.util.Logger;
//import com.eactive.eai.common.util.MessageUtil;
//import com.eactive.eai.util.JpdExceptionUtil;
//import com.eactive.eai.adapter.Keys;
//import com.eactive.eai.common.EAITable;
//import com.eactive.eai.common.exception.ExceptionHandler;
//import com.eactive.eai.common.kesa.KESAMessage;
//import com.eactive.eai.common.routing.RoutingManager;
//import com.eactive.eai.transformer.function.util.CodeConversion;
//import com.eactive.eai.transformer.transform.TransformManager;
//import java.util.HashMap;
//import java.util.Iterator;
//import com.bea.wli.common.Protocol;
//import com.eactive.eai.control.LogSender;
//import com.eactive.eai.control.Transform;
//import com.eactive.eai.common.kbmessage.*;
//import com.eactive.eai.common.bpa.RuleManager;
//
///**
// * @jpd:process process::
// * <process name="CompRRFCProcess">
// * <clientRequest name="복합거래-RR-프로세스" method="callService" returnMethod="clientReturn">
// * <onException name="OnException" executeOnRollback="true">
// * <perform name="에러처리" method="printExceptionMessage"/>
// * <finish name="Finish"/>
// * </onException>
// * <decision name="WarmUp">
// * <if name="isRealCall" conditionMethod="isRealCall"/>
// * <default name="Default">
// * <finish name="Finish"/>
// * </default>
// * </decision>
// * <perform name="초기화" method="init"/>
// * <whileDo name="호출할 다음 메시지 유무 판단" conditionMethod="existNextSvc">
// * <decision name="서비스메시지순서 판단">
// * <if name="1번서비스 메시지" conditionMethod="isFirstSvcMsg"/>
// * <default name="Default">
// * <controlSend name="getNextServiceSeq" method="ruleManagerCtrlGetNextServiceSeq"/>
// * <decision name="요청메시지와 결과 메시지 병합 여부 판단">
// * <if name="FC타입" conditionMethod="isFCType">
// * <controlSend name="다음 요청 메세지 변환" method="transformCtrlTransformComp"/>
// * </if>
// * <default name="Default"/>
// * </decision>
// * </default>
// * </decision>
// * <decision name="마지막 서비스메시지의 타입 판단">
// * <if name="FC타입" conditionMethod="isFinalFCType"/>
// * <default name="Default">
// * <controlSend name="Outbound 호출" method="ifRouterProcess3"/>
// * <perform name="보상거래 확인" method="setCompList"/>
// * </default>
// * </decision>
// * </whileDo>
// * <decision name="보상거래처리여부">
// * <if name="정상처리" conditionMethod="isNonError">
// * <perform name="정상응답메시지설정" method="setResponseMessage"/>
// * </if>
// * <if name="보상거래처리" conditionMethod="isCompensation">
// * <whileDo name="보상거래처리" conditionMethod="existNextCom">
// * <controlSend name="보상거래처리" method="ifRouterProcess4"/>
// * <perform name="보상처리응답메시지설정" method="setCompensationResult"/>
// * </whileDo>
// * </if>
// * <default name="오류처리">
// * <perform name="오류응답메시지설정" method="setErrorMessage"/>
// * </default>
// * </decision>
// * </clientRequest>
// * </process>::
// */
//
//@Protocol(httpSoap=false)
//@com.bea.wli.jpd.Process(process = "<process name=\"CompRRFCProcess\"> "+" <clientRequest name=\"복합거래-RR-프로세스\" method=\"callService\" returnMethod=\"clientReturn\"> "+" <onException name=\"OnException\" executeOnRollback=\"true\"> "+" <perform name=\"에러처리\" method=\"printExceptionMessage\"/> "+" <finish name=\"Finish\"/> "+" </onException> "+" <decision name=\"WarmUp\"> "+" <if name=\"isRealCall\" conditionMethod=\"isRealCall\"/> "+" <default name=\"Default\"> "+" <finish name=\"Finish\"/> "+" </default> "+" </decision> "+" <perform name=\"초기화\" method=\"init\"/> "+" <whileDo name=\"호출할 다음 메시지 유무 판단\" conditionMethod=\"existNextSvc\"> "+" <decision name=\"서비스메시지순서 판단\"> "+" <if name=\"1번서비스 메시지\" conditionMethod=\"isFirstSvcMsg\"/> "+" <default name=\"Default\"> "+" <controlSend name=\"getNextServiceSeq\" method=\"ruleManagerCtrlGetNextServiceSeq\"/> "+" <decision name=\"요청메시지와 결과 메시지 병합 여부 판단\"> "+" <if name=\"FC타입\" conditionMethod=\"isFCType\"> "+" <controlSend name=\"다음 요청 메세지 변환\" method=\"transformCtrlTransformComp\"/> "+" </if> "+" <default name=\"Default\"/> "+" </decision> "+" </default> "+" </decision> "+" <decision name=\"마지막 서비스메시지의 타입 판단\"> "+" <if name=\"FC타입\" conditionMethod=\"isFinalFCType\"/> "+" <default name=\"Default\"> "+" <controlSend name=\"Outbound 호출\" method=\"ifRouterProcess3\"/> "+" <perform name=\"보상거래 확인\" method=\"setCompList\"/> "+" </default> "+" </decision> "+" </whileDo> "+" <decision name=\"보상거래처리여부\"> "+" <if name=\"정상처리\" conditionMethod=\"isNonError\"> "+" <perform name=\"정상응답메시지설정\" method=\"setResponseMessage\"/> "+" </if> "+" <if name=\"보상거래처리\" conditionMethod=\"isCompensation\"> "+" <whileDo name=\"보상거래처리\" conditionMethod=\"existNextCom\"> "+" <controlSend name=\"보상거래처리\" method=\"ifRouterProcess4\"/> "+" <perform name=\"보상처리응답메시지설정\" method=\"setCompensationResult\"/> "+" </whileDo> "+" </if> "+" <default name=\"오류처리\"> "+" <perform name=\"오류응답메시지설정\" method=\"setErrorMessage\"/> "+" </default> "+" </decision> "+" </clientRequest> "+"</process>")
//public class CompRRFCProcess implements com.bea.jpd.ProcessDefinition
//{
// public java.lang.String[] layerNames;
//
// public int nextSvcSeq;
//
// public String tranName;
//
// public java.lang.Object outObject;
//
// public java.lang.Object[] scrObjects;
//
// public java.lang.String comTranName;
//
// public java.lang.String kesaCd;
//
// public int logPssSeq;
//
// static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
//
// public java.util.Properties callProp;
//
// public EAIMessage resEaiMsg;
//
// public EAIMessage compEaiMsg; //보상거래 요청 메시지
//
// public EAIMessage compResEaiMsg; //보상거래 응답 메시지
//
// public Object[] orgBizData; //보상거래시 요청할 원기동 메시지
//
// public com.eactive.eai.common.message.EAIMessage reqEaiMsg;
//
// //public java.lang.String nextSvcScr;
//
// public boolean isFistSvcMsg;
//
// public boolean existNextSvcMsg; //다음 서비스 메시지 유무
//
// public int svcMsgSize; //서비스 메시지 수
//
//// public int[] calledSvcMsgSeq; //수행되었던 서비스메시지 처리번호
//
// public int callCount; //보상거래 등록 카운트
//
// public int count; //보상처리 거래 카운트
//
// public String reqUUID;
//
// public int[] compList ; //보상거래가 필요한 서비스메시지 처리번호 목록
//
// public String keyMgtMsgVl ;
//
// public boolean isFinalFC; //마지막 서비스 메시지가 FC인지 설정하는 플래그
//
// public boolean isFC;
//
// private final static String OUTBOUND_FC_TYPE = "F";
//
// public boolean nonNextSvcMsg;
//
// //public int sourceCount;
//
// //public java.lang.Object[] transSourceMsg; //실제 호출된 Outbound 수 만큼의 소스 메시지를 저장하기 위한 리스트
//
// //public java.lang.String[] transLayoutNames;
//
// public int resultCount;
//
// /**
// * for Server Log Level - by kscheon
// * start
// */
// static Logger esbLogger = Logger.getLogger(Logger.LOGGER_ESBFW);
// private int svrLogLevel;
// private static ThreadLocal local = new ThreadLocal(); //경과시간 동기화를 위한 ThreadLocal
// /**
// * for Server Log Level - by kscheon
// * end
// */
//
// static final long serialVersionUID = 1L;
//
// @com.bea.wli.jpd.Callback()
// public Callback callback;
//
// /*
// * 이 주석 위의 영역에는 디자인 뷰에서 만든 변수 선언이 포함되어 있습니다.
// * 이 주석 아래의 영역에는 디자인 뷰에서 만든 컨트롤 선언이 포함되어 있습니다.
// *
// * 이 영역의 코드는 자동으로 생성됩니다.
// *
// * 이 코드 영역에서는 양방향 편집이 완전히 지원됩니다.
// * 경고: 애플리케이션에서 이미 사용하고 있는 프로세스 변수와 컨트롤 선언을 변경하는
// * 경우 사용 중인 모든 위치에서 해당 선언을 업데이트하지 않으면 애플리케이션에서
// * 오류가 발생할 수 있습니다.
// */
//
//
// /**
// * @common:context
// */
// @com.bea.wli.jpd.Context()
// JpdContext context; //(..컨트롤 삽입 표식 - 이 라인을 수정하지 마십시오.)
//
// /*
// * 이 주석 아래의 영역에는 프로세스 언어의 통신 노드에서 참조하는 java 메소드가 포함되어 있습니다.
// *
// * 이 영역의 코드는 자동으로 생성됩니다.
// *
// * 이 코드 영역에서는 양방향 편집이 부분적으로 지원됩니다.
// * 경고: 메소드 본문에 코드를 추가할 수 있지만 보호 섹션 블록 주석의 외부
// * 합니다. 이 주석 내의 코드를 수정하면 이 코드를 생성한 디자인 뷰 빌더에서
// * 정보를 볼 수 없습니다.
// */
//
//
// public EAIMessage clientReturn()
// {
//
// /**
// * ServerLog Level이 info인경우 로깅 - by kscheon
// * start
// */
// if(svrLogLevel >= 1) {
// try{
// long msgSndTm = System.currentTimeMillis();
//
// Long threadData = (Long)local.get();
// long processTm = msgSndTm - threadData.longValue();
// if (esbLogger.isInfo()) esbLogger.info("CompRRFCProcess] End... - 경과시간 : " + processTm + "(ms) - EAI Server Log Level is INFO");
// } catch (Exception e) {
// }
// }
// /**
// * ServerLog Level이 info인경우 로깅 - by kscheon
// * end
// */
//
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // return
// return resEaiMsg;
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }
//
//
//
//
// public void callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp)
// {
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // parameter assignment
// this.reqEaiMsg = reqEaiMsg;
// this.callProp = callProp;
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
//
// if(this.reqEaiMsg == null) return;
// /**
// * ServerLog Level이 info인경우 로깅 - by kscheon
// * start
// */
// svrLogLevel = this.reqEaiMsg.getSvrLogLvl();
//
//
// if(svrLogLevel >= 1) {
// try{
// long msgRcvTm = System.currentTimeMillis();
// local.set(new Long(msgRcvTm));
//
// if (esbLogger.isInfo()) esbLogger.info("CompRRFCProcess] started... - EAI Server Log Level is INFO");
// }catch(Exception e){
// }
// }
// /**
// * ServerLog Level이 info인경우 로깅 - by kscheon
// * end
// */
//
// }
//
// public void ifRouterProcess4() throws Exception
// {
// logger.debug("CompRRFCProcess] 보상거래를 호출합니다");
// String compEaisvcCd = this.reqEaiMsg.getCurrentSvcMsg().getCpnsSvcPssCd();
// if (compEaisvcCd !=null) {
// try {
// compEaiMsg = EAIMessageManager.getInstance().getEAIMessage(compEaisvcCd);
// compEaiMsg.setSvcOgNo(reqUUID);
// compEaiMsg.setBizMsg(orgBizData);
// compEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
//
// compEaiMsg = MessageUtil.makeCompEAIMessage(compEaiMsg, reqEaiMsg);
//
// compResEaiMsg = compEaiMsg;
// callProp.setProperty(EAIKeys.CALL_COMP_KEY, EAIKeys.CALL_COMP_VALUE); //보상거래 프로퍼티 설정
// callProp.setProperty(EAIKeys.CALL_COMP_SVC_SEQ, ""+this.reqEaiMsg.getSvcPssSeq());
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFRR004";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// //this.resEaiMsg.setRspErrCd(rspErrorCode);
// // this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// // throw new RuntimeException(rspErrorCode);
// }
// } else {
// String[] msgArgs = new String[2];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// msgArgs[1] = ""+this.reqEaiMsg.getSvcPssSeq();
// String rspErrorCode = "RECEAIFRR005";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] "+rspErrorMsg);
// // this.resEaiMsg.setRspErrCd(rspErrorCode);
// // this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// // throw new RuntimeException(rspErrorCode);
// }
// try {
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.compResEaiMsg = IFRouter.process(this.compEaiMsg, this.callProp);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// } catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFRR006";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.compResEaiMsg.setRspErrCd(rspErrorCode);
// this.compResEaiMsg.setRspErrMsg(rspErrorMsg);
// // throw new RuntimeException(rspErrorCode);
//
// }
//
// logger.debug("CompRRFCProcess] 보상거래를 호출을 마칩니다.");
// }
//
//
// public void ruleManagerCtrlGetNextServiceSeq() throws Exception
// {
// logger.debug("CompRRFCProcess] 다음서비스메시지를 추출합니다.");
//
// Object[] objs = new Object[1];
// objs[0] = this.resEaiMsg.getBizMsg()[0];
// this.reqEaiMsg.setBizMsg(objs);
//
// try{
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.nextSvcSeq = RuleManager.getNextServieSeq(this.reqEaiMsg);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFRR003";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// // throw new RuntimeException(rspErrorCode);
//
// existNextSvcMsg = false; //다음 서비스메시지 추출에서 오류가 발생하면 반복 루틴을 종료하도록 한다.
// }
//
// if (this.nextSvcSeq > 0) {
//
// this.reqEaiMsg.setSvcPssSeq(this.nextSvcSeq);
// this.reqEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
// existNextSvcMsg = true;
// } else if (this.nextSvcSeq == -1){
// if ( this.reqEaiMsg.getCurrentSvcMsg().getNxtSvcPssSeq() > 0) {
// this.reqEaiMsg.setSvcPssSeq(this.reqEaiMsg.getCurrentSvcMsg().getNxtSvcPssSeq());
// this.reqEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
// existNextSvcMsg = true;
// } else {
// existNextSvcMsg = false;
// }
// } else {
// existNextSvcMsg = false;
// }
// logger.debug("CompRRFCProcess] 다음서비스메시지를 추출 했습니다. - " + existNextSvcMsg);
// }
//
//
// public void transformCtrlTransformComp() throws Exception
// {
// logger.debug("CompRRFCProcess] FC 타입에 대한 다음메시지 변환을 수행합니다. ");
// try {
// if (this.reqEaiMsg.getCurrentSvcMsg().getNxtSvcPssSeq() == 0 ){
// logger.debug("CompRRFCProcess] 마지막 결과 메시지 변환을 위한 FC 입니다.");
//
// this.isFinalFC = true;
// this.nonNextSvcMsg = true;
//
// tranName = this.reqEaiMsg.getCurrentSvcMsg().getBsRspCnvMsgID();
// } else {
// tranName = this.reqEaiMsg.getCurrentSvcMsg().getCnvMsgID();
// }
//
// TransformManager manager = TransformManager.getManager();
// com.eactive.eai.transformer.transform.Transform transform = manager.getTransform(tranName);
// String sourceLayout = "";
//
// String resTransform = getLayoutName(this.resEaiMsg.getCurrentSvcMsg().getBsRspCnvMsgID());
//
// if (transform == null) {
// String[] msgArgs = new String[1];
// msgArgs[0] = tranName;
// String rspErrorCode = "RECEAIFRR008";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] " +rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
// } else {
// int sourceCount = transform.getSourceLayoutCount();
//
// Object obj = scrObjects[0];
// String reqlayoutName = layerNames[0];
//
// scrObjects = new Object[sourceCount];
// layerNames = new String[sourceCount];
//
// for (int i=0; i<sourceCount; i++) {
// sourceLayout = transform.getSourceLayout(i).getName();
//
// resultCount = 0;
//
// //결과 변환규칙에 요청메시지의 레이아웃이 존재하면
// if (sourceLayout.equals(reqlayoutName)) {
// scrObjects[resultCount] = obj;
// layerNames[resultCount] = reqlayoutName;
// resultCount++;
// }
//
// if (sourceLayout.equals(resTransform)) {
// scrObjects[resultCount] = this.resEaiMsg.getBizMsg()[0];
// layerNames[resultCount] = resTransform;
// resultCount++;
// }
// }
// }
// } catch(Exception e) {
// e.printStackTrace();
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFRR008";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] "+rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// }
//
// /*
// } else {
// tranName = this.reqEaiMsg.getCurrentSvcMsg().getCnvMsgID();
//
// scrObjects[1] = this.resEaiMsg.getBizMsg()[0];
// //layerNames[0]의 데이터는 이전 처리된 서비스메시지의 변환에서 추출함 - init 메소드에서 설정 했음
//
// try{
// layerNames[1] = getLayoutName (this.resEaiMsg.getCurrentSvcMsg().getBsRspCnvMsgID());
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFRR008";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// }
// }
// */
// try {
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.outObject = Transform.transformComp(this.kesaCd, true, this.tranName, this.scrObjects, this.layerNames);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFRR007";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// }
//
// logger.debug("CompRRFCProcess] FC 타입에 대한 다음메시지 변환을 수행을 마칩니다. ");
// }
//
//
// public void ifRouterProcess3() throws Exception
// {
// //첫번째 서비스 메시지가 아니면 이전 아웃바운드 결과데이터를 요청메시지의 요청 데이터로 설정
//
// logger.debug("CompRRFCProcess] 아웃바운드를 호출합니다. - " +this.reqEaiMsg.getCurrentSvcMsg().getOutbRtnNm());
// this.reqEaiMsg.setRspErrCd(EAIMessageKeys.EAI_DEFAULT_CODE);
//
// try{
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }catch (Exception e) {
// String[] msgArgs = new String[2];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// msgArgs[1] = ""+this.reqEaiMsg.getSvcPssSeq();
// String rspErrorCode = "RECEAIFRR002";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
//// throw new RuntimeException(rspErrorCode);
// }
//
// logger.debug("CompRRFCProcess] 아웃바운드를 호출 수행을 마칩니다..");
// }
//
// @CallbackInterface()
// public interface Callback extends ServiceBrokerControl //(..영역 끝 표식 - 이 라인을 수정하지 마십시오.)
// {
// }
//
// /*
// * 이 주석 아래에 삽입한 코드는 디자인 뷰에서 만든 수행 또는 조건 노드에 해당하는
// * 메소드용입니다.
// *
// * 여기에서 코드를 수정하거나 새로 추가하십시오.
// */
//
//
//
// public boolean checkServiceMsgSize()
// {
// // Outbound Error일 경우
// if( MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) &&
// reqEaiMsg.getSvcMsgs().size() > 1 ) {
// return true;
// }
// else {
// return false;
// }
// }
//
//
// public boolean isOutboundCall()
// {
// return true;
// }
//
//
// public void init() throws Exception
// {
// this.resEaiMsg = this.reqEaiMsg;
// existNextSvcMsg = true;
// isFinalFC = false;
// isFC = false;
// nonNextSvcMsg = false;
// isFistSvcMsg = true;
//
// callCount = 0;
// count = 0;
// resultCount = 0;
//
// this.reqUUID = this.reqEaiMsg.getSvcOgNo(); //보상거래에 원래의 UUID 설정을 위해 저장
// //-----------------------------------------------
// // KBMessage 표준으로 변경함 2008.05.08
// //-----------------------------------------------
// //this.kesaCd = this.reqEaiMsg.getKesaMsg().getCService();
// this.kesaCd = this.reqEaiMsg.getKbMsg().getKBCommon().getTelgmRecvTranCd();
// //-----------------------------------------------
//
// this.orgBizData = new Object[1];
// orgBizData[0] = this.reqEaiMsg.getBizMsg()[0]; //보상거래의 요청메시지에 원기동의 요청메시지를 설정
//
// scrObjects = new Object[2]; //요청메시지와 응답메시지 변환을 위한 소스 오브젝트
//
// this.keyMgtMsgVl = this.reqEaiMsg.getCurrentSvcMsg().getKeyMgtMsgVl();
//
// try {
// this.svcMsgSize = this.reqEaiMsg.getSvcMsgs().size();
// }catch (Exception e) {
// logger.error ("CompRRFCProcess] 요청 메시지에서 서비스메시지를 가져올 수 없습니다.");
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFRR001";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
//
// }
//
// try{
// TransformManager manager = TransformManager.getManager();
// com.eactive.eai.transformer.transform.Transform transform = manager.getTransform(this.reqEaiMsg.getCurrentSvcMsg().getCnvMsgID());
// layerNames = new String[2]; //요청메시지와 응답메시지 변환을 위한 소스 레이아웃
//
// layerNames[0] = transform.getSourceLayout(0).getName();
// scrObjects[0] = this.reqEaiMsg.getBizMsg()[0];
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFRR008";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// }
// }
//
// public void printExceptionMessage() throws Exception
// {
// Exception e = this.context.getExceptionInfo().getException();
// if (logger.isError()) logger.error("CompRRFCProcess] ExceptionPath : "+e.getMessage());
//
//
// }
//
// public boolean isSourceAsync()
// {
// if(EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp()) ) {
// return true;
// }
// else {
// return false;
// }
//
// }
//
// public boolean isRealCall()
// {
// if(this.callProp != null) {
// String mode = this.callProp.getProperty(EAIKeys.CALL_MODE_KEY);
// if(mode != null && EAIKeys.CALL_MODE_WARMUP.equals(mode)) {
// logger.debug("CompRRFCProcess] Warming Up Called");
// return false;
// }
// else {
// return true;
// }
// }
// else {
// return true;
// }
// }
//
//
// public boolean isCompensation()
// {
// //------------------------------
// // TO-DO
// // 보상거래가 등록된 서비스메시지가 하나라도 있으면 수행
// //------------------------------
// logger.debug("CompRRFCProcess] 보상거래 유무를 확인합니다");
//
// if (this.compList != null ) { //보상거래가 등록된 서비스가 하나라도 있으면
// logger.debug("CompRRFCProcess] 보상거래가 등록되어 있습니다.");
// return true;
// }
// else {
// return false;
// }
// }
//
//
// public boolean existNextCom()
// {
// //------------------------------
// // TO-DO
// // 보상거래 서비스코드가 등록된 경우만 실행
// //------------------------------
// logger.debug("CompRRFCProcess] 실행할 보상거래가 있는지 확인합니다.");
// if (callCount > 0 ) {
// if (callCount == count) {
// return false;
// }
// else if (this.compList[count] >0) { //보상거래 처리가 등록된 서비스 메시지 이면 보상거래 처리
// logger.debug("CompRRFCProcess] 실행할 보상거래가 있습니다. [ " +count+" ] - "+ this.compList[count]);
// this.reqEaiMsg.setSvcPssSeq(this.compList[count]); //보상거래를 위해 처리된 순서대로 서비스메시지를 설정
// count++;
// return true;
// }
// else {
// return false;
// }
//
// }
// else {
// return false;
// }
// }
//
//
// public boolean isNonError()
// {
// // 업무오류와 정상코드가 동일하므로 제거해야함 : 2008.06.03
// //if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) || EAIMessageKeys.BWK_ERRMSG_CODE.equals(resEaiMsg.getRspErrCd())){
// if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())){
// return false;
// } else {
// return true;
// }
// }
//
// public boolean isFirstSvcMsg()
// {
// if (this.svcMsgSize <= 0){
// logger.error("CompRRFCProcess] 해당 복합거래에 대한 ServiceMessage가 없습니다.- "+reqEaiMsg.getEAISvcCd());
// }
// if (isFistSvcMsg){
// isFistSvcMsg = false;
// logger.debug("CompRRFCProcess] 첫번째 서비스 메시지 입니다.");
// return true;
// } else {
// logger.debug("CompRRFCProcess] 첫번째 이후 서비스 메시지 입니다.");
// return false;
// }
//
// }
//
// public boolean existNextSvc()
// {
// return existNextSvcMsg;
// }
//
//
// public void setErrorMessage() throws Exception
// {
// logger.debug("CompRRFCProcess ] 오류 응답 메시지를 수신했습니다. "+ this.resEaiMsg.getBizMsg()[0].toString());
// }
//
// public void setResponseMessage() throws Exception
// {
// logger.debug("CompRRFCProcess ] 정상 응답 메시지를 수신했습니다. "+ this.resEaiMsg.getBizMsg()[0].toString());
//
// }
//
// public void setCompensationResult() throws Exception
// {
// //보강거래 처리에서 오류가 발생한경우에 대한 처리절차 추가 필요
// if(!MessageUtil.checkRspErrCd(this.compResEaiMsg.getRspErrCd())) { //보상거래 처리시 오류가 발생한 경우
// logger.error("CompRRFCProcess ] 보상거래 처리시 오류가 발생했습니다 - " + this.compResEaiMsg.getRspErrCd() +" - " + this.compResEaiMsg.getRspErrMsg());
// } else {
// logger.info ( "CompRRFCProcess ] 보상거래 처리가 정상적으로 처리되었습니다. - [ "+ this.compEaiMsg.getEAISvcCd()+" ] ");
// }
//
// }
//
// public boolean isFCType()
// {
// if(existNextSvcMsg){
// logger.debug("CompRRFCProcess ] 다음 서비스 메시지가 FC타입인지 확인합니다.");
// String outName = this.reqEaiMsg.getCurrentSvcMsg().getOutbRtnNm();
// RoutingManager rm = RoutingManager.getInstance();
// RoutingVO vo = rm.getRoutingVO(outName);
// String layerDstcd = vo.getLayerDstcd();
//
// if (OUTBOUND_FC_TYPE.equals(layerDstcd) ) {
// if (outName.equals(this.reqEaiMsg.getFlwCntlRtnNm())){ //자기 자신의 FC와 동일한지 확인
// logger.debug("CompRRFCProcess ] 다음 서비스 메시지가 FC타입입니다..");
// isFC = true;
// return true;
// }
// else {
// String[] msgArgs = new String[2];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// msgArgs[1] = ""+this.reqEaiMsg.getSvcPssSeq();
// String rspErrorCode = "RECEAIFRR009";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] " +rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// logger.error("CompRRFCProcess ] FC 설정이 잘못 되었습니다.");
// return false;
// }
// }
// else {
// logger.debug("CompRRFCProcess ] 다음 서비스 메시지가 FC타입이 아닙니다.");
// return false;
// }
// } else {
// this.nonNextSvcMsg = true;
// return false;
// }
// }
//
// private String getLayoutName (String transformName) throws Exception{
// TransformManager manager = TransformManager.getManager();
// com.eactive.eai.transformer.transform.Transform transform = manager.getTransform(transformName);
// String layoutName = "";
// if (transform == null) {
// String[] msgArgs = new String[1];
// msgArgs[0] = transformName;
// String rspErrorCode = "RECEAIFRR008";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] " +rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
// } else {
// layoutName = transform.getTargetLayout().getName();
// }
//
// return layoutName;
//
// }
// /*
// private void makeTransformSource() throws Exception {
//
// String outName = this.reqEaiMsg.getCurrentSvcMsg().getOutbRtnNm();
// RoutingManager rm = RoutingManager.getInstance();
// RoutingVO vo = rm.getRoutingVO(outName);
// String layerDstcd = vo.getLayerDstcd();
//
// if (OUTBOUND_FC_TYPE.equals(layerDstcd) ) {
// String resultTransform = this.reqEaiMsg.getCurrentSvcMsg().getBsRspCnvMsgID();
// TransformManager manager = TransformManager.getManager();
// Transform transform = manager.getTransform(resultTransform);
//
// String reslayout =getLayoutName (this.resEaiMsg.getCurrentSvcMsg().getBsRspCnvMsgID());
//
// if (transform == null) {
// String[] msgArgs = new String[1];
// msgArgs[0] = resultTransform;
// String rspErrorCode = "RECEAIFRR010";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("CompRRFCProcess] " +rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
//// throw new RuntimeException(rspErrorCode);
// } else {
// sourceCount = transform.getSourceLayoutCount();
// transSourceMsg = new Object[sourceCount];
// transLayoutNames = new String[sourceCount];
//
// String scrName = "";
//
// for (int i=0; i<sourceCount; i++) {
// scrName = transform.getSourceLayout(i).getName();
// //결과 변환규칙에 요청메시지의 레이아웃이 존재하면
// if (scrName.equals(layerNames[0])) {
// transSourceMsg[resultCount] = scrObjects[0] ;
// transLayoutNames[resultCount] = layerNames[0];
// resultCount++;
// }
// if (reslayout.equals(layerNames[0])) {
// transSourceMsg[resultCount] = this.resEaiMsg.getBizMsg()[0] ;
// transLayoutNames[resultCount] = reslayout;
// resultCount++;
// }
// }
// }
// }
//
// }
//*/
//
// public boolean isFinalFCType()
// {
//// if (this.isFinalFC){
// if (this.nonNextSvcMsg) {
// if (this.isFinalFC){
// Object obj[] = new Object[1];
// obj[0] = outObject;
//
// this.resEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
// this.resEaiMsg.setBizMsg(obj);
// }
// existNextSvcMsg = false;
// return true;
// } else {
// if (isFC) {
// // 업무오류와 정상코드가 동일하므로 제거해야함 : 2008.06.03
// //if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) || EAIMessageKeys.BWK_ERRMSG_CODE.equals(resEaiMsg.getRspErrCd())){
// if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())){
// logger.debug("compRRFCProcess ] 다음 요청메시지 변환 중 오류가 발생했습니다. ");
// existNextSvcMsg = false;
// return true;
// }
// else {
// logger.debug("compRRFCProcess ] 다음 요청메시지 변환이 정상 적으로 수행 되었습니다.");
// Object obj[] = new Object[1];
// obj[0] = outObject;
// this.reqEaiMsg.setBizMsg(obj);
//
// this.reqEaiMsg.setSvcPssSeq(this.reqEaiMsg.getCurrentSvcMsg().getNxtSvcPssSeq());
// this.reqEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
//
// logger.debug("CompRRFCProcess] 다음 서비스 메시지 처리 순서는 [ " +this.reqEaiMsg.getSvcPssSeq()+" ] 입니다.");
//
// isFC = false;
// return false;
// }
// } else {
//
// if (!isFistSvcMsg) {
// this.reqEaiMsg.setBizMsg(this.resEaiMsg.getBizMsg());
// }
// return false;
// }
// }
//
// }
//
// public void setCompList() throws Exception
// {
//
// logger.debug("CompRRFCProcess] 오류응답 여부를 확인합니다. ");
// // 업무오류와 정상코드가 동일하므로 제거해야함 : 2008.06.03
// //if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) || EAIMessageKeys.BWK_ERRMSG_CODE.equals(resEaiMsg.getRspErrCd())){
// if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())){
// existNextSvcMsg = false;
// logger.debug("CompRRFCProcess] 오류 응답을 수신했습니다 " );
//
// //String tranClassify = this.resEaiMsg.getKesaMsg().getCTranClassify();
// String telgmDmndDstcd = this.resEaiMsg.getKbMsg().getKBHeader().getTelgmDmndDstcd();
// if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())) {
// //if (EAIKeys.TR_RES.equals(tranClassify) || EAIKeys.TR_CANCEL_RES.equals(tranClassify) || EAIKeys.TR_NET_RES.equals(tranClassify) || EAIKeys.TR_SYSTEMINFO_RES.equals(tranClassify)){
// if(KBMessageKeys.TELGMDMNDDSTCD_RECV.equals(telgmDmndDstcd)) {
// if (this.reqEaiMsg.getCurrentSvcMsg().getCpnsSvcPssCd() != null && this.reqEaiMsg.getCurrentSvcMsg().getCpnsSvcPssCd().length() > 0) {
// if (this.compList == null ){
// this.compList = new int[svcMsgSize];
// }
// this.compList[callCount] = this.reqEaiMsg.getCurrentSvcMsg().getSvcPssSeq();
// logger.debug("CompRRFCProcess] 보상거래를 등록 합니다. - " + this.compList[callCount]);
// callCount++;
// }
// }
// }
// } else {
// if (this.reqEaiMsg.getCurrentSvcMsg().getCpnsSvcPssCd() != null && this.reqEaiMsg.getCurrentSvcMsg().getCpnsSvcPssCd().length() > 0) {
// if (this.compList == null ){
// this.compList = new int[svcMsgSize];
// }
// this.compList[callCount] = this.reqEaiMsg.getCurrentSvcMsg().getSvcPssSeq();
// logger.debug("CompRRFCProcess] 보상거래를 등록 합니다. - " + this.compList[callCount]);
// callCount++;
// }
// }
// }
//}
//
@@ -0,0 +1,360 @@
package com.eactive.eai.flowcontroller;
//package com.eactive.eai.flowcontroller;
//
//import com.bea.control.ServiceBrokerControl;
//import com.bea.jpd.JpdContext;
//import com.bea.data.RawData;
//import com.bea.wli.control.broker.MessageBroker;
//import com.bea.wli.jpd.Callback;
//import com.bea.wli.jpd.CallbackInterface;
//import com.bea.xml.XmlObjectList;
//import org.apache.beehive.controls.api.bean.Control;
//import org.apache.beehive.controls.api.events.EventHandler;
//import org.apache.xmlbeans.XmlObject;
//import com.eactive.eai.adapter.AdapterGroupVO;
//import com.eactive.eai.adapter.AdapterManager;
//import com.eactive.eai.adapter.AdapterVO;
//import com.eactive.eai.common.EAIKeys;
//import com.eactive.eai.common.exception.ExceptionUtil;
//import com.eactive.eai.common.message.*;
//import com.eactive.eai.common.property.PropManager;
//import com.eactive.eai.common.routing.IFRouter;
//import com.eactive.eai.common.routing.RoutingVO;
//import com.eactive.eai.common.util.Logger;
//import com.eactive.eai.common.util.MessageUtil;
//import com.eactive.eai.util.JpdExceptionUtil;
//import com.eactive.eai.adapter.Keys;
//import com.eactive.eai.common.EAITable;
//import com.eactive.eai.common.exception.ExceptionHandler;
//import com.eactive.eai.common.kesa.KESAMessage;
//import com.eactive.eai.transformer.function.util.CodeConversion;
//import javax.transaction.Transaction;
//import weblogic.transaction.TxHelper;
//import com.bea.wli.common.Protocol;
//import com.eactive.eai.control.*;
//
///**
// * @jpd:process process::
// * <process name="PCompFCProcess">
// * <clientRequest name="PCompFCProcess" method="callService" returnMethod="clientReturn">
// * <onException name="OnException" executeOnRollback="true">
// * <perform name="에러처리" method="printExceptionMessage"/>
// * <finish name="Finish"/>
// * </onException>
// * <decision name="WarmUp">
// * <if name="isRealCall" conditionMethod="isRealCall"/>
// * <default name="Default">
// * <controlSend name="PCompMRFCProcess 호출" method="pCompMRFCProcessCtrlCallService"/>
// * <finish name="Finish"/>
// * </default>
// * </decision>
// * <perform name="초기화" method="init"/>
// * <controlSend name="PCompMRFCProcess 호출" method="pCompMRFCProcessCtrlCallService1"/>
// * <controlSend name="응답메시지수신" method="jmsQueueReceiverCtrlReceive"/>
// * <perform name="응답메시시 설정" method="setResponseMessage"/>
// * </clientRequest>
// * </process>::
// */
//
//@Protocol(httpSoap=false)
//@com.bea.wli.jpd.Process(process = "<process name=\"PCompFCProcess\"> "+" <clientRequest name=\"PCompFCProcess\" method=\"callService\" returnMethod=\"clientReturn\"> "+" <onException name=\"OnException\" executeOnRollback=\"true\"> "+" <perform name=\"에러처리\" method=\"printExceptionMessage\"/> "+" <finish name=\"Finish\"/> "+" </onException> "+" <decision name=\"WarmUp\"> "+" <if name=\"isRealCall\" conditionMethod=\"isRealCall\"/> "+" <default name=\"Default\"> "+" <controlSend name=\"PCompMRFCProcess 호출\" method=\"pCompMRFCProcessCtrlCallService\"/> "+" <finish name=\"Finish\"/> "+" </default> "+" </decision> "+" <perform name=\"초기화\" method=\"init\"/> "+" <controlSend name=\"PCompMRFCProcess 호출\" method=\"pCompMRFCProcessCtrlCallService1\"/> "+" <controlSend name=\"응답메시지수신\" method=\"jmsQueueReceiverCtrlReceive\"/> "+" <perform name=\"응답메시시 설정\" method=\"setResponseMessage\"/> "+" </clientRequest> "+"</process>")
//public class PCompFCProcess implements com.bea.jpd.ProcessDefinition
//{
// public java.io.Serializable outMessage;
//
// public int timeout;
//
// public java.lang.String colId;
//
// public java.lang.String queueName;
//
// public java.lang.String queueConnectName;
//
// public java.lang.String recvData;
//
// public String adptrMsgPtrnCd; // migration - boolean 값이 아니라 [S, N, C] 값을 가짐
//
// public java.lang.String adapterGroupName;
//
// public int logPssSeq;
//
// static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
//
// public java.util.Properties callProp;
//
// public EAIMessage resEaiMsg;
//
// public com.eactive.eai.common.message.EAIMessage reqEaiMsg;
//
// /**
// * for Server Log Level - by kscheon
// * start
// */
// static Logger esbLogger = Logger.getLogger(Logger.LOGGER_ESBFW);
// private int svrLogLevel;
// private static ThreadLocal local = new ThreadLocal(); //경과시간 동기화를 위한 ThreadLocal
// /**
// * for Server Log Level - by kscheon
// * end
// */
//
// static final long serialVersionUID = 1L;
//
// @com.bea.wli.jpd.Callback()
// public Callback callback;
//
// /*
// * 이 주석 위의 영역에는 디자인 뷰에서 만든 변수 선언이 포함되어 있습니다.
// * 이 주석 아래의 영역에는 디자인 뷰에서 만든 컨트롤 선언이 포함되어 있습니다.
// *
// * 이 영역의 코드는 자동으로 생성됩니다.
// *
// * 이 코드 영역에서는 양방향 편집이 완전히 지원됩니다.
// * 경고: 애플리케이션에서 이미 사용하고 있는 프로세스 변수와 컨트롤 선언을 변경하는
// * 경우 사용 중인 모든 위치에서 해당 선언을 업데이트하지 않으면 애플리케이션에서
// * 오류가 발생할 수 있습니다.
// */
//
// /**
// * @common:control
// */
// @Control()
// private com.eactive.eai.flowcontroller.PCompMRFCProcessPControl pCompMRFCProcessCtrl;
//
//
// /**
// * @common:context
// */
// @com.bea.wli.jpd.Context()
// JpdContext context; //(..컨트롤 삽입 표식 - 이 라인을 수정하지 마십시오.)
//
// /*
// * 이 주석 아래의 영역에는 프로세스 언어의 통신 노드에서 참조하는 java 메소드가 포함되어 있습니다.
// *
// * 이 영역의 코드는 자동으로 생성됩니다.
// *
// * 이 코드 영역에서는 양방향 편집이 부분적으로 지원됩니다.
// * 경고: 메소드 본문에 코드를 추가할 수 있지만 보호 섹션 블록 주석의 외부
// * 합니다. 이 주석 내의 코드를 수정하면 이 코드를 생성한 디자인 뷰 빌더에서
// * 정보를 볼 수 없습니다.
// */
//
//
// public EAIMessage clientReturn()
// {
//
// /**
// * ServerLog Level이 info인경우 로깅 - by kscheon
// * start
// */
// if(svrLogLevel >= 1) {
// try{
// long msgSndTm = System.currentTimeMillis();
//
// Long threadData = (Long)local.get();
// long processTm = msgSndTm - threadData.longValue();
// if (esbLogger.isInfo()) esbLogger.info("PCompFCProcess] End... - 경과시간 : " + processTm + "(ms) - EAI Server Log Level is INFO");
// } catch (Exception e) {
// }
// }
// /**
// * ServerLog Level이 info인경우 로깅 - by kscheon
// * end
// */
//
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // return
// return resEaiMsg;
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }
//
//
//
//
// public void callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp)
// {
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // parameter assignment
// this.reqEaiMsg = reqEaiMsg;
// this.callProp = callProp;
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
//
// if(this.reqEaiMsg == null) return;
// /**
// * ServerLog Level이 info인경우 로깅 - by kscheon
// * start
// */
// svrLogLevel = this.reqEaiMsg.getSvrLogLvl();
//
//
// if(svrLogLevel >= 1) {
// try{
// long msgRcvTm = System.currentTimeMillis();
// local.set(new Long(msgRcvTm));
//
// if (esbLogger.isInfo()) esbLogger.info("BaseFCProcess] started... - EAI Server Log Level is INFO");
// }catch(Exception e){
// }
// }
// /**
// * ServerLog Level이 info인경우 로깅 - by kscheon
// * end
// */
//
// }
//
//
// public void pCompMRFCProcessCtrlCallService() throws Exception
// {
// try {
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.recvData = pCompMRFCProcessCtrl.callService(this.reqEaiMsg, this.callProp);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFPM101";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("PCompFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
// }
//
// }
//
// public void pCompMRFCProcessCtrlCallService1() throws Exception
// {
// logger.debug("PCompFCProcess] PCompMRFCProcess 호출 수행합니다... ["+System.currentTimeMillis()+"]");
// Transaction t = TxHelper.getTransactionManager().suspend() ;
//
// try{
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.recvData = pCompMRFCProcessCtrl.callService(this.reqEaiMsg, this.callProp);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFPM102";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("PCompFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
// }
// logger.debug("PCompFCProcess] PCompMRFCProcess 호출 수행을 마칩니다... ["+System.currentTimeMillis()+"]");
// TxHelper.getTransactionManager().resume(t);
//
// }
//
// public void jmsQueueReceiverCtrlReceive() throws Exception
// {
// logger.debug("PCompFCProcess] 응답메시지를 수신합니다.... ["+System.currentTimeMillis()+"]");
// try{
// JMSQueueReceiver jmsQueueReceiverCtrl = new JMSQueueReceiver();
//
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.outMessage = jmsQueueReceiverCtrl.receive(this.queueConnectName, this.queueName, this.colId, this.timeout);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFPM103";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("PCompFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
// }
// logger.debug("PCompFCProcess] 응답메시지를 수신했습니다.... ["+System.currentTimeMillis()+"]");
// }
//
// @CallbackInterface()
// public interface Callback extends ServiceBrokerControl //(..영역 끝 표식 - 이 라인을 수정하지 마십시오.)
// {
// }
//
// /*
// * 이 주석 아래에 삽입한 코드는 디자인 뷰에서 만든 수행 또는 조건 노드에 해당하는
// * 메소드용입니다.
// *
// * 여기에서 코드를 수정하거나 새로 추가하십시오.
// */
//
//
// public void init() throws Exception
// {
// logger.debug("PCompFCProcess ] 초기화를 실행합니다.");
// this.resEaiMsg = this.reqEaiMsg;
//
// this.queueConnectName = EAIKeys.PCOMP_CON_FACTORY;
// this.queueName = EAIKeys.PCOMP_RES_QUEUE;
// this.colId = this.reqEaiMsg.getSvcOgNo();
// timeout = 0;
//
// logger.debug("PCompFCProcess ] 초기화를 실행을 마칩니다.");
//
// }
//
// public void printExceptionMessage() throws Exception
// {
// Exception e = this.context.getExceptionInfo().getException();
// if (logger.isError()) logger.error("PCompFCProcess] ExceptionPath : "+e.getMessage());
//
//
// }
//
// public boolean isRealCall()
// {
// if(this.callProp != null) {
// String mode = this.callProp.getProperty(EAIKeys.CALL_MODE_KEY);
// if(mode != null && EAIKeys.CALL_MODE_WARMUP.equals(mode)) {
// logger.debug("PCompFCProcess] Warming Up Called");
// return false;
// }
// else {
// return true;
// }
// }
// else {
// return true;
// }
// }
//
//
// public void setResponseMessage() throws Exception
// {
// logger.debug("PCompFCProcess] 응답메시지를 설정합니다.....");
// if(this.outMessage instanceof EAIMessage) {
// this.resEaiMsg = (EAIMessage) this.outMessage;
// }
// else {
// logger.error ("PCompFCProcess] 응답 메시지의 형식이 EAIMessage 가 아닙니다. ");
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFPM104";
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("PCompMRFCProcess] " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new Exception(rspErrorCode);
// }
// logger.debug("PCompFCProcess] 응답메시지를 설정을 마칩니다.....");
// }
//}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,24 @@
package com.eactive.eai.flowcontroller;
//package com.eactive.eai.flowcontroller;
//
//import com.bea.control.ServiceControl;
//import org.apache.beehive.controls.api.bean.ControlExtension;
//
///**
// * @jc:location uri="/Process/com/eactive/eai/flowcontroller/PCompMRFCProcess.jpd"
// * @editor-info:link autogen-style="pCtrl" source="PCompMRFCProcess.jpd" autogen="true"
// */
//@ControlExtension()
//@ServiceControl.Location()
//@com.bea.wli.common.control.Location(uri = "/Process/com/eactive/eai/flowcontroller/PCompMRFCProcess.jpd")
//public interface PCompMRFCProcessPControl extends com.bea.control.ProcessControl
//{
// /**
// * @jc:conversation phase="start"
// */
// @com.bea.wli.common.Conversation(value = com.bea.wli.common.Conversation.Phase.START)
// public java.lang.String callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp);
//
// public PCompMRFCProcessPControl create();
//}
//
@@ -0,0 +1,284 @@
package com.eactive.eai.flowcontroller;
//package com.eactive.eai.flowcontroller;
//
//import com.bea.control.ServiceBrokerControl;
//import com.bea.jpd.JpdContext;
//import com.bea.data.RawData;
//import com.bea.wli.control.broker.MessageBroker;
//import com.bea.wli.jpd.Callback;
//import com.bea.wli.jpd.CallbackInterface;
//import com.bea.xml.XmlObjectList;
//import org.apache.beehive.controls.api.bean.Control;
//import org.apache.beehive.controls.api.events.EventHandler;
//import org.apache.xmlbeans.XmlObject;
//import com.eactive.eai.common.EAIKeys;
//import com.eactive.eai.common.exception.ExceptionUtil;
//import com.eactive.eai.common.message.EAIMessage;
//import com.eactive.eai.common.util.Logger;
//import com.eactive.eai.control.*;
//import com.eactive.eai.common.routing.IFRouter;
//
///**
// * @jpd:process process::
// * <process name="PCompOutFCProcess">
// * <clientRequest name="Client Request with Return" method="callService" returnMethod="clientReturn">
// * <decision name="Warmup">
// * <if name="isRealCall" conditionMethod="isRealCall"/>
// * <default name="Default">
// * <finish name="Finish"/>
// * </default>
// * </decision>
// * </clientRequest>
// * <block name="Group">
// * <onException name="OnException">
// * <perform name="에러처리" method="printExceptionMessage"/>
// * <finish name="Finish"/>
// * </onException>
// * <perform name="초기화" method="init"/>
// * <controlSend name="Outbound호출" method="ifRouterCtrlProcess1"/>
// * <controlSend name="응답메시지리턴" method="jmsQueueSenderCtrlSendObject1"/>
// * </block>
// * </process>::
// * @jws:protocol java-call="false" jms-soap="false"
// */
//@com.bea.wli.common.Protocol(javaCall = false,
// jmsSoap = false, httpSoap = false)
//@com.bea.wli.jpd.Process(process = "<process name=\"PCompOutFCProcess\"> " +
// " <clientRequest name=\"Client Request with Return\" method=\"callService\" returnMethod=\"clientReturn\"> " +
// " <decision name=\"Warmup\"> " +
// " <if name=\"isRealCall\" conditionMethod=\"isRealCall\"/> " +
// " <default name=\"Default\"> " +
// " <finish name=\"Finish\"/> " +
// " </default> " +
// " </decision> " +
// " </clientRequest> " +
// " <block name=\"Group\"> " +
// " <onException name=\"OnException\"> " +
// " <perform name=\"에러처리\" method=\"printExceptionMessage\"/> " +
// " <finish name=\"Finish\"/> " +
// " </onException> " +
// " <perform name=\"초기화\" method=\"init\"/> " +
// " <controlSend name=\"Outbound호출\" method=\"ifRouterCtrlProcess1\"/> " +
// " <controlSend name=\"응답메시지리턴\" method=\"jmsQueueSenderCtrlSendObject1\"/> " +
// " </block> " +
// "</process>")
//public class PCompOutFCProcess implements com.bea.jpd.ProcessDefinition
//{
// public java.lang.String colId;
//
// public java.io.Serializable outMessage;
//
// public java.lang.String queueName;
//
// public java.lang.String queueConName;
//
// public java.lang.String ack;
//
// public com.eactive.eai.common.message.EAIMessage resEaiMsg;
//
// public java.util.Properties callProp;
//
// public com.eactive.eai.common.message.EAIMessage reqEaiMsg;
//
// static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
//
// static final long serialVersionUID = 1L;
//
// @com.bea.wli.jpd.Callback()
// public Callback callback;
//
// /*
// * 이 주석 위의 영역에는 디자인 뷰에서 만든 변수 선언이 포함되어 있습니다.
// * 이 주석 아래의 영역에는 디자인 뷰에서 만든 컨트롤 선언이 포함되어 있습니다.
// *
// * 이 영역의 코드는 자동으로 생성됩니다.
// *
// * 이 코드 영역에서는 양방향 편집이 완전히 지원됩니다.
// * 경고: 애플리케이션에서 이미 사용하고 있는 프로세스 변수와 컨트롤 선언을 변경하는
// * 경우 사용 중인 모든 위치에서 해당 선언을 업데이트하지 않으면 애플리케이션에서
// * 오류가 발생할 수 있습니다.
// */
//
// /**
// * @common:context
// */
// @com.bea.wli.jpd.Context()
// JpdContext context; //(..컨트롤 삽입 표식 - 이 라인을 수정하지 마십시오.)
//
// /*
// * 이 주석 아래의 영역에는 프로세스 언어의 통신 노드에서 참조하는 java 메소드가 포함되어 있습니다.
// *
// * 이 영역의 코드는 자동으로 생성됩니다.
// *
// * 이 코드 영역에서는 양방향 편집이 부분적으로 지원됩니다.
// * 경고: 메소드 본문에 코드를 추가할 수 있지만 보호 섹션 블록 주석의 외부
// * 합니다. 이 주석 내의 코드를 수정하면 이 코드를 생성한 디자인 뷰 빌더에서
// * 정보를 볼 수 없습니다.
// */
//
//
//
//
//
// public void jmsQueueSenderCtrlSendObject() throws Exception
// {
// logger.debug("PCompOutFCProcess] 응답 메시지를 Queue에 전송합니다..");
// this.outMessage = this.resEaiMsg;
// JMSQueueSender jmsQueueSenderCtrl = new JMSQueueSender();
//
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // method call
// jmsQueueSenderCtrl.sendObject(this.queueConName, this.queueName, this.outMessage, this.colId);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// logger.debug("PCompOutFCProcess] 응답 메시지를 Queue에 전송을 마칩니다..");
// }
//
// public java.lang.String clientReturn()
// {
// this.ack = "PCompOutFCProcess] callService Called";
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // return
// return ack;
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }
//
//
//
//
// public void callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp)
// {
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // parameter assignment
// this.reqEaiMsg = reqEaiMsg;
// this.callProp = callProp;
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }
//
//
//
//
// public void ifRouterCtrlProcess1() throws Exception
// {
// logger.debug("PCompOutFCProcess] outbound를 호출합니다..");
// try
// {
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }
// catch (Exception e)
// {
// String[] msgArgs = new String[2];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// msgArgs[1] = "" +
// this.reqEaiMsg.getSvcPssSeq();
// String rspErrorCode = "RECEAIFPM301";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError())
// logger.error("PCompOutFCProcess] " +
// rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
//// throw new RuntimeException(rspErrorCode); //async type 이므로 throw하지 않고 응답메시지에 에러 코드를 set해서 넘김
// }
// logger.debug("PCompOutFCProcess] outbound를 호출을 마칩니다..");
// }
//
// public void jmsQueueSenderCtrlSendObject1() throws Exception
// {
// logger.debug("PCompOutFCProcess] 응답 메시지를 Queue에 전송합니다..");
// this.outMessage = this.resEaiMsg;
// try
// {
// JMSQueueSender jmsQueueSenderCtrl = new JMSQueueSender();
//
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // method call
// jmsQueueSenderCtrl.sendObject(this.queueConName, this.queueName, this.outMessage, this.colId);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }catch (Exception e) {
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFPM302";
// String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
// if (logger.isError()) logger.error("PCompOutFCProcess] "+rspErrorMsg);
// e.printStackTrace();
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
// }
// logger.debug("PCompOutFCProcess] 응답 메시지를 Queue에 전송을 마칩니다.." );
// }
//
//
// @CallbackInterface()
// public interface Callback extends ServiceBrokerControl //(..영역 끝 표식 - 이 라인을 수정하지 마십시오.)
// {
// }
//
// /*
// * 이 주석 아래에 삽입한 코드는 디자인 뷰에서 만든 수행 또는 조건 노드에 해당하는
// * 메소드용입니다.
// *
// * 여기에서 코드를 수정하거나 새로 추가하십시오.
// */
//
//
// public boolean isRealCall()
// {
// if(this.callProp != null) {
// String mode = this.callProp.getProperty(EAIKeys.CALL_MODE_KEY);
// if(mode != null && EAIKeys.CALL_MODE_WARMUP.equals(mode)) {
// logger.debug("PCompOutFCProcess] Warming Up Called");
// return false;
// }
// else {
// return true;
// }
// }
// else {
// return true;
// }
//
// }
//
// public void init() throws Exception
// {
// logger.debug("PCompOutFCProcess] 초기화를 수행합니다.." );
// this.resEaiMsg = this.reqEaiMsg;
//
// this.queueConName = EAIKeys.PCOMP_CON_FACTORY;
// this.queueName = EAIKeys.PCOMP_OUT_RES_QUEUE;
//
// this.colId = this.reqEaiMsg.getSvcOgNo();
// logger.debug("PCompOutFCProcess] 초기화를 마칩니다.." );
//
// }
//
// public void printExceptionMessage() throws Exception
// {
// Exception e = this.context.getExceptionInfo().getException();
//
// if (logger.isError()) logger.error("PCompOutFCProcess] ExceptionPath : "+e.getMessage());
// try {
// JMSQueueSender jmsQueueSenderCtrl = new JMSQueueSender();
// jmsQueueSenderCtrl.sendObject(this.queueConName, this.queueName, this.resEaiMsg, this.colId);
// } catch(Exception ex) {
// if (logger.isError()) logger.error("PCompOutFCProcess] ExceptionPath Error: "+ex.getMessage());
// ex.printStackTrace();
// }
//
// }
//}
@@ -0,0 +1,24 @@
package com.eactive.eai.flowcontroller;
//package com.eactive.eai.flowcontroller;
//
//import com.bea.control.ServiceControl;
//import org.apache.beehive.controls.api.bean.ControlExtension;
//
///**
// * @jc:location uri="/Process/com/eactive/eai/flowcontroller/PCompOutFCProcess.jpd"
// * @editor-info:link autogen-style="pCtrl" source="PCompOutFCProcess.jpd" autogen="true"
// */
//@ControlExtension()
//@ServiceControl.Location()
//@com.bea.wli.common.control.Location(uri = "/Process/com/eactive/eai/flowcontroller/PCompOutFCProcess.jpd")
//public interface PCompOutFCProcessPControl extends com.bea.control.ProcessControl
//{
// /**
// * @jc:conversation phase="start"
// */
// @com.bea.wli.common.Conversation(value = com.bea.wli.common.Conversation.Phase.START)
// public java.lang.String callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp);
//
// public PCompOutFCProcessPControl create();
//}
//
@@ -0,0 +1,443 @@
package com.eactive.eai.flowcontroller;
import java.util.Iterator;
import java.util.Properties;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.adapter.AdapterPropManager;
import com.eactive.eai.adapter.AdapterVO;
import com.eactive.eai.adapter.Keys;
import com.eactive.eai.adapter.http.client.HttpClientAdapterServiceKey;
import com.eactive.eai.common.EAIKeys;
import com.eactive.eai.common.EAITable;
import com.eactive.eai.common.exception.ExceptionHandler;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.message.EAIMessage;
import com.eactive.eai.common.message.EAIMessageKeys;
import com.eactive.eai.common.routing.IFRouter;
import com.eactive.eai.common.routing.Process;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageUtil;
import com.eactive.eai.common.util.ServiceUtil;
import com.eactive.eai.control.LogSender;
import com.eactive.eai.message.StandardMessage;
import com.eactive.eai.message.service.InterfaceMapper;
import com.eactive.eai.transformer.function.util.CodeConversion;
import com.ext.eai.common.stdmessage.STDMessageKeys;
public class PubFCProcess extends Process {
public String adptrMsgPtrnCd;
public java.lang.String adapterGroupName;
public int logPssSeq;
public int callCount;
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
public java.util.Properties callProp;
public EAIMessage resEaiMsg;
public com.eactive.eai.common.message.EAIMessage reqEaiMsg;
static Logger esbLogger = Logger.getLogger(Logger.LOGGER_ESBFW);
private int svrLogLevel;
private static ThreadLocal local = new ThreadLocal();
static final long serialVersionUID = 1L;
String guidLogPrefix = "";
public EAIMessage clientReturn() {
if (svrLogLevel >= 1) {
try {
long msgSndTm = System.currentTimeMillis();
Long threadData = (Long) local.get();
long processTm = msgSndTm - threadData.longValue();
if (esbLogger.isInfo())
esbLogger.info(
guidLogPrefix + " End... - 경과시간 : " + processTm + "(ms) - EAI Server Log Level is INFO");
} catch (Exception e) {
logger.warn("clientReturn", e);
}
}
return resEaiMsg;
}
public void callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp) {
this.reqEaiMsg = reqEaiMsg;
this.callProp = callProp;
if (this.reqEaiMsg == null)
return;
svrLogLevel = this.reqEaiMsg.getSvrLogLvl();
// guidLogPrefix = guidLogPrefix + " GUID["+reqEaiMsg.getKbMsg().getKBHeader().getGuIdNo()+"]";
guidLogPrefix = guidLogPrefix + " GUID[" + getGuid(reqEaiMsg) + "]";
if (svrLogLevel >= 1) {
try {
long msgRcvTm = System.currentTimeMillis();
local.set(new Long(msgRcvTm));
if (esbLogger.isInfo())
esbLogger.info(guidLogPrefix + " started... - EAI Server Log Level is INFO");
} catch (Exception e) {
logger.warn("callService", e);
}
}
try {
flow();
} catch (Exception e) {
printExceptionMessage(e);
if (isSourceAsync()) {
logSenderCtrlSend();
callExceptionHandler();
}
return;
}
}
public void flow() throws Exception {
// isRealCall
if (!isRealCall()) {
return;
}
// 초기화
init();
// Outbound 프로세스 호출
ifRouterProcess();
while (isNextServiceExist()) {
// GUID설정
setGUID();
// ServiceMessage 설정
setCurrentService();
// Outbound 호출
ifRouterProcessEach();
}
}
public void ifRouterProcess() throws Exception {
try {
this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF001";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + " " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
this.callCount++;
// ----------------------------------------------------
// 기동시스템이 Async 거래의 OUtbound에서 오류가 발생할 경우
// ExceptionHandler를 통해 응답메시지를 전송한다.
// ----------------------------------------------------
if (EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp())) {
if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())) {
try {
// AdapterManager adapterManager = AdapterManager.getInstance();
// AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(this.reqEaiMsg.getSngSysItfTp());
// String inAdapterMsgType = inAdptGrpVO.getMessageType();
//// Object[] bizObjs = this.reqEaiMsg.getBizMsg();
// Object[] bizObjs = this.reqEaiMsg.getExtMsg().getBizData();
// if(EAITable.EBCDIC_TYPE.equals(inAdapterMsgType)) {
// if(bizObjs != null && bizObjs[0] instanceof byte[]) {
// bizObjs[0] = CodeConversion.meToMixedAsc((byte[])bizObjs[0]);
// }
// }
//// this.resEaiMsg.setBizMsg(bizObjs);
// this.resEaiMsg.getExtMsg().setBizData(bizObjs);
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.resEaiMsg.getStandardMessage().setBizData(bizData, inboundCharset);
ExceptionHandler.handle(this.resEaiMsg);
// ----------------------------------------------------------
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " ExceptionHandler Call Error :" + e.getMessage());
}
}
}
}
public void ifRouterProcessEach() throws Exception {
try {
this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF100";
String orgErrorCode = ExceptionUtil.getErrorCode(e, rspErrorCode);
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, orgErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + " " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
}
this.callCount++;
}
public void logSenderCtrlSend() {
// String telgmDmndDstcd = extmessage.getSendRecv();
String returnType = getReturnType(reqEaiMsg);
if (STDMessageKeys.SEND_RECV_CD_RECV.equals(returnType)) {
this.logPssSeq = 400;
} else {
this.logPssSeq = 200;
}
try {
LogSender.send(this.logPssSeq, this.resEaiMsg, null);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " AA Exception Logging Error :" + e.getMessage());
}
}
public boolean checkServiceMsgSize() {
// Outbound Error일 경우
if (MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) && reqEaiMsg.getSvcMsgs().size() > 1) {
return true;
} else {
return false;
}
}
public boolean isOutboundCall() {
return true;
}
public void init() throws Exception {
InterfaceMapper mapper = this.reqEaiMsg.getMapper();
StandardMessage standardMessage = this.reqEaiMsg.getStandardMessage();
String guid = mapper.getGuid(standardMessage);
String guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ Current GUID [" + guid + "][" + guidseq + "]");
mapper.nextGuidSeq(standardMessage);
guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ ADD PATHSEQ GUID [" + guid + "][" + guidseq + "]");
if (logger.isDebug())
logger.debug(guidLogPrefix + " set PROCESS_TYPE [" + EAIMessageKeys.PUBLISH_PROCESS + "]");
this.reqEaiMsg.setSvcPssTp(EAIMessageKeys.PUBLISH_PROCESS);
this.callCount = 0;
this.reqEaiMsg.setSvcPssSeq(1);
this.resEaiMsg = this.reqEaiMsg;
this.adapterGroupName = reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp();
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(this.adapterGroupName);
// 등록된 어댑터가 실제 존재하지 않는 경우 : 2009.04.03
if (adptGrpVO == null) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF001";
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs) + "(Adapter Not Found - "
+ this.adapterGroupName + ")";
if (logger.isError())
logger.error(guidLogPrefix + " " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
this.adptrMsgPtrnCd = adptGrpVO.getAdptrMsgPtrnCd();
// 2009.03.11
// AA가 아니고 기동이 KB표준이 아닌 경우
// Adapter의 timeout값을 설정한다.
try {
String svcTsmtUsgTp = this.reqEaiMsg.getSvcTsmtUsgTp(); // 기동 호출방식
String psvItfTp = this.reqEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 수동 호출방식
if (!(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
&& !(com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls()))) {
// SA 또는 SNA Adapter일 경우에 는 SA Timeout값을 설정
if ((EAIMessageKeys.SYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
|| Keys.TYPE_SNA.equals(adptGrpVO.getType())) {
int saTimeoutSec = this.reqEaiMsg.getCurrentSvcMsg().getTmoVl();
if (logger.isDebug())
logger.debug(guidLogPrefix + " SA TimeoutValue [" + saTimeoutSec + "]");
setTimeout(this.reqEaiMsg, "" + saTimeoutSec);
} else {
int timeout = ServiceUtil.getTimeoutValue(adapterGroupName);
if (logger.isDebug())
logger.debug(guidLogPrefix + " Target Adapter TimeoutValue [" + timeout + "]");
if (timeout > 0) {
if (logger.isDebug())
logger.debug(guidLogPrefix + " Set Adapter TimeoutValue [" + timeout + "] to KBMessage");
setTimeout(this.reqEaiMsg, "" + timeout);
}
}
}
} catch (Exception e) {
if (logger.isWarn()) {
logger.warn(guidLogPrefix + " Get Adapter TimeoutValue Error - ", e);
}
}
}
public void printExceptionMessage(Exception e) {
// Exception e = this.context.getExceptionInfo().getException();
if (logger.isError())
logger.error(guidLogPrefix + " ExceptionPath : " + e.getMessage());
}
public boolean isSourceAsync() {
if (EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp())) {
return true;
} else {
return false;
}
}
public void callExceptionHandler() {
try {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(this.reqEaiMsg.getSngSysItfTp());
String inAdapterMsgType = inAdptGrpVO.getMessageType();
if (EAITable.EBCDIC_TYPE.equals(inAdapterMsgType)) {
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
byte[] asc = CodeConversion.meToMixedAsc(bizData.getBytes());
try {
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.reqEaiMsg.getStandardMessage().setBizData(new String(asc), inboundCharset);
} catch (Exception e) {
logger.error("setBizData error", e);
}
}
ExceptionHandler.handle(this.reqEaiMsg);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + " ExceptionHandler Call Error :" + e.getMessage());
}
}
public boolean isRealCall() {
if (this.callProp != null) {
String mode = this.callProp.getProperty(EAIKeys.CALL_MODE_KEY);
if (mode != null && EAIKeys.CALL_MODE_WARMUP.equals(mode)) {
logger.warn(guidLogPrefix + " Warming Up Called");
return false;
} else {
return true;
}
} else {
return true;
}
}
public boolean isNextServiceExist() {
if ((reqEaiMsg.getSvcMsgs().size() > 1) && (reqEaiMsg.getSvcMsgs().size() > this.callCount)) {
return true;
} else {
return false;
}
}
private String getAdapterType(String adapterGroupName) {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(this.adapterGroupName);
return adptGrpVO.getType();
}
private boolean isNKESA(String adapterGroupName) {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterPropManager manager = AdapterPropManager.getInstance();
AdapterGroupVO adptGrpVO = null;
AdapterVO adptVO = null;
adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
if (adptGrpVO == null || !Keys.TYPE_HTTP.equals(adptGrpVO.getType()))
return false;
Iterator<AdapterVO> adapters = adptGrpVO.getAdapters();
if(adapters != null && adapters.hasNext()) {
adptVO = adptGrpVO.getAdapters().next();
}
if (adptVO == null) return false;
Properties httpProp = (Properties) manager.getProperties(adptVO.getPropGroupName()).clone();
String method = httpProp.getProperty(HttpClientAdapterServiceKey.METHOD);
if ("NKESA".equals(method)) return true;
else return false;
}
public void setGUID() throws Exception {
InterfaceMapper mapper = this.resEaiMsg.getMapper();
StandardMessage standardMessage = this.resEaiMsg.getStandardMessage();
String guid = mapper.getGuid(standardMessage);
String guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ Current GUID [" + guid + "][" + guidseq + "]");
mapper.nextGuidSeq(standardMessage);
guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ ADD PATHSEQ GUID [" + guid + "][" + guidseq + "]");
String svcTsmtUsgTp = this.reqEaiMsg.getSvcTsmtUsgTp(); // 기동 호출방식
String psvItfTp = this.reqEaiMsg.getCurrentSvcMsg().getPsvItfTp(); // 수동 호출방식
if ((!(com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.adptrMsgPtrnCd))
&& !(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp)))
|| ((com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.adptrMsgPtrnCd))
&& (EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp)
&& EAIMessageKeys.SYNC_SVC.equals(psvItfTp)))) {
String prcssRtdTranCd = mapper.getReturnServiceId(standardMessage);
if (prcssRtdTranCd != null && prcssRtdTranCd.length() >= 14) {
String cicsTrncd = prcssRtdTranCd.substring(0, 4);
String telgmRecvTranCd = prcssRtdTranCd.substring(4, 14);
mapper.setServiceId(standardMessage, telgmRecvTranCd);
} else {
if (logger.isInfo()) {
logger.info(guidLogPrefix + "- PrcssRtdTranCd Length < 14 [" + prcssRtdTranCd + "]");
}
}
}
if (!(EAIMessageKeys.ASYNC_SVC.equals(svcTsmtUsgTp) && EAIMessageKeys.ASYNC_SVC.equals(psvItfTp))
&& (com.eactive.eai.adapter.Keys.IF_STANDARD.equals(this.reqEaiMsg.getStdMsgUsgCls()))
&& (STDMessageKeys.RECOVER_YN_YES.equals(getRecoverYn(this.reqEaiMsg)) ) ) {
String reqOgtranGuIdNo = getOrgGuid(this.reqEaiMsg);
mapper.setOrgGuid(standardMessage, reqOgtranGuIdNo);
if (logger.isInfo()) {
logger.info(guidLogPrefix + " OgtranGuIdNo 복원 " + this.reqEaiMsg.getSvcOgNo() + " OgtranGuIdNo ["
+ mapper.getOrgGuid(standardMessage) + "]");
}
}
}
public void setCurrentService() throws Exception {
if (logger.isDebug())
logger.debug(guidLogPrefix + " Outound Service Call - ");
String keyMgtMsgVl = reqEaiMsg.getCurrentSvcMsg().getKeyMgtMsgVl();
if (logger.isDebug())
logger.debug(guidLogPrefix + " keyMgtMsgVl[" + keyMgtMsgVl + "]");
reqEaiMsg.setSvcPssSeq(reqEaiMsg.getSvcPssSeq() + 1);
reqEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
}
}
@@ -0,0 +1,389 @@
package com.eactive.eai.flowcontroller;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.adapter.AdapterPropManager;
import com.eactive.eai.adapter.AdapterVO;
import com.eactive.eai.common.EAIKeys;
import com.eactive.eai.common.EAITable;
import com.eactive.eai.common.exception.ExceptionHandler;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.message.EAIMessage;
import com.eactive.eai.common.message.EAIMessageKeys;
import com.eactive.eai.common.routing.IFRouter;
import com.eactive.eai.common.routing.Process;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageUtil;
import com.eactive.eai.control.LogSender;
import com.eactive.eai.message.StandardMessage;
import com.eactive.eai.message.service.InterfaceMapper;
import com.eactive.eai.transformer.function.util.CodeConversion;
import com.ext.eai.common.stdmessage.STDMessageKeys;
public class StartFCProcess extends Process {
public String adptrMsgPtrnCd; // migration - boolean 값이 아니라 [S, N, C] 값을 가짐
public java.lang.String adapterGroupName;
public int logPssSeq;
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
public java.util.Properties callProp;
public EAIMessage resEaiMsg;
public com.eactive.eai.common.message.EAIMessage reqEaiMsg;
static Logger esbLogger = Logger.getLogger(Logger.LOGGER_ESBFW);
private int svrLogLevel;
private static ThreadLocal local = new ThreadLocal();
static final long serialVersionUID = 1L;
String guidLogPrefix = "";
public EAIMessage clientReturn() {
if (svrLogLevel >= 1) {
try {
long msgSndTm = System.currentTimeMillis();
Long threadData = (Long) local.get();
long processTm = msgSndTm - threadData.longValue();
if (esbLogger.isInfo())
esbLogger.info(
guidLogPrefix + " End... - 경과시간 : " + processTm + "(ms) - EAI Server Log Level is INFO");
} catch (Exception e) {
logger.error("clientReturn", e);
}
}
return resEaiMsg;
}
public void callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp) {
this.reqEaiMsg = reqEaiMsg;
this.callProp = callProp;
if (this.reqEaiMsg == null)
return;
svrLogLevel = this.reqEaiMsg.getSvrLogLvl();
// guidLogPrefix = guidLogPrefix + "GUID["+reqEaiMsg.getKbMsg().getKBHeader().getGuIdNo()+"]";
guidLogPrefix = guidLogPrefix + "GUID[" + getGuid(reqEaiMsg) + "]";
if (svrLogLevel >= 1) {
try {
long msgRcvTm = System.currentTimeMillis();
local.set(new Long(msgRcvTm));
if (esbLogger.isInfo())
esbLogger.info(guidLogPrefix + " started... - EAI Server Log Level is INFO");
} catch (Exception e) {
logger.error("callService error", e);
}
}
try {
flow();
} catch (Exception e) {
// 에러처리
printExceptionMessage(e);
// ASYNC
if (isSourceAsync()) {
// Async-로그
logSenderCtrlSend();
// ExcetpionHandler 호출
callExceptionHandler();
}
return;
}
}
public void flow() throws Exception {
// isRealCall
if (!isRealCall()) {
return;
}
// 초기화
init();
// Start Target Adapter
startTargetAdapter();
// Outbound 프로세스 호출
ifRouterProcess();
// GUID설정
setGUID();
// ASYNC-SYNC모델
if (checkServiceMsgSize()) {
// ServiceMessage설정
setCurrentService();
// 응답메시지전송
ifRouterProcessResponse();
}
}
public void ifRouterProcess() throws Exception {
try {
this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF001";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + "" + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
// ----------------------------------------------------
// 기동시스템이 Async 거래의 OUtbound에서 오류가 발생할 경우
// ExceptionHandler를 통해 응답메시지를 전송한다.
// ----------------------------------------------------
if (EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp())) {
if (!MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd())) {
try {
// AdapterManager adapterManager = AdapterManager.getInstance();
// AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(this.reqEaiMsg.getSngSysItfTp());
// String inAdapterMsgType = inAdptGrpVO.getMessageType();
//// Object[] bizObjs = this.reqEaiMsg.getBizMsg();
// Object[] bizObjs = this.reqEaiMsg.getExtMsg().getBizData();
// if(EAITable.EBCDIC_TYPE.equals(inAdapterMsgType)) {
// if(bizObjs != null && bizObjs[0] instanceof byte[]) {
// bizObjs[0] = CodeConversion.meToMixedAsc((byte[])bizObjs[0]);
// }
// }
//// this.resEaiMsg.setBizMsg(bizObjs);
// this.resEaiMsg.getExtMsg().setBizData(bizObjs);
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.resEaiMsg.getStandardMessage().setBizData(bizData, inboundCharset);
ExceptionHandler.handle(this.resEaiMsg);
// ----------------------------------------------------------
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + "ExceptionHandler Call Error :" + e.getMessage());
}
}
}
}
public void ifRouterProcessResponse() throws Exception {
try {
this.resEaiMsg = IFRouter.process(this.resEaiMsg, this.callProp);
} catch (Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF100";
String orgErrorCode = ExceptionUtil.getErrorCode(e, rspErrorCode);
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, orgErrorCode, msgArgs);
if (logger.isError())
logger.error(guidLogPrefix + "" + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
// throw new RuntimeException(rspErrorCode);
}
}
public void logSenderCtrlSend() {
String returnType = getReturnType(reqEaiMsg);
if (STDMessageKeys.SEND_RECV_CD_RECV.equals(returnType)) {
this.logPssSeq = 400;
} else {
this.logPssSeq = 200;
}
try {
LogSender.send(this.logPssSeq, this.resEaiMsg, null);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + "AA Exception Logging Error :" + e.getMessage());
}
}
public boolean checkServiceMsgSize() {
// Outbound Error일 경우
if (MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) && reqEaiMsg.getSvcMsgs().size() > 1) {
return true;
} else {
return false;
}
}
public void setCurrentService() throws Exception {
if (logger.isDebug())
logger.debug(guidLogPrefix + "ASYNC-SYNC CALLED");
// ---------------------------------------------------------------
// AS의 경우 다음 서비스메시지(AS 응답)에 키관리메시지내용을 복사한다.
// ---------------------------------------------------------------
String keyMgtMsgVl = resEaiMsg.getCurrentSvcMsg().getKeyMgtMsgVl();
if (logger.isDebug())
logger.debug(guidLogPrefix + "AS 응답 keyMgtMsgVl[" + keyMgtMsgVl + "]");
resEaiMsg.setSvcPssSeq(resEaiMsg.getSvcPssSeq() + 1);
resEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
// ---------------------------------------------------------------
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(this.adapterGroupName);
this.adptrMsgPtrnCd = adptGrpVO.getAdptrMsgPtrnCd(); // migration - boolean 값이 아니라 [S, N, C] 값을 가짐
// SA Type의 요청 Outbound가 비표준일 경우
// KESA Header의 값을 바꾼다. (0200 -> TR_RES)
}
public boolean isOutboundCall() {
return true;
}
public void init() throws Exception {
InterfaceMapper mapper = this.reqEaiMsg.getMapper();
StandardMessage standardMessage = this.reqEaiMsg.getStandardMessage();
String guid = mapper.getGuid(standardMessage);
String guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ Current GUID [" + guid + "][" + guidseq + "]");
mapper.nextGuidSeq(standardMessage);
guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ ADD PATHSEQ GUID [" + guid + "][" + guidseq + "]");
this.resEaiMsg = this.reqEaiMsg;
this.adapterGroupName = reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp();
}
public void printExceptionMessage(Exception e) {
// Exception e = this.context.getExceptionInfo().getException();
if (logger.isError())
logger.error(guidLogPrefix + "ExceptionPath : " + e.getMessage());
}
public boolean isSourceAsync() {
if (EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp())) {
return true;
} else {
return false;
}
}
public void callExceptionHandler() {
try {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(this.reqEaiMsg.getSngSysItfTp());
String inAdapterMsgType = inAdptGrpVO.getMessageType();
if (EAITable.EBCDIC_TYPE.equals(inAdapterMsgType)) {
//// Object[] bizObjs = this.reqEaiMsg.getBizMsg();
// Object[] bizObjs = this.reqEaiMsg.getExtMsg().getBizData();
// if(bizObjs != null && bizObjs[0] instanceof byte[]) {
// bizObjs[0] = CodeConversion.meToMixedAsc((byte[])bizObjs[0]);
// }
//// this.reqEaiMsg.setBizMsg(bizObjs);
// this.reqEaiMsg.getExtMsg().setBizData(bizObjs);
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
byte[] asc = CodeConversion.meToMixedAsc(bizData.getBytes());
try {
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.reqEaiMsg.getStandardMessage().setBizData(new String(asc), inboundCharset);
} catch (Exception e) {
logger.error("setBizData error", e);
}
}
// ----------------------------------------------------------
ExceptionHandler.handle(this.reqEaiMsg);
} catch (Exception e) {
if (logger.isError())
logger.error(guidLogPrefix + "ExceptionHandler Call Error :" + e.getMessage());
}
}
public boolean isRealCall() {
if (this.callProp != null) {
String mode = this.callProp.getProperty(EAIKeys.CALL_MODE_KEY);
if (mode != null && EAIKeys.CALL_MODE_WARMUP.equals(mode)) {
logger.warn(guidLogPrefix + "Warming Up Called");
return false;
} else {
return true;
}
} else {
return true;
}
}
public void setGUID() throws Exception {
InterfaceMapper mapper = this.resEaiMsg.getMapper();
StandardMessage standardMessage = this.resEaiMsg.getStandardMessage();
String guid = mapper.getGuid(standardMessage);
String guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ Current GUID [" + guid + "][" + guidseq + "]");
mapper.nextGuidSeq(standardMessage);
guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug())
logger.debug(guidLogPrefix + " REQ ADD PATHSEQ GUID [" + guid + "][" + guidseq + "]");
}
public void startTargetAdapter() throws Exception {
try {
String srcAdapterGroupName = this.reqEaiMsg.getSngSysItfTp();
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO srcAdapterGroup = adapterManager.getAdapterGroupVO(srcAdapterGroupName);
String[] srcAdapterNames = srcAdapterGroup.getAdapterNames();
if (srcAdapterNames != null && srcAdapterNames.length > 0) {
AdapterVO srcAdapter = srcAdapterGroup.getAdapterVO(srcAdapterNames[0]);
String adapterPropGroupName = srcAdapter.getPropGroupName();
// PropManager manager = PropManager.getInstance();
AdapterPropManager manager = AdapterPropManager.getInstance();
String adptrPropVal = manager.getProperty(adapterPropGroupName, "inisafe.related.adapter.groups");
if (logger.isDebug())
logger.debug(guidLogPrefix + "" + adapterPropGroupName + " : inisafe.related.adapter.groups -> "
+ adptrPropVal);
if (adptrPropVal != null && adptrPropVal.trim().length() > 0) {
String[] adapter_list = adptrPropVal.split(",");
for (int p = 0; p < adapter_list.length; p++) {
String[] adapterNames = adapterManager.getAdapterGroupVO(adapter_list[p]).getAdapterNames();
for (int i = 0; i < adapterNames.length; i++) {
if (logger.isDebug())
logger.debug(guidLogPrefix + "startTargetAdapter :" + adapter_list[p] + " "
+ adapterNames[i]);
try {
adapterManager.getAdapterGroupVO(adapter_list[p]).getAdapterVO(adapterNames[i]).start();
} catch (Exception ex) {
if (logger.isWarn()) {
logger.warn(guidLogPrefix + "startTargetAdapter Fail :" + adapter_list[p] + " "
+ adapterNames[i], ex);
}
}
}
}
} else {
if (logger.isDebug())
logger.debug(
guidLogPrefix + "inisafe.related.adapter.groups NOT FOUND :" + srcAdapterGroupName);
}
} else {
if (logger.isDebug())
logger.debug(guidLogPrefix + "srcAdapter NOT FOUND :" + srcAdapterGroupName);
}
} catch (Exception e) {
if (logger.isError()) {
logger.error(guidLogPrefix + "startTargetAdapter Error", e);
}
}
}
}
@@ -0,0 +1,384 @@
package com.eactive.eai.flowcontroller;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.adapter.AdapterPropManager;
import com.eactive.eai.adapter.AdapterVO;
import com.eactive.eai.common.EAIKeys;
import com.eactive.eai.common.EAITable;
import com.eactive.eai.common.exception.ExceptionHandler;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.message.EAIMessage;
import com.eactive.eai.common.message.EAIMessageKeys;
import com.eactive.eai.common.routing.IFRouter;
import com.eactive.eai.common.routing.Process;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageUtil;
import com.eactive.eai.control.LogSender;
import com.eactive.eai.message.StandardMessage;
import com.eactive.eai.message.service.InterfaceMapper;
import com.eactive.eai.transformer.function.util.CodeConversion;
import com.ext.eai.common.stdmessage.STDMessageKeys;
public class StopFCProcess extends Process
{
public String adptrMsgPtrnCd; // migration - boolean 값이 아니라 [S, N, C] 값을 가짐
public java.lang.String adapterGroupName;
public int logPssSeq;
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
public java.util.Properties callProp;
public EAIMessage resEaiMsg;
public com.eactive.eai.common.message.EAIMessage reqEaiMsg;
static Logger esbLogger = Logger.getLogger(Logger.LOGGER_ESBFW);
private int svrLogLevel;
private static ThreadLocal local = new ThreadLocal(); //경과시간 동기화를 위한 ThreadLocal
static final long serialVersionUID = 1L;
String guidLogPrefix = "";
public EAIMessage clientReturn()
{
if(svrLogLevel >= 1) {
try{
long msgSndTm = System.currentTimeMillis();
Long threadData = (Long)local.get();
long processTm = msgSndTm - threadData.longValue();
if (esbLogger.isInfo()) esbLogger.info( guidLogPrefix + " End... - 경과시간 : " + processTm + "(ms) - EAI Server Log Level is INFO");
} catch (Exception e) {
logger.warn("clientReturn", e);
}
}
return resEaiMsg;
}
public void callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp)
{
this.reqEaiMsg = reqEaiMsg;
this.callProp = callProp;
if(this.reqEaiMsg == null) return;
svrLogLevel = this.reqEaiMsg.getSvrLogLvl();
// guidLogPrefix = guidLogPrefix + " GUID["+reqEaiMsg.getKbMsg().getKBHeader().getGuIdNo()+"]";
guidLogPrefix = guidLogPrefix + " GUID["+reqEaiMsg.getMapper().getGuid(reqEaiMsg.getStandardMessage())+"]";
if(svrLogLevel >= 1) {
try{
long msgRcvTm = System.currentTimeMillis();
local.set(new Long(msgRcvTm));
if (esbLogger.isInfo()) esbLogger.info( guidLogPrefix + " started... - EAI Server Log Level is INFO");
}catch(Exception e){
logger.warn("callService", e);
}
}
try{
flow();
}catch (Exception e){
//에러처리
printExceptionMessage(e);
//ASYNC
if (isSourceAsync()){
//Async-로그
logSenderCtrlSend();
//ExcetpionHandler 호출
callExceptionHandler();
}
return;
}
}
public void flow() throws Exception {
//isRealCall
if (!isRealCall()){
return ;
}
//초기화
init();
//Outbound 프로세스 호출
ifRouterProcess();
//GUID설정
setGUID();
//ASYNC-SYNC모델
if (checkServiceMsgSize()){
//ServiceMessage설정
setCurrentService();
//응답메시지전송
ifRouterProcessResponse();
}
//Stop Target Adapter
stopTargetAdapter();
}
public void ifRouterProcess() throws Exception
{
try {
this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
} catch(Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF001";
String rspErrorMsg = ExceptionUtil.make(e, rspErrorCode, msgArgs);
if (logger.isError()) logger.error( guidLogPrefix + "" + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
throw new Exception(rspErrorCode);
}
//----------------------------------------------------
// 기동시스템이 Async 거래의 OUtbound에서 오류가 발생할 경우
// ExceptionHandler를 통해 응답메시지를 전송한다.
//----------------------------------------------------
if( EAIMessageKeys.ASYNC_SVC.equals( this.reqEaiMsg.getSvcTsmtUsgTp() ) ) {
if( ! MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) ) {
try {
//----------------------------------------------------------
// INBOUND ADAPTER 가 SNA - EBCDIC 메시지를 사용할 경우
// 업무메시지를 ASCII로 통변환하여 ExceptionHandler로 전달한다.
// 2007.06.01 : 데이터 전달방식 수정 DHLEE
//----------------------------------------------------------
// AdapterManager adapterManager = AdapterManager.getInstance();
// AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(this.reqEaiMsg.getSngSysItfTp());
// String inAdapterMsgType = inAdptGrpVO.getMessageType();
//// Object[] bizObjs = this.reqEaiMsg.getBizMsg();
// Object[] bizObjs = this.reqEaiMsg.getExtMsg().getBizData();
// if(EAITable.EBCDIC_TYPE.equals(inAdapterMsgType)) {
// if(bizObjs != null && bizObjs[0] instanceof byte[]) {
// bizObjs[0] = CodeConversion.meToMixedAsc((byte[])bizObjs[0]);
// }
// }
//// this.resEaiMsg.setBizMsg(bizObjs);
// this.resEaiMsg.getExtMsg().setBizData(bizObjs);
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.resEaiMsg.getStandardMessage().setBizData(bizData, inboundCharset);
ExceptionHandler.handle(this.resEaiMsg);
//----------------------------------------------------------
} catch(Exception e) {
if (logger.isError()) logger.error( guidLogPrefix + "ExceptionHandler Call Error :" + e.getMessage());
}
}
}
}
public void ifRouterProcessResponse() throws Exception
{
try {
this.resEaiMsg = IFRouter.process(this.resEaiMsg, this.callProp);
} catch(Exception e) {
String[] msgArgs = new String[1];
msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
String rspErrorCode = "RECEAIFBF100";
String orgErrorCode = ExceptionUtil.getErrorCode(e, rspErrorCode);
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, orgErrorCode, msgArgs);
if (logger.isError()) logger.error( guidLogPrefix + "" + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
this.resEaiMsg.setRspErr(rspErrorCode,rspErrorMsg);
//throw new RuntimeException(rspErrorCode);
}
}
public void logSenderCtrlSend()
{
String telgmDmndDstcd = reqEaiMsg.getMapper().getSendRecvDivision(reqEaiMsg.getStandardMessage());
if(STDMessageKeys.SEND_RECV_CD_RECV.equals(telgmDmndDstcd)) {
// 응답인 경우
this.logPssSeq = 400;
}
else {
// 요청 인경우
this.logPssSeq = 200;
}
try {
LogSender.send(this.logPssSeq, this.resEaiMsg, null);
} catch(Exception e) {
if (logger.isError()) logger.error( guidLogPrefix + "AA Exception Logging Error :" + e.getMessage());
}
}
public boolean checkServiceMsgSize()
{
// Outbound Error일 경우
if( MessageUtil.checkRspErrCd(this.resEaiMsg.getRspErrCd()) &&
reqEaiMsg.getSvcMsgs().size() > 1 ) {
return true;
}
else {
return false;
}
}
public void setCurrentService() throws Exception
{
if (logger.isDebug()) logger.debug( guidLogPrefix + "ASYNC-SYNC CALLED");
//---------------------------------------------------------------
// AS의 경우 다음 서비스메시지(AS 응답)에 키관리메시지내용을 복사한다.
//---------------------------------------------------------------
String keyMgtMsgVl = resEaiMsg.getCurrentSvcMsg().getKeyMgtMsgVl();
if(logger.isDebug()) logger.debug( guidLogPrefix + "AS 응답 keyMgtMsgVl["+keyMgtMsgVl+"]");
resEaiMsg.setSvcPssSeq( resEaiMsg.getSvcPssSeq() + 1 );
resEaiMsg.getCurrentSvcMsg().setKeyMgtMsgVl(keyMgtMsgVl);
//---------------------------------------------------------------
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(this.adapterGroupName);
this.adptrMsgPtrnCd = adptGrpVO.getAdptrMsgPtrnCd(); // migration - boolean 값이 아니라 [S, N, C] 값을 가짐
// SA Type의 요청 Outbound가 비표준일 경우
// KESA Header의 값을 바꾼다. (0200 -> TR_RES)
}
public boolean isOutboundCall()
{
return true;
}
public void init() throws Exception
{
InterfaceMapper mapper = this.reqEaiMsg.getMapper();
StandardMessage standardMessage = this.reqEaiMsg.getStandardMessage();
String guid = mapper.getGuid(standardMessage);
String guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug()) logger.debug( guidLogPrefix + " REQ Current GUID ["+guid+ "]["+guidseq+"]");
mapper.nextGuidSeq(standardMessage);
guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug()) logger.debug( guidLogPrefix + " REQ ADD PATHSEQ GUID ["+guid+ "]["+guidseq+"]");
this.resEaiMsg = this.reqEaiMsg;
this.adapterGroupName = reqEaiMsg.getCurrentSvcMsg().getPsvSysItfTp();
}
public void printExceptionMessage(Exception e)
{
//Exception e = this.context.getExceptionInfo().getException();
if (logger.isError()) logger.error( guidLogPrefix + "ExceptionPath : "+e.getMessage());
}
public boolean isSourceAsync()
{
if(EAIMessageKeys.ASYNC_SVC.equals(this.reqEaiMsg.getSvcTsmtUsgTp()) ) {
return true;
}
else {
return false;
}
}
public void callExceptionHandler()
{
try {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO inAdptGrpVO = adapterManager.getAdapterGroupVO(this.reqEaiMsg.getSngSysItfTp());
String inAdapterMsgType = inAdptGrpVO.getMessageType();
if(EAITable.EBCDIC_TYPE.equals(inAdapterMsgType)) {
String bizData = this.reqEaiMsg.getStandardMessage().getBizData();
byte[] asc = CodeConversion.meToMixedAsc(bizData.getBytes());
try {
String inboundCharset = callProp.getProperty(com.eactive.eai.adapter.Keys.CHARSET_KEY_IN);
this.reqEaiMsg.getStandardMessage().setBizData(new String(asc), inboundCharset);
} catch (Exception e) {
logger.error("setBizData error", e);
}
}
ExceptionHandler.handle(this.reqEaiMsg);
} catch(Exception e) {
if (logger.isError()) logger.error( guidLogPrefix + "ExceptionHandler Call Error :" + e.getMessage());
}
}
public boolean isRealCall()
{
if(this.callProp != null) {
String mode = this.callProp.getProperty(EAIKeys.CALL_MODE_KEY);
if(mode != null && EAIKeys.CALL_MODE_WARMUP.equals(mode)) {
logger.warn( guidLogPrefix + "Warming Up Called");
return false;
}
else {
return true;
}
}
else {
return true;
}
}
public void setGUID() throws Exception {
InterfaceMapper mapper = this.resEaiMsg.getMapper();
StandardMessage standardMessage = this.resEaiMsg.getStandardMessage();
String guid = mapper.getGuid(standardMessage);
String guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug()) logger.debug( guidLogPrefix + " REQ Current GUID ["+guid+ "]["+guidseq+"]");
mapper.nextGuidSeq(standardMessage);
guidseq = mapper.getGuidSeq(standardMessage);
if (logger.isDebug()) logger.debug( guidLogPrefix + " REQ ADD PATHSEQ GUID ["+guid+ "]["+guidseq+"]");
}
public void stopTargetAdapter() throws Exception {
try {
String srcAdapterGroupName = this.reqEaiMsg.getSngSysItfTp();
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO srcAdapterGroup = adapterManager.getAdapterGroupVO( srcAdapterGroupName );
String[] srcAdapterNames = srcAdapterGroup.getAdapterNames();
if(srcAdapterNames != null && srcAdapterNames.length > 0) {
AdapterVO srcAdapter = srcAdapterGroup.getAdapterVO(srcAdapterNames[0]);
String adapterPropGroupName = srcAdapter.getPropGroupName();
//PropManager manager = PropManager.getInstance();
AdapterPropManager manager = AdapterPropManager.getInstance();
String adptrPropVal = manager.getProperty(adapterPropGroupName, "inisafe.related.adapter.groups");
if (logger.isDebug()) logger.debug( guidLogPrefix + " " + adapterPropGroupName + " : inisafe.related.adapter.groups -> " + adptrPropVal);
if(adptrPropVal != null && adptrPropVal.trim().length() > 0) {
String[] adapter_list = adptrPropVal.split(",");
for(int p=0; p<adapter_list.length; p++) {
String[] adapterNames = adapterManager.getAdapterGroupVO(adapter_list[p]).getAdapterNames();
for(int i=0; i<adapterNames.length; i++) {
if (logger.isDebug()) logger.debug( guidLogPrefix + " stopTargetAdapter :" + adapter_list[p] + " " + adapterNames[i]);
try {
adapterManager.getAdapterGroupVO(adapter_list[p]).getAdapterVO(adapterNames[i]).stop();
} catch(Exception ex) {
if (logger.isWarn()) {
logger.warn( guidLogPrefix + " stopTargetAdapter Fail :" + adapter_list[p] + " " + adapterNames[i], ex);
}
}
}
}
}
else {
if (logger.isDebug()) logger.debug( guidLogPrefix + " inisafe.related.adapter.groups NOT FOUND :" + srcAdapterGroupName);
}
}
else {
if (logger.isDebug()) logger.debug( guidLogPrefix + " srcAdapter NOT FOUND :" + srcAdapterGroupName);
}
}
catch(Exception e) {
if (logger.isError()) {
logger.error( guidLogPrefix + " stopTargetAdapter Error", e);
}
}
}
}
@@ -0,0 +1,429 @@
package com.eactive.eai.flowcontroller;
//package com.eactive.eai.flowcontroller;
//
//import com.bea.control.ServiceBrokerControl;
//import com.bea.jpd.JpdContext;
//import com.bea.data.RawData;
//import com.bea.wli.control.broker.MessageBroker;
//import com.bea.wli.jpd.Callback;
//import com.bea.wli.jpd.CallbackInterface;
//import com.bea.xml.XmlObjectList;
//import org.apache.beehive.controls.api.bean.Control;
//import org.apache.beehive.controls.api.events.EventHandler;
//import org.apache.xmlbeans.XmlObject;
//import com.eactive.eai.common.EAIKeys;
//import com.eactive.eai.common.dao.DAOFactory;
//import com.eactive.eai.common.exception.ExceptionUtil;
//import com.eactive.eai.common.message.*;
//import com.eactive.eai.common.routing.IFRouter;
//import com.eactive.eai.common.routing.RoutingVO;
//import com.eactive.eai.common.util.Logger;
//import com.eactive.eai.common.util.ServiceLocator;
//import com.eactive.eai.timer.TimerAdminVO;
//import com.eactive.eai.timer.TimerDAO;
//import com.eactive.eai.timer.TimerKeys;
//import com.eactive.eai.timer.TimerManager;
//import com.eactive.eai.util.JpdExceptionUtil;
//import javax.transaction.Transaction;
//import javax.transaction.UserTransaction;
//import weblogic.transaction.TxHelper;
//import com.bea.wli.common.Protocol;
//import com.eactive.eai.control.LogSender;
//
///**
// * @jpd:process process::
// * <process name="TimerFCProcess">
// * <clientRequest name="Timer Flow Control" method="callService" returnMethod="clientReturn">
// * <onException name="OnException">
// * <perform name="Error났을경우" method="printExceptionMessage"/>
// * </onException>
// * <decision name="WarmUp">
// * <if name="isRealCall" conditionMethod="isRealCall"/>
// * <default name="Default">
// * <finish name="Finish"/>
// * </default>
// * </decision>
// * <perform name="TimerAdminVO정보 가지고옮" method="PreSetting"/>
// * <decision name="Decision">
// * <if name="취소거래" conditionMethod="CancelTransactionGB">
// * <perform name="취소거래호출하기위한 설정" method="CancelSetting"/>
// * <controlSend name="취소거래OutBound프로세스호출" method="ifRouterProcess1">
// * <onException name="OnException" retryCount="0">
// * <perform name="취소거래실패했을경우 setting및 rollback" method="RollBack"/>
// * </onException>
// * </controlSend>
// * <decision name="Decision">
// * <if name="Timeout거래" conditionMethod="TimeoutTransactionGB">
// * <perform name="Timeout거래호출을 위한 설정" method="TimeoutSetting"/>
// * <controlSend name="Timeout거래OutBound프로세스호출" method="ifRouterProcess2">
// * <onException name="OnException">
// * <perform name="Timeout거래실패했을경우 setting및 rollback" method="RollBack"/>
// * </onException>
// * </controlSend>
// * </if>
// * <default name="Timeout거래 안보냄"/>
// * </decision>
// * </if>
// * <default name="재전송거래">
// * <perform name="재전송호출하기위한설정" method="ReSendSetting"/>
// * <controlSend name="Outbound프로세스호출" method="ifRouterProcess3">
// * <onException name="OnException" retryCount="0">
// * <perform name="재전송거래 실패했을경우 setting및rollback" method="RollBack"/>
// * </onException>
// * </controlSend>
// * </default>
// * </decision>
// * </clientRequest>
// * </process>::
// */
//@Protocol(httpSoap=false)
//@com.bea.wli.jpd.Process(process = "<process name=\"TimerFCProcess\"> " +
// " <clientRequest name=\"Timer Flow Control\" method=\"callService\" returnMethod=\"clientReturn\"> " +
// " <onException name=\"OnException\"> " +
// " <perform name=\"Error났을경우\" method=\"printExceptionMessage\"/> " +
// " </onException> " +
// " <decision name=\"WarmUp\"> " +
// " <if name=\"isRealCall\" conditionMethod=\"isRealCall\"/> " +
// " <default name=\"Default\"> " +
// " <finish name=\"Finish\"/> " +
// " </default> " +
// " </decision> " +
// " <perform name=\"TimerAdminVO정보 가지고옮\" method=\"PreSetting\"/> " +
// " <decision name=\"Decision\"> " +
// " <if name=\"취소거래\" conditionMethod=\"CancelTransactionGB\"> " +
// " <perform name=\"취소거래호출하기위한 설정\" method=\"CancelSetting\"/> " +
// " <controlSend name=\"취소거래OutBound프로세스호출\" method=\"ifRouterProcess1\"> " +
// " <onException name=\"OnException\" retryCount=\"0\"> " +
// " <perform name=\"취소거래실패했을경우 setting및 rollback\" method=\"RollBack\"/> " +
// " </onException> " +
// " </controlSend> " +
// " <decision name=\"Decision\"> " +
// " <if name=\"Timeout거래\" conditionMethod=\"TimeoutTransactionGB\"> " +
// " <perform name=\"Timeout거래호출을 위한 설정\" method=\"TimeoutSetting\"/> " +
// " <controlSend name=\"Timeout거래OutBound프로세스호출\" method=\"ifRouterProcess2\"> " +
// " <onException name=\"OnException\"> " +
// " <perform name=\"Timeout거래실패했을경우 setting및 rollback\" method=\"RollBack\"/> " +
// " </onException> " +
// " </controlSend> " +
// " </if> " +
// " <default name=\"Timeout거래 안보냄\"/> " +
// " </decision> " +
// " </if> " +
// " <default name=\"재전송거래\"> " +
// " <perform name=\"재전송호출하기위한설정\" method=\"ReSendSetting\"/> " +
// " <controlSend name=\"Outbound프로세스호출\" method=\"ifRouterProcess3\"> " +
// " <onException name=\"OnException\" retryCount=\"0\"> " +
// " <perform name=\"재전송거래 실패했을경우 setting및rollback\" method=\"RollBack\"/> " +
// " </onException> " +
// " </controlSend> " +
// " </default> " +
// " </decision> " +
// " </clientRequest> " +
// "</process>")
//public class TimerFCProcess implements com.bea.jpd.ProcessDefinition
//{
// static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
//
// public java.util.Properties callProp;
//
// public EAIMessage resEaiMsg;
//
// public com.eactive.eai.common.message.EAIMessage reqEaiMsg;
//
// static final long serialVersionUID = 1L;
//
// @com.bea.wli.jpd.Callback()
// public Callback callback;
//
// public TimerAdminVO timerAdminVO;
//
// public String MsgTrceColTxt = "";
//
// /*
// * 이 주석 위의 영역에는 디자인 뷰에서 만든 변수 선언이 포함되어 있습니다.
// * 이 주석 아래의 영역에는 디자인 뷰에서 만든 컨트롤 선언이 포함되어 있습니다.
// *
// * 이 영역의 코드는 자동으로 생성됩니다.
// *
// * 이 코드 영역에서는 양방향 편집이 완전히 지원됩니다.
// * 경고: 애플리케이션에서 이미 사용하고 있는 프로세스 변수와 컨트롤 선언을 변경하는
// * 경우 사용 중인 모든 위치에서 해당 선언을 업데이트하지 않으면 애플리케이션에서
// * 오류가 발생할 수 있습니다.
// */
//
// /**
// * @common:context
// */
// @com.bea.wli.jpd.Context()
// JpdContext context; //(..컨트롤 삽입 표식 - 이 라인을 수정하지 마십시오.)
//
// /*
// * 이 주석 아래의 영역에는 프로세스 언어의 통신 노드에서 참조하는 java 메소드가 포함되어 있습니다.
// *
// * 이 영역의 코드는 자동으로 생성됩니다.
// *
// * 이 코드 영역에서는 양방향 편집이 부분적으로 지원됩니다.
// * 경고: 메소드 본문에 코드를 추가할 수 있지만 보호 섹션 블록 주석의 외부
// * 합니다. 이 주석 내의 코드를 수정하면 이 코드를 생성한 디자인 뷰 빌더에서
// * 정보를 볼 수 없습니다.
// */
//
//
// public EAIMessage clientReturn()
// {
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // return
// return resEaiMsg;
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }
//
//
//
//
// public void callService(com.eactive.eai.common.message.EAIMessage reqEaiMsg, java.util.Properties callProp)
// {
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // parameter assignment
// this.reqEaiMsg = reqEaiMsg;
// this.callProp = callProp;
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }
//
// public void ifRouterProcess1() throws Exception
// {
// if (logger.isDebug())
// logger.debug("TimerFCProcess] ifRouterProcess cancel ");
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }
//
//
// public void ifRouterProcess3() throws Exception
// {
//
// if (logger.isDebug()) logger.debug("TimerFCProcess] ifRouterProcess resend ");
// //this.resEaiMsg = this.reqEaiMsg;
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
//
// }
//
//
// public void ifRouterProcess2() throws Exception
// {
// if (logger.isDebug()) logger.debug("TimerFCProcess] ifRouterProcess timeout ");
// //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
// // input transform
// // return method call
// this.resEaiMsg = IFRouter.process(this.reqEaiMsg, this.callProp);
// // output transform
// // output assignments
// //#END : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
// }
//
// @CallbackInterface()
// public interface Callback extends ServiceBrokerControl //(..영역 끝 표식 - 이 라인을 수정하지 마십시오.)
// {
// }
//
// /*
// * 이 주석 아래에 삽입한 코드는 디자인 뷰에서 만든 수행 또는 조건 노드에 해당하는
// * 메소드용입니다.
// *
// * 여기에서 코드를 수정하거나 새로 추가하십시오.
// */
//
//
//
// public boolean CancelTransactionGB()
// {
//
// if (timerAdminVO.getCnclTranEn().equals("1")){
// if (logger.isDebug()) logger.debug("TimerFCProcess] CancelTransactionGB true");
// return true;
// }else{
// if (logger.isDebug()) logger.debug("TimerFCProcess] CancelTransactionGB false");
// return false;
// }
//
// }
//
//
// public void PreSetting() throws Exception
// {
// if (logger.isDebug()) logger.debug("TimerFCProcess] PreSetting");
// String timerAdminName = callProp.getProperty(TimerKeys.TIMER_ADMIN_NAME);
// TimerManager timerManager = TimerManager.getInstance();
// timerAdminVO = timerManager.getTimerAdminRule(timerAdminName);
//
// String timerInfoName = callProp.getProperty(TimerKeys.TIMER_ADMIN_NAME);
// MsgTrceColTxt = callProp.getProperty(TimerKeys.MSG_TRCE_COL_TXT );
// }
//
// public boolean TimeoutTransactionGB()
// {
// if ( timerAdminVO.getTmoTranTrsYn().equals("1")){
// return true;
// }else{
// return false;
// }
// }
//
// public void CancelSetting() throws Exception
// {
// reqEaiMsg.setSvcPssSeq(1);
//
// //Timeout table 상태 변경
// DAOFactory daoFactory = DAOFactory.newInstance();
// TimerDAO dao = null;
// Transaction tx = null;
// try {
// tx = TxHelper.getTransactionManager().suspend();
// dao = (TimerDAO)daoFactory.create(TimerDAO.class);
// dao.updateTimerInfoStatusSend(MsgTrceColTxt,TimerKeys.STATUS_FLAG_CANCEL_RUN);
// } catch(Exception e) {
// e.printStackTrace();
// String rspErrorCode = "RECEAIFTF001";
// String orgErrorCode = ExceptionUtil.getErrorCode(e, rspErrorCode);
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, orgErrorCode);
// if (logger.isError()) logger.error("TimerFCProcess] " + rspErrorMsg);
// throw new Exception(orgErrorCode);
// }finally {
// if(tx!=null) {
// try {
// TxHelper.getTransactionManager().resume(tx);
// } catch(Exception e) {
// }
// }
// }
// }
//
// public void ReSendSetting() throws Exception
// {
// if (logger.isDebug()) {
// logger.debug("TimerFCProcess] ReSendSetting start ");
// logger.debug("TimerFCProcess] ReSendSetting "+MsgTrceColTxt);
// }
// reqEaiMsg.setSvcPssSeq(1);
//
// //Timeout table 상태 변경
// DAOFactory daoFactory = DAOFactory.newInstance();
// TimerDAO dao = null;
// Transaction tx = null;
// try {
// tx = TxHelper.getTransactionManager().suspend();
// dao = (TimerDAO)daoFactory.create(TimerDAO.class);
//
// dao.updateTimerInfoStatusSend(MsgTrceColTxt,TimerKeys.STATUS_FLAG_RESEND_RUN);
//
// } catch(Exception e) {
// e.printStackTrace();
// String rspErrorCode = "RECEAIFTF002";
// String orgErrorCode = ExceptionUtil.getErrorCode(e, rspErrorCode);
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, orgErrorCode);
// if (logger.isError()) logger.error("TimerFCProcess] " + rspErrorMsg);
// throw new Exception(orgErrorCode);
// }finally {
// if(tx!=null) {
// try {
// TxHelper.getTransactionManager().resume(tx);
// } catch(Exception e) {
// }
// }
// }
// if (logger.isDebug()) logger.debug("TimerFCProcess] ReSendSetting end ");
// }
// public void RollBack() throws Exception
// {
// Exception e = context.getExceptionInfo().getException();
// e.printStackTrace();
// String[] msgArgs = new String[1];
// msgArgs[0] = this.reqEaiMsg.getEAISvcCd();
// String rspErrorCode = "RECEAIFTF003";
// String orgErrorCode = ExceptionUtil.getErrorCode(e, rspErrorCode);
// String rspErrorMsg = ExceptionUtil.make(rspErrorCode, orgErrorCode, msgArgs);
// if (logger.isError()) logger.error("TimerFCProcess] " + rspErrorMsg);
// this.resEaiMsg.setRspErrCd(rspErrorCode);
// this.resEaiMsg.setRspErrMsg(rspErrorMsg);
//
// //TimerInfo table 상태 변경
// DAOFactory daoFactory = DAOFactory.newInstance();
// TimerDAO dao = null;
// Transaction tx = null;
// try {
// tx = TxHelper.getTransactionManager().suspend();
// dao = (TimerDAO)daoFactory.create(TimerDAO.class);
// dao.updateTimerInfoStatusSend(MsgTrceColTxt,TimerKeys.STATUS_FLAG_ERROR);
//
// } catch(Exception e1) {
// e.printStackTrace();
// String rspErrorCode1 = "RECEAIFTF004";
// String orgErrorCode1 = ExceptionUtil.getErrorCode(e, rspErrorCode1);
// String rspErrorMsg1 = ExceptionUtil.make(rspErrorCode1, orgErrorCode1);
// if (logger.isError()) logger.error("TimerFCProcess] " + rspErrorMsg1);
// throw new Exception(orgErrorCode);
// }finally {
// if(tx!=null) {
// try {
// TxHelper.getTransactionManager().resume(tx);
// } catch(Exception e1) {
// }
// }
// }
// }
//
//
//
//
// public void TimeoutSetting() throws Exception
// {
// reqEaiMsg.setSvcPssSeq(2);
// }
//
//
//
// public void printExceptionMessage() throws Exception
// {
// Exception e = this.context.getExceptionInfo().getException();
// String rspErrorCode1 = "RECEAIFTF005";
// String orgErrorCode1 = ExceptionUtil.getErrorCode(e, rspErrorCode1);
// String rspErrorMsg1 = ExceptionUtil.make(rspErrorCode1, orgErrorCode1);
// if (logger.isError()) logger.error("TimerFCProcess] " + rspErrorMsg1);
// e.printStackTrace();
//
// Object[] objs = new Object[1];
// objs[0] = null;
// this.resEaiMsg.setBizMsg(objs);
//
//
// }
//
// public boolean isRealCall()
// {
// if(this.callProp != null) {
// String mode = this.callProp.getProperty(EAIKeys.CALL_MODE_KEY);
// if(mode != null && EAIKeys.CALL_MODE_WARMUP.equals(mode)) {
// System.out.println("TimerFCProcess] Warming Up Called");
// return false;
// }
// else {
// return true;
// }
// }
// else {
// return true;
// }
// }
//
//}