1 /* 2 * $HeadURL: $ 3 * $Date: $ 4 * $Revision: $ 5 * $Author: $ 6 * 7 * Copyright (c) 2005 MindTree Consulting Ltd. 8 * 9 * This file is part of Insight. 10 * 11 * Insight is free software: you can redistribute it and/or modify it under the 12 * terms of the GNU General Public License as published by the Free Software 13 * Foundation, either version 3 of the License, or (at your option) any later 14 * version. 15 * 16 * Insight is distributed in the hope that it will be useful, but 17 * WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 19 * Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License along with 22 * Insight. If not, see <http://www.gnu.org/licenses/>. 23 */ 24 25 package com.mindtree.techworks.insight.preferences; 26 27 import java.util.Collection; 28 import java.util.List; 29 30 import com.mindtree.techworks.insight.preferences.model.Preference; 31 32 33 /** 34 * <p> 35 * This is an interface used by the PreferenceManager for retrieving and 36 * storing data into the data-store, which could be an XML file, a properties 37 * file or a database. The actual datastore used and format of data depends on 38 * the implementation of this interface. 39 * </p> 40 * <p> 41 * The lowest unit of transfer between the PreferenceManager and a data-store is 42 * a Preference.</p> 43 * 44 * @see com.mindtree.techworks.insight.preferences.PreferenceManager PreferenceManager 45 * @see com.mindtree.techworks.insight.preferences.model.Preference Preference 46 * 47 * @author Bindul Bhowmik 48 * @version $Revision: 27 $ $Date: 2007-12-16 04:58:03 -0700 (Sun, 16 Dec 2007) $ 49 * 50 */ 51 public interface PreferenceDataHandler { 52 53 /** 54 * Returns a list of names of all Preferences currently for the instance 55 * of Insight from the store. 56 * 57 * @return A collection of Preference Names 58 */ 59 public Collection getPreferenceNameList(); 60 61 /** 62 * Returns all the preferences from the store. The implications of using this 63 * method will largely depend on the store, and the Handler implementation. 64 * @return A collection of Preferences 65 */ 66 public Collection getAllPreferences(); 67 68 /** 69 * Loads a particular Preference using the Preference Id passed. 70 * 71 * @param preferenceId The id of the Preference to be loaded 72 * 73 * @return The preference for the id passed, or null. 74 */ 75 public Preference getPreference(String preferenceId); 76 77 /** 78 * Saves the passed preferences to the store. 79 * 80 * @param preferences The Preferences to store. 81 * @throws PreferenceHandlerStoreException 82 */ 83 public void savePreferences(List preferences) throws PreferenceHandlerStoreException; 84 85 }