/*
 * @(#)SftpRenameFileEvent.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 SftpRenameFileEvent
        extends SftpEvent {

    private final String oldFile;
    private final String newFile;
    private final String path;

    /**
     * Creates a new SftpRenameFileEvent instance
     *
     * @param source  the event source
     * @param oldFile the old file name
     * @param newFile the new file name
     */
    public SftpRenameFileEvent(Sftp source, String oldFile, String newFile, String path) {
        super(source);

        this.oldFile = oldFile;
        this.newFile = newFile;
        this.path = path;
    }

    /**
     * Gets old file name
     *
     * @return old file name
     */
    public String getOldFile() {
        return this.oldFile;
    }

    /**
     * Gets new file name
     *
     * @return new file name
     */
    public String getNewFile() {
        return this.newFile;
    }

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

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