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 interface.
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$
030 */
031@FunctionalInterface
032public interface Action extends Assembler
033{
034    /** Prefix for action related classes and templates */
035    String PREFIX = "actions";
036
037    /** Property for the size of the module cache if caching is on */
038    String CACHE_SIZE_KEY = "action.cache.size";
039
040    /** The default size for the action cache */
041    int CACHE_SIZE_DEFAULT = 20;
042
043    /** Represents Action Objects */
044    String NAME = "action";
045
046    /**
047     * A subclass must implement this method to perform itself.  The
048     * Action can also set the screen that is associated with {@link PipelineData}.
049     *
050     * @param pipelineData Turbine information.
051     * @throws Exception a generic exception.
052     */
053    void doPerform(PipelineData pipelineData) throws Exception;
054
055    /**
056     * Subclasses can override this method to add additional
057     * functionality.
058     *
059     * @param pipelineData Turbine information.
060     * @throws Exception a generic exception.
061     */
062    default void perform(PipelineData pipelineData) throws Exception
063    {
064        doPerform(pipelineData);
065    }
066}