001 /** 002 * iFish - An iRiver iHP jukebox database creation tool 003 * 004 * Copyright (C) 2009 Richard "Shred" Körber 005 * http://ifish.shredzone.org 006 * 007 * This program is free software: you can redistribute it and/or modify 008 * it under the terms of the GNU General Public License as published by 009 * the Free Software Foundation, either version 3 of the License, or 010 * (at your option) any later version. 011 * 012 * This program is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 015 * GNU General Public License for more details. 016 * 017 * You should have received a copy of the GNU General Public License 018 * along with this program. If not, see <http://www.gnu.org/licenses/>. 019 */ 020 package net.shredzone.ifish.db; 021 022 import java.io.*; 023 024 /** 025 * The StatusCallback will keep the implementing class informed about 026 * the current state of importing, synchronizing and exporting operations 027 * of NaviDb objects. 028 * 029 * @author Richard Körber <dev@shredzone.de> 030 * @version $Id: StatusCallback.java 291 2009-04-28 21:29:27Z shred $ 031 */ 032 public interface StatusCallback { 033 034 /** 035 * Set the maximum number of entries to be processed by the current 036 * action. If max is negative, then the maximum number is not known. 037 * Anyhow, during the operation setMaxEntries could be invoked multiple 038 * times. 039 * 040 * @param max Maximum number of entries. 041 */ 042 public void setMaxEntries( int max ); 043 044 /** 045 * Set the current entry number that is being processed by the current 046 * action. If the number is negative, then the current entry number is 047 * not known. 048 * 049 * @param index Current entry. 050 */ 051 public void setCurrentIndex( int index ); 052 053 /** 054 * Set the current entry that is being processed by the current 055 * action. If null is passed, then no Entry is currently processed, 056 * or there are no Entries being processed. 057 * 058 * @param entry Entry currently being processed, or null. 059 */ 060 public void setCurrentEntry( Entry entry ); 061 062 /** 063 * Set the current directory being processed. If there are no 064 * directories to be processed, dir will be null. Note that this 065 * method might be invoked several times, even without any changes. 066 * 067 * @param base Base directory 068 * @param dir Current directory 069 */ 070 public void setCurrentDir( File base, File dir ); 071 072 /*--------------------------------------------------------------------*/ 073 074 /** 075 * A default implementation of the StatusCallback class, which is 076 * just doing nothing. It is convenient to inherit from this class 077 * to implement own StatusCallbacks without needing to implement 078 * all the methods. 079 * <p> 080 * Method documentation see StatusCallback. 081 */ 082 public class DefaultStatusCallback implements StatusCallback { 083 @Override 084 public void setMaxEntries( int max ) {} 085 086 @Override 087 public void setCurrentIndex( int index ) {} 088 089 @Override 090 public void setCurrentEntry( Entry entry ) {} 091 092 @Override 093 public void setCurrentDir( File base, File dir ) {} 094 } 095 096 }