001    // Copyright 2006, 2008, 2009, 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;
016    
017    import org.apache.tapestry5.ioc.Resource;
018    import org.apache.tapestry5.services.InvalidationEventHub;
019    import org.apache.tapestry5.services.ResourceDigestGenerator;
020    
021    /**
022     * Caches information about resources on the classpath. In addition, acts as an invalidation hub for any resources for
023     * which information is obtained (when any of the resources are changed, invalidation listeners are notified so they can
024     * clear their caches).
025     * <p>
026     * Note that the name and role of this class changed (and diminished) quite a bit in Tapestry 5.3. It is now focused on
027     */
028    public interface ResourceDigestManager extends InvalidationEventHub
029    {
030        /**
031         * Returns true if the path requires that the client URL for the resource include a digest to validate that the
032         * client is authorized to access the resource.
033         * 
034         * @param resource
035         * @return true if digest is required for the resource
036         * @see ResourceDigestGenerator#requiresDigest(String)
037         */
038        boolean requiresDigest(Resource resource);
039    
040        /**
041         * Returns the digest for the given path.
042         * 
043         * @param resource
044         * @return the digest, or null if the resource does not exist
045         */
046        String getDigest(Resource resource);
047    }