    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 base class that defines what a Layout module is.
    026 *
    027 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
    028 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
    029 * @version $Id: Layout.java 1706239 2015-10-01 13:18:35Z tv $
    030 */
    031public abstract class Layout
    032    extends Assembler
    033{
    034    /** Prefix for layout related classes and templates */
    035    public static final String PREFIX = "layouts";
    036
    037    /** Property for the size of the layout cache if caching is on */
    038    public static final String CACHE_SIZE_KEY = "layout.cache.size";
    039
    040    /** The default size for the layout cache */
    041    public static final int CACHE_SIZE_DEFAULT = 10;
    042
    043    /** Represents Layout Objects */
    044    public static final String NAME = "layout";
    045
    046    /**
    047     * @see org.apache.turbine.modules.Assembler#getPrefix()
    048     */
    049    @Override
    050    public String getPrefix()
    051    {
    052        return PREFIX;
    053    }
    054
    055    /**
    056     * A subclass must override this method to perform itself.  The
    057     * Action can also set the screen that is associated with PipelineData.
    058     * @param pipelineData Turbine information.
    059     * @exception Exception a generic exception.
    060     */
    061    protected abstract void doBuild(PipelineData pipelineData) throws Exception;
    062
    063    /**
    064     * Subclasses can override this method to add additional
    065     * functionality.  This method is protected to force clients to
    066     * use ActionLoader to perform an Action.
    067     *
    068     * @param pipelineData Turbine information.
    069     * @exception Exception a generic exception.
    070     */
    071    protected void build(PipelineData pipelineData) throws Exception
    072    {
    073        doBuild(pipelineData);
    074    }
    075}