/*
 * @(#)FtpConnectedEvent.java
 *
 * Copyright (c) 2001-2002 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.ftp;

/**
 * Fired when connection to FTP server is established.
 */
public class FtpConnectedEvent
        extends FtpEvent {

    private String hostname;

    /**
     * Creates FtpConnectedEvent.
     *
     * @param source   the source of the event
     * @param hostname the hostname of the FTP server
     */
    public FtpConnectedEvent(Object source, String hostname) {
        super(source);
        this.hostname = hostname;
    }

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

    public void accept(FtpListener listener) {
        if (listener != null) {
            listener.connected(this);
        }
    }

    /**
     * Gets String equivalent of this event.
     *
     * @return the String equivalent for this event
     */
    public String toString() {
        return "Connected to host: " + hostname;
    }

}
