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