1 package org.apache.turbine.modules;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "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.turbine.pipeline.PipelineData;
23
24 /**
25 * This is the base class that defines what a Navigation module is.
26 *
27 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
28 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
29 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
30 * @version $Id: Navigation.java 1709648 2015-10-20 17:08:10Z tv $
31 */
32 public abstract class Navigation
33 extends Assembler
34 {
35 /** Prefix for navigation related classes and templates */
36 public static final String PREFIX = "navigations";
37
38 /** Property for the size of the navigation cache if caching is on */
39 public static final String CACHE_SIZE_KEY = "navigation.cache.size";
40
41 /** The default size for the navigation cache */
42 public static final int CACHE_SIZE_DEFAULT = 10;
43
44 /** Represents Navigation Objects */
45 public static final String NAME = "navigation";
46
47 /**
48 * @see org.apache.turbine.modules.Assembler#getPrefix()
49 */
50 @Override
51 public String getPrefix()
52 {
53 return PREFIX;
54 }
55
56 /**
57 * A subclass must override this method to build itself.
58 * Subclasses override this method to store the navigation in
59 * RunData or to write the navigation to the output stream
60 * referenced in RunData.
61 *
62 * @param pipelineData Turbine information.
63 * @return the content of the navigation module
64 * @exception Exception a generic exception.
65 */
66 protected abstract String doBuild(PipelineData pipelineData) throws Exception;
67
68 /**
69 * Subclasses can override this method to add additional
70 * functionality. This method is protected to force clients to
71 * use NavigationLoader to build a Navigation.
72 *
73 * @param pipelineData Turbine information.
74 * @return the content of the navigation module
75 * @exception Exception a generic exception.
76 */
77 protected String build(PipelineData pipelineData)
78 throws Exception
79 {
80 return doBuild(pipelineData);
81 }
82 }