/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * $Header:$
 */
package org.apache.beehive.netui.pageflow;

import org.apache.beehive.netui.pageflow.internal.InternalConstants;

/**
 * Constants related to Page Flow.
 */ 
public interface PageFlowConstants
{
    /**
     * The name of the special action in a user-defined {@link PageFlowController} (.jpf) that is
     * processed when the URI for the .jpf is accessed.
     */ 
    public static final String BEGIN_ACTION_NAME = "begin";
    
    /**
     * The extension used for hitting a {@link PageFlowController} through its URI.
     */ 
    public static final String PAGEFLOW_EXTENSION = ".jpf";
    
    /**
     * The extension used for hitting a {@link PageFlowController} through its URI.
     * @deprecated Use {@link #PAGEFLOW_EXTENSION} instead.
     */ 
    public static final String JPF_EXTENSION = PAGEFLOW_EXTENSION;
    
    /**
     * The extension for Struts action URIs used with page flows.
     */ 
    public static final String ACTION_EXTENSION = ".do";
    
    /**
     * The name of the {@link GlobalApp} class defined by the user for a web application.
     * 
     * @deprecated This constant will be removed with no replacement.
     */ 
    public static final String GLOBALAPP_CLASSNAME = "global.Global";
    
    /**
     * The name of the source file for the {@link GlobalApp} class defined by the user for a
     * web application.
     * 
     * @deprecated This constant will be removed with no replacement.
     */ 
    public static final String GLOBALAPP_SOURCEFILE_NAME = "Global.app";
    
    /**
     * The filename prefix for Struts module configuration files generated from page flow source files.
     */ 
    public static final String PAGEFLOW_MODULE_CONFIG_PREFIX = "struts-config";
    
    /**
     * The filename prefix for Struts module configuration files generated from page flow source files.
     * @deprecated Use {@link #PAGEFLOW_MODULE_CONFIG_PREFIX} instead.
     */ 
    public static final String JPF_MODULE_CONFIG_PREFIX = PAGEFLOW_MODULE_CONFIG_PREFIX;

    /**
     * The file extensioni for Struts configuration files generated by the Page Flow compiler.
     */ 
    public static final String PAGEFLOW_MODULE_CONFIG_EXTENSION = ".xml";
    
    /**
     * The file extensioni for Struts configuration files generated by the Page Flow compiler.
     * @deprecated Use {@link #PAGEFLOW_MODULE_CONFIG_EXTENSION} instead.
     */ 
    public static final String JPF_MODULE_CONFIG_EXTENSION = PAGEFLOW_MODULE_CONFIG_EXTENSION;

    /**
     * The prefix for a button or imageButton that has an action.
     * @deprecated This is an internal constant that will be removed without replacement.
     */
    public static final String ACTION_OVERRIDE = InternalConstants.ACTION_OVERRIDE_PREFIX;

    /**
     * Servlet context-param that configures the maximum number of consecutive server forwards before error.
     * 
     * @deprecated Instead of this context-param, use the <code>max-forwards-per-request</code> element within
     *             <code>pageflow-config</code> in /WEB-INF/netui-config.xml.
     */ 
    public static final String FORWARD_OVERFLOW_COUNT_PARAM = "jpf-forward-overflow-count";
    
    /**
     * Servlet context-param that configures the maximum depth of the Page Flow nesting stack.
     * 
     * @deprecated Instead of this context-param, use the <code>max-nesting-stack-depth</code> element within
     *             <code>pageflow-config</code> in /WEB-INF/netui-config.xml.
     */ 
    public static final String NESTING_OVERFLOW_COUNT_PARAM = "jpf-nesting-overflow-count";
    
    /**
     * Default value for the maximum number of consecutive server forwards before error.
     * 
     * @deprecated This constant will be removed without replacement in a future release.  The value is read from
     *     netui-config.xsd (the schema for netui-config.xml).
     */ 
    public static final int DEFAULT_FORWARD_OVERFLOW_COUNT = 50;
    
    /**
     * Default value for the maximum depth of the Page Flow nesting stack.
     * 
     * @deprecated This constant will be removed without replacement in a future release.  The value is read from
     *     netui-config.xsd (the schema for netui-config.xml).
     */ 
    public static final int DEFAULT_NESTING_OVERFLOW_COUNT = 25;

     
    /**
     * Servlet context-param that configures whether to apply security constraints on server forwards to page
     * flow actions.  Normally, security constraints are not applied on server forwards.
     * 
     * @deprecated Instead of this context-param, use the <code>ensure-secure-forwards</code> element within
     *             <code>pageflow-config</code> in /WEB-INF/beehive-netui-config.xml.
     */ 
    public static final String SECURE_FORWARDS_PARAM = "jpf-secure-forwards";
    
    /**
     * The default classloader-relative directory for Struts module configuration files generated by the Page Flow compiler.
     */ 
    public static final String PAGEFLOW_MODULE_CONFIG_GEN_DIR = "/_pageflow";
    
    /**
     * The default webapp-relative directory for Struts module configuration files generated by the Page Flow compiler.
     * @deprecated Use {@link #PAGEFLOW_MODULE_CONFIG_GEN_DIR} instead.
     */ 
    public static final String JPF_MODULE_CONFIG_GEN_DIR = PAGEFLOW_MODULE_CONFIG_GEN_DIR;
    
    /**
     * The name of an automatically-generated Forward that can be used from <i>any</i> Page Flow action, in situations
     * where a framework servlet can handle the response itself.  Currently, this happens when a nested page flow returns
     * after being shown in a popup window.  In the calling page flow, the handler for the return action would return
     * something like <code>new Forward("_auto")</code>, and the framework would write out the correct javascript to
     * close the popup window.
     */ 
    public static final String AUTO_VIEW_RENDER_FORWARD_NAME = "_auto";

    /**
     * The default value of the extension used in the servlet path of the URI for a Forward to the
     * framework servlet rendering the response. (See {@link #AUTO_VIEW_RENDER_FORWARD_NAME}) The
     * extension is part of the &lt;url-pattern&gt; used to map a NetUI ViewRenderer Forward to the Servlet
     * handling the rendering.
     */
    public static String DEFAULT_VIEW_RENDERING_EXTENSION = "render";

    /**
     * The &lt;param-name&gt; of a web-app &lt;context-param&gt; used to configure the extension used
     * in the servlet path of the URI for a Forward to the framework servlet rendering the response.
     * (See {@link #AUTO_VIEW_RENDER_FORWARD_NAME}) The value for the extension should match the
     * extension in the &lt;url-pattern&gt; used to map a NetUI ViewRenderer Forward to the Servlet
     * handling the rendering. Setting the associated &lt;param-value&gt; overrides the default value
     * of the "render" extension in the servlet-mapping, &lt;url-pattern&gt;*.render&lt;/url-pattern&gt;.
     */
    public static String VIEW_RENDERING_EXTENSION_PARAM = "ViewRenderingExtension";

    /**
     * The request attribute name for the view renderer object used by a
     * framework servlet to render the response.
     */
    public static String VIEW_RENDERER_ATTRIBUTE_NAME = "NetuiViewRenderer";

    /**
     * A string used in the path of the URI that identifies the command for the framework servlet
     * to render a ViewRenderer (an attribute on the request) in the response.
     */
    public static String VIEW_RENDERER_URI_COMMAND = "returnActionViewRenderer";
}
