1 package org.apache.turbine.modules.navigations;
2
3
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 */
22
23
24 import org.apache.turbine.modules.Navigation;
25 import org.apache.turbine.pipeline.PipelineData;
26
27 /**
28 * Base Template Navigation.
29 *
30 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
31 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
32 * @version $Id$
33 */
34 public abstract class TemplateNavigation implements Navigation
35 {
36 /**
37 * WebMacro Navigations extending this class should override this
38 * method to perform any particular business logic and add
39 * information to the context.
40 *
41 * @param pipelineData Turbine information.
42 * @throws Exception a generic exception.
43 */
44 protected abstract void doBuildTemplate(PipelineData pipelineData) throws Exception;
45
46 /**
47 * This Builds the WebMacro/FreeMarker/etc template.
48 * @param pipelineData Turbine information.
49 * @return the content of the navigation module
50 * @throws Exception a generic exception.
51 */
52 public abstract String buildTemplate(PipelineData pipelineData) throws Exception;
53
54 /**
55 * Calls doBuildTemplate() and then buildTemplate().
56 *
57 * @param pipelineData Turbine information.
58 * @return the content of the navigation module
59 * @throws Exception a generic exception.
60 */
61 @Override
62 public String doBuild(PipelineData pipelineData)
63 throws Exception
64 {
65 doBuildTemplate(pipelineData);
66 return buildTemplate(pipelineData);
67 }
68 }