package com.eactive.eai.common.routing; 



/** 
* 1. 기능 : Process 초기화 하기 위한 Factory Class
* 2. 처리 개요 : 
*     - 초기화 된 Process 인스턴스를 HashMap 객체에 담는다.
*     - 해당 어댑터의 Process 인스턴스를 반환 한다.
* 3. 주의사항 
*
* @author  : 
* @version : v 1.0.0
* @see : Process
* @since   : 
*/
public class ProcessFactory 
{ 
//	private static final String BaseFCProcess   = "com.eactive.eai.flowcontroller.BaseFCProcess";
//	private static final String B2BFCProcess    = "com.eactive.eai.flowcontroller.B2BFCProcess";
//	private static final String C2RFCProcess    = "com.eactive.eai.flowcontroller.C2RFCProcess";
//
//	
//	private static final String SocketProcess   = "com.eactive.eai.outbound.SocketProcess";
//	private static final String HTTPProcess     = "com.eactive.eai.outbound.HTTPProcess";
//	private static final String SIMHTTPProcess  = "com.eactive.eai.outbound.SIMHTTPProcess";
//	private static final String LoopBackProcess = "com.eactive.eai.outbound.LoopBackProcess";
	
    /**
     * ProcessFactory instance
     */
    private static final ProcessFactory factory = new ProcessFactory();
    
    /** 
    * 1. 기능 :  Default Constructor
    * 2. 처리 개요 : 
    *     - 타입 별 Process instance를 어댑터 HashMap에 담는다.
    * 3. 주의사항 
    *
    **/
    private ProcessFactory() {
    }
    
    /** 
    * 1. 기능 :  ProcessFactory Object를 반환하는 getter method
    * 2. 처리 개요 : ProcessFactory Object를 반환한다.
    * 3. 주의사항 
    *
    * @return   ProcessFactory object
    **/
    public static ProcessFactory newInstance() {
        return factory;
    }
    
    /** 
    * 1. 기능 :  해당 프로세스의 Process Object를 반환
    * 2. 처리 개요 : 
    *     - Process instance HashMap으로 부터 해당 어댑터의 Process Object를 반환 한다.
    * 3. 주의사항 
    *
    * @param    serviceURI URI
    * @return   Process object
    **/
    public Process getProcess(String serviceURI)  throws Exception  {
    	if(serviceURI==null) return null;        
        Process process = null;
        
//        if(serviceURI.equals(BaseFCProcess)) {
//            process = new com.eactive.eai.flowcontroller.BaseFCProcess();
//        } else if(serviceURI.equals(B2BFCProcess)) {
//        	process = new com.eactive.eai.flowcontroller.B2BFCProcess();
//        } else if(serviceURI.equals(C2RFCProcess)) {
//        	process = new com.eactive.eai.flowcontroller.C2RFCProcess();
//        } else if(serviceURI.equals(SocketProcess)) {
//        	process = new com.eactive.eai.outbound.SocketProcess();
//        } else if(serviceURI.equals(HTTPProcess)) {
//        	process = new com.eactive.eai.outbound.HTTPProcess();
//        } else if(serviceURI.equals(SIMHTTPProcess)) {
//        	process = new com.eactive.eai.outbound.SIMHTTPProcess();
//        } else if(serviceURI.equals(LoopBackProcess)) {
//        	process = new com.eactive.eai.outbound.LoopBackProcess();
//        }
        if(process==null) {
            throw new RuntimeException("Process not found. - "+serviceURI);
        }
        return process;
    }
    

} 

