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 * Generic Action class. 026 * 027 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a> 028 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> 029 * @version $Id: Action.java 1706239 2015-10-01 13:18:35Z tv $ 030 */ 031public abstract class Action extends Assembler 032{ 033 /** Prefix for action related classes and templates */ 034 public static final String PREFIX = "actions"; 035 036 /** Property for the size of the module cache if caching is on */ 037 public static final String CACHE_SIZE_KEY = "action.cache.size"; 038 039 /** The default size for the action cache */ 040 public static final int CACHE_SIZE_DEFAULT = 20; 041 042 /** Represents Action Objects */ 043 public static final String NAME = "action"; 044 045 /** 046 * @see org.apache.turbine.modules.Assembler#getPrefix() 047 */ 048 @Override 049 public String getPrefix() 050 { 051 return PREFIX; 052 } 053 054 /** 055 * A subclass must override this method to perform itself. The 056 * Action can also set the screen that is associated with {@link PipelineData}. 057 * 058 * @param pipelineData Turbine information. 059 * @exception Exception a generic exception. 060 */ 061 public abstract void doPerform(PipelineData pipelineData) throws Exception; 062 063 /** 064 * Subclasses can override this method to add additional 065 * functionality. This method is protected to force clients to 066 * use ActionLoader to perform an Action. 067 * 068 * @param pipelineData Turbine information. 069 * @exception Exception a generic exception. 070 */ 071 protected void perform(PipelineData pipelineData) throws Exception 072 { 073 doPerform(pipelineData); 074 } 075 076 077}