001package es.ucm.fdi.gaia.jcolibri.cbraplications;
002
003import es.ucm.fdi.gaia.jcolibri.cbrcore.CBRCaseBase;
004import es.ucm.fdi.gaia.jcolibri.cbrcore.CBRQuery;
005import es.ucm.fdi.gaia.jcolibri.exception.ExecutionException;
006
007/**
008 * Defines the method of an standard CBR application.
009 * It is composed by:
010 * <ul>
011 * <li>A configuration method to set up the application.
012 * <li>A preCycle that loads cases and prepares the application to run.
013 * <li>The cycle method that runs a CBR step using the given query.
014 * <li>A postCycle in charge of finishing the application.
015 * </ul>
016 * 
017 * @author Juan A. Recio-GarcĂ­a
018 *
019 */
020public interface StandardCBRApplication
021{
022        /**
023         * Configures the application: case base, connectors, etc.
024         * @throws ExecutionException
025         */
026    void configure() throws ExecutionException;
027
028    /**
029     * Runs the precyle where typically cases are read and organized into a case base. 
030     * @return The created case base with the cases in the storage.
031     * @throws ExecutionException
032     */
033    CBRCaseBase preCycle() throws ExecutionException;
034
035    /**
036     * Executes a CBR cycle with the given query.
037     * @throws ExecutionException
038     */
039    void cycle(CBRQuery query) throws ExecutionException;
040
041    /**
042     * Runs the code to shutdown the application. Typically it closes the connector.
043     * @throws ExecutionException
044     */
045    void postCycle() throws ExecutionException;
046}