
package com.eactive.eai.adapter.http.client;

import java.util.Properties;

import com.eactive.eai.adapter.ElinkDefaultAdapter;
import com.eactive.eai.common.util.Logger;

public class HttpClientAdapterMain extends ElinkDefaultAdapter {
	private static Logger logger = Logger.getLogger(Logger.LOGGER_ADAPTER);

	public Object execute(Properties prop, Object message, Properties tempProp) throws Exception {
		String httpType = prop.getProperty(HttpClientAdapterServiceKey.HTTP_TYPE); // Http Type에 대한 class name
		String adapterGroupName = tempProp.getProperty(com.eactive.eai.adapter.Keys.OUT_ADAPTER_GROUP_NAME);
		String adapterName = tempProp.getProperty(com.eactive.eai.adapter.Keys.OUT_ADAPTER_NAME);
		HttpClientAdapterService service = HttpClientAdapterServiceFactory.createFactory(httpType, adapterGroupName, adapterName);
		if (service == null) {
			throw new Exception("Can not create HttpClientAdapterService httpType=" + httpType +" adapterName="+adapterName);
		}
		return service.execute(prop, message, tempProp);
	}
}
