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.services.assets;
014
015import org.apache.tapestry5.services.assets.StreamableResource;
016import org.apache.tapestry5.services.javascript.JavaScriptAggregationStrategy;
017
018import java.io.IOException;
019
020/**
021 * Assembles the individual assets of a {@link org.apache.tapestry5.services.javascript.JavaScriptStack} into
022 * a single resource; this is needed to generate a checksum for the aggregated assets, and also to service the
023 * aggregated stack content.
024 *
025 * @see org.apache.tapestry5.SymbolConstants#COMBINE_SCRIPTS
026 * @since 5.4
027 */
028public interface JavaScriptStackAssembler
029{
030    /**
031     * Obtains the {@link org.apache.tapestry5.services.javascript.JavaScriptStack} by name, and then
032     * uses the {@link org.apache.tapestry5.services.assets.StreamableResourceSource} service to
033     * obtain the assets, which are combined together.
034     *
035     * Expects the {@linkplain org.apache.tapestry5.services.LocalizationSetter#setNonPersistentLocaleFromLocaleName(String) non-persistent locale} to be set before invoking!
036     */
037    StreamableResource assembleJavaScriptResourceForStack(String stackName, boolean compress, JavaScriptAggregationStrategy javascriptAggregationStrategy) throws IOException;
038}