001 package railo.runtime.config.component; 002 003 import railo.commons.io.res.Resource; 004 import railo.runtime.config.ConfigWebFactory; 005 006 public class ComponentFactory { 007 008 009 /** 010 * this method deploy all components for org.railo.cfml 011 * @param dir components directory 012 * @param doNew redeploy even the file exist, this is set to true when a new version is started 013 */ 014 public static void deploy(Resource dir, boolean doNew) { 015 String path="/resource/component/org/railo/cfml/"; 016 017 deploy(dir,path,doNew,"Base"); 018 deploy(dir,path,doNew,"Feed"); 019 deploy(dir,path,doNew,"Ftp"); 020 deploy(dir,path,doNew,"Http"); 021 deploy(dir,path,doNew,"Mail"); 022 deploy(dir,path,doNew,"Query"); 023 deploy(dir,path,doNew,"Result"); 024 025 // orm 026 dir = dir.getRealResource("orm"); 027 path+="orm/"; 028 if(!dir.exists())dir.mkdirs(); 029 deploy(dir,path,doNew,"IEventHandler"); 030 deploy(dir,path,doNew,"INamingStrategy"); 031 } 032 033 private static void deploy(Resource dir, String path,boolean doNew, String name) { 034 Resource f = dir.getRealResource(name+".cfc"); 035 if(!f.exists() || doNew)ConfigWebFactory.createFileFromResourceEL(path+name+".cfc",f); 036 } 037 } 038