init
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
|
||||
import com.eactive.eai.adapter.ElinkAdapter;
|
||||
import com.eactive.eai.adapter.ElinkAdapterFactory;
|
||||
import com.eactive.eai.adapter.Keys;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
|
||||
public class AMQSender {
|
||||
|
||||
public static Object callService(String adapterGroupName, Properties prop, Object inputData, Properties tempProp)
|
||||
throws Exception {
|
||||
ElinkAdapter adapter = ElinkAdapterFactory.newInstance().getElinkAdapter(Keys.TYPE_AMQ);
|
||||
|
||||
try {
|
||||
return adapter.callService(adapterGroupName, prop, inputData, tempProp);
|
||||
} catch (JMSException jmse) {
|
||||
throw jmse;
|
||||
} catch (Exception e) {
|
||||
throw new Exception(ExceptionUtil.getErrorCode(e, "RECEAICUL001"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.eactive.eai.adapter.ElinkAdapter;
|
||||
import com.eactive.eai.adapter.ElinkAdapterFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class BusinessApplicationSender {
|
||||
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
static final String IA_CONTROL_ERROR = "RECEAIAHA003";
|
||||
|
||||
public static byte[] callService(String adapterGroupName, Properties prop, Object message, Properties tempProp)
|
||||
throws Exception {
|
||||
byte[] resBytes;
|
||||
try {
|
||||
ElinkAdapterFactory factory = ElinkAdapterFactory.newInstance();
|
||||
ElinkAdapter adapter = factory.getElinkAdapter(com.eactive.eai.adapter.Keys.TYPE_APP);
|
||||
if (prop == null) {
|
||||
prop = new Properties();
|
||||
}
|
||||
if (tempProp == null) {
|
||||
tempProp = new Properties();
|
||||
}
|
||||
if (tempProp.getProperty("ADAPTER_GROUP_NAME") == null) {
|
||||
tempProp.setProperty("ADAPTER_GROUP_NAME", adapterGroupName);
|
||||
}
|
||||
resBytes = (byte[]) adapter.callService(adapterGroupName, prop, message, tempProp);
|
||||
} catch (Exception e) {
|
||||
logger.error("callService error", e);
|
||||
throw e;
|
||||
}
|
||||
return resBytes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.eactive.eai.adapter.ElinkAdapter;
|
||||
import com.eactive.eai.adapter.ElinkAdapterFactory;
|
||||
import com.eactive.eai.adapter.Keys;
|
||||
import com.eactive.eai.adapter.http.HttpStatusException;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class HttpSender {
|
||||
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
static final long serialVersionUID = 1L;
|
||||
static final String HTTP_CONTROL_ERROR1 = "RECEAIOHC001";
|
||||
static final String HTTP_CONTROL_ERROR2 = "RECEAIOHC002";
|
||||
static final String HTTP_QUICS = "HTTP_QUICS"; //럭키넘버스 업무를 위한 http adpater
|
||||
|
||||
public static Object callService(String adapterGroupName, Properties prop, Object inputData, Properties tempProp)
|
||||
throws Exception {
|
||||
|
||||
ElinkAdapter adapter = null;
|
||||
|
||||
adapter = ElinkAdapterFactory.newInstance().getElinkAdapter(Keys.TYPE_HTTP);
|
||||
|
||||
String adapterName = tempProp.getProperty(com.eactive.eai.adapter.Keys.OUT_ADAPTER_NAME);
|
||||
|
||||
try {
|
||||
return adapter.callService(adapterGroupName, prop, inputData, tempProp);
|
||||
} catch (SocketTimeoutException ste) {
|
||||
throw ste;
|
||||
} catch (HttpStatusException hse) {
|
||||
throw hse;
|
||||
} catch (Exception e) {
|
||||
logger.error("HttpSender] callService " + adapterName + " : "+ e.getMessage(), e);
|
||||
throw new Exception(ExceptionUtil.getErrorCode(e, HTTP_CONTROL_ERROR1) + ", Adapter : " + adapterName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.eactive.eai.control;
|
||||
//package com.eactive.eai.control;
|
||||
//
|
||||
//import java.util.Properties;
|
||||
//
|
||||
//import com.eactive.eai.adapter.mq.Keys;
|
||||
//import com.eactive.eai.adapter.mq.MQChannelChecker;
|
||||
//import com.eactive.eai.common.property.PropManager;
|
||||
//import com.eactive.eai.common.util.StringUtil;
|
||||
//
|
||||
//public class IBMMQUtil {
|
||||
//
|
||||
// public static boolean checkChannel(String adapterName)
|
||||
// {
|
||||
// PropManager manager = PropManager.getInstance();
|
||||
// Properties prop = manager.getProperties(adapterName);
|
||||
//
|
||||
// String senderChannel = StringUtil.getNullStr(prop.getProperty(Keys.MQ_SENDER_CHANNEL));
|
||||
// String receiverChannel = StringUtil.getNullStr(prop.getProperty(Keys.MQ_RECEIVER_CHANNEL));
|
||||
//
|
||||
// MQChannelChecker checker = new MQChannelChecker();
|
||||
//
|
||||
// if (senderChannel.equals("") && receiverChannel.equals("")) {
|
||||
// return checker.checkChannel(prop, prop.getProperty(Keys.MQ_CHANNEL));
|
||||
// } else {
|
||||
// boolean isSenderAlive = true;
|
||||
// boolean isReceiverAlive = true;
|
||||
//
|
||||
// if (!senderChannel.equals("")) {
|
||||
// isSenderAlive = checker.checkChannel(prop, senderChannel);
|
||||
// }
|
||||
//
|
||||
// if (!receiverChannel.equals("")) {
|
||||
// isReceiverAlive = checker.checkChannel(prop, receiverChannel);
|
||||
// }
|
||||
//
|
||||
// return (isSenderAlive && isReceiverAlive);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.Message;
|
||||
import javax.jms.ObjectMessage;
|
||||
import javax.jms.Queue;
|
||||
import javax.jms.QueueConnection;
|
||||
import javax.jms.QueueConnectionFactory;
|
||||
import javax.jms.QueueReceiver;
|
||||
import javax.jms.QueueSession;
|
||||
import javax.jms.TextMessage;
|
||||
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.jms.JmsServiceLocator;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class JMSQueueReceiver {
|
||||
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
private QueueConnectionFactory factory;
|
||||
private QueueConnection con = null;
|
||||
private QueueSession ses = null;
|
||||
private Queue queue = null;
|
||||
private String jms_connectionfactory;
|
||||
private String queue_name;
|
||||
|
||||
public java.io.Serializable receive(String queueConnectionFactory, String queueName, String traceNumber, int timeout) throws Exception {
|
||||
|
||||
init(queueConnectionFactory, queueName);
|
||||
QueueReceiver receiver = null;
|
||||
|
||||
try {
|
||||
if (con != null && ses != null) {
|
||||
|
||||
if(traceNumber != null && traceNumber.length() > 0) {
|
||||
receiver = ses.createReceiver(queue, "JMSCorrelationID = '" + traceNumber + "'");
|
||||
}
|
||||
else {
|
||||
receiver = ses.createReceiver(queue);
|
||||
}
|
||||
Message message = (Message)receiver.receive(timeout);
|
||||
|
||||
if (message == null) {
|
||||
String[] msgArgs = new String[2];
|
||||
msgArgs[0] = queueName;
|
||||
msgArgs[1] = traceNumber;
|
||||
String rspErrorCode = "RECEAICJR001";
|
||||
String rspErrorMsg = ExceptionUtil.make(rspErrorCode, msgArgs);
|
||||
throw new JMSQueueReceiverTimeOutException (rspErrorMsg);
|
||||
}
|
||||
|
||||
if (message instanceof ObjectMessage) {
|
||||
if(logger.isInfo()) logger.info("MESSAGE IS ObjectMessage");
|
||||
return ((ObjectMessage)message).getObject();
|
||||
}
|
||||
else if (message instanceof TextMessage) {
|
||||
if(logger.isInfo()) logger.info("MESSAGE IS TextMessage");
|
||||
return ((TextMessage)message).getText();
|
||||
}
|
||||
else {
|
||||
if(logger.isInfo()) logger.info("MESSAGE IS ELSEMESSAGE");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new JMSException(new StringBuffer("연결되지 않음 TARGET >> localhost").append("에 대한 수신...").toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("receive error", e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (receiver != null) try { receiver.close(); receiver = null; } catch (Throwable e) {
|
||||
logger.error("receiver.close error", e);
|
||||
}
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
public void init(String queueConnectionFactory, String queueName) {
|
||||
jms_connectionfactory = queueConnectionFactory;
|
||||
queue_name = queueName;
|
||||
startQueueConnection();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
closeQueueConnection();
|
||||
}
|
||||
|
||||
private void startQueueConnection() {
|
||||
try {
|
||||
JmsServiceLocator locator = JmsServiceLocator.getInstance();
|
||||
factory = locator.getQueueConnectionFactory(jms_connectionfactory);
|
||||
|
||||
if(factory == null) {
|
||||
throw new Exception("QueueConnectionFactory is NULL - " + jms_connectionfactory);
|
||||
}
|
||||
con = factory.createQueueConnection();
|
||||
if(con == null) {
|
||||
throw new Exception("createQueueConnection is NULL - " + jms_connectionfactory);
|
||||
}
|
||||
ses = con.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
|
||||
queue = (Queue)locator.getQueue(queue_name);
|
||||
|
||||
con.start();
|
||||
} catch (Throwable e) {
|
||||
// e.printStackTrace();
|
||||
logger.error("startQueueConnection error", e);
|
||||
closeQueueConnection();
|
||||
}
|
||||
}
|
||||
private void closeQueueConnection() {
|
||||
if (ses != null) try { ses.close(); ses = null; } catch (Throwable e) {
|
||||
logger.error("ses.close error", e);
|
||||
}
|
||||
if (con != null) try { con.stop(); } catch (Throwable e) {
|
||||
logger.error("con.stop error", e);
|
||||
}
|
||||
if (con != null) try { con.close(); con = null; } catch (Throwable e) {
|
||||
logger.error("con.close error", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
public class JMSQueueReceiverTimeOutException extends Exception
|
||||
{
|
||||
public JMSQueueReceiverTimeOutException() {
|
||||
super("JMSQueueReceiverTimeOutException is occured.");
|
||||
}
|
||||
|
||||
public JMSQueueReceiverTimeOutException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.ObjectMessage;
|
||||
import javax.jms.Queue;
|
||||
import javax.jms.QueueConnection;
|
||||
import javax.jms.QueueConnectionFactory;
|
||||
import javax.jms.QueueSender;
|
||||
import javax.jms.QueueSession;
|
||||
import javax.jms.TextMessage;
|
||||
|
||||
import com.eactive.eai.common.jms.JmsServiceLocator;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
|
||||
public class JMSQueueSender {
|
||||
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
private QueueConnectionFactory factory;
|
||||
private QueueConnection con = null;
|
||||
private QueueSession ses = null;
|
||||
private QueueSender qsender;
|
||||
private Queue queue = null;
|
||||
private TextMessage msg;
|
||||
private ObjectMessage objmsg;
|
||||
|
||||
private String jms_connectionfactory;
|
||||
private String queue_name;
|
||||
|
||||
public void send(String queueConnectionFactory, String queueName, String message, String id) throws JMSException {
|
||||
init(queueConnectionFactory, queueName);
|
||||
if(ses !=null) msg = ses.createTextMessage();
|
||||
if(id!=null) msg.setJMSCorrelationID(id);
|
||||
msg.setText(message);
|
||||
qsender.send(msg);
|
||||
closeQueueConnection();
|
||||
}
|
||||
|
||||
public void sendObject(String queueConnectionFactory, String queueName, java.io.Serializable message, String id) throws JMSException {
|
||||
|
||||
init(queueConnectionFactory, queueName);
|
||||
if(ses !=null) objmsg = ses.createObjectMessage();
|
||||
if(id!=null) objmsg.setJMSCorrelationID(id);
|
||||
objmsg.setObject(message);
|
||||
qsender.send(objmsg);
|
||||
closeQueueConnection();
|
||||
}
|
||||
|
||||
public void init(String queueConnectionFactory, String queueName) {
|
||||
jms_connectionfactory = queueConnectionFactory;
|
||||
queue_name = queueName;
|
||||
startQueueConnection();
|
||||
}
|
||||
|
||||
|
||||
public void close() {
|
||||
closeQueueConnection();
|
||||
}
|
||||
|
||||
private void startQueueConnection() {
|
||||
try {
|
||||
JmsServiceLocator locator = JmsServiceLocator.getInstance();
|
||||
|
||||
factory = locator.getQueueConnectionFactory(jms_connectionfactory);
|
||||
if(factory == null) throw new Exception("factory not found - " + jms_connectionfactory);
|
||||
con = factory.createQueueConnection();
|
||||
if(con == null) throw new Exception("createQueueConnection return null");
|
||||
ses = con.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
|
||||
if(ses == null) throw new Exception("createQueueSession return null");
|
||||
queue = (Queue)locator.getQueue(queue_name);
|
||||
qsender = ses.createSender(queue);
|
||||
con.start();
|
||||
} catch (Throwable e) {
|
||||
closeQueueConnection();
|
||||
}
|
||||
}
|
||||
private void closeQueueConnection() {
|
||||
if (ses != null) try { ses.close(); ses = null; } catch (Throwable e) {
|
||||
logger.debug(e.toString());
|
||||
}
|
||||
if (con != null) try { con.stop(); } catch (Throwable e) {
|
||||
logger.debug(e.toString());
|
||||
}
|
||||
if (con != null) try { con.close(); con = null; } catch (Throwable e) {
|
||||
logger.debug(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import javax.jms.BytesMessage;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.Message;
|
||||
import javax.jms.ObjectMessage;
|
||||
import javax.jms.TextMessage;
|
||||
import javax.jms.Topic;
|
||||
import javax.jms.TopicConnection;
|
||||
import javax.jms.TopicConnectionFactory;
|
||||
import javax.jms.TopicSession;
|
||||
import javax.jms.TopicSubscriber;
|
||||
import javax.naming.Context;
|
||||
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.jms.JmsServiceLocator;
|
||||
import com.eactive.eai.common.server.EAIServerManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class JMSTopicReceiver {
|
||||
static final long serialVersionUID = 1L;
|
||||
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
static final String JMSRES_CONTROL_ERROR = "RECEAIORC001";
|
||||
static final String JMSRES_CONNNECTION_FAIL = "RECEAIORC100";
|
||||
static final String JMSRES_TIME_OUT = "RECEAIORC200";
|
||||
|
||||
private TopicConnectionFactory factory;
|
||||
private TopicConnection con = null;
|
||||
private TopicSession ses = null;
|
||||
private Topic topic = null;
|
||||
private String jms_connectionfactory;
|
||||
private String topic_name;
|
||||
|
||||
private static String topic_surfix;
|
||||
|
||||
static
|
||||
{
|
||||
EAIServerManager eaiServerManager = EAIServerManager.getInstance();
|
||||
String serverName = eaiServerManager.getLocalServerName();
|
||||
|
||||
if(serverName != null) {
|
||||
//juns 서버명 변경에 따른 인스턴스 룰 추출변경
|
||||
//ex)EAIDSG_i11 => EAIDS01_i01
|
||||
//topic_surfix = "_" +serverName.substring(serverName.length()-4);
|
||||
topic_surfix = "_" + serverName.substring(serverName.length()-5, serverName.length()-4)
|
||||
+ serverName.substring(serverName.length()-1, serverName.length());
|
||||
}
|
||||
}
|
||||
|
||||
public java.lang.Object receive(String topicConnectionFactory, String topicName, String traceNumber, int timeout) throws java.lang.Exception {
|
||||
jms_connectionfactory = topicConnectionFactory;
|
||||
topic_name = topicName + topic_surfix;
|
||||
startTopicConnection();
|
||||
|
||||
TopicSubscriber subscriber = null;
|
||||
|
||||
try {
|
||||
if (con != null && ses != null) {
|
||||
subscriber = ses.createSubscriber(topic, "JMSCorrelationID = '" + traceNumber + "'", true);
|
||||
|
||||
Message message = (Message)subscriber.receive(timeout);
|
||||
|
||||
if (message == null) {
|
||||
if (logger.isError()) logger.error("JmsResponseControl]요청에 대한 응답을 수신하지 못했습니다. JMSCorrelationID["+traceNumber+"]");
|
||||
throw new Exception(JMSRES_TIME_OUT);
|
||||
}
|
||||
|
||||
if (message instanceof ObjectMessage) {
|
||||
return ((ObjectMessage)message).getObject();
|
||||
}
|
||||
else if (message instanceof TextMessage) {
|
||||
return ((TextMessage)message).getText();
|
||||
}
|
||||
else if (message instanceof BytesMessage) {
|
||||
return getBytesMessage((BytesMessage)message);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (logger.isError()) logger.error("Topic Connection Failed [" + topicConnectionFactory + "]");
|
||||
throw new JMSException(JMSRES_CONNNECTION_FAIL);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new Exception(ExceptionUtil.getErrorCode(e, JMSRES_CONTROL_ERROR));
|
||||
} finally {
|
||||
if (subscriber != null) {
|
||||
try { subscriber.close(); subscriber = null; }
|
||||
catch (Throwable e) {
|
||||
if (logger.isWarn()) logger.warn("subscriber.close Failed", e);
|
||||
}
|
||||
}
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] getBytesMessage(BytesMessage message) throws Exception {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
byte[] buff = new byte[100];
|
||||
int getSize = -1;
|
||||
try {
|
||||
while(true) {
|
||||
getSize = message.readBytes(buff);
|
||||
if(getSize > 0) {
|
||||
bos.write(buff, 0, getSize);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return bos.toByteArray();
|
||||
} catch(Exception e) {
|
||||
throw new Exception("Read ByteMessage Error : " +e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if(bos != null) bos.close();
|
||||
} catch(Exception ex) {
|
||||
if (logger.isWarn()) logger.warn("bos.close Failed", ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public void init() {
|
||||
//jms_connectionfactory = context.getControlAttribute("jc:jms-topic-receive", "jms-factory-jndi");
|
||||
//topic_name = context.getControlAttribute("jc:jms-topic-receive", "jms-topic-jndi");
|
||||
jms_connectionfactory = "";
|
||||
topic_name = "";
|
||||
|
||||
startTopicConnection();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
closeTopicConnection();
|
||||
}
|
||||
|
||||
private void startTopicConnection() {
|
||||
Context ctx = null;
|
||||
try {
|
||||
JmsServiceLocator locator = JmsServiceLocator.getInstance();
|
||||
|
||||
factory = locator.getTopicConnectionFactory(jms_connectionfactory);
|
||||
if(factory == null) throw new Exception("factory not found - " + jms_connectionfactory);
|
||||
con = factory.createTopicConnection();
|
||||
if(con == null) throw new Exception("createQueueConnection return null");
|
||||
ses = con.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
|
||||
if(ses == null) throw new Exception("createTopicSession return null");
|
||||
topic = locator.getTopic(topic_name);
|
||||
con.start();
|
||||
} catch (Throwable e) {
|
||||
logger.error("startTopicConnection", e );
|
||||
closeTopicConnection();
|
||||
if (ctx != null) try { ctx.close(); ctx = null; } catch (Throwable ex) {
|
||||
logger.warn("ctx.close error");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void closeTopicConnection() {
|
||||
if (ses != null) try { ses.close(); ses = null; } catch (Throwable e) {
|
||||
logger.warn("ses.close error");
|
||||
}
|
||||
if (con != null) try { con.stop(); } catch (Throwable e) {
|
||||
logger.warn("con.stop error");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.eactive.eai.adapter.ElinkAdapter;
|
||||
import com.eactive.eai.adapter.ElinkAdapterFactory;
|
||||
|
||||
public class JtcSender {
|
||||
|
||||
static final String WEBT_CONTROL_ERROR = "RECEAIOWC001";
|
||||
|
||||
public static byte[] callService(String adapterGroupName, Properties prop, Object message, Properties tempProp) throws java.lang.Exception
|
||||
{
|
||||
byte[] resBytes;
|
||||
try {
|
||||
//new socket 과 old socket을 분기 하기 위해서
|
||||
String protocol = (String)prop.getProperty("protocol");
|
||||
|
||||
|
||||
ElinkAdapterFactory factory = ElinkAdapterFactory.newInstance();
|
||||
ElinkAdapter adapter = null;
|
||||
adapter = factory.getElinkAdapter(com.eactive.eai.adapter.Keys.TYPE_JTC);
|
||||
if(prop==null) {
|
||||
prop = new Properties();
|
||||
}
|
||||
if(prop.getProperty("ADAPTER_GROUP_NAME") == null) {
|
||||
prop.setProperty("ADAPTER_GROUP_NAME", adapterGroupName);
|
||||
}
|
||||
resBytes = (byte[])adapter.callService(adapterGroupName, prop, message, tempProp);
|
||||
} catch(Exception e) {
|
||||
throw e;
|
||||
}
|
||||
return resBytes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.logger.EAILogSender;
|
||||
import com.eactive.eai.common.message.EAIMessage;
|
||||
|
||||
public class LogSender {
|
||||
|
||||
static final String LS_CONTROL_ERROR = "RECEAIOLC001";
|
||||
|
||||
public static void send(int logPssSno, EAIMessage eaiMsg, Properties altKeyProp)
|
||||
throws java.lang.Exception
|
||||
{
|
||||
// DBLogTransactionLogger 로 로직 이동함
|
||||
// Transaction tx = null;
|
||||
try {
|
||||
// tx = TxHelper.getTransactionManager().suspend();
|
||||
eaiMsg.setLogPssSno(logPssSno);
|
||||
EAILogSender.send(eaiMsg, altKeyProp);
|
||||
}
|
||||
catch(Exception e) {
|
||||
throw new Exception(ExceptionUtil.getErrorCode(e, LS_CONTROL_ERROR));
|
||||
} finally {
|
||||
// if(tx!=null) {
|
||||
// try {
|
||||
// TxHelper.getTransactionManager().resume(tx);
|
||||
// } catch(Exception e) {
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.eactive.eai.adapter.ElinkAdapter;
|
||||
import com.eactive.eai.adapter.ElinkAdapterFactory;
|
||||
import com.eactive.eai.adapter.wca.exception.WCAException;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
|
||||
public class SNASender {
|
||||
static final long serialVersionUID = 1L;
|
||||
|
||||
public static byte[] callService(String adapterGroupName, Properties prop, Object message,Properties tempProp)
|
||||
throws Exception
|
||||
{
|
||||
byte[] resBytes;
|
||||
try {
|
||||
ElinkAdapterFactory factory = ElinkAdapterFactory.newInstance();
|
||||
ElinkAdapter adapter = factory.getElinkAdapter(com.eactive.eai.adapter.Keys.TYPE_SNA);
|
||||
resBytes = (byte[])adapter.callService(adapterGroupName, prop, message, tempProp);
|
||||
}
|
||||
catch(WCAException wcae) {
|
||||
// String errCode = wcae.getErrorReturnCode();
|
||||
// throw new Exception(errCode);
|
||||
throw new Exception(wcae.getErrorReturnCode() + ":" + wcae.getMessage());
|
||||
|
||||
}
|
||||
catch(Exception e) {
|
||||
throw new Exception(ExceptionUtil.getErrorCode(e, "RECEAIOSC001"));
|
||||
}
|
||||
|
||||
return resBytes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.eactive.eai.adapter.ElinkAdapter;
|
||||
import com.eactive.eai.adapter.ElinkAdapterFactory;
|
||||
import com.eactive.eai.adapter.Keys;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class SocketSender {
|
||||
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
static final String SOCK_CONTROL_ERROR = "RECEAIOSC001";
|
||||
|
||||
public static byte[] callService(String adapterGroupName, Properties prop, Object message, Properties tempProp) throws java.lang.Exception
|
||||
{
|
||||
byte[] resBytes;
|
||||
try {
|
||||
//new socket 과 old socket을 분기 하기 위해서
|
||||
// String protocol = (String)prop.getProperty("protocol");
|
||||
|
||||
|
||||
ElinkAdapterFactory factory = ElinkAdapterFactory.newInstance();
|
||||
ElinkAdapter adapter = null;
|
||||
adapter = factory.getElinkAdapter(com.eactive.eai.adapter.Keys.TYPE_NET2);
|
||||
if(prop==null) {
|
||||
prop = new Properties();
|
||||
}
|
||||
if(tempProp==null) {
|
||||
tempProp = new Properties();
|
||||
}
|
||||
if(tempProp.getProperty(Keys.OUT_ADAPTER_GROUP_NAME) == null) {
|
||||
tempProp.setProperty(Keys.OUT_ADAPTER_GROUP_NAME, adapterGroupName);
|
||||
}
|
||||
resBytes = (byte[])adapter.callService(adapterGroupName, prop, message, tempProp);
|
||||
} catch(Exception e) {
|
||||
logger.error("callService error", e);
|
||||
//throw new Exception(ExceptionUtil.getErrorCode(e, SOCK_CONTROL_ERROR));
|
||||
throw e;
|
||||
}
|
||||
return resBytes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.eactive.eai.adapter.ElinkAdapter;
|
||||
import com.eactive.eai.adapter.ElinkAdapterFactory;
|
||||
import com.eactive.eai.common.message.EAIMessageKeys;
|
||||
import com.eactive.eai.common.tas.TASUtil;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class TasSocketSender {
|
||||
private static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
static final String SOCK_CONTROL_ERROR = "RECEAIOSC001";
|
||||
|
||||
public static byte[] callService(String adapterGroupName, Properties prop, Object message, Properties tempProp) throws java.lang.Exception
|
||||
{
|
||||
byte[] resBytes;
|
||||
try {
|
||||
//new socket 과 old socket을 분기 하기 위해서
|
||||
// String protocol = (String)prop.getProperty("protocol");
|
||||
String tasBizCode = (String)prop.getProperty(EAIMessageKeys.TAS_BIZ_CODE);
|
||||
|
||||
if(tasBizCode == null) {
|
||||
throw new Exception("TAS_BIZ_CODE 값이 전달되지 않았습니다.");
|
||||
}
|
||||
|
||||
if(prop==null) {
|
||||
prop = new Properties();
|
||||
}
|
||||
|
||||
byte[] tasRequest = TASUtil.addTasHeader((byte[])message, tasBizCode) ;
|
||||
|
||||
//
|
||||
// 업무별어댑터 일 경우 어댑터의 업무코드를 등록하고
|
||||
// 대표어댑터 일 경우에는 어댑터명을 어떻게 조회할지 확인 필요
|
||||
// AdapterGroupVO tasInfoAdapter = manager.getTasInfoAdapterGroupVO(tasBizCode, Keys.ADAPTER_OUT);
|
||||
|
||||
prop.setProperty("ADAPTER_GROUP_NAME", adapterGroupName);
|
||||
|
||||
ElinkAdapterFactory factory = ElinkAdapterFactory.newInstance();
|
||||
ElinkAdapter adapter = null;
|
||||
adapter = factory.getElinkAdapter(com.eactive.eai.adapter.Keys.TYPE_NET2);
|
||||
resBytes = (byte[])adapter.callService(adapterGroupName, prop, tasRequest, tempProp);
|
||||
|
||||
// TODO : 응답메시지에도 헤더가 있는지 확인필요
|
||||
// 2019.07.25 응답에도 헤더(업무코드)가 있는 것으로 확인
|
||||
if(resBytes != null && resBytes.length > 3) {
|
||||
resBytes = TASUtil.removeTasHeader(resBytes);
|
||||
}
|
||||
|
||||
} catch(Exception e) {
|
||||
logger.error("callService error",e);
|
||||
//throw new Exception(ExceptionUtil.getErrorCode(e, SOCK_CONTROL_ERROR));
|
||||
throw e;
|
||||
}
|
||||
return resBytes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.transformer.TransformService;
|
||||
|
||||
public class Transform {
|
||||
static final long serialVersionUID = 1L;
|
||||
|
||||
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
static Logger esbLogger = Logger.getLogger(Logger.LOGGER_ESBFW);
|
||||
/**
|
||||
*
|
||||
* isMath 는 대량 입력/출력 일때 참조를 무시
|
||||
* @param infoKey
|
||||
* @param isReq
|
||||
* @param transformName
|
||||
* @param sources
|
||||
* @param isMath
|
||||
* @return
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
public static Object transform(String infoKey, boolean isReq, String transformName, Object[] sources, boolean isMass)
|
||||
throws java.lang.Exception {
|
||||
if(esbLogger.isInfo()) esbLogger.info(infoKey +" Transform START: " + transformName);
|
||||
Object obj = TransformService.transform(infoKey, isReq, transformName, sources,isMass);
|
||||
if(esbLogger.isInfo()) esbLogger.info(infoKey +" Transform End: " + transformName);
|
||||
return obj;
|
||||
}
|
||||
|
||||
public static Object transformSingleForMass(String infoKey, boolean isReq, String transformName, Object sources) throws Exception{
|
||||
return transform(infoKey, isReq, transformName,new Object[]{sources},true);
|
||||
}
|
||||
public static Object transformSingle(String infoKey, boolean isReq, String transformName, Object sources)
|
||||
throws java.lang.Exception {
|
||||
return transform(infoKey, isReq, transformName,new Object[]{sources},false);
|
||||
}
|
||||
|
||||
public static Object transformComp(String infoKey, boolean isReq, String transformName, Object[] sources, String[] layoutNames)
|
||||
throws Exception {
|
||||
if(esbLogger.isInfo()) esbLogger.info(infoKey +" Transform START : " + transformName);
|
||||
Object obj = TransformService.transformComp(infoKey, isReq, transformName, sources, layoutNames);
|
||||
if(esbLogger.isInfo()) esbLogger.info(infoKey +" Transform END : " + transformName);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.eactive.eai.control;
|
||||
//package com.eactive.eai.control;
|
||||
//
|
||||
//import javax.ejb.CreateException;
|
||||
//import javax.ejb.SessionBean;
|
||||
//import javax.ejb.SessionContext;
|
||||
//import javax.naming.Context;
|
||||
//import javax.naming.InitialContext;
|
||||
//import javax.naming.NamingException;
|
||||
//import javax.transaction.Transaction;
|
||||
//import javax.transaction.TransactionManager;
|
||||
//import weblogic.transaction.TxHelper;
|
||||
//
|
||||
//import weblogic.wtc.jatmi.TPException;
|
||||
//import weblogic.wtc.jatmi.TPReplyException;
|
||||
//import weblogic.wtc.jatmi.TypedCArray;
|
||||
//import weblogic.wtc.jatmi.Reply;
|
||||
//import weblogic.wtc.gwt.TuxedoConnectionFactory;
|
||||
//import weblogic.wtc.gwt.TuxedoConnection;
|
||||
//import weblogic.wtc.jatmi.ApplicationToMonitorInterface;
|
||||
//
|
||||
//public class TuxedoCArraySender {
|
||||
// private static final long serialVersionUID = 1L;
|
||||
// private int tpurcode;
|
||||
// private int tperrno;
|
||||
//
|
||||
// public int gettpurcode() {
|
||||
// return tpurcode;
|
||||
// }
|
||||
//
|
||||
// public int gettperrno() {
|
||||
// return tperrno;
|
||||
// }
|
||||
//
|
||||
// public byte[] service(String svcName, boolean isSync, boolean isXA, byte[] request)
|
||||
// throws TPException, TPReplyException {
|
||||
// Context ctx;
|
||||
// TuxedoConnectionFactory tcf = null;
|
||||
// TuxedoConnection tc = null;
|
||||
// TypedCArray tca;
|
||||
// Reply reply;
|
||||
//
|
||||
// //-----------------------------------------------------------------
|
||||
// // 1. Tuxedo의 TuxedoConnectionFactory를 생성한다.
|
||||
// //-----------------------------------------------------------------
|
||||
// try {
|
||||
// ctx = new InitialContext();
|
||||
// tcf = (TuxedoConnectionFactory)ctx.lookup("tuxedo.services.TuxedoConnection");
|
||||
// } catch (NamingException ne) {
|
||||
// // Could not get the tuxedo object, throw TPENOENT
|
||||
// throw new TPException(TPException.TPENOENT,
|
||||
// "Could not get TuxedoConnectionFactory : " + ne);
|
||||
// }
|
||||
//
|
||||
// Transaction tx = null;
|
||||
//
|
||||
// TransactionManager tm = null;
|
||||
// try {
|
||||
// //-----------------------------------------------------------------
|
||||
// // 1. TX Begin.
|
||||
// //-----------------------------------------------------------------
|
||||
// // Suspend Orginal transaction
|
||||
// tx = TxHelper.getTransactionManager().suspend();
|
||||
// if(isXA) {
|
||||
// tm = (javax.transaction.TransactionManager)
|
||||
// ctx.lookup("javax.transaction.TransactionManager");
|
||||
// tm.begin();
|
||||
// }
|
||||
//
|
||||
// //-----------------------------------------------------------------
|
||||
// // 2. TUXEDO 서비스를 호출한다.
|
||||
// // 3. tpurcode를 확인해서 commit/rollback 한다.
|
||||
// //-----------------------------------------------------------------
|
||||
// tc = tcf.getTuxedoConnection();
|
||||
//
|
||||
// int datasize = request.length;
|
||||
// tca = new TypedCArray(datasize);
|
||||
// tca.carray = request;
|
||||
// if(isSync) {
|
||||
// reply = tc.tpcall(svcName, tca, ApplicationToMonitorInterface.TPNOTRAN);
|
||||
// tca = (TypedCArray)reply.getReplyBuffer();
|
||||
// if(tm != null) tm.commit();
|
||||
// return (tca.carray);
|
||||
// }
|
||||
// else {
|
||||
// tc.tpacall(svcName, tca, ApplicationToMonitorInterface.TPNOREPLY);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// } catch (NamingException ne) {
|
||||
// try { if(tm != null) tm.rollback(); } catch(Exception e) { }
|
||||
// ne.printStackTrace();
|
||||
// throw new TPException(TPException.TPENOENT,
|
||||
// "Could not get TuxedoConnectionFactory : " + ne);
|
||||
// } catch (TPReplyException tre) {
|
||||
// try { if(tm != null) tm.rollback(); } catch(Exception e) { }
|
||||
// tperrno = tre.gettperrno();
|
||||
// tre.printStackTrace();
|
||||
// throw tre;
|
||||
// } catch (TPException te) {
|
||||
// try { if(tm != null) tm.rollback(); } catch(Exception e) { }
|
||||
// tperrno = te.gettperrno();
|
||||
// te.printStackTrace();
|
||||
// throw te;
|
||||
// } catch (Exception ex) {
|
||||
// try { if(tm != null) tm.rollback(); } catch(Exception e) { }
|
||||
// ex.printStackTrace();
|
||||
// throw new TPException(TPException.TPESYSTEM, "Exception: " + ex);
|
||||
// }
|
||||
// finally {
|
||||
// // Closing the association with Tuxedo
|
||||
// if(tc != null) tc.tpterm();
|
||||
//
|
||||
// if(tx != null) {
|
||||
// try {
|
||||
// TxHelper.getTransactionManager().resume(tx);
|
||||
// } catch(Exception e) {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,250 @@
|
||||
package com.eactive.eai.control;
|
||||
//package com.eactive.eai.control;
|
||||
//
|
||||
//import javax.naming.Context;
|
||||
//import javax.naming.InitialContext;
|
||||
//import javax.naming.NamingException;
|
||||
//import javax.transaction.Transaction;
|
||||
//import javax.transaction.TransactionManager;
|
||||
//
|
||||
//import weblogic.transaction.TxHelper;
|
||||
//import weblogic.wtc.gwt.TuxedoConnection;
|
||||
//import weblogic.wtc.gwt.TuxedoConnectionFactory;
|
||||
//import weblogic.wtc.jatmi.ApplicationToMonitorInterface;
|
||||
//import weblogic.wtc.jatmi.CallDescriptor;
|
||||
//import weblogic.wtc.jatmi.Reply;
|
||||
//import weblogic.wtc.jatmi.TPException;
|
||||
//import weblogic.wtc.jatmi.TPReplyException;
|
||||
//import weblogic.wtc.jatmi.TypedFML;
|
||||
//import weblogic.wtc.jatmi.TypedFML32;
|
||||
//
|
||||
//public class TuxedoFmlSender {
|
||||
// private static final long serialVersionUID = 1L;
|
||||
// private int tpurcode;
|
||||
// private int tperrno;
|
||||
//
|
||||
//
|
||||
// public int gettpurcode() {
|
||||
// return tpurcode;
|
||||
// }
|
||||
//
|
||||
// public int gettperrno() {
|
||||
// return tperrno;
|
||||
// }
|
||||
//
|
||||
// public TypedFML32 service(String svcName, boolean isSync, boolean isXA, TypedFML32 infml) throws Exception
|
||||
// {
|
||||
//
|
||||
// Context ctx = null;
|
||||
// TuxedoConnectionFactory tcf = null;
|
||||
// TuxedoConnection tc = null;
|
||||
// Reply reply;
|
||||
//
|
||||
// Transaction tx = null;
|
||||
// TransactionManager tm = null;
|
||||
//
|
||||
// try {
|
||||
// tx = TxHelper.getTransactionManager().suspend();
|
||||
//
|
||||
// ctx = new InitialContext();
|
||||
//
|
||||
// //-----------------------------------------------------------------
|
||||
// // 0. TX Begin if XA
|
||||
// //-----------------------------------------------------------------
|
||||
// if(isXA) {
|
||||
// tm = (javax.transaction.TransactionManager)
|
||||
// ctx.lookup("javax.transaction.TransactionManager");
|
||||
// tm.begin();
|
||||
// }
|
||||
//
|
||||
// //-----------------------------------------------------------------
|
||||
// // 1. Tuxedo의 TuxedoConnectionFactory를 생성한다.
|
||||
// //-----------------------------------------------------------------
|
||||
// tcf = (TuxedoConnectionFactory) ctx.lookup("tuxedo.services.TuxedoConnection");
|
||||
// tc = tcf.getTuxedoConnection();
|
||||
//
|
||||
// //-----------------------------------------------------------------
|
||||
// // 2. TUXEDO 서비스를 호출한다.
|
||||
// //-----------------------------------------------------------------
|
||||
// if(isSync) {
|
||||
// if(isXA) {
|
||||
// reply = tc.tpcall(svcName, infml, ApplicationToMonitorInterface.TPTRAN);
|
||||
// }
|
||||
// else {
|
||||
// reply = tc.tpcall(svcName, infml, ApplicationToMonitorInterface.TPNOTRAN);
|
||||
// }
|
||||
// tpurcode = reply.gettpurcode();
|
||||
// if(isXA) {
|
||||
// if(tpurcode < 0) {
|
||||
// tm.rollback();
|
||||
// }
|
||||
// else {
|
||||
// tm.commit();
|
||||
// }
|
||||
// }
|
||||
// //-----------------------------------------------------------------
|
||||
// // 3. tpurcode를 확인해서 commit/rollback 한다.
|
||||
// //-----------------------------------------------------------------
|
||||
//
|
||||
// return (TypedFML32)reply.getReplyBuffer();
|
||||
// }
|
||||
// else {
|
||||
// tc.tpacall(svcName, infml, ApplicationToMonitorInterface.TPNOREPLY);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// } catch (NamingException ne) {
|
||||
// try { if(tm != null) tm.rollback(); } catch(Exception e) { }
|
||||
// ne.printStackTrace();
|
||||
// throw new TPException(TPException.TPENOENT,
|
||||
// "Could not get TuxedoConnectionFactory : " + ne);
|
||||
// } catch (TPReplyException tre) {
|
||||
// try { if(tm != null) tm.rollback(); } catch(Exception e) { }
|
||||
// tperrno = tre.gettperrno();
|
||||
// tre.printStackTrace();
|
||||
// throw tre;
|
||||
// } catch (TPException te) {
|
||||
// try { if(tm != null) tm.rollback(); } catch(Exception e) { }
|
||||
// tperrno = te.gettperrno();
|
||||
// te.printStackTrace();
|
||||
// throw te;
|
||||
// } catch (Exception ex) {
|
||||
// try { if(tm != null) tm.rollback(); } catch(Exception e) { }
|
||||
// ex.printStackTrace();
|
||||
// throw new TPException(TPException.TPESYSTEM, "Exception: " + ex);
|
||||
// }
|
||||
// finally {
|
||||
// // Closing the association with Tuxedo
|
||||
// if(tc != null) tc.tpterm();
|
||||
//
|
||||
// if(tx!=null) {
|
||||
// try {
|
||||
// TxHelper.getTransactionManager().resume(tx);
|
||||
// } catch(Exception e) {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public TypedFML32 TPFWDSVCXA(TypedFML32 infml) throws Exception
|
||||
// {
|
||||
//
|
||||
// Context ctx = null;
|
||||
// TuxedoConnectionFactory tcf;
|
||||
// TuxedoConnection tuxConnection;
|
||||
// Reply reply;
|
||||
//
|
||||
// Transaction tx = null;
|
||||
//
|
||||
// TransactionManager tm = null;
|
||||
// try {
|
||||
// tx = TxHelper.getTransactionManager().suspend();
|
||||
//
|
||||
// ctx = new InitialContext();
|
||||
//
|
||||
// //-----------------------------------------------------------------
|
||||
// // 1. Tuxedo의 TuxedoConnectionFactory를 생성한다.
|
||||
// //-----------------------------------------------------------------
|
||||
// tcf = (TuxedoConnectionFactory) ctx.lookup("tuxedo.services.TuxedoConnection");
|
||||
// tuxConnection = tcf.getTuxedoConnection();
|
||||
//
|
||||
// //-----------------------------------------------------------------
|
||||
// // 2. TUXEDO 서비스를 호출한다.
|
||||
// //-----------------------------------------------------------------
|
||||
// reply = tuxConnection.tpcall("mnEaicomn_ms", infml, ApplicationToMonitorInterface.TPNOTRAN);
|
||||
// tuxConnection.tpterm();
|
||||
// //-----------------------------------------------------------------
|
||||
// // 3. tpurcode를 확인해서 commit/rollback 한다.
|
||||
// //-----------------------------------------------------------------
|
||||
// tpurcode = reply.gettpurcode();
|
||||
////System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
|
||||
////System.out.println("TuxedoFmlSender] TPFWDSVCXA tpurcode["+tpurcode+"]");
|
||||
////System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
|
||||
//
|
||||
// return (TypedFML32)reply.getReplyBuffer();
|
||||
// } catch (NamingException ne) {
|
||||
// ne.printStackTrace();
|
||||
// throw new TPException(TPException.TPENOENT,
|
||||
// "Could not get TuxedoConnectionFactory : " + ne);
|
||||
// } catch (TPReplyException tre) {
|
||||
// tperrno = tre.gettperrno();
|
||||
// tre.printStackTrace();
|
||||
// throw tre;
|
||||
// } catch (TPException te) {
|
||||
// tperrno = te.gettperrno();
|
||||
// te.printStackTrace();
|
||||
// throw te;
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// throw new TPException(TPException.TPESYSTEM, "Exception: " + ex);
|
||||
// }
|
||||
// finally {
|
||||
// if(tx!=null) {
|
||||
// try {
|
||||
// TxHelper.getTransactionManager().resume(tx);
|
||||
// } catch(Exception e) {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public TypedFML32 TPFWDSVCNXA(TypedFML32 infml) throws Exception
|
||||
// {
|
||||
// Context ctx = null;
|
||||
// TuxedoConnectionFactory tcf;
|
||||
// TuxedoConnection tuxConnection;
|
||||
// Reply reply;
|
||||
//
|
||||
// Transaction tx = null;
|
||||
//
|
||||
// TransactionManager tm = null;
|
||||
// try {
|
||||
// tx = TxHelper.getTransactionManager().suspend();
|
||||
//
|
||||
// ctx = new InitialContext();
|
||||
//
|
||||
// //-----------------------------------------------------------------
|
||||
// // 1. Tuxedo의 TuxedoConnectionFactory를 생성한다.
|
||||
// //-----------------------------------------------------------------
|
||||
// tcf = (TuxedoConnectionFactory) ctx.lookup("tuxedo.services.TuxedoConnection");
|
||||
// tuxConnection = tcf.getTuxedoConnection();
|
||||
//
|
||||
// //-----------------------------------------------------------------
|
||||
// // 2. TUXEDO 서비스를 호출한다.
|
||||
// //-----------------------------------------------------------------
|
||||
// reply = tuxConnection.tpcall("mnEaicomn_ss", infml, ApplicationToMonitorInterface.TPNOTRAN);
|
||||
// tuxConnection.tpterm();
|
||||
// //-----------------------------------------------------------------
|
||||
// // 3. tpurcode를 확인해서 commit/rollback 한다.
|
||||
// //-----------------------------------------------------------------
|
||||
// tpurcode = reply.gettpurcode();
|
||||
////System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
|
||||
////System.out.println("TuxedoFmlSender] TPFWDSVCNXA tpurcode["+tpurcode+"]");
|
||||
////System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
|
||||
// return (TypedFML32)reply.getReplyBuffer();
|
||||
// } catch (NamingException ne) {
|
||||
// ne.printStackTrace();
|
||||
// throw new TPException(TPException.TPENOENT,
|
||||
// "Could not get TuxedoConnectionFactory : " + ne);
|
||||
// } catch (TPReplyException tre) {
|
||||
// tperrno = tre.gettperrno();
|
||||
// tre.printStackTrace();
|
||||
// throw tre;
|
||||
// } catch (TPException te) {
|
||||
// tperrno = te.gettperrno();
|
||||
// te.printStackTrace();
|
||||
// throw te;
|
||||
// } catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// throw new TPException(TPException.TPESYSTEM, "Exception: " + ex);
|
||||
// }
|
||||
// finally {
|
||||
// if(tx!=null) {
|
||||
// try {
|
||||
// TxHelper.getTransactionManager().resume(tx);
|
||||
// } catch(Exception e) {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.eactive.eai.control;
|
||||
//package com.eactive.eai.control;
|
||||
//
|
||||
//import javax.naming.Context;
|
||||
//import javax.naming.InitialContext;
|
||||
//import javax.naming.NamingException;
|
||||
//import javax.transaction.Transaction;
|
||||
//import javax.transaction.TransactionManager;
|
||||
//import weblogic.transaction.TxHelper;
|
||||
//
|
||||
//import weblogic.wtc.jatmi.TPException;
|
||||
//import weblogic.wtc.jatmi.TPReplyException;
|
||||
//import weblogic.wtc.jatmi.Reply;
|
||||
//import weblogic.wtc.jatmi.TypedString;
|
||||
//import weblogic.wtc.gwt.TuxedoConnectionFactory;
|
||||
//import weblogic.wtc.gwt.TuxedoConnection;
|
||||
//import weblogic.wtc.jatmi.ApplicationToMonitorInterface;
|
||||
//
|
||||
//public class TuxedoStringSender {
|
||||
// private static final long serialVersionUID = 1L;
|
||||
// private int tpurcode;
|
||||
// private int tperrno;
|
||||
//
|
||||
// public int gettpurcode() {
|
||||
// return tpurcode;
|
||||
// }
|
||||
//
|
||||
// public int gettperrno() {
|
||||
// return tperrno;
|
||||
// }
|
||||
//
|
||||
// public byte[] service(String svcName, boolean isSync, boolean isXA, byte[] request)
|
||||
// throws TPException, TPReplyException {
|
||||
// Context ctx;
|
||||
// TuxedoConnectionFactory tcf = null;
|
||||
// TuxedoConnection tc = null;
|
||||
// TypedString tString;
|
||||
// Reply reply;
|
||||
//
|
||||
// //-----------------------------------------------------------------
|
||||
// // 1. Tuxedo의 TuxedoConnectionFactory를 생성한다.
|
||||
// //-----------------------------------------------------------------
|
||||
// try {
|
||||
// ctx = new InitialContext();
|
||||
// tcf = (TuxedoConnectionFactory)ctx.lookup("tuxedo.services.TuxedoConnection");
|
||||
// } catch (NamingException ne) {
|
||||
// // Could not get the tuxedo object, throw TPENOENT
|
||||
// throw new TPException(TPException.TPENOENT,
|
||||
// "Could not get TuxedoConnectionFactory : " + ne);
|
||||
// }
|
||||
//
|
||||
// Transaction tx = null;
|
||||
//
|
||||
// TransactionManager tm = null;
|
||||
// try {
|
||||
// //-----------------------------------------------------------------
|
||||
// // 1. TX Begin.
|
||||
// //-----------------------------------------------------------------
|
||||
// // Suspend Orginal transaction
|
||||
// tx = TxHelper.getTransactionManager().suspend();
|
||||
// if(isXA) {
|
||||
// tm = (javax.transaction.TransactionManager)
|
||||
// ctx.lookup("javax.transaction.TransactionManager");
|
||||
// tm.begin();
|
||||
// }
|
||||
//
|
||||
// //-----------------------------------------------------------------
|
||||
// // 2. TUXEDO 서비스를 호출한다.
|
||||
// // 3. tpurcode를 확인해서 commit/rollback 한다.
|
||||
// //-----------------------------------------------------------------
|
||||
// tc = tcf.getTuxedoConnection();
|
||||
//
|
||||
// tString = new TypedString(new String(request));
|
||||
// if(isSync) {
|
||||
// reply = tc.tpcall(svcName, tString, ApplicationToMonitorInterface.TPNOTRAN);
|
||||
// tString = (TypedString)reply.getReplyBuffer();
|
||||
// if(tm != null) tm.commit();
|
||||
// String sMsg = tString.getStringBuffer().toString();
|
||||
// return (sMsg.getBytes());
|
||||
// }
|
||||
// else {
|
||||
// tc.tpacall(svcName, tString, ApplicationToMonitorInterface.TPNOREPLY);
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// } catch (NamingException ne) {
|
||||
// try { if(tm != null) tm.rollback(); } catch(Exception e) { }
|
||||
// ne.printStackTrace();
|
||||
// throw new TPException(TPException.TPENOENT,
|
||||
// "Could not get TuxedoConnectionFactory : " + ne);
|
||||
// } catch (TPReplyException tre) {
|
||||
// try { if(tm != null) tm.rollback(); } catch(Exception e) { }
|
||||
// tperrno = tre.gettperrno();
|
||||
// tre.printStackTrace();
|
||||
// throw tre;
|
||||
// } catch (TPException te) {
|
||||
// try { if(tm != null) tm.rollback(); } catch(Exception e) { }
|
||||
// tperrno = te.gettperrno();
|
||||
// te.printStackTrace();
|
||||
// throw te;
|
||||
// } catch (Exception ex) {
|
||||
// try { if(tm != null) tm.rollback(); } catch(Exception e) { }
|
||||
// ex.printStackTrace();
|
||||
// throw new TPException(TPException.TPESYSTEM, "Exception: " + ex);
|
||||
// }
|
||||
// finally {
|
||||
// // Closing the association with Tuxedo
|
||||
// if(tc != null) tc.tpterm();
|
||||
//
|
||||
// if(tx != null) {
|
||||
// try {
|
||||
// TxHelper.getTransactionManager().resume(tx);
|
||||
// } catch(Exception e) {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.eactive.eai.adapter.ElinkAdapter;
|
||||
import com.eactive.eai.adapter.ElinkAdapterFactory;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
public class WebSocketSender {
|
||||
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
static final String SOCK_CONTROL_ERROR = "RECEAIOSC001";
|
||||
|
||||
public static byte[] callService(String adapterGroupName, Properties prop, Object message, Properties tempProp) throws java.lang.Exception
|
||||
{
|
||||
byte[] resBytes;
|
||||
try {
|
||||
//new socket 과 old socket을 분기 하기 위해서
|
||||
String protocol = (String)prop.getProperty("protocol");
|
||||
|
||||
ElinkAdapterFactory factory = ElinkAdapterFactory.newInstance();
|
||||
ElinkAdapter adapter = null;
|
||||
// if(protocol == null || protocol.trim().length() ==0) {
|
||||
// adapter = factory.getWLIAdapter(com.eactive.eai.adapter.Keys.TYPE_NET);
|
||||
// }
|
||||
// else {
|
||||
adapter = factory.getElinkAdapter(com.eactive.eai.adapter.Keys.TYPE_WSK);
|
||||
// }
|
||||
if(prop==null) {
|
||||
prop = new Properties();
|
||||
}
|
||||
if(tempProp==null) {
|
||||
tempProp = new Properties();
|
||||
}
|
||||
if(tempProp.getProperty("ADAPTER_GROUP_NAME") == null) {
|
||||
tempProp.setProperty("ADAPTER_GROUP_NAME", adapterGroupName);
|
||||
}
|
||||
resBytes = (byte[])adapter.callService(adapterGroupName, prop, message, tempProp);
|
||||
} catch(Exception e) {
|
||||
if (logger.isError()) logger.error(e.getMessage(),e);
|
||||
//throw new Exception(ExceptionUtil.getErrorCode(e, SOCK_CONTROL_ERROR));
|
||||
throw e;
|
||||
}
|
||||
return resBytes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.eactive.eai.control;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import com.eactive.eai.adapter.ElinkAdapter;
|
||||
import com.eactive.eai.adapter.ElinkAdapterFactory;
|
||||
|
||||
public class WebTSender {
|
||||
|
||||
static final String WEBT_CONTROL_ERROR = "RECEAIOWC001";
|
||||
|
||||
public static byte[] callService(String adapterGroupName, Properties prop, Object message, Properties tempProp) throws java.lang.Exception
|
||||
{
|
||||
byte[] resBytes;
|
||||
try {
|
||||
//new socket 과 old socket을 분기 하기 위해서
|
||||
String protocol = (String)prop.getProperty("protocol");
|
||||
|
||||
|
||||
ElinkAdapterFactory factory = ElinkAdapterFactory.newInstance();
|
||||
ElinkAdapter adapter = null;
|
||||
adapter = factory.getElinkAdapter(com.eactive.eai.adapter.Keys.TYPE_WBT);
|
||||
if(prop==null) {
|
||||
prop = new Properties();
|
||||
}
|
||||
if(prop.getProperty("ADAPTER_GROUP_NAME") == null) {
|
||||
prop.setProperty("ADAPTER_GROUP_NAME", adapterGroupName);
|
||||
}
|
||||
resBytes = (byte[])adapter.callService(adapterGroupName, prop, message, tempProp);
|
||||
} catch(Exception e) {
|
||||
throw e;
|
||||
}
|
||||
return resBytes;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user