/**
 * NotificationGeneratorFactory.java
 * Created Jul 3, 2008
 * Copyright (c) TANDBERG Television 2007-2008
 */
package com.tandbergtv.watchpoint.pmm.schedule.notify;

import com.tandbergtv.watchpoint.pmm.entities.DistributionSchedule;
import com.tandbergtv.watchpoint.pmm.entities.Planner;
import com.tandbergtv.watchpoint.pmm.entities.Schedule;

/**
 * Factory class for producing notification generators
 * 
 * @author Sahil Verma
 */
public class NotificationGeneratorFactory {
	
	protected NotificationGeneratorFactory() {
	}
	
	/**
	 * Returns a new instance of this factory
	 * 
	 * @return
	 */
	public static NotificationGeneratorFactory newInstance() {
		return new NotificationGeneratorFactory();
	}
	
	/**
	 * Returns the notification generator for the specified schedule
	 * 
	 * @param schedule
	 * @return
	 */
	public INotificationGenerator newGenerator(Schedule schedule) {
		if (schedule instanceof Planner)
			return new PlannerNotificationGenerator();
		else if (schedule instanceof DistributionSchedule)
			return new PitchNotificationGenerator();
		
		throw new UnsupportedOperationException(
			"Notification generator for schedule " + schedule + " " + schedule.getClass() + " is not available");
	}
}
