001// Licensed under the Apache License, Version 2.0 (the "License");
002// you may not use this file except in compliance with the License.
003// You may obtain a copy of the License at
004//
005// http://www.apache.org/licenses/LICENSE-2.0
006//
007// Unless required by applicable law or agreed to in writing, software
008// distributed under the License is distributed on an "AS IS" BASIS,
009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010// See the License for the specific language governing permissions and
011// limitations under the License.
012
013package org.apache.tapestry5.internal.webresources;
014
015import org.apache.tapestry5.services.assets.ResourceTransformer;
016
017/**
018 * Wraps a {@link ResourceTransformer} to provide additional features such as caching.
019 *
020 * @see org.apache.tapestry5.services.assets.StreamableResourceSource
021 * @since 5.4
022 */
023public interface ResourceTransformerFactory
024{
025
026    /**
027     * Constructs a compiler around a another ResourceTransformer implementation. In development mode, the wrapped version
028     * will handle caching, as well as logging output of timing for the real implementation.
029     *
030     * @param sourceName
031     *         for debugging: source name, e.g., "Less"
032     * @param targetName
033     *         for debugging: target name, e.g., "CSS"
034     * @param transformer
035     *         performs the actual work
036     * @param cacheMode
037     *         Indicates if and how the compiled content should be cached (in development mode only)
038     * @return transformer
039     */
040    ResourceTransformer createCompiler(String contentType, String sourceName, String targetName, ResourceTransformer transformer, CacheMode cacheMode);
041
042}