001// Copyright 2004, 2005 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007//     http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry.services;
016
017import java.util.List;
018
019import javax.servlet.ServletContext;
020
021import org.apache.tapestry.spec.IApplicationSpecification;
022import org.apache.tapestry.web.WebActivator;
023import org.apache.tapestry.web.WebContext;
024
025/**
026 * A "global" holder for various services and configurations. In many cases, these values end up as
027 * properties of the {@link org.apache.tapestry.services.Infrastructure}. The servlet and portlet
028 * implementations differentiate themselves by storing different values into these properties.
029 * 
030 * @author Howard Lewis Ship
031 * @since 4.0
032 */
033public interface ApplicationGlobals
034{
035    /**
036     * Invoked by the (indirectly) by the servlet at init(), after parsing the application
037     * specification.
038     */
039    public void storeActivator(WebActivator activator);
040
041    public void storeSpecification(IApplicationSpecification applicationSpecification);
042
043    /**
044     * Invoked (indirectly) by the servlet at init().
045     */
046    public void storeServletContext(ServletContext context);
047
048    /**
049     * Invoked (indirectly) by the servlet at init().
050     */
051
052    public void storeWebContext(WebContext context);
053
054    /**
055     * Returns the previously stored context.
056     * 
057     * @see #store(WebContext)}.
058     */
059
060    public WebContext getWebContext();
061
062    /**
063     * Returns the previously stored context.
064     * 
065     * @see #storeServletContext(ServletContext)
066     */
067    public ServletContext getServletContext();
068
069    public WebActivator getActivator();
070
071    public IApplicationSpecification getSpecification();
072
073    public String getActivatorName();
074
075    /**
076     * Stores the default set of engine service definitions. Application services override factory
077     * services with the same {@link org.apache.tapestry.engine.IEngineService#getName()name}.
078     * 
079     * @param factoryServices
080     *            List of {@link org.apache.tapestry.engine.IEngineService}.
081     */
082
083    public void storeFactoryServices(List factoryServices);
084
085    /**
086     * Returns the factory default services as a List of
087     * {@link org.apache.tapestry.engine.IEngineService}.
088     */
089
090    public List getFactoryServices();
091}