/**
 * (c) 2006 Exadel Inc. 
 */
package org.richfaces.utils;

import javax.faces.FacesException;

import org.ajax4jsf.renderkit.RendererBase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author Maksim Kaszynski
 *
 */
public class TemplateLoader {
	
	private static final Log log = LogFactory.getLog(TemplateLoader.class);
	
	public static RendererBase loadTemplate(String className) {
		RendererBase template = null;
		try{
			template = (RendererBase)Class.forName(className).newInstance();
		} catch (ClassNotFoundException e) {
			log.error("class not found: " + className );
			throw new FacesException(e);
		} catch (Exception e) {
			log.error("exception in loading class : " + className);
			throw new FacesException(e);
		}
		return template;
	}

}
