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
015package org.apache.tapestry.describe;
016
017import org.apache.tapestry.IMarkupWriter;
018import org.apache.tapestry.event.ReportStatusListener;
019
020/**
021 * Service for collecting together status information across the framework; service implementations
022 * implement the {@link org.apache.tapestry.event.ReportStatusListener} interface and register
023 * themselves as listeners here. When desired, the {@link #fireReportStatus(IMarkupWriter)} event
024 * will invoke the listener method on each registered object.
025 * 
026 * @author Howard M. Lewis Ship
027 * @since 4.0
028 */
029public interface ReportStatusHub
030{
031    /**
032     * Adds the listener; listeners will be invoked in the order in which they are added.
033     * <strong>Note: only service implementation that are singletons should be report status
034     * listeners. Threaded or pooled implementations should not be added; or should be careful to
035     * add and remove themselves from the hub directly.</strong>
036     * 
037     * @param listener
038     */
039    public void addReportStatusListener(ReportStatusListener listener);
040
041    public void removeReportStatusListener(ReportStatusListener listener);
042
043    /**
044     * Generates an HTML status report by invoking
045     * {@link ReportStatusListener#reportStatus(ReportStatusEvent)} on each registered listener.
046     * 
047     * @param writer
048     *            a markup writer to send the report to.
049     */
050    public void fireReportStatus(IMarkupWriter writer);
051}