001// Copyright 2026 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.corelib.pages;
016
017import java.util.List;
018
019import org.apache.tapestry5.annotations.Cached;
020import org.apache.tapestry5.annotations.Property;
021import org.apache.tapestry5.annotations.UnknownActivationContextCheck;
022import org.apache.tapestry5.annotations.WhitelistAccessOnly;
023import org.apache.tapestry5.http.TapestryHttpSymbolConstants;
024import org.apache.tapestry5.ioc.annotations.Inject;
025import org.apache.tapestry5.ioc.annotations.Symbol;
026import org.apache.tapestry5.ioc.services.AssembledPipeline;
027import org.apache.tapestry5.ioc.services.PipelineBuilder;
028
029/**
030 * Page used to see the pipelines assembled by the {@link PipelineBuilder}: which filters are in each pipeline, and
031 * in which order they are invoked.
032 *
033 * A pipeline is assembled when the service it implements is first realized, so this page shows more as the
034 * application runs.
035 *
036 * @since 5.10
037 */
038@UnknownActivationContextCheck(false)
039@WhitelistAccessOnly
040public class Pipelines
041{
042    @Inject
043    private PipelineBuilder pipelineBuilder;
044
045    @Property
046    @Inject
047    @Symbol(TapestryHttpSymbolConstants.PRODUCTION_MODE)
048    private boolean productionMode;
049
050    @Property
051    private AssembledPipeline pipeline;
052
053    @Property
054    private int pipelineIndex;
055
056    @Property
057    private String filter;
058
059    @Cached
060    public List<AssembledPipeline> getPipelines()
061    {
062        return pipelineBuilder.getAssembledPipelines();
063    }
064
065    /**
066     * Identifies the panel of the current pipeline, for the links at the top of the page. The index is used rather
067     * than the service interface, since the same interface may be the basis of more than one pipeline.
068     */
069    public String getPipelineClientId()
070    {
071        return "pipeline-" + pipelineIndex;
072    }
073}