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