001    // Copyright 2005 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.tapestry.describe;
016    
017    import org.apache.tapestry.IMarkupWriter;
018    import org.apache.tapestry.event.ReportStatusListener;
019    
020    /**
021     * Service for collecting together status information across the framework;
022     * service implementations implement the
023     * {@link org.apache.tapestry.event.ReportStatusListener} interface and register
024     * themselves as listeners here. When desired, the
025     * {@link #fireReportStatus(IMarkupWriter)} event will invoke the listener
026     * method on each registered object.
027     * 
028     * @author Howard M. Lewis Ship
029     * @since 4.0
030     */
031    public interface ReportStatusHub
032    {
033    
034        /**
035         * Adds the listener; listeners will be invoked in the order in which they
036         * are added. <strong>Note: only service implementation that are singletons
037         * should be report status listeners. Threaded or pooled implementations
038         * should not be added; or should be careful to add and remove themselves
039         * from the hub directly.</strong>
040         * 
041         * @param listener
042         */
043        void addReportStatusListener(ReportStatusListener listener);
044    
045        void removeReportStatusListener(ReportStatusListener listener);
046    
047        /**
048         * Generates an HTML status report by invoking
049         * {@link ReportStatusListener#reportStatus(org.apache.tapestry.event.ReportStatusEvent)} on each
050         * registered listener.
051         * 
052         * @param writer
053         *            a markup writer to send the report to.
054         */
055        void fireReportStatus(IMarkupWriter writer);
056    }