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,12 @@
package com.eactive.eai.inbound.action;
public class ActionException extends Exception
{
public ActionException() {
super("ActionException is occured.");
}
public ActionException(String msg) {
super(msg);
}
}
@@ -0,0 +1,43 @@
package com.eactive.eai.inbound.action;
public class ActionFactory
{
/*
private static HashMap actions = new HashMap();
private ActionFactory() {
}
public static RequestAction createAction(String actionName) throws ActionException {
RequestAction action = (RequestAction)actions.get(actionName);
if(action == null) {
try {
Class cl = Class.forName(actionName);
action = (RequestAction)cl.newInstance();
actions.put(actionName,action);
} catch(Exception e) {
throw new ActionException("Cannot create a RequestAction. - "+actionName);
}
}
return action;
}
*/
//--------------------------------------------------------------------
// 200703.29 : DHLEE
// DefaultRequestAction 읠 중복사용으로 인한 DATA 공유문제
//--------------------------------------------------------------------
private ActionFactory() {
}
public static RequestAction createAction(String actionName) throws ActionException {
RequestAction action = null;
try {
Class cl = Class.forName(actionName);
action = (RequestAction)cl.newInstance();
} catch(Exception e) {
throw new ActionException("Cannot create a RequestAction. - "+actionName);
}
return action;
}
}
@@ -0,0 +1,78 @@
package com.eactive.eai.inbound.action;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.MessageKeyExtractor;
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 EAI메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - 어뎁터의 업무그룹명을 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class AdapterGroupBizRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 표준메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
// byte[] tmp = null;
String key[] = null;
/**
* _BPM_OU_NET_AsC{KOF} 값추출시 BPM 추출
* _BPM_OU_NET_AsC 값추출시 BPM 추출
*/
String adptGrpName = adapterGroupName;
if (adptGrpName != null && adptGrpName.length() >= 4 ){
adptGrpName = adptGrpName.substring(1,4);
}
if (logger.isDebug()) {
if(message instanceof byte[]) {
// tmp = (byte[])message;
logger.debug(adapterName+"] received data >> ["+ new String((byte[])message) +"]");
}else if (message instanceof String) {
// tmp = ((String)message).getBytes();
logger.debug(adapterName+"] received data >> ["+ (String)message +"]");
}
else{
logger.debug(adapterName+"] received data >> ["+ message +"]");
// throw new ActionException(ExceptionUtil.getErrorCode(null, "RECEAIIRA001"));
}
}
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message, true, true);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
for(int i=0; i<key.length; i++ ) {
key[i] = adptGrpName.trim() + key[i];
}
return key;
}
public String getDescription() {
return "키추출방식 : (그룹명업무3자리)+추출키값";
}
}
@@ -0,0 +1,91 @@
package com.eactive.eai.inbound.action;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.MessageKeyExtractor;
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 EAI메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - 어뎁터의 업무그룹명을 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class AdapterGroupNameParseRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 표준메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
byte[] tmp = null;
String key[] = null;
/**
* _BPM_OU_NET_AsC{KOF} 값추출시 BPMKOF 추출
* _BPM_OU_NET_AsC 값추출시 BPM 추출
*/
String adptGrpName = adapterGroupName;
String chnl = "";
String inst = "";
if (adptGrpName != null
&& adptGrpName.length() >= 4
){
chnl = adptGrpName.substring(1,4);
}
if (adptGrpName != null
&& adptGrpName.length() >= 4
&& adptGrpName.indexOf("{") >= 0
&& adptGrpName.indexOf("}") >= 0
&& adptGrpName.indexOf("{") < adptGrpName.indexOf("}")
){
int start = adptGrpName.indexOf("{")+1;
int end = adptGrpName.indexOf("}");
inst = adptGrpName.substring(start,end);
}
if ("".equals(chnl) && "".equals(inst)){
;
}else{
adptGrpName = chnl + inst;
}
if(message instanceof byte[]) {
tmp = (byte[])message;
}else if (message instanceof String) {
tmp = ((String)message).getBytes();
}else{
throw new ActionException(ExceptionUtil.getErrorCode(null, "RECEAIIRA001"));
}
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, tmp, true, true);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isDebug()) logger.debug(adapterName+"] received data >> ["+ new String(tmp)+"]");
for(int i=0; i<key.length; i++ ) {
key[i] = adptGrpName.trim() + key[i];
}
return key;
}
public String getDescription() {
return "키추출방식 : (그룹명업무3자리+{}안의값)+추출키값";
}
}
@@ -0,0 +1,65 @@
package com.eactive.eai.inbound.action;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.MessageKeyExtractor;
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 EAI메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - 어뎁터의 업무그룹명을 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class AdapterGroupNameRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 EAI메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
byte[] tmp = null;
String key[] = null;
String adptGrpName = adapterGroupName;
if(message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
tmp = (byte[])message;
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ new String(tmp));
} else {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ message);
}
for(int i=0; i<key.length; i++ ) {
key[i] = adptGrpName.trim() + key[i];
}
return key;
}
public String getDescription() {
return "키추출방식 : 어댑터그룹명+추출키값";
}
}
@@ -0,0 +1,74 @@
package com.eactive.eai.inbound.action;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.MessageKeyExtractor;
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 EAI메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class AdapterRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 EAI메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
byte[] tmp = null;
String[] key = null;
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String eaiBizCode = null;
if(adptGrpVO != null) {
eaiBizCode = adptGrpVO.getEaiBizCode();
}
else {
eaiBizCode = getEaiBizCodeFromAdapterName(adapterGroupName);
}
if(message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
tmp = (byte[])message;
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ new String(tmp));
} else {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ message);
}
for(int i=0; i<key.length; i++) {
key[i] = eaiBizCode.trim() + key[i];
}
return key;
}
public String getDescription() {
return "키추출방식 : 어댑터업무구분코드+추출키값";
}
}
@@ -0,0 +1,61 @@
package com.eactive.eai.inbound.action;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.MessageKeyExtractor;
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 EAI메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
:
*/
public class DefaultRequestAction extends RequestActionSupport
{
// -----------------------------------------------
// 메시지키 테이블의 변경에 따른 수정사항 반영
// -----------------------------------------------
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 EAI메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
byte[] tmp = null;
String[] key = null;
if(message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
tmp = (byte[])message;
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ new String(tmp));
} else {
try {
key = MessageKeyExtractor.getMessageKeyValue(this.adapterGroupName, message);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ message);
}
return key;
}
public String getDescription() {
return "키추출방식 : 추출키값";
}
}
@@ -0,0 +1,19 @@
package com.eactive.eai.inbound.action;
import java.util.Properties;
public interface RequestAction
{
/**
* Inbound Adapter 이름을 초기화 한다.
*/
public void setAdapterInfo(String adapterGroupName, String adapterName, Properties prop);
/**
* input message로 부터 업무 Key 필드를 생성 반환한다.
*/
public String[] perform(Object message) throws ActionException;
public String getDescription();
}
@@ -0,0 +1,64 @@
package com.eactive.eai.inbound.action;
import java.util.Properties;
import com.eactive.eai.common.message.EAIMessageKeys;
import com.eactive.eai.common.messagekey.MessageKeyFldVO;
import com.eactive.eai.common.messagekey.MessageKeyManager;
import com.eactive.eai.common.messagekey.MessageKeyVO;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageKeyExtractor;
import com.eactive.eai.common.util.MessageUtil;
public class RequestActionSupport implements RequestAction
{
protected String adapterGroupName;
protected String adapterName;
protected Properties prop;
protected Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
public void setAdapterInfo(String adapterGroupName,String adapterName, Properties prop)
{
this.adapterGroupName = adapterGroupName;
this.adapterName = adapterName;
this.prop = prop;
}
public String[] perform(Object message) throws ActionException
{
byte[] tmp = null;
String[] key = null;
if(message instanceof byte[]) {
tmp = (byte[])message;
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ new String(tmp));
} else {
if (logger.isInfo()) logger.info(adapterName+"] received data >> "+ message);
}
return key;
}
@Override
public String getDescription() {
return "Action Decription";
}
public String getEaiBizCodeFromAdapterName(String adapterGroupName) {
String eaiBizCode = null;
if(adapterGroupName != null && adapterGroupName.length() > 4) {
eaiBizCode = adapterGroupName.substring(1, 4);
}
return eaiBizCode;
}
// public static void main(String[] argv) {
// RequestActionSupport s = new RequestActionSupport();
// String adapterGroupName = "_ERF_IN_NET_AsS{KFTC}";
// String eaiBizCode = s.getEaiBizCodeFromAdapterName(adapterGroupName);
// System.out.println(adapterGroupName + "=>" + eaiBizCode);
// }
}
@@ -0,0 +1,77 @@
package com.eactive.eai.inbound.action;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey;
import com.eactive.eai.adapter.http.dynamic.impl.HttpAdapterServiceRest;
import com.eactive.eai.common.messagekey.MessageKeyFldVO;
import com.eactive.eai.common.messagekey.MessageKeyGroupVO;
import com.eactive.eai.common.messagekey.MessageKeyManager;
import com.eactive.eai.common.messagekey.MessageKeyVO;
import com.eactive.eai.inbound.action.ActionException;
import com.eactive.eai.inbound.action.RequestActionSupport;
import java.util.List;
import java.util.Properties;
public class RestAdapterMethodHeaderRequestAction extends RequestActionSupport {
public static final String STEMSG_METHOD_DELIMITER = ":";
public static final String STEMSG_SERVICE_HEADER_DELIMITER = "^";
public static final String STEMSG_HEADER_SEPARATOR = ";";
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 표준메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException {
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String adptGrpName = adptGrpVO.getName();
String requestMethod = prop.getProperty(HttpAdapterServiceRest.PROPERTIES_NAME_HTTP_REQUEST_METHOD);
String keyCode = adptGrpName + "I";
MessageKeyManager manager = MessageKeyManager.getInstance();
MessageKeyVO msgKey = manager.getMessageKey(keyCode);
List<MessageKeyGroupVO> alMsgGroups = msgKey.getAlMsgGroups();
int groupSize = alMsgGroups.size();
Properties inboundheader = (Properties) prop.get(HttpAdapterServiceKey.INBOUND_HEADER);
String[] keys = new String[groupSize];
if (logger.isInfo()) {
logger.info("MessageKeyExtractor] CURRENT RULE [{}]", keyCode);
}
String baseMessageKey = adptGrpName + STEMSG_METHOD_DELIMITER + requestMethod + STEMSG_SERVICE_HEADER_DELIMITER;
for (int g = 0; g < groupSize; g++) {
MessageKeyGroupVO groupVo = msgKey.getMessageKeyGroup(g);
int fldSize = groupVo.getMessageKeyFldLength();
String[] keyBuffer = new String[fldSize];
for (int i = 0; i < fldSize; i++) {
MessageKeyFldVO keyFld = groupVo.getMessageKeyFld(i);
String tmpKey = inboundheader.getProperty(keyFld.getBwkColNm().toLowerCase(),"");
keyBuffer[i] = tmpKey;
}
String currentKey = baseMessageKey + String.join(STEMSG_HEADER_SEPARATOR, keyBuffer);
keys[g] = currentKey;
if (logger.isInfo()) {
logger.info("MessageKeyExtractor] CURRENT RULE[{}] KEY [{}]", keyCode,currentKey);
}
}
return keys;
}
}
@@ -0,0 +1,79 @@
package com.eactive.eai.inbound.action;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.adapter.Keys;
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey;
import com.eactive.eai.adapter.http.dynamic.impl.HttpAdapterServiceRest;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.MessageKeyExtractor;
import com.eactive.eai.inbound.action.ActionException;
import com.eactive.eai.inbound.action.RequestActionSupport;
import org.apache.commons.lang3.StringUtils;
public class RestAdapterMethodUrlRequestAction extends RequestActionSupport {
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 표준메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException {
String[] key = null;
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String adptGrpName = adptGrpVO.getName();
if (StringUtils.equals(adptGrpVO.getType(), Keys.TYPE_HTTP_CUSTOM)
|| StringUtils.equals(adptGrpVO.getType(), Keys.TYPE_REST)) {
try {
String requestMethod = prop
.getProperty(HttpAdapterServiceRest.PROPERTIES_NAME_HTTP_REQUEST_METHOD);
// /api/v1/public/getUserInfo.svc
String inboundUri = prop.getProperty(HttpAdapterServiceKey.INBOUND_EXTURI);
String apiPath = prop.getProperty(HttpAdapterServiceKey.API_PATH);
// /getUserInfo.svc
String apiUri = org.apache.commons.lang.StringUtils.removeStart(inboundUri, apiPath);
// _TST_IN_RST_SyS|POST:getUserInfo.svc
String apiKey = adptGrpName + ":" + requestMethod + "|" + StringUtils.removeStart(apiUri, "/");
return new String[] { apiKey };
} catch (Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
}
if (message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValueForRest(this.adapterGroupName, message, prop, "url", true);
} catch (Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isDebug())
logger.debug(adapterName + "] received data >> [" + new String((byte[]) message) + "]");
} else {
try {
key = MessageKeyExtractor.getMessageKeyValueForRest(this.adapterGroupName, message, prop, "url", true);
} catch (Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isDebug())
logger.debug(adapterName + "] received data >> [" + message + "]");
}
for (int i = 0; i < key.length; i++) {
key[i] = adptGrpName.trim() + key[i];
}
return key;
}
}
@@ -0,0 +1,78 @@
package com.eactive.eai.inbound.action;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageKeyExtractor;
/**
* 1. 기능 : Rest Url 추출 용
* 2. 처리 개요 :
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class RestDataAdapterGroupParseRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 표준메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
String[] key = null;
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String adptGrpName = adptGrpVO.getName();
if (adptGrpName != null && adptGrpName.length() >= 4) {
String chnl = adptGrpName.substring(1, 4);
if (adptGrpName.indexOf("{") >= 0 && adptGrpName.indexOf("}") >= 0
&& adptGrpName.indexOf("{") < adptGrpName.indexOf("}")) {
int start = adptGrpName.indexOf("{") + 1;
int end = adptGrpName.indexOf("}");
String inst = adptGrpName.substring(start, end);
adptGrpName = chnl + inst;
} else {
adptGrpName = chnl;
}
}
if(message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValueForRest(this.adapterGroupName, message, prop, "data", true);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isDebug()) logger.debug(adapterName+"] received data >> ["+ new String((byte[])message)+"]");
} else {
try {
key = MessageKeyExtractor.getMessageKeyValueForRest(this.adapterGroupName, message, prop, "data", true);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isDebug()) logger.debug(adapterName+"] received data >> ["+ message+"]");
}
for(int i=0; i<key.length; i++) {
key[i] = adptGrpName.trim() + key[i];
}
return key;
}
}
@@ -0,0 +1,78 @@
package com.eactive.eai.inbound.action;
import com.eactive.eai.adapter.AdapterGroupVO;
import com.eactive.eai.adapter.AdapterManager;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.Logger;
import com.eactive.eai.common.util.MessageKeyExtractor;
/**
* 1. 기능 : Rest Url 추출 용
* 2. 처리 개요 :
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class RestHeaderAdapterGroupParseRequestAction extends RequestActionSupport
{
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 표준메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException
{
String[] key = null;
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String adptGrpName = adptGrpVO.getName();
if (adptGrpName != null && adptGrpName.length() >= 4) {
String chnl = adptGrpName.substring(1, 4);
if (adptGrpName.indexOf("{") >= 0 && adptGrpName.indexOf("}") >= 0
&& adptGrpName.indexOf("{") < adptGrpName.indexOf("}")) {
int start = adptGrpName.indexOf("{") + 1;
int end = adptGrpName.indexOf("}");
String inst = adptGrpName.substring(start, end);
adptGrpName = chnl + inst;
} else {
adptGrpName = chnl;
}
}
if(message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValueForRest(this.adapterGroupName, message, prop, "header", true);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isDebug()) logger.debug(adapterName+"] received data >> ["+ new String((byte[])message)+"]");
} else {
try {
key = MessageKeyExtractor.getMessageKeyValueForRest(this.adapterGroupName, message, prop, "header", true);
} catch(Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isDebug()) logger.debug(adapterName+"] received data >> ["+ message+"]");
}
for(int i=0; i<key.length; i++) {
key[i] = adptGrpName.trim() + key[i];
}
return key;
}
}
@@ -0,0 +1,54 @@
package com.eactive.eai.inbound.action;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.MessageKeyExtractor;
/**
* 1. 기능 : Rest Url 추출 용
* 2. 처리 개요 :
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class RestHeaderParseRequestAction extends RequestActionSupport {
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 표준메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException {
String[] key = null;
if (message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValueForRest(this.adapterGroupName, message, prop, "header",
true);
} catch (Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isDebug())
logger.debug(adapterName + "] received data >> [" + new String((byte[]) message) + "]");
} else {
try {
key = MessageKeyExtractor.getMessageKeyValueForRest(this.adapterGroupName, message, prop, "header",
true);
} catch (Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isDebug())
logger.debug(adapterName + "] received data >> [" + message + "]");
}
return key;
}
}
@@ -0,0 +1,103 @@
package com.eactive.eai.inbound.action;
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.adapter.http.dynamic.HttpAdapterServiceKey;
import com.eactive.eai.adapter.http.dynamic.impl.HttpAdapterServiceRest;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.MessageKeyExtractor;
/**
* 1. 기능 : Rest Url 추출 용
* 2. 처리 개요 :
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class RestUrlAdapterGroupParseRequestAction extends RequestActionSupport {
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 표준메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException {
String[] key = null;
AdapterManager adapterManager = AdapterManager.getInstance();
AdapterGroupVO adptGrpVO = adapterManager.getAdapterGroupVO(adapterGroupName);
String adptGrpName = adptGrpVO.getName();
if (adptGrpName != null && adptGrpName.length() >= 4) {
String chnl = adptGrpName.substring(1, 4);
//EIMS에서 지원하지 않아 주석 처리
// if (adptGrpName.indexOf("{") >= 0 && adptGrpName.indexOf("}") >= 0
// && adptGrpName.indexOf("{") < adptGrpName.indexOf("}")) {
// int start = adptGrpName.indexOf("{") + 1;
// int end = adptGrpName.indexOf("}");
// String inst = adptGrpName.substring(start, end);
// adptGrpName = chnl + inst;
// } else {
// adptGrpName = chnl;
// }
adptGrpName = chnl;
}
if (StringUtils.equals(adptGrpVO.getType(), Keys.TYPE_HTTP_CUSTOM)
|| StringUtils.equals(adptGrpVO.getType(), Keys.TYPE_REST)) {
try {
String requestMethod = prop
.getProperty(HttpAdapterServiceRest.PROPERTIES_NAME_HTTP_REQUEST_METHOD);
// /api/v1/public/getUserInfo.svc
String apiUri = prop.getProperty(HttpAdapterServiceKey.INBOUND_EXTURI);
// MDIKFTC:POST/api/v1/public/getUserInfo.svc
// String apiKey = adptGrpName + ":" + requestMethod + "/" + StringUtils.removeStart(apiUri, "/");
// MDIKFTCPOST/api/v1/public/getUserInfo.svc
String apiKey = adptGrpName + requestMethod + "/" + StringUtils.removeStart(apiUri, "/");
return new String[] { apiKey };
} catch (Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
}
if (message instanceof byte[]) {
try {
key = MessageKeyExtractor.getMessageKeyValueForRest(this.adapterGroupName, message, prop, "url", true);
} catch (Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isDebug())
logger.debug(adapterName + "] received data >> [" + new String((byte[]) message) + "]");
} else {
try {
key = MessageKeyExtractor.getMessageKeyValueForRest(this.adapterGroupName, message, prop, "url", true);
} catch (Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
if (logger.isDebug())
logger.debug(adapterName + "] received data >> [" + message + "]");
}
for (int i = 0; i < key.length; i++) {
key[i] = adptGrpName.trim() + key[i];
}
return key;
}
}
@@ -0,0 +1,47 @@
package com.eactive.eai.inbound.action;
import org.apache.commons.lang3.StringUtils;
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey;
import com.eactive.eai.adapter.http.dynamic.impl.HttpAdapterServiceRest;
import com.eactive.eai.common.exception.ExceptionUtil;
/**
* 1. 기능 : Rest Url 추출 용
* 2. 처리 개요 :
* - 어뎁터의 업무그룹코드를 키값앞에 추가한다.
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @author :
* @version : v 1.0.0
* @see :
* @since :
*/
public class RestUrlParseRequestAction extends RequestActionSupport {
/**
* 1. 기능 : Inbound Adapter를 통해 전달받은 비표준메시지에서 표준메시지를 생성하기 위한 키값을 추출
* 2. 처리 개요 :
* - MessageKeyExtractor를 통해 Adapter별 추출 Rule에 따라 메시지를 구분할 수 있는 키값을 추출한다.
* 3. 주의사항
*
* @param message Object 타입의 요청메시지
* @return String 비표준메시지의 메시지키값
* @exception
**/
public String[] perform(Object message) throws ActionException {
try {
String requestMethod = prop.getProperty(HttpAdapterServiceRest.PROPERTIES_NAME_HTTP_REQUEST_METHOD);
// /api/v1/public/getUserInfo.svc
String apiUri = prop.getProperty(HttpAdapterServiceKey.INBOUND_EXTURI);
// POST/api/v1/public/getUserInfo.svc
String apiKey = requestMethod + "/" + StringUtils.removeStart(apiUri, "/");
return new String[] { apiKey };
} catch (Exception e) {
throw new ActionException(ExceptionUtil.getErrorCode(e, "RECEAIIRA001"));
}
}
}