package com.cim.idm.mwmsextend.checkplan;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import com.cim.idm.framework.util.service.ServiceUtil;
import com.cim.idm.mwmsextend.checkplan.management.CheckPlanService;
import com.cim.idm.mwmsextend.checkplan.management.impl.CheckPlanServiceImpl;
@Component
public class CheckPlanServiceProxy implements ApplicationContextAware{
	
	private Log log = LogFactory.getLog(this.getClass());
	private static ApplicationContext ac ;
	
	@Override
	public void setApplicationContext(ApplicationContext context)
			throws BeansException {
		this.ac = context;
		log.debug(this.getClass().getSimpleName() +" Success Get ApplicationContext");
	}
	
	public static CheckPlanService getCheckPlanService(){
		try{
			return (CheckPlanService)ac.getBean(ServiceUtil.formatSimpleClassName(CheckPlanService.class));
		}catch(Throwable e){
			return (CheckPlanService)ac.getBean(CheckPlanServiceImpl.class);
		}
	}	
}