001// Copyright 2013 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.webresources;
016
017import org.apache.tapestry5.services.assets.ResourceTransformer;
018
019/**
020 * Creates ResourceTransformer around a named {@link org.apache.tapestry5.webresources.services.ResourceProcessor}.
021 *
022 * @see org.apache.tapestry5.services.assets.StreamableResourceSource
023 * @since 5.4
024 */
025public interface ResourceTransformerFactory
026{
027
028    /**
029     * Constructs a compiler around a another ResourceTransformer implementation. In development mode, the wrapped version
030     * will handle caching, as well as logging output of timing for the real implementation.
031     *
032     * @param sourceName
033     *         for debugging: source name, e.g., "Less"
034     * @param targetName
035     *         for debugging: target name, e.g., "CSS"
036     * @param transformer
037     *         performs the actual work
038     * @param cacheMode
039     *         Indicates if and how the compiled content should be cached (in development mode only)
040     * @return transformer
041     * @see org.apache.tapestry5.webresources.services.ResourceProcessorSource
042     */
043    ResourceTransformer createCompiler(String contentType, String sourceName, String targetName, ResourceTransformer transformer, CacheMode cacheMode);
044
045}