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

import java.util.EventListener;

/**
 * Implements methods for capturing events sourced from File Transfer classes.
 * <p/>
 * Typicaly your application will implement this interface to capture the
 * following events :
 * <br>
 * <code>FileTransferConnectedEvent</code><br>
 * <code>FileTransferDisconnectedEvent</code><br>
 * <code>FileTransferSslHandshakeEvent</code><br>
 * <code>FileTransferCommandEvent</code><br>
 * <code>FileTransferResponseEvent</code><br>
 * <code>FileTransferUploadEvent</code><br>
 * <code>FileTransferDownloadEvent</code><br>
 * <code>FileTransferProgressEvent</code><br>
 * <code>FileTransferCreateDirEvent</code><br>
 * <code>FileTransferChangeDirEvent</code><br>
 * <code>FileTransferDeleteDirEvent</code><br>
 * <code>FileTransferRenameFileEvent</code><br>
 * <code>FileTransferDeleteFileEvent</code><br>
 * <p/>
 * In addition to implementing this interface your application should register
 * itself as an EventListener which may look somewhat like this:<br>
 * <pre>
 * public class Application ... implements FileTransferListener
 * {
 *  ...
 *  public ... initMethod(...)
 *  {
 *    FtpFileTranfer ftpFt = new FtpFileTranfer();
 *    ftpFt.addListener(this);
 *  }
 *  ...
 * }
 * </pre>
 */
public interface FileTransferListener
        extends EventListener {
    /**
     * Invoked when connection to server is established.
     *
     * @param event a <code>FileTransferConnectedEvent</code>
     *
     * @see FileTransferConnectedEvent
     */
    void connected(FileTransferConnectedEvent event);

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

    /**
     * Invoked when SSL handshake is completed in SSL-based transfer.
     *
     * @param event an event instance
     *
     * @see FileTransferSslHandshakeEvent
     */
    void sslHandshakeCompleted(FileTransferSslHandshakeEvent event);

    /**
     * Invoked when a command is sent to server.
     *
     * @param event a <code>FileTransferCommandEvent</code>
     *
     * @see FileTransferCommandEvent
     */
    void commandSent(FileTransferCommandEvent event);

    /**
     * Invoked when a response is received from server.
     *
     * @param event a <code>FileTransferResponseEvent</code>
     *
     * @see FileTransferResponseEvent
     */
    void responseReceived(FileTransferResponseEvent event);

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

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

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

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

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

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

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

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

    /**
     * A listener adapter. Provides default (empty) call-back methods.
     */
    class Adapter
            implements FileTransferListener {

        @Override
        public void connected(FileTransferConnectedEvent event) {
            // empty
        }

        @Override
        public void disconnected(FileTransferDisconnectedEvent event) {
            // empty
        }

        @Override
        public void sslHandshakeCompleted(FileTransferSslHandshakeEvent event) {
            // empty
        }

        @Override
        public void commandSent(FileTransferCommandEvent event) {
            // empty
        }

        @Override
        public void responseReceived(FileTransferResponseEvent event) {
            // empty
        }

        @Override
        public void upload(FileTransferUploadEvent event) {
            // empty
        }

        @Override
        public void download(FileTransferDownloadEvent event) {
            // empty
        }

        @Override
        public void progress(FileTransferProgressEvent event) {
            // empty
        }

        @Override
        public void changeDir(FileTransferChangeDirEvent event) {
            // empty
        }

        @Override
        public void createDir(FileTransferCreateDirEvent event) {
            // empty
        }

        @Override
        public void deleteDir(FileTransferDeleteDirEvent event) {
            // empty
        }

        @Override
        public void renameFile(FileTransferRenameFileEvent event) {
            // empty
        }

        @Override
        public void deleteFile(FileTransferDeleteFileEvent event) {
            // empty
        }
    }

}
