/*
 * @(#)SftpDeleteFileEvent.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.sftp.events;

import com.jscape.inet.sftp.Sftp;

/**
 * This event is fired when directory is deleted from server.
 */
public class SftpDeleteFileEvent
        extends SftpEvent {

    private final String file;
    private final String path;

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

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

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

    /**
     * The "backwards dispatching" support.
     *
     * @param listener the event listener
     */
    public void accept(SftpListener listener) {
        listener.deleteFile(this);
    }
}
