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

    private String dir;
    private String path;

    /**
     * Creates a new FtpCreateDirEvent instance
     *
     * @param source the source of this event
     * @param dir    the name of the directory created
     * @param path   the remote directory path where the directory was created
     */
    public FtpCreateDirEvent(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.createDir(this);
        }
    }

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

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

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