/*
 * @(#)FileTransferDisconnectedEvent.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 connection to server is released.
 */
public class FileTransferDisconnectedEvent
        extends FileTransferEvent {

    private final String hostname;

    /**
     * Creates <code>FileTransferDisconnectedEvent</code>.
     *
     * @param source   the source of the event
     * @param hostname the hostname of the server
     */
    public FileTransferDisconnectedEvent(FileTransfer source, String hostname) {
        super(source);

        this.hostname = hostname;
    }

    /**
     * Gets server hostname.
     *
     * @return hostname
     */
    public String getHostname() {
        return this.hostname;
    }

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

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