001/*
002 *  jDTAUS Core API
003 *  Copyright (C) 2005 Christian Schulte
004 *  <cs@schulte.it>
005 *
006 *  This library is free software; you can redistribute it and/or
007 *  modify it under the terms of the GNU Lesser General Public
008 *  License as published by the Free Software Foundation; either
009 *  version 2.1 of the License, or any later version.
010 *
011 *  This library is distributed in the hope that it will be useful,
012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 *  Lesser General Public License for more details.
015 *
016 *  You should have received a copy of the GNU Lesser General Public
017 *  License along with this library; if not, write to the Free Software
018 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
019 *
020 */
021package org.jdtaus.core.monitor;
022
023/**
024 * {@code TaskEventSource} is implemented by classes firing
025 * {@code TaskEvent}s.
026 * <p>Example: Listening to all jDTAUS Core SPI compliant implementations in the
027 * system<blockquote><pre>
028 * TaskEventSource source =
029 *     (TaskEventSource) ContainerFactory.getContainer().
030 *     getObject( TaskEventSource.class );
031 *
032 * source.addTaskListener(<i>your application's listener</i>);
033 * </pre></blockquote></p>
034 *
035 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
036 * @version $JDTAUS: TaskEventSource.java 8641 2012-09-27 06:45:17Z schulte $
037 */
038public interface TaskEventSource
039{
040    //--TaskEventSource---------------------------------------------------------
041
042    /**
043     * Adds a {@code TaskListener} to the listener list.
044     *
045     * @param listener The listener to be added to the listener list.
046     *
047     * @throws NullPointerException if {@code listener} is {@code null}.
048     */
049    void addTaskListener( TaskListener listener );
050
051    /**
052     * Removes a {@code TaskListener} from the listener list.
053     *
054     * @param listener The listener to be removed from the listener list.
055     *
056     * @throws NullPointerException if {@code listener} is {@code null}.
057     */
058    void removeTaskListener( TaskListener listener );
059
060    /**
061     * Gets all currently registered {@code TaskListener}s.
062     *
063     * @return all currently registered {@code TaskListener}s.
064     */
065    TaskListener[] getTaskListeners();
066
067    //---------------------------------------------------------TaskEventSource--
068}