/*
 * @(#)FtpDeleteDirEvent.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 directory is deleted on the remote server.
 */
public class FtpDeleteDirEvent
        extends FtpEvent {

    private String dir;
    private String path;

    /**
     * Creates a new FtpDeleteDirEvent instance
     *
     * @param source the event source
     * @param dir    the directory deleted
     * @param path   the remote directory path that this directory was deleted from
     */
    public FtpDeleteDirEvent(Object source, String dir, String path) {
        super(source);
        this.dir = dir;
        this.path = path;

    }

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

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

    /**
     * Gets name of directory deleted.
     *
     * @return directory name
     */
    public String getDirectory() {
        return dir;
    }

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