package com.capgemini.reports.execution.posting;

import javax.jms.JMSException;
import javax.naming.NamingException;

import org.quartz.SchedulerException;

import com.capgemini.reports.execution.AbstractExecutionReport;

/** Strategy interface. Allows several behaviour when receiving a demand. */
public interface IPostingStrategy {

    /**
     * What to do when a request is received to perform a report.<br>
     * The operation can be any of the following:
     * <ul>
     * <li>Post the report immediately into the queue</li>
     * <li>Post a delayed job in Quartz, that will hold the report execution until later today, then send it to the queue</li>
     * <li>Register a scheduled report to be executed some time in the future.</li>
     * </ul>
     * 
     * @param report the report to perform
     * 
     * @throws SchedulerException if a scheduling operation goes boom
     * @throws JMSException if unable to post report in a JMS queue
     * @throws NamingException if unable to find the queue in JMS dictionary
     */
    void handleRequest(final AbstractExecutionReport<?, ?> report) throws SchedulerException, JMSException, NamingException;

}
