init
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user