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 Navigation module is. 026 * 027 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a> 028 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> 029 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> 030 * @version $Id: Navigation.java 1773378 2016-12-09 13:19:59Z tv $ 031 */ 032public abstract class Navigation 033 extends Assembler 034{ 035 /** Prefix for navigation related classes and templates */ 036 public static final String PREFIX = "navigations"; 037 038 /** Property for the size of the navigation cache if caching is on */ 039 public static final String CACHE_SIZE_KEY = "navigation.cache.size"; 040 041 /** The default size for the navigation cache */ 042 public static final int CACHE_SIZE_DEFAULT = 10; 043 044 /** Represents Navigation Objects */ 045 public static final String NAME = "navigation"; 046 047 /** 048 * @see org.apache.turbine.modules.Assembler#getPrefix() 049 */ 050 @Override 051 public String getPrefix() 052 { 053 return PREFIX; 054 } 055 056 /** 057 * A subclass must override this method to build itself. 058 * Subclasses override this method to store the navigation in 059 * RunData or to write the navigation to the output stream 060 * referenced in RunData. 061 * 062 * @param pipelineData Turbine information. 063 * @return the content of the navigation module 064 * @throws Exception a generic exception. 065 */ 066 protected abstract String doBuild(PipelineData pipelineData) throws Exception; 067 068 /** 069 * Subclasses can override this method to add additional 070 * functionality. This method is protected to force clients to 071 * use NavigationLoader to build a Navigation. 072 * 073 * @param pipelineData Turbine information. 074 * @return the content of the navigation module 075 * @throws Exception a generic exception. 076 */ 077 protected String build(PipelineData pipelineData) 078 throws Exception 079 { 080 return doBuild(pipelineData); 081 } 082}