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 015 package org.apache.tapestry.services; 016 017 import java.util.List; 018 019 import javax.servlet.ServletContext; 020 021 import org.apache.tapestry.spec.IApplicationSpecification; 022 import org.apache.tapestry.web.WebActivator; 023 import 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 */ 033 public interface ApplicationGlobals 034 { 035 /** 036 * Invoked by the (indirectly) by the servlet at init(), after parsing the application 037 * specification. 038 */ 039 void storeActivator(WebActivator activator); 040 041 void storeSpecification(IApplicationSpecification applicationSpecification); 042 043 /** 044 * Invoked (indirectly) by the servlet at init(). 045 */ 046 void storeServletContext(ServletContext context); 047 048 /** 049 * Invoked (indirectly) by the servlet at init(). 050 */ 051 052 void storeWebContext(WebContext context); 053 054 /** 055 * Returns the previously stored context. 056 * 057 * @see #storeWebContext(WebContext) . 058 */ 059 060 WebContext getWebContext(); 061 062 /** 063 * Returns the previously stored context. 064 * 065 * @see #storeServletContext(ServletContext) 066 */ 067 ServletContext getServletContext(); 068 069 WebActivator getActivator(); 070 071 IApplicationSpecification getSpecification(); 072 073 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()} . 078 * 079 * @param factoryServices 080 * List of {@link org.apache.tapestry.engine.IEngineService}. 081 */ 082 083 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 List getFactoryServices(); 091 }