    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
    015package org.apache.tapestry5.internal.services;
    016
    017import org.apache.tapestry5.ioc.Resource;
    018import org.apache.tapestry5.services.InvalidationEventHub;
    019import 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 * determining which files require a digest, and which what the digests are for resources.
    028 * <p/>
    029 * Further, in 5.4, this service has been stripped down to an unused placeholder; it only present to prevent
    030 * errors where modules have contributed a String extension to protected (even though the service is internal). As of
    031 * 5.4, all assets have a built-in checksum in the URL directly (in 5.3 and earlier, the URL included the application
    032 * version number).
    033 *
    034 * @deprecated Deprecated in 5.4 with no replacement; see release notes about classpath assets moving to /META-INF/assets/.
    035 *             To be removed in 5.5.
    036 */
    037public interface ResourceDigestManager extends InvalidationEventHub
    038{
    039    /**
    040     * Returns true if the path requires that the client URL for the resource include a digest to validate that the
    041     * client is authorized to access the resource.
    042     *
    043     * As of 5.4, simply returns false.
    044     *
    045     * @param resource
    046     * @return true if digest is required for the resource
    047     * @see ResourceDigestGenerator#requiresDigest(String)
    048     */
    049    boolean requiresDigest(Resource resource);
    050
    051    /**
    052     * Returns the digest for the given path.
    053     * <p/>
    054     * As of 5.4, simple returns null.
    055     *
    056     * @param resource
    057     * @return the digest, or null if the resource does not exist
    058     */
    059    String getDigest(Resource resource);
    060}