/*
 * @(#)FileTransferCommandEvent.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 command is sent to an FTP server.  This event is only fired when communicating
 * with FTP/FTPS servers and is not fired when communicating using SFTP (FTP over SSH) protocol.
 */
public class FileTransferCommandEvent
        extends FileTransferEvent {

    private final String command;

    /**
     * Creates <code>FileTransferCommandEvent</code>.
     *
     * @param source  the source of the event
     * @param command the command sent to FTP server
     */
    public FileTransferCommandEvent(FileTransfer source, String command) {
        super(source);

        this.command = command;
    }

    /**
     * Gets command sent to FTP server.
     *
     * @return the command sent to FTP server
     */
    public String getCommand() {
        return this.command;
    }

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

    @Override
    public String toString() {
        return "FileTransferCommandEvent {"
                + "command='" + this.command + '\''
                + '}';
    }
}
