001    // Copyright 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.internal.services.assets;
016    
017    import org.apache.tapestry5.ioc.Resource;
018    import org.apache.tapestry5.ioc.internal.util.URLChangeTracker;
019    import org.apache.tapestry5.services.InvalidationEventHub;
020    import org.apache.tapestry5.services.InvalidationListener;
021    import org.apache.tapestry5.services.UpdateListener;
022    import org.apache.tapestry5.services.assets.ResourceDependencies;
023    
024    /**
025     * Tracks resources (at least, resources that can change because they are on the file system) and
026     * acts as an {@link UpdateListener} to check for changes and notify its listeners.
027     *
028     * @since 5.3
029     */
030    public interface ResourceChangeTracker extends InvalidationEventHub, ResourceDependencies
031    {
032        /**
033         * Start tracking the resource (or return the last modified time of an already tracked resource). Only file system
034         * resources are tracked. Resources are tracked until <em>any</em> resource changes, at which points
035         * {@linkplain InvalidationListener listeners} are notified and the internal state
036         * is cleared.
037         *
038         * @param resource to track
039         * @return last modified time, to nearest second
040         * @see URLChangeTracker
041         */
042        long trackResource(Resource resource);
043    }