001 package 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
022 import org.apache.turbine.pipeline.PipelineData;
023 import org.apache.turbine.util.RunData;
024
025 /**
026 * Generic Action class.
027 *
028 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
029 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
030 * @version $Id: Action.java 717934 2008-11-15 21:48:47Z tv $
031 */
032 public abstract class Action extends Assembler
033 {
034 /** Prefix for action related classes and templates */
035 public static final String PREFIX = "actions";
036
037 /** Property for the size of the module cache if caching is on */
038 public static final String CACHE_SIZE_KEY = "action.cache.size";
039
040 /** The default size for the action cache */
041 public static final int CACHE_SIZE_DEFAULT = 20;
042
043 /** Represents Action Objects */
044 public static final String NAME = "action";
045
046 /**
047 * @see org.apache.turbine.modules.Assembler#getPrefix()
048 */
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 RunData.
057 *
058 * @deprecated Use PipelineData version instead.
059 * @param data Turbine information.
060 * @exception Exception a generic exception.
061 */
062 public abstract void doPerform(RunData data) throws Exception;
063
064 /**
065 * Subclasses can override this method to add additional
066 * functionality. This method is protected to force clients to
067 * use ActionLoader to perform an Action.
068 * @deprecated Use PipelineData version instead.
069 * @param data Turbine information.
070 * @exception Exception a generic exception.
071 */
072 protected void perform(RunData data) throws Exception
073 {
074 doPerform(data);
075 }
076
077 /**
078 * A subclass must override this method to perform itself. The
079 * Action can also set the screen that is associated with RunData.
080 *
081 * @param data Turbine information.
082 * @exception Exception a generic exception.
083 */
084 public void doPerform(PipelineData pipelineData) throws Exception
085 {
086 RunData data = getRunData(pipelineData);
087 doPerform(data);
088 }
089
090 /**
091 * Subclasses can override this method to add additional
092 * functionality. This method is protected to force clients to
093 * use ActionLoader to perform an Action.
094 *
095 * @param data Turbine information.
096 * @exception Exception a generic exception.
097 */
098 protected void perform(PipelineData pipelineData) throws Exception
099 {
100 doPerform(pipelineData);
101 }
102
103
104 }