001package org.apache.turbine.modules.navigations;
002
003
004/*
005 * Licensed to the Apache Software Foundation (ASF) under one
006 * or more contributor license agreements.  See the NOTICE file
007 * distributed with this work for additional information
008 * regarding copyright ownership.  The ASF licenses this file
009 * to you under the Apache License, Version 2.0 (the
010 * "License"); you may not use this file except in compliance
011 * with the License.  You may obtain a copy of the License at
012 *
013 *   http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing,
016 * software distributed under the License is distributed on an
017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
018 * KIND, either express or implied.  See the License for the
019 * specific language governing permissions and limitations
020 * under the License.
021 */
022
023
024import org.apache.turbine.modules.Navigation;
025import org.apache.turbine.pipeline.PipelineData;
026
027/**
028 * Base Template Navigation.
029 *
030 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
031 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
032 * @version $Id$
033 */
034public abstract class TemplateNavigation implements Navigation
035{
036    /**
037     * WebMacro Navigations extending this class should override this
038     * method to perform any particular business logic and add
039     * information to the context.
040     *
041     * @param pipelineData Turbine information.
042     * @throws Exception a generic exception.
043     */
044    protected abstract void doBuildTemplate(PipelineData pipelineData) throws Exception;
045
046    /**
047     * This Builds the WebMacro/FreeMarker/etc template.
048     * @param pipelineData Turbine information.
049     * @return the content of the navigation module
050     * @throws Exception a generic exception.
051     */
052    public abstract String buildTemplate(PipelineData pipelineData) throws Exception;
053
054    /**
055     * Calls doBuildTemplate() and then buildTemplate().
056     *
057     * @param pipelineData Turbine information.
058     * @return the content of the navigation module
059     * @throws Exception a generic exception.
060     */
061    @Override
062    public String doBuild(PipelineData pipelineData)
063            throws Exception
064    {
065        doBuildTemplate(pipelineData);
066        return buildTemplate(pipelineData);
067    }
068}