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.type.scope.storage;
020
021import lucee.commons.io.log.Log;
022import lucee.runtime.CFMLFactoryImpl;
023
024public class StorageScopeEngine {
025        
026        private StorageScopeCleaner[] cleaners;
027
028        private CFMLFactoryImpl factory;
029
030        private Log log;
031
032        public StorageScopeEngine(CFMLFactoryImpl factory, Log log,StorageScopeCleaner[] cleaners){
033                this.cleaners=cleaners;
034                this.factory=factory;
035                this.log=log;
036                
037                for(int i=0;i<cleaners.length;i++){
038                        cleaners[i].init(this);
039                }
040        }
041        
042        public void clean() {
043                for(int i=0;i<cleaners.length;i++){
044                        cleaners[i].clean();
045                }
046        }
047        
048        /**
049         * @return the factory
050         */
051        public CFMLFactoryImpl getFactory() {
052                return factory;
053        }
054
055        /**
056         * @return the log
057         */
058        public Log _getLog() {
059                return log;
060        }
061
062        public void remove(int type, String appName, String cfid) {
063                
064                getFactory().getScopeContext().remove(type,appName,cfid);
065        }
066}