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

    private String hostname;
    private int port;

    /**
     * Creates a new event instance.
     *
     * @param source   the source of the event
     * @param hostname the hostname of the SSH server
     */
    public SftpDisconnectedEvent(Sftp source, String hostname, int port) {
        super(source);
        this.hostname = hostname;
        this.port = port;
    }

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

    public int getPort() {
        return this.port;
    }

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


}
