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.impl;
016    
017    import java.util.List;
018    
019    import javax.servlet.ServletContext;
020    
021    import org.apache.tapestry.services.ApplicationGlobals;
022    import org.apache.tapestry.spec.IApplicationSpecification;
023    import org.apache.tapestry.web.WebActivator;
024    import org.apache.tapestry.web.WebContext;
025    
026    /**
027     * Implementation of {@link ApplicationGlobals}.
028     * 
029     * @author Howard Lewis Ship
030     * @since 4.0
031     */
032    public class ApplicationGlobalsImpl implements ApplicationGlobals
033    {
034        private WebActivator _activator;
035    
036        private IApplicationSpecification _specification;
037    
038        private WebContext _webContext;
039    
040        private List _factoryServices;
041    
042        private ServletContext _servletContext;
043    
044        public void storeActivator(WebActivator activator)
045        {
046            _activator = activator;
047        }
048    
049        public void storeSpecification(IApplicationSpecification applicationSpecification)
050        {
051            _specification = applicationSpecification;
052        }
053    
054        public WebActivator getActivator()
055        {
056            return _activator;
057        }
058    
059        public IApplicationSpecification getSpecification()
060        {
061            return _specification;
062        }
063    
064        public String getActivatorName()
065        {
066            return _activator.getActivatorName();
067        }
068    
069        public WebContext getWebContext()
070        {
071            return _webContext;
072        }
073    
074        public void storeWebContext(WebContext context)
075        {
076            _webContext = context;
077        }
078    
079        public void storeFactoryServices(List factoryServices)
080        {
081            _factoryServices = factoryServices;
082        }
083    
084        public List getFactoryServices()
085        {
086            return _factoryServices;
087        }
088    
089        public ServletContext getServletContext()
090        {
091            return _servletContext;
092        }
093    
094        public void storeServletContext(ServletContext context)
095        {
096            _servletContext = context;
097        }
098    }