// Notifier.java
//
// Created: October 2005
//
// This file is a component of the BioMoby project.
// Copyright Martin Senger (martin.senger@gmail.com).
//

package org.biomoby.shared.event;

/**
 *
 * @author <A HREF="mailto:martin.senger@gmail.com">Martin Senger</A>
 * @version $Id: Notifier.java,v 1.9 2006/02/19 18:42:57 senger Exp $
 */

public interface Notifier {

    static final int DATA_TYPES_START  = 0;
    static final int DATA_TYPES_COUNT  = 1;
    static final int DATA_TYPE_LOADING = 2;
    static final int DATA_TYPE_LOADED  = 3;
    static final int DATA_TYPES_END    = 4;

    static final int SERVICE_TYPES_START  = 5;
    static final int SERVICE_TYPES_COUNT  = 6;
    static final int SERVICE_TYPE_LOADING = 7;
    static final int SERVICE_TYPE_LOADED  = 8;
    static final int SERVICE_TYPES_END    = 9;

    static final int NAMESPACES_START  = 10;
    static final int NAMESPACES_COUNT  = 11;
    static final int NAMESPACE_LOADING = 12;
    static final int NAMESPACE_LOADED  = 13;
    static final int NAMESPACES_END    = 14;

    static final int AUTHORITIES_START = 15;
    static final int AUTHORITIES_COUNT = 16;
    static final int AUTHORITY_LOADING = 17;
    static final int AUTHORITY_LOADED  = 18;
    static final int AUTHORITIES_END   = 19;

    static final int DATA_TYPES_RESET    = 20;
    static final int SERVICE_TYPES_RESET = 21;
    static final int NAMESPACES_RESET    = 22;
    static final int AUTHORITIES_RESET   = 23;

    static final int DATA_TYPES_CANCELLED    = 24;
    static final int SERVICE_TYPES_CANCELLED = 25;
    static final int NAMESPACES_CANCELLED    = 26;
    static final int AUTHORITIES_CANCELLED   = 27;

    static final int DATA_TYPES_UPDATED       = 28;
    static final int SERVICE_TYPES_UPDATED    = 29;
    static final int NAMESPACES_UPDATED       = 30;
    static final int AUTHORITIES_UPDATED      = 31;

    static final int SIGNAL_CANCEL_DATA_TYPES    = 1;
    static final int SIGNAL_CANCEL_SERVICE_TYPES = 2;
    static final int SIGNAL_CANCEL_SERVICES      = 3;
    static final int SIGNAL_CANCEL_NAMESPACES    = 4;

    /*********************************************************************
     * Adds the specified notification listener to receive
     * notification events from the class that implements this
     * interface. <p>
     *
     * @param l notification listener to be added
     ********************************************************************/
    void addNotificationListener (NotificationListener l);

    /*********************************************************************
     * Adds the specified notification listeners to receive
     * notification events from the class that implements this
     * interface. <p>
     *
     * @param l notification listeners to be added
     ********************************************************************/
    void addNotificationListeners (NotificationListener[] l);

    /*********************************************************************
     * Removes the specified notification listener so that it no
     * longer receives notification events from the class that
     * implements this interface. <p>
     *
     * @param l notification listener to be removed
     ********************************************************************/
    void removeNotificationListener (NotificationListener l);

    /*********************************************************************
     * Removes the specified notification listeners so that they no
     * longer receive notification events from the class that
     * implements this interface. <p>
     *
     * @param l notification listeners to be removed
     ********************************************************************/
    void removeNotificationListeners (NotificationListener[] l);

    /*********************************************************************
     * Returns an array of all the NotificationListeners added to the
     * class that implements this interface. <p>
     *
     * @return all of the NotificationListeners added or an empty
     * array if no listeners have been added
     ********************************************************************/
    NotificationListener[] getNotificationListeners();

    /*********************************************************************
     * Call the notifier and signal that it can stop loading data (or
     * whatever it is doing). <p>
     *
     * @param callbackSignal identifies what to stop doing (some usual
     * values of this signal are defined elsewhere in this interface
     * with names starting by <tt>SIGNAL_</tt>)
     ********************************************************************/
    void callback (int callbackSignal);

    /*********************************************************************
     *
     ********************************************************************/
    void fireEvent (int type, Object message, Object details);

    /*********************************************************************
     *
     ********************************************************************/
    void fireEvent (NotificationEvent event);

}
