package eu.dnetlib.functionality.alert.alerter.atom;

import javax.servlet.ServletContext;

import org.springframework.web.context.support.WebApplicationContextUtils;

/**
 * This is an utility class used for retrieving an Atom alerter instance within the context of a servlet or a JSP page.
 * @author thanos
 * @see eu.dnetlib.functionality.alert.alerter.atom.AtomAlerter
 *
 */
public class AtomAlerterContextUtils {
	/**
	 * Retrieve an Atom alerter instance.
	 * @param context the servlet context within which the Atom alerter instance should be retrieved 
	 * @return an Atom alerter instance within the servlet context specified
	 */
	public static AtomAlerter getAtomAlerter(final ServletContext context) {
		return (AtomAlerter) WebApplicationContextUtils.getWebApplicationContext(context).getBean("atomAlerter");
	}	
}
