    001    // Copyright 2006, 2007, 2008, 2011 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.tapestry5.services;
    016
    017    /**
    018     * An object which manages a list of {@link org.apache.tapestry5.services.InvalidationListener}s. There are multiple
    019     * event hub services implementing this interface, each with a specific marker annotation; each can register listeners
    020     * and fire events; these are based on the type of resource that has been invalidated. Tapestry has built-in support
    021     * for:
    022     * <dl>
    023     * <dt>message catalog resources
    024     * <dd>{@link org.apache.tapestry5.services.ComponentMessages} marker annotation
    025     * <dt>component templates
    026     * <dd>{@link org.apache.tapestry5.services.ComponentTemplates} marker annotation
    027     * <dt>component classes
    028     * <dd>{@link org.apache.tapestry5.services.ComponentClasses} marker annotation
    029     * </dl>
    030     * <p>
    031     * Starting in Tapestry 5.3, these services are disabled in production (it does nothing).
    032     *
    033     * @since 5.1.0.0
    034     */
    035    public interface InvalidationEventHub
    036    {
    037        /**
    038         * Adds a listener, who needs to know when an underlying resource of a given category has changed (so that the
    039         * receiver may discard any cached data that may have been invalidated). Does nothing in production mode.
    040         */
    041        void addInvalidationListener(InvalidationListener listener);
    042    }