001package org.apache.turbine.modules;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.turbine.pipeline.PipelineData;
023
024/**
025 * This is the interface that defines what a Page module is.
026 *
027 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
028 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
029 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
030 * @version $Id$
031 */
032@FunctionalInterface
033public interface Page extends Assembler
034{
035    /** Prefix for page related classes and templates */
036    String PREFIX = "pages";
037
038    /** Property for the size of the page cache if caching is on */
039    String CACHE_SIZE_KEY = "page.cache.size";
040
041    /** The default size for the page cache */
042    int CACHE_SIZE_DEFAULT = 5;
043
044    /** Represents Page Objects */
045    String NAME = "page";
046
047    /**
048     * A subclass must override this method to build itself.
049     * Subclasses override this method to store the page in PipelineData or
050     * to write the page to the output stream referenced in PipelineData.
051     * @param pipelineData Turbine information.
052     * @throws Exception a generic exception.
053     */
054    void doBuild(PipelineData pipelineData) throws Exception;
055
056    /**
057     * Subclasses can override this method to add additional
058     * functionality.
059     *
060     * @param pipelineData Turbine information.
061     * @throws Exception a generic exception.
062     */
063    default void build(PipelineData pipelineData)
064        throws Exception
065    {
066        doBuild(pipelineData);
067    }
068}