001    /**
002     *   GRANITE DATA SERVICES
003     *   Copyright (C) 2006-2013 GRANITE DATA SERVICES S.A.S.
004     *
005     *   This file is part of the Granite Data Services Platform.
006     *
007     *   Granite Data Services is free software; you can redistribute it and/or
008     *   modify it under the terms of the GNU Lesser General Public
009     *   License as published by the Free Software Foundation; either
010     *   version 2.1 of the License, or (at your option) any later version.
011     *
012     *   Granite Data Services is distributed in the hope that it will be useful,
013     *   but WITHOUT ANY WARRANTY; without even the implied warranty of
014     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
015     *   General Public License for more details.
016     *
017     *   You should have received a copy of the GNU Lesser General Public
018     *   License along with this library; if not, write to the Free Software
019     *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
020     *   USA, or see <http://www.gnu.org/licenses/>.
021     */
022    package org.granite.context;
023    
024    import java.util.Map;
025    
026    import org.granite.config.GraniteConfig;
027    import org.granite.config.flex.ServicesConfig;
028    
029    /**
030     * @author William DRAI
031     */
032    public class SimpleGraniteContext extends GraniteContext {
033    
034        private Map<String, Object> applicationMap;
035    
036    
037        public static SimpleGraniteContext createThreadInstance(
038            GraniteConfig graniteConfig,
039            ServicesConfig servicesConfig,
040            Map<String, Object> applicationMap) {
041            
042            return createThreadInstance(graniteConfig, servicesConfig, null, applicationMap, null);
043        }
044        
045        public static SimpleGraniteContext createThreadInstance(
046            GraniteConfig graniteConfig,
047            ServicesConfig servicesConfig,
048            Map<String, Object> applicationMap,
049            String clientType) {
050            
051            return createThreadInstance(graniteConfig, servicesConfig, null, applicationMap, clientType);
052        }
053        
054        public static SimpleGraniteContext createThreadInstance(
055            GraniteConfig graniteConfig,
056            ServicesConfig servicesConfig,
057            String sessionId,
058            Map<String, Object> applicationMap,
059            String clientType) {
060    
061            SimpleGraniteContext graniteContext = new SimpleGraniteContext(graniteConfig, servicesConfig, sessionId, applicationMap, clientType);
062            setCurrentInstance(graniteContext);
063            return graniteContext;
064        }
065    
066    
067        private SimpleGraniteContext(GraniteConfig graniteConfig, ServicesConfig servicesConfig, String sessionId, Map<String, Object> applicationMap, String clientType) {
068            super(graniteConfig, servicesConfig, sessionId, clientType);
069            this.applicationMap = applicationMap;
070        }
071    
072        @Override
073            public Object getSessionLock() {
074                    return null;
075            }
076    
077            @Override
078        public Map<String, String> getInitialisationMap() {
079            return null;
080        }
081        @Override
082        public Map<String, Object> getApplicationMap() {
083            return applicationMap;
084        }
085        @Override
086            public Map<String, Object> getSessionMap(boolean create) {
087                    return null;
088            }
089            @Override
090        public Map<String, Object> getSessionMap() {
091            return null;
092        }
093        @Override
094        public Map<String, Object> getRequestMap() {
095            return null;
096        }
097    }