/*
 * @(#)FtpDeleteFileEvent.java
 *
 * Copyright (c) 2001-2004 JScape
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JScape. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JScape.
 */
package com.jscape.inet.ftp;

/**
 * Fired when a file is deleted from remote server
 */
public class FtpDeleteFileEvent
        extends FtpEvent {

    private String file;
    private String path;

    /**
     * Creates a new FtpDeleteFileEvent instance
     *
     * @param source the event source
     * @param file   the name of file deleted
     * @param path   the remote directory path this file was deleted from
     */
    public FtpDeleteFileEvent(Object source, String file, String path) {
        super(source);
        this.file = file;
        this.path = path;
    }

    /**
     * Gets remote directory path that this file was deleted from
     *
     * @return remote directory path
     */
    public String getPath() {
        return path;
    }

    /**
     * Method accept
     *
     * @see FtpEvent#accept(FtpListener)
     */
    public void accept(FtpListener listener) {
        if (listener != null) {
            listener.deleteFile(this);
        }
    }

    /**
     * Gets name of file deleted
     *
     * @return file name
     */
    public String getFile() {
        return file;
    }

    /**
     * Gets String representation of this event.
     *
     * @return event message
     */
    public String toString() {
        return "Deleted file " + file + " from remote directory path of " + path;
    }
}
