001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.services;
020
021import java.util.HashMap;
022import java.util.Map;
023
024import lucee.runtime.PageContext;
025import lucee.runtime.config.ConfigImpl;
026import lucee.runtime.config.ConfigWebUtil;
027import lucee.runtime.engine.ThreadLocalPageContext;
028import lucee.runtime.exp.SecurityException;
029import coldfusion.server.Service;
030import coldfusion.server.ServiceException;
031import coldfusion.server.ServiceMetaData;
032
033public class ServiceSupport implements Service {
034
035        public void start() throws ServiceException {}
036
037        public void stop() throws ServiceException {}
038
039        public void restart() throws ServiceException {}
040
041        public int getStatus() {
042                return STARTED;
043        }
044
045        public ServiceMetaData getMetaData() {
046                return new EmptyServiceMetaData();
047        }
048
049        public Object getProperty(String key) {return null;}
050
051        public void setProperty(String key, Object value) {}
052
053        public Map getResourceBundle() {
054                return new HashMap();
055        }       
056
057    protected void checkWriteAccess() throws SecurityException {
058        ConfigWebUtil.checkGeneralWriteAccess(config(),"");
059        }
060    protected void checkReadAccess() throws SecurityException {
061        ConfigWebUtil.checkGeneralReadAccess(config(),"");
062        }
063
064        protected ConfigImpl config() {
065                return (ConfigImpl) ThreadLocalPageContext.getConfig();
066        }
067
068        protected PageContext pc() {
069                return ThreadLocalPageContext.get();
070        }
071}