001/*
002 * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
003 * 
004 * http://www.izforge.com/izpack/
005 * http://developer.berlios.de/projects/izpack/
006 * 
007 * Copyright 2004 Klaus Bartz
008 * 
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *     http://www.apache.org/licenses/LICENSE-2.0
014 *     
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 */
021
022package com.izforge.izpack.event;
023
024import java.io.File;
025import java.util.List;
026
027import com.izforge.izpack.util.AbstractUIProgressHandler;
028
029/**
030 * <p>
031 * Implementations of this class are used to handle customizing uninstallation. The defined methods
032 * are called from the destroyer at different, well defined points of uninstallation.
033 * </p>
034 * 
035 * @author Klaus Bartz
036 * 
037 */
038public interface UninstallerListener
039{
040
041    // ------------------------------------------------------------------------
042    // Constant Definitions
043    // ------------------------------------------------------------------------
044    public static final int BEFORE_DELETION = 1;
045
046    public static final int AFTER_DELETION = 2;
047
048    public static final int BEFORE_DELETE = 3;
049
050    public static final int AFTER_DELETE = 4;
051
052    /**
053     * This method will be called from the destroyer before the given files will be deleted.
054     * 
055     * @param files all files which should be deleted
056     * @param handler a handler to the current used UIProgressHandler
057     * @throws Exception
058     */
059    void beforeDeletion(List files, AbstractUIProgressHandler handler) throws Exception;
060
061    /**
062     * Returns true if this listener would be informed at every delete operation, else false. If it
063     * is true, the listener will be called two times (before and after) of every action. Handle
064     * carefully, else performance problems are possible.
065     * 
066     * @return true if this listener would be informed at every delete operation, else false
067     */
068    boolean isFileListener();
069
070    /**
071     * This method will be called from the destroyer before the given file will be deleted.
072     * 
073     * @param file file which should be deleted
074     * @param handler a handler to the current used UIProgressHandler
075     * @throws Exception
076     */
077    void beforeDelete(File file, AbstractUIProgressHandler handler) throws Exception;
078
079    /**
080     * This method will be called from the destroyer after the given file was deleted.
081     * 
082     * @param file file which was just deleted
083     * @param handler a handler to the current used UIProgressHandler
084     * @throws Exception
085     */
086    void afterDelete(File file, AbstractUIProgressHandler handler) throws Exception;
087
088    /**
089     * This method will be called from the destroyer after the given files are deleted.
090     * 
091     * @param files all files which where deleted
092     * @param handler a handler to the current used UIProgressHandler
093     * @throws Exception
094     */
095    void afterDeletion(List files, AbstractUIProgressHandler handler) throws Exception;
096
097}