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.client; 020 021import lucee.commons.io.log.Log; 022import lucee.commons.io.res.Resource; 023import lucee.runtime.PageContext; 024import lucee.runtime.type.Collection; 025import lucee.runtime.type.Struct; 026import lucee.runtime.type.scope.Client; 027import lucee.runtime.type.scope.storage.StorageScopeFile; 028 029public class ClientFile extends StorageScopeFile implements Client { 030 031 032 /** 033 * Constructor of the class 034 * @param pc 035 * @param name 036 * @param sct 037 */ 038 private ClientFile(PageContext pc,Resource res,Struct sct) { 039 super(pc,res,"client",SCOPE_CLIENT,sct); 040 } 041 042 043 /** 044 * Constructor of the class, clone existing 045 * @param other 046 */ 047 private ClientFile(ClientFile other,boolean deepCopy) { 048 super(other,deepCopy); 049 } 050 051 /** 052 * load new instance of the class 053 * @param name 054 * @param pc 055 * @param log 056 * @return 057 */ 058 public static Client getInstance(String name, PageContext pc, Log log) { 059 060 Resource res=_loadResource(pc.getConfig(),SCOPE_CLIENT,name,pc.getCFID()); 061 Struct data=_loadData(pc,res,log); 062 return new ClientFile(pc,res,data); 063 } 064 065 @Override 066 public Collection duplicate(boolean deepCopy) { 067 return new ClientFile(this,deepCopy); 068 } 069}