/*
 * @(#)FileTransferCreateDirEvent.java
 *
 * Copyright (c) 1999-2007 JSCAPE LLC
 *
 * 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.filetransfer;

/**
 * Fired when directory is created on server.
 */
public class FileTransferCreateDirEvent
        extends FileTransferEvent {

    private final String directory;
    private final String path;

    /**
     * Creates <code>FileTransferCreateDirEvent</code>.
     *
     * @param source    the source of the event
     * @param directory the directory created on server
     * @param path      the path the new directory was created from
     */
    public FileTransferCreateDirEvent(FileTransfer source, String directory, String path) {
        super(source);

        this.directory = directory;

        this.path = path;
    }

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

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

    /**
     * {@inheritDoc}
     */
    public void accept(FileTransferListener listener) {
        listener.createDir(this);
    }

    @Override
    public String toString() {
        return "FileTransferCreateDirEvent {"
                + "directory='" + this.directory + '\''
                + ", path='" + this.path + '\''
                + '}';
    }
}
