001 /* PAVLOV -- Multiple Choice Study System 002 * Copyright (C) 2000 - 2004 T.J. Willis 003 * 004 * This program is free software; you can redistribute it and/or 005 * modify it under the terms of the GNU General Public License 006 * as published by the Free Software Foundation; either version 2 007 * of the License, or (at your option) any later version. 008 * 009 * This program is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 * GNU General Public License for more details. 013 * 014 * You should have received a copy of the GNU General Public License 015 * along with this program; if not, write to the Free Software 016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. 017 * 018 * $Header: /cvsroot/pavlov/net/sourceforge/pavlov/user/UserFile.java,v 1.2 2004/05/19 03:12:14 tj_willis Exp $ 019 */ 020 package net.sourceforge.pavlov.user; 021 022 import java.io.*; 023 import org.xml.sax.*; 024 import org.xml.sax.helpers.*; 025 import net.sourceforge.pavlov.zipUtilities.XMLFileFilter; 026 027 028 /** 029 * Describe interface <code>UserFile</code> here. 030 * 031 * @author <a href="mailto:tj_willis@users.sourceforge.net"> T.J. Willis </a> 032 * @version 1.0 033 */ 034 public interface UserFile 035 { 036 037 /** 038 * Returns true if the file exists. 039 * 040 * @return a <code>boolean</code> value 041 */ 042 boolean exists(); 043 /** 044 * Returns true if the file is readable. 045 * 046 * @return a <code>boolean</code> value 047 */ 048 boolean canRead(); 049 /** 050 * Returns true if the file is writable. 051 * 052 * @return a <code>boolean</code> value 053 */ 054 boolean canWrite(); 055 /** 056 * Save the user to the file. 057 * 058 * @param user an <code>User</code> value 059 * @exception FileNotFoundException if an error occurs 060 * @exception IOException if an error occurs 061 */ 062 public void save(User user) throws FileNotFoundException, IOException; 063 /** 064 * Reads the user from the file if it exists and if the password is correct. 065 * 066 * @param password a <code>String</code> value 067 * @return an <code>User</code> value 068 * @exception SAXException if an error occurs 069 * @exception FileNotFoundException if an error occurs 070 * @exception IOException if an error occurs 071 */ 072 User read(String password) throws SAXException, FileNotFoundException, IOException; 073 074 075 076 077 }