/*
 * @(#)SftpListener.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;

/**
 * The event listener abstraction.
 * Implements methods for capturing events sourced from Sftp class.
 * <p/>
 * Typicaly your application will implement this interface to capture the
 * following events :
 * <br>
 * <code>SftpConnectedEvent</code><br>
 * <code>SftpDisconnectedEvent</code><br>
 * <code>SftpUploadEvent</code><br>
 * <code>SftpDownloadEvent</code><br>
 * <code>SftpListingEvent</code><br>
 * <code>SftpProgressEvent</code><br>
 * <code>SftpDeleteDirEvent</code><br>
 * <code>SftpDeleteFileEvent</code><br>
 * <code>SftpRenameFileEvent</code><br>
 * <code>SftpCreateDirEvent</code><br>
 * <code>SftpChangeDirEvent</code><br>
 * <p/>
 * <p/>
 * In addition to implementing this interface your application should register
 * itself as an EventListener which may look somewhat like this:<br>
 * <pre>
 * import com.jscape.inet.sftp.*;
 * import com.jscape.inet.sftp.events.*;
 * import com.jscape.inet.ssh.util.SshParameters;
 *
 * public class MySftpListener implements SftpListener {
 *
 *      public void connected(SftpConnectedEvent event) {
 *              System.out.println("Connected to host: " + event.getHostname());
 *
 *      }
 *
 *  public void disconnected(SftpDisconnectedEvent event) {
 *          System.out.println("Disconnected from host: " + event.getHostname());
 *
 *      }
 *
 *      public void download(SftpDownloadEvent event) {
 *              // process event
 *     }
 *
 *      public void upload(SftpUploadEvent event) {
 *              // process event
 *  }
 *
 *      public void progress(SftpProgressEvent event) {
 *              // process event
 *     }
 *
 *      public void dirListing(SftpListingEvent event) {
 *              // process event
 *     }
 *
 *      public void deleteDir(SftpDeleteDirEvent event) {
 *              // process event
 *  }
 *
 *      public void deleteFile(SftpDeleteFileEvent event) {
 *              // process event
 *  }
 *
 *      public void renameFile(SftpRenameFileEvent event) {
 *              // process event
 *  }
 *
 *      public void createDir(SftpCreateDirEvent event) {
 *              // process event
 *  }
 *
 *      public void changeDir(SftpChangeDirEvent event) {
 *              // process event
 *  }
 *
 *      public static void main(String[] args) {
 *              try {
 *                      String hostname = "ftp.host.com";
 *                      String username = "jsmith";
 *                      String password = "secret";
 *
 *                      // create connection parameters
 *                      SshParameters sshParams =
 *                              new SshParameters(hostname, username, password);
 *                      Sftp sftp = new Sftp(sshParams);
 *
 *                      // subscribe listener to published events
 *                      sftp.addSftpListener(new MySftpListener());
 *
 *                      // connect then disconnect
 *                      sftp.connect();
 *                      sftp.disconnect();
 *
 *         } catch (SftpException e) {
 *                      e.printStackTrace();
 *         }
 *     }
 * }
 * </pre>
 */
public interface SftpListener {

    /**
     * Invoked when connection to server is established.
     *
     * @param event a <code>SftpConnectedEvent</code>
     *
     * @see SftpConnectedEvent
     */
    void connected(SftpConnectedEvent event);

    /**
     * Invoked when connection to server is released.
     *
     * @param event a <code>SftpDisconnectedEvent</code>
     *
     * @see SftpDisconnectedEvent
     */
    void disconnected(SftpDisconnectedEvent event);

    /**
     * Invoked when file is downloaded from server.
     *
     * @param event a <code>SftpDownloadEvent</code>
     *
     * @see SftpDownloadEvent
     */
    void download(SftpDownloadEvent event);

    /**
     * Invoked when file is uploaded to server.
     *
     * @param event a <code>SftpUploadEvent</code>
     *
     * @see SftpUploadEvent
     */
    void upload(SftpUploadEvent event);

    /**
     * Invoked to mark progress of a download or upload operation.<br>
     *
     * @param event a <code>SftpProgressEvent</code>
     *
     * @see SftpProgressEvent
     */
    void progress(SftpProgressEvent event);

    /**
     * Invoked when directory listing is retrieved from server.
     *
     * @param event a <code>SftpListingEvent</code>
     *
     * @see SftpListingEvent
     */
    void dirListing(SftpListingEvent event);

    /**
     * Invoked when directory is deleted.
     *
     * @param event a <code>SftpDeleteDirEvent</code>
     *
     * @see SftpDeleteDirEvent
     */
    void deleteDir(SftpDeleteDirEvent event);


    /**
     * Invoked when a file is deleted.
     *
     * @param event a <code>SftpDeleteFileEvent</code>
     *
     * @see SftpDeleteFileEvent
     */
    void deleteFile(SftpDeleteFileEvent event);

    /**
     * Invoked when a file is renamed.
     *
     * @param event a <code>SftpRenameFileEvent</code>
     *
     * @see SftpRenameFileEvent
     */
    void renameFile(SftpRenameFileEvent event);

    /**
     * Invoked when a directory is created.
     *
     * @param event a <code>SftpCreateDirEvent</code>
     *
     * @see SftpCreateDirEvent
     */
    void createDir(SftpCreateDirEvent event);

    /**
     * Invoked when the remote directory path is changed.
     *
     * @param event a <code>SftpChangeDirEvent</code>
     *
     * @see SftpChangeDirEvent
     */
    void changeDir(SftpChangeDirEvent event);
}
