001 /** 002 * Connector.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 * 05/01/2007 008 */ 009 package jcolibri.cbrcore; 010 011 import java.util.Collection; 012 013 import jcolibri.exception.InitializingException; 014 015 /** 016 * Connector interface declares the methods required to access the cases stored in a persistence media. 017 * jCOLIBRI splits the managing of cases into persistence media and in-memory organization. This interface defines the access to de persistence and 018 * the CBRCaseBase interface defines the in-memory organization. Both interfaces are related as the CBRCaseBase manages the Connector. 019 * 020 * Implementations should read/write cases from Data Bases, Plain Text files, Ontologies, XML files, etc. 021 * 022 * @author Juan A. Recio-García 023 * @see jcolibri.cbrcore.CBRCaseBase 024 */ 025 public interface Connector { 026 027 028 /** 029 * Initialices the connector with the given XML file 030 * 031 * @param file XMl file with the settings 032 * @throws InitializingException 033 * Raised if the connector can not be initialezed. 034 */ 035 public void initFromXMLfile(java.net.URL file) throws InitializingException; 036 037 /** 038 * Cleanup any resource that the connector might be using, and suspends the 039 * service 040 * 041 */ 042 public void close(); 043 044 /** 045 * Stores given classes on the storage media 046 * 047 * @param cases 048 * List of cases 049 */ 050 public void storeCases(Collection<CBRCase> cases); 051 052 /** 053 * Deletes given cases for the storage media 054 * 055 * @param cases 056 * List of cases 057 */ 058 public void deleteCases(Collection<CBRCase> cases); 059 060 /** 061 * Returns max cases without any special consideration 062 * 063 * @return The list of retrieved cases 064 */ 065 public Collection<CBRCase> retrieveAllCases(); 066 067 /** 068 * Retrieves some cases depending on the filter. TODO. 069 */ 070 public Collection<CBRCase> retrieveSomeCases(CaseBaseFilter filter); 071 072 }