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

    private final String directory;
    private final String path;

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


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

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

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