/* ----------------------------------------
 * Origin  : GFI INFORMATIQUE 
 * Project : CDPP Propagation Tool 
 * ----------------------------------------
 * History 
 * Version : 01/05/2015 : SCA : V2.1
 * ----------------------------------------
 */
package fr.tlse.irap.server;

import org.apache.log4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class ApplicationContextHolder implements ApplicationContextAware {

	/** Spring Context directly injected by Spring */
	private static ApplicationContext context = null;
	private static final Logger logger = Logger.getLogger(ApplicationContextHolder.class);
	
	/**
	 * Method ApplicationContextAware, automatically called by the constructor
	 */
	public void setApplicationContext(ApplicationContext ctx) throws BeansException {
		context = ctx;
		logger.info("ApplicationContextHolder IS LOADED");
	}

	/**
	 * Static method to retrieve the context
	 */
	public static ApplicationContext getContext() {
		return context;
	}
	
}
