Changeset 2457
- Timestamp:
- 07/20/09 23:31:09 (4 years ago)
- Location:
- coldbox/trunk/system
- Files:
-
- 5 modified
-
includes/Debug.cfm (modified) (4 diffs)
-
interceptors/EnvironmentControl.cfc (modified) (5 diffs)
-
plugins/Webservices.cfc (modified) (3 diffs)
-
plugins/XMLParser.cfc (modified) (29 diffs)
-
services/DebuggerService.cfc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
coldbox/trunk/system/includes/Debug.cfm
r2443 r2457 10 10 Date : September 25, 2005 11 11 Description : 12 Debugging template for the application 13 14 Modification History: 15 10/13/2005 - Moved reqCollection from session to request. 16 12/23/2005 - Eliminated ConfigStruct Dump 17 01/06/2006 - Eliminated controller references. 18 01/16/2006 - Added support for child applications. 19 06/08/2006 - Updated for coldbox. 20 06/09/2006 - Changed isDefined to StructkeyExists 21 07/12/2006 - Tracer now shows first expanded. 22 02/01/2007 - Updated context references 12 The ColdBox debugger 23 13 -----------------------------------------------------------------------> 24 14 <cfoutput> … … 119 109 <div class="fw_debugContentCell"> 120 110 <cfif Event.getCurrentView() eq ""><span class="fw_redText">N/A</span><cfelse>#Event.getCurrentView()#</cfif> 111 </div> 112 113 <div class="fw_debugTitleCell"> 114 LogBox Appenders: 115 </div> 116 <div class="fw_debugContentCell">#controller.getLogBox().getCurrentAppenders()#</div> 117 <div class="fw_debugTitleCell"> 118 RootLogger Levels: 119 </div> 120 <div class="fw_debugContentCell"> 121 #controller.getLogBox().logLevels.lookup(controller.getLogBox().getRootLogger().getLevelMin())# - 122 #controller.getLogBox().logLevels.lookup(controller.getLogBox().getRootLogger().getLevelMax())# 121 123 </div> 122 124 … … 189 191 <!--- **************************************************************---> 190 192 <cfif controller.getSetting("EnableDumpVar")> 191 <cfset dumpList = Event.getValue("dumpvar",0)> 192 <cfif dumplist neq 0> 193 <cfif structKeyExists(rc,"dumpvar")> 193 194 <!--- Dump Var ---> 194 <div class="fw_titles" onClick="fw_toggle('fw_dumpvar')"> 195 Dumpvar 196 </div> 195 <div class="fw_titles" onClick="fw_toggle('fw_dumpvar')"> Dumpvar</div> 197 196 <div class="fw_debugContent" id="fw_dumpvar"> 198 <cfloop list="# dumplist#" index="i">197 <cfloop list="#rc.dumpvar#" index="i"> 199 198 <cfif isDefined("#i#")> 200 199 <cfdump var="#evaluate(i)#" label="#i#" expand="false"> 201 200 <cfelseif event.valueExists(i)> 202 <cfset _tmpvar = event.getValue(i)> 203 <cfdump var="#_tmpvar#" label="#i#" expand="false"> 201 <cfdump var="#event.getValue(i)#" label="#i#" expand="false"> 204 202 </cfif> 205 203 </cfloop> … … 222 220 <cfset varVal = requestCollection[vars]> 223 221 <tr> 224 <td align="right" width="15%" class="fw_debugTablesTitles"> #lcase(vars)#:</td>222 <td align="right" width="15%" class="fw_debugTablesTitles"><strong>#lcase(vars)#:</strong></td> 225 223 <td class="fw_debugTablesCells"> 226 224 <cfif isSimpleValue(varVal) > -
coldbox/trunk/system/interceptors/EnvironmentControl.cfc
r2393 r2457 32 32 var configFile = ""; 33 33 34 /* Verify that the configFile propety is set */ 34 // Regex for JSON 35 instance.jsonRegex = "^(\{|\[)(.)*(\}|\])$"; 36 37 // Verify that the configFile propety is set 35 38 if( not propertyExists('configFile') ){ 36 39 $throw("Config File property does not exist. Please declare it.",'','interceptors.EnvironmentControl.configFilePropertyNotDefined'); 37 40 } 38 / * Try to locate the path */41 // Try to locate the path 39 42 configFile = locateFilePath(getProperty('configFile')); 40 / * Validate it */43 // Validate it 41 44 if( len(configFile) eq 0 ){ 42 45 $throw('Config File could not be located: #getProperty('configFile')#. Please check again.','','interceptors.EnvironmentControl.configFileNotFound'); 43 46 } 47 // Save Config File 48 setConfigFile(configFile); 44 49 45 / * execute check */50 // Completed Flag 46 51 setProperty('interceptorCompleted',false); 47 48 //Verified, set it49 setConfigFile(configFile);50 52 51 53 //Verify the fireOnInit flag … … 53 55 setProperty('fireOnInit',true); 54 56 } 57 55 58 //Check if we need to fire the interception at configuration 56 59 if( getProperty('fireOnInit') ){ … … 92 95 var environmentsArray = ArrayNew(1); 93 96 var SettingsArray = ArrayNew(1); 94 var settingsLength = 0;97 var environmentXML = ""; 95 98 var i = 1; 96 var ENVIRONMENT= "";99 var environment = ""; 97 100 var oXML = ""; 98 101 var configSettings = getController().getConfigSettings(); … … 100 103 var oUtilities = getPlugin("Utilities"); 101 104 var oJSON = getPlugin("JSON"); 105 var oXMLParser = getPlugin("XMLParser"); 102 106 103 107 //Parse it … … 106 110 //Search and test for environments 107 111 environmentsArray = xmlSearch(oXML, '/environmentcontrol/environment'); 108 109 112 if( arrayLen(environmentsArray) eq 0){ 110 113 $throw("No environment elements found.","Please check your environment file again","interceptors.EnvironmentControl.elementException"); 111 114 } 112 /* Detect the environment */ 113 ENVIRONMENT = detectEnvironment(environmentsArray); 115 // Detect the environment 116 environment = detectEnvironment(environmentsArray); 117 // If no overrides found, then just exit out. 118 if( len(trim(environment)) eq 0 ){ return; } 114 119 115 //Search for ENVIRONMENT settings. 116 SettingsArray = xmlSearch( oXML , "/environmentcontrol/environment[@name='#ENVIRONMENT#']/Setting"); 117 settingsLength = ArrayLen(SettingsArray); 118 //Check if settings for ENVIRONMENT found, else do nothing. 119 if (settingsLength gt 0){ 120 //Loop And set 121 for ( i=1; i lte settingsLength; i=i+1){ 122 thisValue = trim(SettingsArray[i].xmlAttributes.value); 123 /* Replace ${setting} */ 124 thisValue = oUtilities.placeHolderReplacer(trim(thisValue),configSettings); 125 /* json decoding */ 126 if ( (left(thisValue,1) eq "[" AND right(thisValue,1) eq "]") OR 127 (left(thisValue,1) eq "{" AND right(thisValue,1) eq "}") ){ 128 thisValue = oJSON.decode(replace(thisValue,"'","""","all")); 129 } 130 131 /* Check if overriding a set setting */ 132 if( settingExists(trim(SettingsArray[i].xmlAttributes.name)) ){ 133 setSetting( trim(SettingsArray[i].xmlAttributes.name) , thisValue ); 134 } 135 else{ 136 /* Do a full set */ 137 "configSettings.#trim(SettingsArray[i].xmlAttributes.name)#" = thisValue; 138 } 120 //Parse Settings 121 SettingsArray = xmlSearch( oXML , "/environmentcontrol/environment[@name='#environment#']/Setting"); 122 //Insert Your Settings to Config Struct 123 for (i=1; i lte ArrayLen(SettingsArray); i=i+1){ 124 // Get Setting value with PlaceHolding replacements 125 thisValue = oUtilities.placeHolderReplacer(trim(SettingsArray[i].XMLAttributes["value"]),configSettings); 126 //Test for JSON 127 if( reFindNocase(instance.jsonRegex,thisValue) ){ 128 thisValue = oJSON.decode(replace(thisValue,"'","""","all")); 139 129 } 140 } 130 // Check if overriding or new one? 131 if( settingExists(trim(SettingsArray[i].xmlAttributes.name)) ){ 132 setSetting( trim(SettingsArray[i].xmlAttributes.name) , thisValue ); 133 } 134 else{ 135 // Do a full set 136 "configSettings.#trim(SettingsArray[i].xmlAttributes.name)#" = thisValue; 137 } 138 } 139 140 // Parse Other Sections Available in the environment config. 141 environmentXML = xmlSearch( oXML , "/environmentcontrol/environment[@name='#environment#']"); 142 // Mail Settings 143 oXMLParser.parseMailSettings(environmentXML[1],configSettings,oUtilities,true); 144 // i18N 145 oXMLParser.parseLocalization(environmentXML[1],configSettings,oUtilities,true); 146 // Bug Tracers 147 oXMLParser.parseBugTracers(environmentXML[1],configSettings,oUtilities,true); 148 // Web Services 149 oXMLParser.parseWebservices(environmentXML[1],configSettings,oUtilities,true); 150 // Parse Datasources 151 oXMLParser.parseDatasources(environmentXML[1],configSettings,oUtilities,true); 152 // Parse Debugger Settings 153 oXMLParser.parseDebuggerSettings(environmentXML[1],configSettings,oUtilities,true); 154 // Reload Debugger Configuration 155 controller.getDebuggerService().getDebuggerConfig().populate(configSettings.DebuggerSettings); 156 // Parse Interceptors 157 oXMLParser.parseInterceptors(environmentXML[1],configSettings,oUtilities,true); 158 // Parse LogBox 159 oXMLParser.parseLogBox(environmentXML[1],configSettings,oUtilities,true); 160 // Reconfigure LogBox 161 if( NOT structIsEmpty(configSettings["LogBoxConfig"]) ){ 162 controller.getLogBox().configure(controller.getLogBox().getConfig()); 163 controller.setLogger(controller.getLogBox().getLogger("coldbox.system.Controller")); 164 } 141 165 </cfscript> 142 166 </cffunction> -
coldbox/trunk/system/plugins/Webservices.cfc
r2211 r2457 12 12 Macromedia/Adobe. dstanten@adobe.com 13 13 14 15 Modification History:16 02/08/2006 - Updated refresws to look for the webservice in the configstruct first.17 06/08/2006 - Updated for coldbox18 07/29/2006 - Exception is thrown if web service is not found in the configuration structure.19 14 -----------------------------------------------------------------------> 20 15 <cfcomponent name="Webservices" … … 30 25 <cfscript> 31 26 super.Init(arguments.controller); 27 32 28 setpluginName("Web Services"); 33 29 setpluginVersion("1.0"); … … 43 39 44 40 <cffunction name="getWS" returntype="any" access="Public" hint="Get a web service's wsdl url from the configStruct according to which environment you are on." output="false"> 45 <!--- ************************************************************* --->46 41 <cfargument name="name" hint="The name of the web service. If the web service is not found an exception is thrown." type="string" required="Yes"> 47 <!--- ************************************************************* ---> 48 <cfif getController().getSetting("Environment") eq "DEVELOPMENT"> 49 <cfif structKeyExists(getController().getSetting("Webservices").DEV , arguments.name)> 50 <cfreturn getController().getSetting("Webservices").DEV[arguments.name]> 51 </cfif> 52 <cfelse> 53 <cfif structKeyExists(getController().getSetting("Webservices").PRO , arguments.name)> 54 <cfreturn getController().getSetting("Webservices").PRO[arguments.name]> 55 </cfif> 42 <cfset var webservices = getSetting("Webservices")> 43 44 <cfif structKeyExists(webservices , arguments.name)> 45 <cfreturn webservices[arguments.name]> 56 46 </cfif> 57 <cfthrow type="ColdBox.plugins.Webservices.WebServiceNotFoundException" message="The webservice #arguments.name# was not found in the configuration structure."> 47 48 <cfthrow type="Webservices.WebServiceNotFoundException" message="The webservice #arguments.name# was not found in the configuration structure."> 58 49 </cffunction> 59 50 60 51 <cffunction name="getWSobj" access="Public" hint="Get a reference to a webservice obj according to which environment you are on." output="false" returntype="any"> 61 <!--- ************************************************************* --->62 52 <cfargument name="name" hint="The name of the web service. If the web service is not found an exception is thrown" type="string" required="Yes"> 63 <!--- ************************************************************* ---> 64 <cfif getController().getSetting("Environment") eq "DEVELOPMENT"> 65 <cfif structKeyExists(getController().getSetting("Webservices").DEV , arguments.name)> 66 <cfreturn CreateObject("webservice", getController().getSetting("Webservices").DEV[arguments.name] )> 67 </cfif> 68 <cfelse> 69 <cfif structKeyExists(getController().getSetting("Webservices").PRO , arguments.name)> 70 <cfreturn CreateObject("webservice", getController().getSetting("Webservices").PRO[arguments.name] )> 71 </cfif> 72 </cfif> 73 <cfthrow type="ColdBox.plugins.Webservices.WebServiceNotFoundException" message="The webservice #arguments.name# was not found in the configuration structure."> 53 54 <cfreturn createObject("webservice", getWS(arguments.name) )> 55 74 56 </cffunction> 75 57 76 58 <cffunction name="refreshWS" access="Public" hint="Refresh a web service stub object" output="false" returntype="void"> 77 <!--- ************************************************************* --->78 59 <cfargument name="webservice" hint="The name or wsdl URL of the web service to refresh" type="string" required="Yes"> 79 <!--- ************************************************************* --->80 60 <!--- Get the Webservice from the configStruct ---> 81 61 <cfset var ws = getWS(arguments.webservice)> -
coldbox/trunk/system/plugins/XMLParser.cfc
r2443 r2457 10 10 This is a utility function for the framework. It includes any methods 11 11 that will be called from the framework for XML parsing. 12 13 Modification History:14 10/05/2005 - Fix for Dev URL beign blank15 10/06/2005 - Added support for XSD Validation, added this.ConfigFileLocation to be localized.16 10/10/2005 - Added Fix for xsd url in error message for validation.17 12/16/2005 - Changed to variables scope.18 12/18/2006 - Updated MailSettings, owneremail, controller reload.19 01/16/2006 - Added coding to use in child apps, added ApplicationPath,20 FrameworkPath, ChildApp, ParentAppPath, DistanceToParent to fwsetttings.21 02/07/2006 - FrameworkPluginsPath added.22 02/16/2006- Added DebugPassword code.23 06/08/2006 - Updated for Coldbox - Added support for writing the CFMX mapping with . or with /, MessageboxStyleClass24 06/21/2006 - Finished i18N support, file based.25 07/28/2006 - Datasources support, var scope additions.26 08/10/2006 - Child References Eliminated. No longer in use.27 08/20/2006 - i18n Support completed for new plugins.28 10/10/2006 - Mail server settings setup.29 12/20/2006 - new settings: ReinitPassword, InvalidEventHandler30 01/17/2007 - fixed Bug #83, failure to set handler invocation path if / as first char31 01/18/2007 - Preparing for new event registration system.32 01/26/2007 - Datasource Alias and error checking Ticket #88, #8933 12 -----------------------------------------------------------------------> 34 13 <cfcomponent name="XMLParser" … … 52 31 setpluginVersion("2.0"); 53 32 setpluginDescription("I am the framework's XML parser"); 54 55 //Search Patterns for Config file 56 instance.searchSettings = "//Settings/Setting"; 57 instance.searchYourSettings = "//YourSettings/Setting"; 58 instance.searchBugTracer = "//BugTracerReports/BugEmail"; 59 instance.searchWS = "//WebServices/WebService"; 60 instance.searchLayouts = "//Layouts/Layout"; 61 instance.searchDefaultLayout = "//Layouts/DefaultLayout"; 62 instance.searchDefaultView = "//Layouts/DefaultView"; 63 instance.searchMailSettings = "//MailServerSettings"; 64 instance.searchi18NSettings = "//i18N"; 65 instance.searchDatasources = "//Datasources/Datasource"; 66 instance.searchCache = "//Cache"; 67 instance.searchInterceptorCustomPoints = "//Interceptors/CustomInterceptionPoints"; 68 instance.searchInterceptors = "//Interceptors/Interceptor"; 69 instance.searchInterceptorBase = "//Interceptors"; 70 instance.searchDebuggerSettings = "//DebuggerSettings"; 71 72 //Search patterns for fw xml 73 instance.searchConventions = "//Conventions"; 74 33 75 34 //ColdBox Properties 76 35 instance.FileSeparator = createObject("java","java.lang.System").getProperty("file.separator"); … … 78 37 instance.FrameworkConfigXSDFile = ExpandPath("/coldbox/system/config/config.xsd"); 79 38 80 / * Regex for JSON */39 // Regex for JSON 81 40 instance.jsonRegex = "^(\{|\[)(.)*(\}|\])$"; 82 41 … … 90 49 <cffunction name="loadFramework" access="public" hint="Load the framework's configuration xml." output="false" returntype="struct"> 91 50 <!--- ************************************************************* ---> 92 <cfargument name="overrideConfigFile" required="false" type="string" default="" 93 hint="Only used for unit testing or reparsing of a specific coldbox config file."> 51 <cfargument name="overrideConfigFile" required="false" type="string" default="" hint="Only used for unit testing or reparsing of a specific coldbox config file."> 94 52 <!--- ************************************************************* ---> 95 53 <cfscript> … … 112 70 //verify Framework settings File 113 71 if ( not fileExists(instance.FrameworkConfigFile) ){ 114 $throw("Error finding settings.xml configuration file. The file #instance.FrameworkConfigFile# cannot be found.",""," ColdBox.plugins.XMLParser.ColdBoxSettingsNotFoundException");72 $throw("Error finding settings.xml configuration file. The file #instance.FrameworkConfigFile# cannot be found.","","XMLParser.ColdBoxSettingsNotFoundException"); 115 73 } 116 74 //Setup the ColdBox CFML Engine Info … … 145 103 146 104 //Get SettingNodes From Config 147 SettingNodes = XMLSearch(fwXML, instance.searchSettings);105 SettingNodes = XMLSearch(fwXML,"//Settings/Setting"); 148 106 //Insert Settings to Config Struct 149 107 for (i=1; i lte ArrayLen(SettingNodes); i=i+1) … … 154 112 155 113 //Conventions Parsing 156 conventions = XMLSearch(fwXML, instance.searchConventions);114 conventions = XMLSearch(fwXML,"//Conventions"); 157 115 StructInsert(settingsStruct, "HandlersConvention", conventions[1].handlerLocation.xmltext); 158 116 StructInsert(settingsStruct, "pluginsConvention", conventions[1].pluginsLocation.xmltext); … … 177 135 //Validate the findings 178 136 if( not configFileFound ) 179 $throw("ColdBox Application Configuration File can't be found.","The accepted files are: #ConfigXMLFilePath#"," ColdBox.plugins.XMLParser.ConfigXMLFileNotFoundException");137 $throw("ColdBox Application Configuration File can't be found.","The accepted files are: #ConfigXMLFilePath#","XMLParser.ConfigXMLFileNotFoundException"); 180 138 //Insert the correct config file location. 181 139 StructInsert(settingsStruct, "ConfigFileLocation", ConfigXMLFilePath); … … 207 165 } 208 166 catch( Any Exception ){ 209 $throw("Error Loading Framework Configuration.","#Exception.Message# #Exception.Detail#"," ColdBox.plugins.XMLParser.ColdboxSettingsParsingException");167 $throw("Error Loading Framework Configuration.","#Exception.Message# #Exception.Detail#","XMLParser.ColdboxSettingsParsingException"); 210 168 } 211 169 </cfscript> … … 219 177 <!--- ************************************************************* ---> 220 178 <cfscript> 221 var Collections = createObject("java", "java.util.Collections");222 179 //Create Config Structure 223 180 var ConfigStruct = StructNew(); … … 225 182 var ConfigFileLocation = fwSettingsStruct["ConfigFileLocation"]; 226 183 var configXML = ""; 227 //Nodes228 var SettingNodes = "";229 var YourSettingNodes = "";230 var MailSettingsNodes = "";231 //i18n232 var i18NSettingNodes = "";233 var DefaultLocale = "";234 //BugEmail235 var BugEmailNodes = "";236 var BugEmails = "";237 //WebServices238 var WebServiceNodes = "";239 var WebServicesStruct = StructNew();240 var DevWS = StructNew();241 var ProWS = StructNew();242 //Layouts243 var DefaultView = "";244 var LayoutNodes = "";245 var DefaultLayout = "";246 var LayoutViewStruct = Collections.synchronizedMap(CreateObject("java","java.util.LinkedHashMap").init());247 var LayoutFolderStruct = Collections.synchronizedMap(CreateObject("java","java.util.LinkedHashMap").init());248 //Datasources.249 var DatasourcesNodes = "";250 var DSNStruct = StructNew();251 var DatasourcesStruct = Structnew();252 //Cache253 var CacheSettingNodes = "";254 var DebuggerSettingNodes = "";255 //Interceptors256 var InterceptorBase = "";257 var InterceptorNodes = "";258 var CustomInterceptionPoints = "";259 var InterceptorStruct = structnew();260 var InterceptorProperties = "";261 var tempProperty = "";262 //Conventions263 var Conventions = "";264 //loopers265 var i = 0;266 var j = 0;267 184 //Appmapping Variables 268 185 var webPath = ""; … … 272 189 var oUtilities = getPlugin("Utilities"); 273 190 //Testers 274 var tester = "";275 191 var xmlvalidation = ""; 276 192 var errorDetails = ""; 193 var i = 1; 277 194 278 195 try{ 279 280 196 /* ::::::::::::::::::::::::::::::::::::::::: CONFIG FILE PARSING & VALIDATION :::::::::::::::::::::::::::::::::::::::::::: */ 281 282 197 //Validate File, just in case. 283 198 if ( not fileExists(ConfigFileLocation) ){ 284 $throw("The Config File: #ConfigFileLocation# can't be found.","","ColdBox.plugins.XMLParser.ConfigXMLFileNotFoundException"); 285 } 286 287 //Determine Parse Type 199 $throw("The Config File: #ConfigFileLocation# can't be found.","","XMLParser.ConfigXMLFileNotFoundException"); 200 } 201 //Determine Parse Type AND Parse Configuration File 288 202 if ( not fwSettingsStruct["xmlParseActive"] ){ 289 203 configXML = xmlParse(readFile(ConfigFileLocation,false,"utf-8")); … … 292 206 configXML = xmlParse(ConfigFileLocation); 293 207 } 294 295 //Validate the config 208 //Validate the config element 296 209 if ( not structKeyExists(configXML, "config") ) 297 $throw("No Config element found in the configuration file",""," ColdBox.plugins.XMLParser.ConfigXMLParsingException");298 299 /* ::::::::::::::::::::::::::::::::::::::::: APP MAPPINGCALCULATIONS :::::::::::::::::::::::::::::::::::::::::::: */300 301 //Setup the Application Path 210 $throw("No Config element found in the configuration file","","XMLParser.ConfigXMLParsingException"); 211 212 /* ::::::::::::::::::::::::::::::::::::::::: APP LOCATION CALCULATIONS :::::::::::::::::::::::::::::::::::::::::::: */ 213 214 //Setup the Application Path with an Override 302 215 if( arguments.overrideAppMapping neq "" ){ 303 StructInsert(ConfigStruct, "ApplicationPath", ExpandPath(arguments.overrideAppMapping));216 ConfigStruct.ApplicationPath = ExpandPath(arguments.overrideAppMapping); 304 217 if( right(ConfigStruct.ApplicationPath,1) neq "/"){ 305 218 ConfigStruct.ApplicationPath = ConfigStruct.ApplicationPath & "/"; … … 307 220 } 308 221 else{ 309 StructInsert(ConfigStruct, "ApplicationPath", controller.getAppRootPath()); 310 } 311 312 /* ::::::::::::::::::::::::::::::::::::::::: APP MAPPING CALCULATIONS :::::::::::::::::::::::::::::::::::::::::::: */ 222 // Setup Default App Path from main controller 223 ConfigStruct.ApplicationPath = controller.getAppRootPath(); 224 } 313 225 314 226 //Calculate AppMapping if not set in the config, else auto-calculate … … 317 229 localPath = getDirectoryFromPath(replacenocase(getTemplatePath(),"\","/","all")); 318 230 PathLocation = findnocase(webPath, localPath); 231 319 232 if ( PathLocation neq 0) 320 233 ConfigStruct.AppMapping = mid(localPath,PathLocation,len(webPath)); … … 335 248 } 336 249 337 /* ::::::::::::::::::::::::::::::::::::::::: GET SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 338 339 //Get SettingNodes 340 SettingNodes = XMLSearch(configXML, instance.searchSettings); 250 /* ::::::::::::::::::::::::::::::::::::::::: GET COLDBOX SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 251 parseColdboxSettings(configXML,configStruct,oUtilities,arguments.overrideAppMapping); 252 253 /* ::::::::::::::::::::::::::::::::::::::::: YOUR SETTINGS LOADING :::::::::::::::::::::::::::::::::::::::::::: */ 254 parseYourSettings(configXML,configStruct,oUtilities); 255 256 /* ::::::::::::::::::::::::::::::::::::::::: YOUR CONVENTIONS LOADING :::::::::::::::::::::::::::::::::::::::::::: */ 257 parseConventions(configXML,configStruct,oUtilities); 258 259 /* ::::::::::::::::::::::::::::::::::::::::: HANDLER-MODELS-PLUGIN INVOCATION PATHS :::::::::::::::::::::::::::::::::::::::::::: */ 260 parseInvocationPaths(configXML,configStruct,oUtilities); 261 262 /* ::::::::::::::::::::::::::::::::::::::::: EXTERNAL LAYOUTS/VIEWS LOCATION :::::::::::::::::::::::::::::::::::::::::::: */ 263 parseExternalLocations(configXML,configStruct,oUtilities); 264 265 /* ::::::::::::::::::::::::::::::::::::::::: MAIL SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 266 parseMailSettings(configXML,configStruct,oUtilities); 267 268 /* ::::::::::::::::::::::::::::::::::::::::: I18N SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 269 parseLocalization(configXML,configStruct,oUtilities); 270 271 /* ::::::::::::::::::::::::::::::::::::::::: BUG MAIL SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 272 parseBugTracers(configXML,configStruct,oUtilities); 273 274 /* ::::::::::::::::::::::::::::::::::::::::: ENVIRONMENT SETTING :::::::::::::::::::::::::::::::::::::::::::: */ 275 ConfigStruct.Environment = "PRODUCTION"; 276 277 /* ::::::::::::::::::::::::::::::::::::::::: WS SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 278 parseWebservices(configXML,configStruct,oUtilities); 279 280 /* ::::::::::::::::::::::::::::::::::::::::: DATASOURCES SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 281 parseDatasources(configXML,configStruct,oUtilities); 282 283 /* ::::::::::::::::::::::::::::::::::::::::: LAYOUT VIEW FOLDER SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 284 parseLayoutsViews(configXML,configStruct,oUtilities); 285 286 /* ::::::::::::::::::::::::::::::::::::::::: CACHE SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 287 parseCacheSettings(configXML,configStruct,oUtilities); 288 289 /* ::::::::::::::::::::::::::::::::::::::::: DEBUGGER SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 290 parseDebuggerSettings(configXML,configStruct,oUtilities); 291 292 /* ::::::::::::::::::::::::::::::::::::::::: INTERCEPTOR SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 293 parseInterceptors(configXML,configStruct,oUtilities); 294 295 /* ::::::::::::::::::::::::::::::::::::::::: LOGBOX Configuration :::::::::::::::::::::::::::::::::::::::::::: */ 296 parseLogBox(configXML,configStruct,oUtilities); 297 298 /* ::::::::::::::::::::::::::::::::::::::::: CONFIG FILE LAST MODIFIED SETTING :::::::::::::::::::::::::::::::::::::::::::: */ 299 ConfigStruct.ConfigTimeStamp = oUtilities.FileLastModified(ConfigFileLocation); 300 301 /* ::::::::::::::::::::::::::::::::::::::::: XSD VALIDATION :::::::::::::::::::::::::::::::::::::::::::: */ 302 303 } 304 catch( Any Exception ){ 305 $throw("#Exception.Message# & #Exception.Detail#",Exception.tagContext.toString(), "XMLParser.ConfigXMLParsingException"); 306 } 307 308 //Determine which CF version for XML Parsing method 309 if ( fwSettingsStruct["xmlValidateActive"] ){ 310 //Finally Validate With XSD 311 xmlvalidation = XMLValidate(configXML, fwSettingsStruct["ConfigFileSchemaLocation"]); 312 //Validate Errors 313 if(NOT xmlvalidation.status){ 314 for(i = 1; i lte ArrayLen(xmlvalidation.errors); i = i + 1){ 315 errorDetails = errorDetails & xmlvalidation.errors[i] & chr(10) & chr(13); 316 } 317 //Throw the error. 318 $throw("<br>The config.xml file does not validate with the framework's schema.","The error details are:<br/> #errorDetails#","XMLParser.ConfigXMLParsingException"); 319 }// if invalid status 320 }//if xml validation is on 321 322 323 //finish 324 return ConfigStruct; 325 </cfscript> 326 </cffunction> 327 328 <!--- parseColdboxSettings ---> 329 <cffunction name="parseColdboxSettings" output="false" access="public" returntype="void" hint="Parse ColdBox Settings"> 330 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 331 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 332 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 333 <cfargument name="overrideAppMapping" type="string" required="false" default="" hint="Only used for unit testing or reparsing of a specific coldbox config file."/> 334 <cfscript> 335 var ConfigStruct = arguments.config; 336 var fwSettingsStruct = controller.getColdBoxSettings(); 337 var SettingNodes = XMLSearch(arguments.xml,"//Settings/Setting"); 338 var i=1; 339 341 340 if ( ArrayLen(SettingNodes) eq 0 ) 342 $throw("No Setting elements could be found in the configuration file.",""," ColdBox.plugins.XMLParser.ConfigXMLParsingException");341 $throw("No Setting elements could be found in the configuration file.","","XMLParser.ConfigXMLParsingException"); 343 342 //Insert ColdBox Settings to Config Struct 344 343 for (i=1; i lte ArrayLen(SettingNodes); i=i+1){ 345 ConfigStruct[trim(SettingNodes[i].XMLAttributes["name"])] = oUtilities.placeHolderReplacer(trim(SettingNodes[i].XMLAttributes["value"]),ConfigStruct); 346 } 347 //Check for AppName or throw 348 if ( not StructKeyExists(ConfigStruct, "AppName") ) 349 $throw("There was no 'AppName' setting defined. This is required by the framework.","","ColdBox.plugins.XMLParser.ConfigXMLParsingException"); 344 ConfigStruct[trim(SettingNodes[i].XMLAttributes["name"])] = arguments.utility.placeHolderReplacer(trim(SettingNodes[i].XMLAttributes["value"]),ConfigStruct); 345 } 350 346 //overrideAppMapping if passed in. 351 347 if ( arguments.overrideAppMapping neq "" ){ 352 348 ConfigStruct["AppMapping"] = arguments.overrideAppMapping; 353 349 } 354 / * Clean the first / if found */350 // Clean the first / if found 355 351 if( len(ConfigStruct.AppMapping) eq 1 ){ 356 ConfigStruct .AppMapping= "";352 ConfigStruct["AppMapping"] = ""; 357 353 } 358 354 359 355 /* ::::::::::::::::::::::::::::::::::::::::: COLDBOX SETTINGS VALIDATION :::::::::::::::::::::::::::::::::::::::::::: */ 360 356 //Check for AppName or throw 357 if ( not StructKeyExists(ConfigStruct, "AppName") ) 358 $throw("There was no 'AppName' setting defined. This is required by the framework.","","XMLParser.ConfigXMLParsingException"); 361 359 //Check for Default Event 362 360 if ( not StructKeyExists(ConfigStruct, "DefaultEvent") ) 363 $throw("There was no 'DefaultEvent' setting defined. This is required by the framework.","","ColdBox.plugins.XMLParser.ConfigXMLParsingException"); 364 361 $throw("There was no 'DefaultEvent' setting defined. This is required by the framework.","","XMLParser.ConfigXMLParsingException"); 365 362 //Check for Event Name 366 363 if ( not StructKeyExists(ConfigStruct, "EventName") ) 367 364 ConfigStruct["EventName"] = fwSettingsStruct["EventName"] ; 368 369 365 //Check for Request Start Handler 370 366 if ( not StructKeyExists(ConfigStruct, "ApplicationStartHandler") ) 371 367 ConfigStruct["ApplicationStartHandler"] = ""; 372 373 368 //Check for Request End Handler 374 369 if ( not StructKeyExists(ConfigStruct, "RequestStartHandler") ) 375 370 ConfigStruct["RequestStartHandler"] = ""; 376 377 371 //Check for Application Start Handler 378 372 if ( not StructKeyExists(ConfigStruct, "RequestEndHandler") ) 379 373 ConfigStruct["RequestEndHandler"] = ""; 380 381 374 //Check for Session Start Handler 382 375 if ( not StructKeyExists(ConfigStruct, "SessionStartHandler") ) 383 376 ConfigStruct["SessionStartHandler"] = ""; 384 385 377 //Check for Session End Handler 386 378 if ( not StructKeyExists(ConfigStruct, "SessionEndHandler") ) 387 379 ConfigStruct["SessionEndHandler"] = ""; 388 389 380 //Check for InvalidEventHandler 390 381 if ( not StructKeyExists(ConfigStruct, "onInvalidEvent") ) 391 382 ConfigStruct["onInvalidEvent"] = ""; 392 393 383 //Check For DebugMode in settings 394 384 if ( not structKeyExists(ConfigStruct, "DebugMode") or not isBoolean(ConfigStruct.DebugMode) ) 395 385 ConfigStruct["DebugMode"] = "false"; 396 397 386 //Check for DebugPassword in settings, else leave blank. 398 387 if ( not structKeyExists(ConfigStruct, "DebugPassword") ) 399 388 ConfigStruct["DebugPassword"] = ""; 400 401 389 //Check for ReinitPassword 402 390 if ( not structKeyExists(ConfigStruct, "ReinitPassword") ) 403 391 ConfigStruct["ReinitPassword"] = ""; 404 405 392 //Check For Owner Email or Throw 406 393 if ( not StructKeyExists(ConfigStruct, "OwnerEmail") ) 407 394 ConfigStruct["OwnerEmail"] = ""; 408 409 395 //Check For EnableDumpvar or set to true 410 396 if ( not StructKeyExists(ConfigStruct, "EnableDumpVar") or not isBoolean(ConfigStruct.EnableDumpVar)) 411 397 ConfigStruct["EnableDumpVar"] = "true"; 412 413 398 //Check For EnableBugReports Active or set to true 414 399 if ( not StructKeyExists(ConfigStruct, "EnableBugReports") or not isBoolean(ConfigStruct.EnableBugReports)) 415 400 ConfigStruct["EnableBugReports"] = "true"; 416 417 401 //Check For UDFLibraryFile 418 402 if ( not StructKeyExists(ConfigStruct, "UDFLibraryFile") ) 419 403 ConfigStruct["UDFLibraryFile"] = ""; 420 421 404 //Check For CustomErrorTemplate 422 405 if ( not StructKeyExists(ConfigStruct, "CustomErrorTemplate") ) 423 406 ConfigStruct["CustomErrorTemplate"] = ""; 424 425 407 //Check for CustomEmailBugReport 426 408 if ( not StructKeyExists(ConfigStruct, "CustomEmailBugReport") ) 427 409 ConfigStruct["CustomEmailBugReport"] = ""; 428 429 410 //Check for MessageboxStyleOverride if found, default = false 430 411 if ( not structkeyExists(ConfigStruct, "MessageboxStyleOverride") or not isBoolean(ConfigStruct.MessageboxStyleOverride) ) 431 412 ConfigStruct["MessageboxStyleOverride"] = "false"; 432 433 413 //Check for HandlersIndexAutoReload, default = false 434 414 if ( not structkeyExists(ConfigStruct, "HandlersIndexAutoReload") or not isBoolean(ConfigStruct.HandlersIndexAutoReload) ) 435 415 ConfigStruct["HandlersIndexAutoReload"] = false; 436 437 416 //Check for ConfigAutoReload 438 417 if ( not structKeyExists(ConfigStruct, "ConfigAutoReload") or not isBoolean(ConfigStruct.ConfigAutoReload) ) 439 418 ConfigStruct["ConfigAutoReload"] = false; 440 441 419 //Check for ExceptionHandler if found 442 420 if ( not structkeyExists(ConfigStruct, "ExceptionHandler") ) 443 421 ConfigStruct["ExceptionHandler"] = ""; 444 445 422 //Check for PluginsExternalLocation if found 446 423 if ( not structkeyExists(ConfigStruct, "PluginsExternalLocation") ) 447 424 ConfigStruct["PluginsExternalLocation"] = ""; 448 449 425 //Check for Handler Caching 450 426 if ( not structKeyExists(ConfigStruct, "HandlerCaching") or not isBoolean(ConfigStruct.HandlerCaching) ) 451 427 ConfigStruct["HandlerCaching"] = true; 452 453 428 //Check for Event Caching 454 429 if ( not structKeyExists(ConfigStruct, "EventCaching") or not isBoolean(ConfigStruct.EventCaching) ) 455 430 ConfigStruct["EventCaching"] = true; 456 457 431 //Check for IOC Framework & Settings 458 432 if ( not structKeyExists(ConfigStruct, "IOCFramework") ) … … 464 438 if ( not structKeyExists(ConfigStruct, "IOCObjectCaching") or not isBoolean(ConfigStruct.IOCObjectCaching) ) 465 439 ConfigStruct["IOCObjectCaching"] = false; 466 467 440 //RequestContextDecorator 468 441 if ( not structKeyExists(ConfigStruct, "RequestContextDecorator") or len(ConfigStruct["RequestContextDecorator"]) eq 0 ){ 469 442 ConfigStruct["RequestContextDecorator"] = ""; 470 443 } 471 472 444 //Check for ProxyReturnCollection 473 445 if ( not structKeyExists(ConfigStruct, "ProxyReturnCollection") or not isBoolean(ConfigStruct.ProxyReturnCollection) ) 474 446 ConfigStruct["ProxyReturnCollection"] = false; 475 476 447 //Check for External Handlers Location 477 448 if ( not structKeyExists(ConfigStruct, "HandlersExternalLocation") or len(ConfigStruct["HandlersExternalLocation"]) eq 0 ) 478 449 ConfigStruct["HandlersExternalLocation"] = ""; 479 480 450 //Check for Models External Location 481 451 if ( not structKeyExists(ConfigStruct, "ModelsExternalLocation") or len(ConfigStruct["ModelsExternalLocation"]) eq 0 ) … … 504 474 fwSettingsStruct["FlashURLPersistScope"] = ConfigStruct["FlashURLPersistScope"]; 505 475 } 506 507 508 /* ::::::::::::::::::::::::::::::::::::::::: YOUR SETTINGS LOADING :::::::::::::::::::::::::::::::::::::::::::: */ 509 510 //Your Settings To Load 511 YourSettingNodes = XMLSearch(configXML, instance.searchYourSettings); 512 if ( ArrayLen(YourSettingNodes) ){ 513 //Insert Your Settings to Config Struct 514 for (i=1; i lte ArrayLen(YourSettingNodes); i=i+1){ 515 /* Get Setting with PlaceHolding */ 516 tester = oUtilities.placeHolderReplacer(trim(YourSettingNodes[i].XMLAttributes["value"]),ConfigStruct); 517 //Test for JSON 518 if( reFindNocase(instance.jsonRegex,tester) ){ 519 StructInsert(ConfigStruct, YourSettingNodes[i].XMLAttributes["name"], getPlugin("JSON").decode(replace(tester,"'","""","all")) ); 520 } 521 else 522 StructInsert( ConfigStruct, YourSettingNodes[i].XMLAttributes["name"], tester); 523 } 524 } 525 526 /* ::::::::::::::::::::::::::::::::::::::::: YOUR CONVENTIONS LOADING :::::::::::::::::::::::::::::::::::::::::::: */ 527 528 conventions = XMLSearch(configXML,instance.searchConventions); 476 </cfscript> 477 </cffunction> 478 479 <!--- parseInvocationPaths ---> 480 <cffunction name="parseInvocationPaths" output="false" access="public" returntype="void" hint="Parse Invocation paths"> 481 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 482 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 483 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 484 <cfscript> 485 var ConfigStruct = arguments.config; 486 var fwSettingsStruct = controller.getColdBoxSettings(); 487 488 //Set the Handlers External Configuration Paths 489 if( configStruct["HandlersExternalLocation"] neq "" ){ 490 //Expand the external location to get a registration path 491 configStruct["HandlersExternalLocationPath"] = ExpandPath("/" & replace(ConfigStruct["HandlersExternalLocation"],".","/","all")); 492 } 493 else{ 494 configStruct["HandlersExternalLocationPath"] = ""; 495 } 496 497 //Set the Handlers,Models, & Custom Plugin Invocation & Physical Path for this Application 498 if( ConfigStruct["AppMapping"] neq ""){ 499 500 //Parse out the first / to create invocation Path 501 if ( left(ConfigStruct["AppMapping"],1) eq "/" ){ 502 ConfigStruct["AppMapping"] = removeChars(ConfigStruct["AppMapping"],1,1); 503 } 504 505 //Set the Invocation Path 506 ConfigStruct["HandlersInvocationPath"] = replace(ConfigStruct["AppMapping"],"/",".","all") & ".#fwSettingsStruct.handlersConvention#"; 507 ConfigStruct["MyPluginsInvocationPath"] = replace(ConfigStruct["AppMapping"],"/",".","all") & ".#fwSettingsStruct.pluginsConvention#"; 508 ConfigStruct["ModelsInvocationPath"] = replace(ConfigStruct["AppMapping"],"/",".","all") & ".#fwSettingsStruct.ModelsConvention#"; 509 510 //Set the Location Path 511 ConfigStruct["HandlersPath"] = ConfigStruct["AppMapping"]; 512 ConfigStruct["MyPluginsPath"] = ConfigStruct["AppMapping"]; 513 ConfigStruct["ModelsPath"] = ConfigStruct["AppMapping"]; 514 515 //Set the physical path according to system. 516 ConfigStruct["HandlersPath"] = "/" & ConfigStruct["HandlersPath"] & "/#fwSettingsStruct.handlersConvention#"; 517 ConfigStruct["MyPluginsPath"] = "/" & ConfigStruct["MyPluginsPath"] & "/#fwSettingsStruct.pluginsConvention#"; 518 ConfigStruct["ModelsPath"] = "/" & ConfigStruct["ModelsPath"] & "/#fwSettingsStruct.ModelsConvention#"; 519 520 //Set the Handlerspath expanded. 521 ConfigStruct["HandlersPath"] = ExpandPath(ConfigStruct["HandlersPath"]); 522 ConfigStruct["MyPluginsPath"] = ExpandPath(ConfigStruct["MyPluginsPath"]); 523 ConfigStruct["ModelsPath"] = ExpandPath(ConfigStruct["ModelsPath"]); 524 525 } 526 else{ 527 //Parse out the first / to create the invocation Path 528 if ( left(ConfigStruct["AppMapping"],1) eq "/" ){ 529 ConfigStruct["AppMapping"] = removeChars(ConfigStruct["AppMapping"],1,1); 530 } 531 532 /* Handler Registration */ 533 ConfigStruct["HandlersInvocationPath"] = "#fwSettingsStruct.handlersConvention#"; 534 ConfigStruct["HandlersPath"] = controller.getAppRootPath() & "#fwSettingsStruct.handlersConvention#"; 535 536 /* Custom Plugins Registration */ 537 ConfigStruct["MyPluginsInvocationPath"] = "#fwSettingsStruct.pluginsConvention#"; 538 ConfigStruct["MyPluginsPath"] = controller.getAppRootPath() & "#fwSettingsStruct.pluginsConvention#"; 539 540 /* Models Registration */ 541 ConfigStruct["ModelsInvocationPath"] = "#fwSettingsStruct.ModelsConvention#"; 542 ConfigStruct["ModelsPath"] = controller.getAppRootPath() & "#fwSettingsStruct.ModelsConvention#"; 543 } 544 </cfscript> 545 </cffunction> 546 547 <!--- parseExternalLocations ---> 548 <cffunction name="parseExternalLocations" output="false" access="public" returntype="void" hint="Parse External locations"> 549 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 550 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 551 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 552 <cfscript> 553 var ConfigStruct = arguments.config; 554 555 // check for ViewsExternalLocation 556 if( structKeyExists(configStruct,"ViewsExternalLocation") and configStruct["ViewsExternalLocation"] neq "" ){ 557 // Verify the locations, do relative to the app mapping first 558 if( directoryExists(controller.getAppRootPath() & configStruct["ViewsExternalLocation"]) ){ 559 configStruct["ViewsExternalLocation"] = "/" & ConfigStruct["AppMapping"] & "/" & configStruct["ViewsExternalLocation"]; 560 } 561 else if( not directoryExists(expandPath(configStruct["ViewsExternalLocation"])) ){ 562 $throw("ViewsExternalLocation could not be found.","The directories tested was relative and expanded using #configStruct['ViewsExternalLocation']#. Please verify your setting.","XMLParser.ConfigXMLParsingException"); 563 } 564 // Cleanup 565 if ( right(configStruct["ViewsExternalLocation"],1) eq "/" ){ 566 configStruct["ViewsExternalLocation"] = left(configStruct["ViewsExternalLocation"],len(configStruct["ViewsExternalLocation"])-1); 567 } 568 }else{ 569 configStruct["ViewsExternalLocation"] = ""; 570 } 571 572 // check for LayoutsExternalLocation 573 if( structKeyExists(configStruct,"LayoutsExternalLocation") and configStruct["LayoutsExternalLocation"] neq "" ){ 574 // Verify the locations, do relative to the app mapping first 575 if( directoryExists(controller.getAppRootPath() & configStruct["LayoutsExternalLocation"]) ){ 576 configStruct["LayoutsExternalLocation"] = "/" & ConfigStruct["AppMapping"] & "/" & configStruct["LayoutsExternalLocation"]; 577 } 578 else if( not directoryExists(expandPath(configStruct["LayoutsExternalLocation"])) ){ 579 $throw("LayoutsExternalLocation could not be found.","The directories tested was relative and expanded using #configStruct['LayoutsExternalLocation']#. Please verify your setting.","XMLParser.ConfigXMLParsingException"); 580 } 581 // Cleanup 582 if ( right(configStruct["LayoutsExternalLocation"],1) eq "/" ){ 583 configStruct["LayoutsExternalLocation"] = left(configStruct["LayoutsExternalLocation"],len(configStruct["LayoutsExternalLocation"])-1); 584 } 585 }else{ 586 configStruct["LayoutsExternalLocation"] = ""; 587 } 588 </cfscript> 589 </cffunction> 590 591 <!--- parseConventions ---> 592 <cffunction name="parseConventions" output="false" access="public" returntype="void" hint="Parse Conventions"> 593 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 594 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 595 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 596 <cfscript> 597 var ConfigStruct = arguments.config; 598 var conventions = XMLSearch(arguments.xml,"//Conventions"); 599 var fwSettingsStruct = controller.getColdboxSettings(); 600 529 601 if( ArrayLen(conventions) ){ 530 602 /* Override conventions on a per found basis. */ … … 536 608 if( structKeyExists(conventions[1],"modelsLocation") ){ fwSettingsStruct["ModelsConvention"] = trim(conventions[1].modelsLocation.xmltext); } 537 609 } 538 539 /* ::::::::::::::::::::::::::::::::::::::::: HANDLER-MODELS-PLUGIN INVOCATION PATHS :::::::::::::::::::::::::::::::::::::::::::: */ 540 541 //Set the Handlers External Configuration Paths 542 if( configStruct["HandlersExternalLocation"] neq "" ){ 543 //Expand the external location to get a registration path 544 configStruct["HandlersExternalLocationPath"] = ExpandPath("/" & replace(ConfigStruct["HandlersExternalLocation"],".","/","all")); 545 } 546 else{ 547 configStruct["HandlersExternalLocationPath"] = ""; 548 } 549 550 //Set the Handlers,Models, & Custom Plugin Invocation & Physical Path for this Application 551 if( ConfigStruct["AppMapping"] neq ""){ 552 553 //Parse out the first / to create invocation Path 554 if ( left(ConfigStruct["AppMapping"],1) eq "/" ){ 555 ConfigStruct["AppMapping"] = removeChars(ConfigStruct["AppMapping"],1,1); 556 } 557 558 //Set the Invocation Path 559 ConfigStruct["HandlersInvocationPath"] = replace(ConfigStruct["AppMapping"],"/",".","all") & ".#fwSettingsStruct.handlersConvention#"; 560 ConfigStruct["MyPluginsInvocationPath"] = replace(ConfigStruct["AppMapping"],"/",".","all") & ".#fwSettingsStruct.pluginsConvention#"; 561 ConfigStruct["ModelsInvocationPath"] = replace(ConfigStruct["AppMapping"],"/",".","all") & ".#fwSettingsStruct.ModelsConvention#"; 562 563 //Set the Location Path 564 ConfigStruct["HandlersPath"] = ConfigStruct["AppMapping"]; 565 ConfigStruct["MyPluginsPath"] = ConfigStruct["AppMapping"]; 566 ConfigStruct["ModelsPath"] = ConfigStruct["AppMapping"]; 567 568 //Set the physical path according to system. 569 ConfigStruct["HandlersPath"] = "/" & ConfigStruct["HandlersPath"] & "/#fwSettingsStruct.handlersConvention#"; 570 ConfigStruct["MyPluginsPath"] = "/" & ConfigStruct["MyPluginsPath"] & "/#fwSettingsStruct.pluginsConvention#"; 571 ConfigStruct["ModelsPath"] = "/" & ConfigStruct["ModelsPath"] & "/#fwSettingsStruct.ModelsConvention#"; 572 573 //Set the Handlerspath expanded. 574 ConfigStruct["HandlersPath"] = ExpandPath(ConfigStruct["HandlersPath"]); 575 ConfigStruct["MyPluginsPath"] = ExpandPath(ConfigStruct["MyPluginsPath"]); 576 ConfigStruct["ModelsPath"] = ExpandPath(ConfigStruct["ModelsPath"]); 577 578 } 579 else{ 580 //Parse out the first / to create the invocation Path 581 if ( left(ConfigStruct["AppMapping"],1) eq "/" ){ 582 ConfigStruct["AppMapping"] = removeChars(ConfigStruct["AppMapping"],1,1); 583 } 584 585 /* Handler Registration */ 586 ConfigStruct["HandlersInvocationPath"] = "#fwSettingsStruct.handlersConvention#"; 587 ConfigStruct["HandlersPath"] = controller.getAppRootPath() & "#fwSettingsStruct.handlersConvention#"; 588 589 /* Custom Plugins Registration */ 590 ConfigStruct["MyPluginsInvocationPath"] = "#fwSettingsStruct.pluginsConvention#"; 591 ConfigStruct["MyPluginsPath"] = controller.getAppRootPath() & "#fwSettingsStruct.pluginsConvention#"; 592 593 /* Models Registration */ 594 ConfigStruct["ModelsInvocationPath"] = "#fwSettingsStruct.ModelsConvention#"; 595 ConfigStruct["ModelsPath"] = controller.getAppRootPath() & "#fwSettingsStruct.ModelsConvention#"; 596 } 597 598 /* ::::::::::::::::::::::::::::::::::::::::: EXTERNAL VIEWS LOCATION :::::::::::::::::::::::::::::::::::::::::::: */ 599 600 /* check for ViewsExternalLocation */ 601 if( structKeyExists(configStruct,"ViewsExternalLocation") and configStruct["ViewsExternalLocation"] neq "" ){ 602 /* Verify the locations, do relative to the app mapping first */ 603 if( directoryExists(controller.getAppRootPath() & configStruct["ViewsExternalLocation"]) ){ 604 configStruct["ViewsExternalLocation"] = "/" & ConfigStruct["AppMapping"] & "/" & configStruct["ViewsExternalLocation"]; 605 } 606 else if( not directoryExists(expandPath(configStruct["ViewsExternalLocation"])) ){ 607 $throw("ViewsExternalLocation could not be found.","The directories tested was relative and expanded using #configStruct['ViewsExternalLocation']#. Please verify your setting.","ColdBox.plugins.XMLParser.ConfigXMLParsingException"); 608 } 609 /* Cleanup */ 610 if ( right(configStruct["ViewsExternalLocation"],1) eq "/" ){ 611 configStruct["ViewsExternalLocation"] = left(configStruct["ViewsExternalLocation"],len(configStruct["ViewsExternalLocation"])-1); 612 } 613 }else{ 614 configStruct["ViewsExternalLocation"] = ""; 615 } 616 617 /* ::::::::::::::::::::::::::::::::::::::::: EXTERNAL LAYOUTS LOCATION :::::::::::::::::::::::::::::::::::::::::::: */ 618 619 /* check for LayoutsExternalLocation */ 620 if( structKeyExists(configStruct,"LayoutsExternalLocation") and configStruct["LayoutsExternalLocation"] neq "" ){ 621 /* Verify the locations, do relative to the app mapping first */ 622 if( directoryExists(controller.getAppRootPath() & configStruct["LayoutsExternalLocation"]) ){ 623 configStruct["LayoutsExternalLocation"] = "/" & ConfigStruct["AppMapping"] & "/" & configStruct["LayoutsExternalLocation"]; 624 } 625 else if( not directoryExists(expandPath(configStruct["LayoutsExternalLocation"])) ){ 626 $throw("LayoutsExternalLocation could not be found.","The directories tested was relative and expanded using #configStruct['LayoutsExternalLocation']#. Please verify your setting.","XMLParser.ConfigXMLParsingException"); 627 } 628 /* Cleanup */ 629 if ( right(configStruct["LayoutsExternalLocation"],1) eq "/" ){ 630 configStruct["LayoutsExternalLocation"] = left(configStruct["LayoutsExternalLocation"],len(configStruct["LayoutsExternalLocation"])-1); 631 } 632 }else{ 633 configStruct["LayoutsExternalLocation"] = ""; 634 } 635 636 /* ::::::::::::::::::::::::::::::::::::::::: MAIL SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 637 610 </cfscript> 611 </cffunction> 612 613 <!--- parseYourSettings ---> 614 <cffunction name="parseYourSettings" output="false" access="public" returntype="void" hint="Parse Your Settings"> 615 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 616 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 617 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 618 <cfscript> 619 var ConfigStruct = arguments.config; 620 //Your Settings To Load 621 var YourSettingNodes = XMLSearch(arguments.xml, "//YourSettings/Setting"); 622 var i=1; 623 var tester = ""; 624 625 if ( ArrayLen(YourSettingNodes) ){ 626 //Insert Your Settings to Config Struct 627 for (i=1; i lte ArrayLen(YourSettingNodes); i=i+1){ 628 /* Get Setting with PlaceHolding */ 629 tester = arguments.utility.placeHolderReplacer(trim(YourSettingNodes[i].XMLAttributes["value"]),ConfigStruct); 630 //Test for JSON 631 if( reFindNocase(instance.jsonRegex,tester) ){ 632 ConfigStruct[YourSettingNodes[i].XMLAttributes["name"]] = getPlugin("JSON").decode(replace(tester,"'","""","all")); 633 } 634 else 635 ConfigStruct[YourSettingNodes[i].XMLAttributes["name"]] = tester; 636 } 637 } 638 </cfscript> 639 </cffunction> 640 641 <!--- parseLocalization ---> 642 <cffunction name="parseMailSettings" output="false" access="public" returntype="void" hint="Parse Mail Settings"> 643 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 644 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 645 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 646 <cfargument name="isOverride" type="boolean" required="false" default="false" hint="Flag to denote if overriding or first time runner."/> 647 <cfscript> 648 var ConfigStruct = arguments.config; 638 649 //Mail Settings 639 MailSettingsNodes = XMLSearch(configXML, instance.searchMailSettings); 650 var MailSettingsNodes = XMLSearch(arguments.xml,"//MailServerSettings"); 651 640 652 //Check if empty 641 653 if ( ArrayLen(MailSettingsNodes) gt 0 and ArrayLen(MailSettingsNodes[1].XMLChildren) gt 0){ 642 643 654 //Checks 644 655 if ( structKeyExists(MailSettingsNodes[1], "MailServer") ) 645 StructInsert(ConfigStruct, "MailServer", trim(MailSettingsNodes[1].MailServer.xmlText));656 ConfigStruct.MailServer = trim(MailSettingsNodes[1].MailServer.xmlText); 646 657 else 647 StructInsert(ConfigStruct,"MailServer","");658 ConfigStruct.MailServer = ""; 648 659 649 660 //Mail username 650 661 if ( structKeyExists(MailSettingsNodes[1], "MailUsername") ) 651 StructInsert(ConfigStruct, "MailUsername", trim(MailSettingsNodes[1].MailUsername.xmlText));662 ConfigStruct.MailUsername = trim(MailSettingsNodes[1].MailUsername.xmlText); 652 663 else 653 StructInsert(ConfigStruct,"MailUsername","");664 ConfigStruct.MailUsername = ""; 654 665 655 666 //Mail password 656 667 if ( structKeyExists(MailSettingsNodes[1], "MailPassword") ) 657 StructInsert(ConfigStruct, "MailPassword", trim(MailSettingsNodes[1].MailPassword.xmlText));668 ConfigStruct.MailPassword = trim(MailSettingsNodes[1].MailPassword.xmlText); 658 669 else 659 StructInsert(ConfigStruct,"MailPassword","");670 ConfigStruct.MailPassword = ""; 660 671 661 672 //Mail Port 662 673 if ( structKeyExists(MailSettingsNodes[1], "MailPort") ){ 663 674 if (trim(MailSettingsNodes[1].MailPort.xmlText) neq "") 664 StructInsert(ConfigStruct, "MailPort", trim(MailSettingsNodes[1].MailPort.xmlText));675 ConfigStruct.MailPort = trim(MailSettingsNodes[1].MailPort.xmlText); 665 676 else 666 StructInsert(ConfigStruct, "MailPort", 25 );677 ConfigStruct.MailPort = 25; 667 678 } 668 679 else 669 StructInsert(ConfigStruct, "MailPort", 25 ); 670 } 671 else{ 672 StructInsert(ConfigStruct,"MailServer",""); 673 StructInsert(ConfigStruct,"MailUsername",""); 674 StructInsert(ConfigStruct,"MailPassword",""); 675 StructInsert(ConfigStruct,"MailPort",25); 676 } 677 678 /* ::::::::::::::::::::::::::::::::::::::::: I18N SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 679 680 ConfigStruct.MailPort = 25; 681 } 682 else if (NOT arguments.isOverride){ 683 ConfigStruct.MailServer = ""; 684 ConfigStruct.MailUsername = ""; 685 ConfigStruct.MailPassword = ""; 686 ConfigStruct.MailPort = 25; 687 } 688 </cfscript> 689 </cffunction> 690 691 <!--- parseLocalization ---> 692 <cffunction name="parseLocalization" output="false" access="public" returntype="void" hint="Parse localization"> 693 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 694 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 695 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 696 <cfargument name="isOverride" type="boolean" required="false" default="false" hint="Flag to denote if overriding or first time runner."/> 697 <cfscript> 698 var ConfigStruct = arguments.config; 680 699 //i18N Settings 681 i18NSettingNodes = XMLSearch(configXML, instance.searchi18NSettings); 700 var i18NSettingNodes = XMLSearch(arguments.xml,"//i18N"); 701 var i=1; 702 var DefaultLocale = ""; 703 682 704 //Check if empty 683 705 if ( ArrayLen(i18NSettingNodes) gt 0 and ArrayLen(i18NSettingNodes[1].XMLChildren) gt 0){ 684 706 //Parse i18N Settings 685 707 for (i=1; i lte ArrayLen(i18NSettingNodes[1].XMLChildren); i=i+1){ 686 687 708 //Set the Resource Bundle if Using it. 688 709 if ( i18NSettingNodes[1].XMLChildren[i].XMLName eq "DefaultResourceBundle" and len(trim(i18NSettingNodes[1].XMLChildren[i].XMLText)) neq 0 ){ … … 696 717 } 697 718 //Insert to structure. 698 StructInsert(ConfigStruct, trim(i18NSettingNodes[1].XMLChildren[i].XMLName),trim(i18NSettingNodes[1].XMLChildren[i].XMLText));719 ConfigStruct[trim(i18NSettingNodes[1].XMLChildren[i].XMLName)] = trim(i18NSettingNodes[1].XMLChildren[i].XMLText); 699 720 } 700 721 701 722 //set i18n 702 StructInsert(ConfigStruct,"using_i18N",true);703 704 / * Empty Checks */723 ConfigStruct["using_i18N"] = true; 724 725 // Empty Checks 705 726 if ( not structKeyExists(ConfigStruct, "DefaultResourceBundle") ){ 706 StructInsert(ConfigStruct,"DefaultResourceBundle","");727 ConfigStruc.DefaultResourceBundle = ""; 707 728 } 708 729 if ( not structKeyExists(ConfigStruct, "UknownTranslation") ){ 709 StructInsert(ConfigStruct,"UknownTranslation",""); 710 } 711 } 712 else{ 713 StructInsert(ConfigStruct,"DefaultResourceBundle",""); 714 StructInsert(ConfigStruct,"DefaultLocale",""); 715 StructInsert(ConfigStruct,"LocaleStorage",""); 716 StructInsert(ConfigStruct,"UknownTranslation",""); 717 StructInsert(ConfigStruct,"using_i18N",false); 718 } 719 720 /* ::::::::::::::::::::::::::::::::::::::::: BUG MAIL SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 721 722 //Bug Tracer Reports 723 BugEmailNodes = XMLSearch(configXML, instance.searchBugTracer); 724 for (i=1; i lte ArrayLen(BugEmailNodes); i=i+1){ 725 BugEmails = BugEmails & trim(BugEmailNodes[i].XMLText); 726 if ( i neq ArrayLen(BugEmailNodes) ) 727 BugEmails = BugEmails & ","; 728 } 729 //Insert Into Config 730 StructInsert(ConfigStruct, "BugEmails", BugEmails); 731 732 /* ::::::::::::::::::::::::::::::::::::::::: ENVIRONMENT SETTING :::::::::::::::::::::::::::::::::::::::::::: */ 733 734 StructInsert(ConfigStruct,"Environment","PRODUCTION"); 735 736 /* ::::::::::::::::::::::::::::::::::::::::: WS SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 730 ConfigStruct.UknownTranslation = ""; 731 } 732 } 733 else if (NOT arguments.isOverride){ 734 ConfigStruct.DefaultResourceBundle = ""; 735 ConfigStruct.DefaultLocale = ""; 736 ConfigStruct.LocaleStorage = ""; 737 ConfigStruct.UknownTranslation = ""; 738 ConfigStruct["using_i18N"] = false; 739 } 740 </cfscript> 741 </cffunction> 742 743 <!--- parseBugTracers ---> 744 <cffunction name="parseBugTracers" output="false" access="public" returntype="void" hint="Parse bug emails"> 745 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 746 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 747 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 748 <cfargument name="isOverride" type="boolean" required="false" default="false" hint="Flag to denote if overriding or first time runner."/> 749 <cfscript> 750 var ConfigStruct = arguments.config; 751 var BugEmailNodes = XMLSearch(arguments.xml,"//BugTracerReports/BugEmail"); 752 var i=1; 753 var BugEmails = ""; 754 755 if( arrayLen(BugEmailNodes) ){ 756 for (i=1; i lte ArrayLen(BugEmailNodes); i=i+1){ 757 BugEmails = BugEmails & trim(BugEmailNodes[i].XMLText); 758 if ( i neq ArrayLen(BugEmailNodes) ) 759 BugEmails = BugEmails & ","; 760 } 761 //Insert Into Config 762 ConfigStruct.BugEmails = BugEmails; 763 } 764 else if( NOT arguments.isOverride ){ 765 ConfigStruct.BugEmails = ""; 766 } 767 </cfscript> 768 </cffunction> 769 770 <!--- parseWebservices ---> 771 <cffunction name="parseWebservices" output="false" access="public" returntype="void" hint="Parse webservices"> 772 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 773 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 774 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 775 <cfargument name="isOverride" type="boolean" required="false" default="false" hint="Flag to denote if overriding or first time runner."/> 776 <cfscript> 777 var ConfigStruct = arguments.config; 778 var WebServiceNodes = ""; 779 var i=1; 737 780 738 781 //Get Web Services From Config. 739 WebServiceNodes = XMLSearch( configXML, instance.searchWS);782 WebServiceNodes = XMLSearch(arguments.xml,"//WebServices/WebService"); 740 783 if ( ArrayLen(WebServiceNodes) ){ 741 //New Web Service Array 784 // Init webservices holder structure 785 configStruct.webservices = structnew(); 742 786 for (i=1; i lte ArrayLen(WebServiceNodes); i=i+1){ 743 if ( not StructKeyExists(ProWS, trim(WebServiceNodes[i].XMLAttributes["name"])) ){ 744 //Production Web Services 745 StructInsert(ProWS, WebServiceNodes[i].XMLAttributes["name"], Trim(WebServiceNodes[i].XMLAttributes["URL"])); 746 //Check for Dev URL and the ws name is not in the DevWS struct and DevURL is not empty 747 if ( StructKeyExists(WebServiceNodes[i].XMLAttributes, "DevURL") and 748 not StructKeyExists(DevWS, Trim(WebServiceNodes[i].XMLAttributes["name"])) and 749 WebServiceNodes[i].XMLAttributes["DevURL"] neq "") 750 StructInsert(DevWS, WebServiceNodes[i].XMLAttributes["name"], Trim(WebServiceNodes[i].XMLAttributes["DevURL"])); 751 else 752 StructInsert(DevWS, WebServiceNodes[i].XMLAttributes["name"], Trim(WebServiceNodes[i].XMLAttributes["URL"])); 753 } //end ProWS Key Exists 754 } //end for WebService Nodes 755 StructInsert(WebServicesStruct,"DEV",DevWS); 756 StructInsert(WebServicesStruct,"PRO",ProWS); 757 }// end ArrayLen( WebServiceNodes) 758 StructInsert(ConfigStruct,"WebServices",WebServicesStruct); 759 760 /* ::::::::::::::::::::::::::::::::::::::::: DATASOURCES SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 787 configStruct.webservices[WebServiceNodes[i].XMLAttributes["name"]] = trim(WebServiceNodes[i].XMLAttributes["URL"]); 788 } 789 } 790 else if( NOT arguments.isOverride ){ 791 configStruct.webservices = structnew(); 792 } 793 </cfscript> 794 </cffunction> 795 796 <!--- parseDatasources ---> 797 <cffunction name="parseDatasources" output="false" access="public" returntype="void" hint="Parse Datsources"> 798 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 799 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 800 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 801 <cfargument name="isOverride" type="boolean" required="false" default="false" hint="Flag to denote if overriding or first time runner."/> 802 <cfscript> 803 var ConfigStruct = arguments.config; 804 var DatasourcesNodes = ""; 805 var i=1; 806 var DSNStruct = ""; 761 807 762 808 //Datasources Support 763 DatasourcesNodes = XMLSearch( configXML, instance.searchDatasources);809 DatasourcesNodes = XMLSearch(arguments.xml,"//Datasources/Datasource"); 764 810 if ( ArrayLen(DatasourcesNodes) ){ 765 811 //Create Structures 812 ConfigStruct.Datasources = structnew(); 766 813 for(i=1;i lte ArrayLen(DatasourcesNodes); i=i+1){ 767 814 DSNStruct = structNew(); 768 815 769 //Required Entries770 816 if ( not structKeyExists(DatasourcesNodes[i].XMLAttributes, "Alias") or len(Trim(DatasourcesNodes[i].XMLAttributes["Alias"])) eq 0 ) 771 $throw("This datasource entry's alias cannot be blank",""," ColdBox.plugins.XMLParser.ConfigXMLParsingException");817 $throw("This datasource entry's alias cannot be blank","","XMLParser.ConfigXMLParsingException"); 772 818 else 773 StructInsert(DSNStruct,"Alias", Trim(DatasourcesNodes[i].XMLAttributes["Alias"])); 819 DSNStruct.Alias = Trim(DatasourcesNodes[i].XMLAttributes["Alias"]); 820 774 821 if ( not structKeyExists(DatasourcesNodes[i].XMLAttributes, "Name") or len(Trim(DatasourcesNodes[i].XMLAttributes["Name"])) eq 0 ) 775 $throw("This datasource entry's name cannot be blank",""," ColdBox.plugins.XMLParser.ConfigXMLParsingException");822 $throw("This datasource entry's name cannot be blank","","XMLParser.ConfigXMLParsingException"); 776 823 else 777 StructInsert(DSNStruct,"Name", Trim(DatasourcesNodes[i].XMLAttributes["Name"]));824 DSNStruct.Name = Trim(DatasourcesNodes[i].XMLAttributes["Name"]); 778 825 779 826 //Optional Entries. 780 827 if ( structKeyExists(DatasourcesNodes[i].XMLAttributes, "dbtype") ) 781 StructInsert(DSNStruct,"DBType", Trim(DatasourcesNodes[i].XMLAttributes["dbtype"]));828 DSNStruct.DBType = Trim(DatasourcesNodes[i].XMLAttributes["dbtype"]); 782 829 else 783 StructInsert(DSNStruct,"DBType",""); 830 DSNStruct.DBType = ""; 831 784 832 if ( structKeyExists(DatasourcesNodes[i].XMLAttributes, "Username") ) 785 StructInsert(DSNStruct,"Username", Trim(DatasourcesNodes[i].XMLAttributes["username"]));833 DSNStruct.Username = Trim(DatasourcesNodes[i].XMLAttributes["username"]); 786 834 else 787 StructInsert(DSNStruct,"Username",""); 835 DSNStruct.Username = ""; 836 788 837 if ( structKeyExists(DatasourcesNodes[i].XMLAttributes, "password") ) 789 StructInsert(DSNStruct,"Password", Trim(DatasourcesNodes[i].XMLAttributes["password"]));838 DSNStruct.Password = Trim(DatasourcesNodes[i].XMLAttributes["password"]); 790 839 else 791 StructInsert(DSNStruct,"Password",""); 792 793 //Insert to structure 794 if ( not structKeyExists(DatasourcesStruct,DSNStruct.Alias) ) 795 StructInsert(DatasourcesStruct, DSNStruct.Alias , DSNStruct); 796 else 797 $throw("The datasource alias: #dsnStruct.Alias# has already been declared.","","ColdBox.plugins.XMLParser.ConfigXMLParsingException"); 798 } 799 } 800 StructInsert(ConfigStruct, "Datasources", DatasourcesStruct); 801 802 /* ::::::::::::::::::::::::::::::::::::::::: LAYOUT VIEW FOLDER SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 803 840 DSNStruct.Password = ""; 841 842 //Insert to structure with Alias as key 843 ConfigStruct.Datasources[DSNStruct.Alias] = DSNStruct; 844 } 845 } 846 else if( NOT arguments.isOverride ){ 847 ConfigStruct.Datasources = structnew(); 848 } 849 </cfscript> 850 </cffunction> 851 852 <!--- parseLayoutsViews ---> 853 <cffunction name="parseLayoutsViews" output="false" access="public" returntype="void" hint="Parse Layouts And Views"> 854 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 855 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 856 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 857 <cfscript> 858 var ConfigStruct = arguments.config; 859 var DefaultLayout = ""; 860 var DefaultView = ""; 861 var LayoutNodes = ""; 862 var Layout = ""; 863 var i=1; 864 var j=1; 865 var Collections = createObject("java", "java.util.Collections"); 866 var LayoutViewStruct = Collections.synchronizedMap(CreateObject("java","java.util.LinkedHashMap").init()); 867 var LayoutFolderStruct = Collections.synchronizedMap(CreateObject("java","java.util.LinkedHashMap").init()); 868 804 869 //Layout into Config 805 DefaultLayout = XMLSearch( configXML,instance.searchDefaultLayout);870 DefaultLayout = XMLSearch(arguments.xml,"//Layouts/DefaultLayout"); 806 871 //validate Default Layout. 807 872 if ( ArrayLen(DefaultLayout) eq 0 ) 808 $throw("There was no default layout element found.",""," ColdBox.plugins.XMLParser.ConfigXMLParsingException");873 $throw("There was no default layout element found.","","XMLParser.ConfigXMLParsingException"); 809 874 if ( ArrayLen(DefaultLayout) gt 1 ) 810 $throw("There were more than 1 DefaultLayout elements found. There can only be one.",""," ColdBox.plugins.XMLParser.ConfigXMLParsingException");875 $throw("There were more than 1 DefaultLayout elements found. There can only be one.","","XMLParser.ConfigXMLParsingException"); 811 876 //Insert Default Layout 812 StructInsert(ConfigStruct,"DefaultLayout",Trim(DefaultLayout[1].XMLText));877 ConfigStruct.DefaultLayout = Trim(DefaultLayout[1].XMLText); 813 878 814 879 //Default View into Config 815 DefaultView = XMLSearch( configXML,instance.searchDefaultView);880 DefaultView = XMLSearch(arguments.xml,"//Layouts/DefaultView"); 816 881 //validate Default Layout. 817 882 if ( ArrayLen(DefaultView) eq 0 ){ … … 819 884 } 820 885 else if ( ArrayLen(DefaultView) gt 1 ){ 821 $throw("There were more than 1 DefaultView elements found. There can only be one.",""," ColdBox.plugins.XMLParser.ConfigXMLParsingException");886 $throw("There were more than 1 DefaultView elements found. There can only be one.","","XMLParser.ConfigXMLParsingException"); 822 887 } 823 888 else{ … … 827 892 828 893 //Get View Layouts 829 LayoutNodes = XMLSearch( configXML, instance.searchLayouts);894 LayoutNodes = XMLSearch(arguments.xml,"//Layouts/Layout"); 830 895 for (i=1; i lte ArrayLen(LayoutNodes); i=i+1){ 831 896 //Get Layout for the views 832 897 Layout = Trim(LayoutNodes[i].XMLAttributes["file"]); 833 898 for(j=1; j lte ArrayLen(LayoutNodes[i].XMLChildren); j=j+1){ 834 835 899 //Check for View 836 900 if( LayoutNodes[i].XMLChildren[j].XMLName eq "View" ){ 837 901 //Check for Key, if it doesn't exist then create 838 902 if ( not StructKeyExists(LayoutViewStruct, lcase(Trim(LayoutNodes[i].XMLChildren[j].XMLText))) ) 839 StructInsert(LayoutViewStruct, lcase(Trim(LayoutNodes[i].XMLChildren[j].XMLText)), Layout);903 LayoutViewStruct[lcase(Trim(LayoutNodes[i].XMLChildren[j].XMLText))] = Layout; 840 904 } 841 905 //Check for Folder … … 843 907 //Check for Key, if it doesn't exist then create 844 908 if ( not StructKeyExists(LayoutFolderStruct, lcase(Trim(LayoutNodes[i].XMLChildren[j].XMLText))) ) 845 StructInsert(LayoutFolderStruct, lcase(Trim(LayoutNodes[i].XMLChildren[j].XMLText)), Layout);909 LayoutFolderStruct[lcase(Trim(LayoutNodes[i].XMLChildren[j].XMLText))] = Layout; 846 910 } 847 911 848 912 }//end for loop for the layout children 849 913 }//end for loop of all layout nodes 850 StructInsert(ConfigStruct,"ViewLayouts",LayoutViewStruct); 851 StructInsert(ConfigStruct,"FolderLayouts",LayoutFolderStruct); 852 853 /* ::::::::::::::::::::::::::::::::::::::::: OVERRIDE SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 914 915 ConfigStruct.ViewLayouts = LayoutViewStruct; 916 ConfigStruct.FolderLayouts = LayoutFolderStruct; 917 </cfscript> 918 </cffunction> 919 920 <!--- parseCacheSettings ---> 921 <cffunction name="parseCacheSettings" output="false" access="public" returntype="void" hint="Parse Cache Settings"> 922 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 923 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 924 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 925 <cfscript> 926 var ConfigStruct = arguments.config; 927 var CacheSettingNodes = ""; 928 var fwSettingsStruct = controller.getColdboxSettings(); 854 929 855 930 //Cache Override Settings 856 CacheSettingNodes = XMLSearch( configXML, instance.searchCache);857 //Create CacheSettings Structure858 structInsert(ConfigStruct,"CacheSettings",structNew());931 CacheSettingNodes = XMLSearch(arguments.xml,"//Cache"); 932 ConfigStruct.CacheSettings = structnew(); 933 859 934 //Check if empty 860 935 if ( ArrayLen(CacheSettingNodes) gt 0 and ArrayLen(CacheSettingNodes[1].XMLChildren) gt 0){ 861 862 936 //Checks For Default Timeout 863 937 if ( structKeyExists(CacheSettingNodes[1], "ObjectDefaultTimeout") and isNumeric(CacheSettingNodes[1].ObjectDefaultTimeout.xmlText) ) 864 StructInsert(ConfigStruct.CacheSettings, "ObjectDefaultTimeout", trim(CacheSettingNodes[1].ObjectDefaultTimeout.xmlText));938 ConfigStruct.CacheSettings.ObjectDefaultTimeout = trim(CacheSettingNodes[1].ObjectDefaultTimeout.xmlText); 865 939 else 866 $throw("Invalid object timeout. Please see schema.","Value=#CacheSettingNodes[1].ObjectDefaultTimeout.xmlText#"," ColdBox.plugins.XMLParser.InvalidCacheObjectDefaultTimeout");940 $throw("Invalid object timeout. Please see schema.","Value=#CacheSettingNodes[1].ObjectDefaultTimeout.xmlText#","XMLParser.InvalidCacheObjectDefaultTimeout"); 867 941 868 942 //Check ObjectDefaultLastAccessTimeout 869 943 if ( structKeyExists(CacheSettingNodes[1], "ObjectDefaultLastAccessTimeout") and isNumeric(CacheSettingNodes[1].ObjectDefaultLastAccessTimeout.xmlText)) 870 StructInsert(ConfigStruct.CacheSettings, "ObjectDefaultLastAccessTimeout", trim(CacheSettingNodes[1].ObjectDefaultLastAccessTimeout.xmlText));944 ConfigStruct.CacheSettings.ObjectDefaultLastAccessTimeout = trim(CacheSettingNodes[1].ObjectDefaultLastAccessTimeout.xmlText); 871 945 else 872 $throw("Invalid object last access timeout. Please see schema.","Value=#CacheSettingNodes[1].ObjectDefaultLastAccessTimeout.xmlText#"," ColdBox.plugins.XMLParser.InvalidObjectDefaultLastAccessTimeout");946 $throw("Invalid object last access timeout. Please see schema.","Value=#CacheSettingNodes[1].ObjectDefaultLastAccessTimeout.xmlText#","XMLParser.InvalidObjectDefaultLastAccessTimeout"); 873 947 874 948 //Check ReapFrequency 875 949 if ( structKeyExists(CacheSettingNodes[1], "ReapFrequency") and isNumeric(CacheSettingNodes[1].ReapFrequency.xmlText)) 876 StructInsert(ConfigStruct.CacheSettings, "ReapFrequency", trim(CacheSettingNodes[1].ReapFrequency.xmlText));950 ConfigStruct.CacheSettings.ReapFrequency = trim(CacheSettingNodes[1].ReapFrequency.xmlText); 877 951 else 878 $throw("Invalid reaping frequency. Please see schema.","Value=#CacheSettingNodes[1].ReapFrequency.xmlText#"," ColdBox.plugins.XMLParser.InvalidReapFrequency");952 $throw("Invalid reaping frequency. Please see schema.","Value=#CacheSettingNodes[1].ReapFrequency.xmlText#","XMLParser.InvalidReapFrequency"); 879 953 880 954 //Check MaxObjects 881 955 if ( structKeyExists(CacheSettingNodes[1], "MaxObjects") and isNumeric(CacheSettingNodes[1].MaxObjects.xmlText)){ 882 StructInsert(ConfigStruct.CacheSettings, "MaxObjects", trim(CacheSettingNodes[1].MaxObjects.xmlText));956 ConfigStruct.CacheSettings.MaxObjects = trim(CacheSettingNodes[1].MaxObjects.xmlText); 883 957 } 884 958 else 885 $throw("Invalid Max Objects. Please see schema.","Value=#CacheSettingNodes[1].MaxObjects.xmlText#"," ColdBox.plugins.XMLParser.InvalidMaxObjects");959 $throw("Invalid Max Objects. Please see schema.","Value=#CacheSettingNodes[1].MaxObjects.xmlText#","XMLParser.InvalidMaxObjects"); 886 960 887 961 //Check FreeMemoryPercentageThreshold 888 962 if ( structKeyExists(CacheSettingNodes[1], "FreeMemoryPercentageThreshold") and isNumeric(CacheSettingNodes[1].FreeMemoryPercentageThreshold.xmlText)){ 889 StructInsert(ConfigStruct.CacheSettings, "FreeMemoryPercentageThreshold", trim(CacheSettingNodes[1].FreeMemoryPercentageThreshold.xmlText));963 ConfigStruct.CacheSettings.FreeMemoryPercentageThreshold = trim(CacheSettingNodes[1].FreeMemoryPercentageThreshold.xmlText); 890 964 } 891 965 else 892 $throw("Invalid Free Memory Percentage Threshold. Please see schema.","Value=#CacheSettingNodes[1].FreeMemoryPercentageThreshold.xmlText#"," ColdBox.plugins.XMLParser.InvalidFreeMemoryPercentageThreshold");966 $throw("Invalid Free Memory Percentage Threshold. Please see schema.","Value=#CacheSettingNodes[1].FreeMemoryPercentageThreshold.xmlText#","XMLParser.InvalidFreeMemoryPercentageThreshold"); 893 967 894 968 //Check for CacheUseLastAccessTimeouts 895 969 if ( structKeyExists(CacheSettingNodes[1], "UseLastAccessTimeouts") and isBoolean(CacheSettingNodes[1].UseLastAccessTimeouts.xmlText) ){ 896 StructInsert(ConfigStruct.CacheSettings, "UseLastAccessTimeouts", trim(CacheSettingNodes[1].UseLastAccessTimeouts.xmlText));970 ConfigStruct.CacheSettings.UseLastAccessTimeouts = trim(CacheSettingNodes[1].UseLastAccessTimeouts.xmlText); 897 971 } 898 972 else{ 899 StructInsert(ConfigStruct.CacheSettings, "UseLastAccessTimeouts", fwSettingsStruct.CacheUseLastAccessTimeouts );973 ConfigStruct.CacheSettings.UseLastAccessTimeouts = fwSettingsStruct.CacheUseLastAccessTimeouts; 900 974 } 901 975 902 976 //Check for CacheEvictionPolicy 903 977 if ( structKeyExists(CacheSettingNodes[1], "EvictionPolicy") ){ 904 StructInsert(ConfigStruct.CacheSettings, "EvictionPolicy", trim(CacheSettingNodes[1].EvictionPolicy.xmlText));978 ConfigStruct.CacheSettings.EvictionPolicy = trim(CacheSettingNodes[1].EvictionPolicy.xmlText); 905 979 } 906 980 else{ 907 StructInsert(ConfigStruct.CacheSettings, "EvictionPolicy", fwSettingsStruct.CacheEvictionPolicy );981 ConfigStruct.CacheSettings.EvictionPolicy = fwSettingsStruct.CacheEvictionPolicy; 908 982 } 909 983 //Set Override to true. … … 913 987 ConfigStruct.CacheSettings.Override = false; 914 988 } 915 916 /* ::::::::::::::::::::::::::::::::::::::::: DEBUGGER SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 917 918 /* DEBUGGER SETTING NODES */ 919 DebuggerSettingNodes = XMLSearch(configXML, instance.searchDebuggerSettings); 920 //Create debugger settings Structure 921 structInsert(ConfigStruct,"DebuggerSettings",structNew()); 989 </cfscript> 990 </cffunction> 991 992 <!--- parseDebuggerSettings ---> 993 <cffunction name="parseDebuggerSettings" output="false" access="public" returntype="void" hint="Parse Debugger Settings"> 994 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 995 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 996 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 997 <cfargument name="isOverride" type="boolean" required="false" default="false" hint="Flag to denote if overriding or first time runner."/> 998 <cfscript> 999 var ConfigStruct = arguments.config; 1000 var DebuggerSettingNodes = ""; 1001 1002 DebuggerSettingNodes = XMLSearch(arguments.xml,"//DebuggerSettings"); 1003 922 1004 //Check if empty 923 if ( ArrayLen(DebuggerSettingNodes) gt 0 and ArrayLen(DebuggerSettingNodes[1].XMLChildren) gt 0){ 924 /* PersistentRequestProfiler */ 925 if ( structKeyExists(DebuggerSettingNodes[1], "PersistentRequestProfiler") and isBoolean(DebuggerSettingNodes[1].PersistentRequestProfiler.xmlText) ) 926 StructInsert(ConfigStruct.DebuggerSettings, "PersistentRequestProfiler", trim(DebuggerSettingNodes[1].PersistentRequestProfiler.xmlText) ); 927 /* maxPersistentRequestProfilers */ 928 if ( structKeyExists(DebuggerSettingNodes[1], "maxPersistentRequestProfilers") and isNumeric(DebuggerSettingNodes[1].maxPersistentRequestProfilers.xmlText) ) 929 StructInsert(ConfigStruct.DebuggerSettings, "maxPersistentRequestProfilers", trim(DebuggerSettingNodes[1].maxPersistentRequestProfilers.xmlText) ); 930 /* maxRCPanelQueryRows */ 931 if ( structKeyExists(DebuggerSettingNodes[1], "maxRCPanelQueryRows") and isNumeric(DebuggerSettingNodes[1].maxRCPanelQueryRows.xmlText) ) 932 StructInsert(ConfigStruct.DebuggerSettings, "maxRCPanelQueryRows", trim(DebuggerSettingNodes[1].maxRCPanelQueryRows.xmlText) ); 933 934 /* TracerPanel */ 1005 if ( ArrayLen(DebuggerSettingNodes) ){ 1006 // PersistentRequestProfiler 1007 if ( structKeyExists(DebuggerSettingNodes[1], "PersistentRequestProfiler") and isBoolean(DebuggerSettingNodes[1].PersistentRequestProfiler.xmlText) ){ 1008 ConfigStruct.DebuggerSettings.PersistentRequestProfiler = trim(DebuggerSettingNodes[1].PersistentRequestProfiler.xmlText); 1009 } 1010 // maxPersistentRequestProfilers 1011 if ( structKeyExists(DebuggerSettingNodes[1], "maxPersistentRequestProfilers") and isNumeric(DebuggerSettingNodes[1].maxPersistentRequestProfilers.xmlText) ){ 1012 ConfigStruct.DebuggerSettings.maxPersistentRequestProfilers = trim(DebuggerSettingNodes[1].maxPersistentRequestProfilers.xmlText); 1013 } 1014 // maxRCPanelQueryRows */ 1015 if ( structKeyExists(DebuggerSettingNodes[1], "maxRCPanelQueryRows") and isNumeric(DebuggerSettingNodes[1].maxRCPanelQueryRows.xmlText) ){ 1016 ConfigStruct.DebuggerSettings.maxRCPanelQueryRows = trim(DebuggerSettingNodes[1].maxRCPanelQueryRows.xmlText); 1017 } 1018 // TracerPanel 935 1019 if ( structKeyExists(DebuggerSettingNodes[1], "TracerPanel") ){ 936 1020 debugPanelAttributeInsert(ConfigStruct.DebuggerSettings,"TracerPanel",DebuggerSettingNodes[1].TracerPanel.xmlAttributes); 937 1021 } 938 / * InfoPanel */1022 // InfoPanel 939 1023 if ( structKeyExists(DebuggerSettingNodes[1], "InfoPanel") ){ 940 1024 debugPanelAttributeInsert(ConfigStruct.DebuggerSettings,"InfoPanel",DebuggerSettingNodes[1].InfoPanel.xmlAttributes); 941 1025 } 942 / * CachePanel */1026 // CachePanel 943 1027 if ( structKeyExists(DebuggerSettingNodes[1], "CachePanel") ){ 944 1028 debugPanelAttributeInsert(ConfigStruct.DebuggerSettings,"CachePanel",DebuggerSettingNodes[1].CachePanel.xmlAttributes); 945 1029 } 946 / * RCPanel */1030 // RCPanel 947 1031 if ( structKeyExists(DebuggerSettingNodes[1], "RCPanel") ){ 948 1032 debugPanelAttributeInsert(ConfigStruct.DebuggerSettings,"RCPanel",DebuggerSettingNodes[1].RCPanel.xmlAttributes); 949 } 950 1033 } 951 1034 //Set Override to true. 952 1035 ConfigStruct.DebuggerSettings.Override = true; 953 1036 } 954 else{ 955 ConfigStruct.DebuggerSettings.Override = false; 956 } 957 958 /* ::::::::::::::::::::::::::::::::::::::::: INTERCEPTOR SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 959 960 /* Interceptor Preparation. */ 961 StructInsert( ConfigStruct, "InterceptorConfig", structnew() ); 962 StructInsert( ConfigStruct.InterceptorConfig, "Interceptors", arraynew(1) ); 963 964 /* Start by throwOnInvalidStates */ 965 StructInsert( ConfigStruct.InterceptorConfig, "throwOnInvalidStates", true ); 966 //Search for the override 967 InterceptorBase = XMLSearch(configXML,instance.searchInterceptorBase); 968 if ( ArrayLen(InterceptorBase) neq 0 and structKeyExists(InterceptorBase[1].XMLAttributes, "throwOnInvalidStates") ){ 969 ConfigStruct.InterceptorConfig['throwOnInvalidStates'] = InterceptorBase[1].XMLAttributes.throwOnInvalidStates; 970 } 971 972 973 /* Start by Custom Interception Point */ 974 CustomInterceptionPoints = XMLSearch(configXML,instance.searchInterceptorCustomPoints); 975 //validate Custom Interception Point 976 if ( ArrayLen(CustomInterceptionPoints) eq 0 ) 977 StructInsert(ConfigStruct.InterceptorConfig,"CustomInterceptionPoints",""); 978 else if ( ArrayLen(CustomInterceptionPoints) gt 1 ) 979 $throw("There were more than 1 CustomInterceptionPoints elements found. There can only be one.","","ColdBox.plugins.XMLParser.ConfigXMLParsingException"); 980 else 981 StructInsert(ConfigStruct.InterceptorConfig,"CustomInterceptionPoints",oUtilities.placeHolderReplacer(Trim(CustomInterceptionPoints[1].XMLText),ConfigStruct)); 982 983 /* Parse all Interceptor Nodes now. */ 984 InterceptorNodes = XMLSearch(configXML, instance.searchInterceptors); 985 for (i=1; i lte ArrayLen(InterceptorNodes); i=i+1){ 986 //Interceptor Struct 987 InterceptorStruct = structnew(); 988 //get Class 989 InterceptorStruct.class = oUtilities.placeHolderReplacer(Trim(InterceptorNodes[i].XMLAttributes["class"]),ConfigStruct); 990 //Prepare Properties 991 InterceptorStruct.properties = structnew(); 992 993 //Parse Interceptor Properties 994 if ( ArrayLen(InterceptorNodes[i].XMLChildren) ){ 995 for(j=1; j lte ArrayLen(InterceptorNodes[i].XMLChildren); j=j+1){ 996 //Property Complex Check 997 tempProperty = oUtilities.placeHolderReplacer(Trim( InterceptorNodes[i].XMLChildren[j].XMLText ),ConfigStruct); 998 //Check for Complex Setup 999 if( reFindNocase(instance.jsonRegex,tempProperty) ){ 1000 StructInsert( InterceptorStruct.properties, Trim(InterceptorNodes[i].XMLChildren[j].XMLAttributes["name"]), getPlugin('JSON').decode(replace(tempProperty,"'","""","all")) ); 1001 } 1002 else{ 1003 StructInsert( InterceptorStruct.properties, Trim(InterceptorNodes[i].XMLChildren[j].XMLAttributes["name"]), tempProperty ); 1004 } 1005 }//end loop of properties 1006 }//end if no properties 1007 1008 //Add to Array 1009 ArrayAppend( ConfigStruct.InterceptorConfig.Interceptors, InterceptorStruct ); 1010 1011 }//end interceptor nodes 1012 1013 1014 /* ::::::::::::::::::::::::::::::::::::::::: LOGBOX Configuration :::::::::::::::::::::::::::::::::::::::::::: */ 1015 parseLogBox(configXML,configStruct,oUtilities); 1016 1017 /* ::::::::::::::::::::::::::::::::::::::::: CONFIG FILE LAST MODIFIED SETTING :::::::::::::::::::::::::::::::::::::::::::: */ 1018 StructInsert(ConfigStruct, "ConfigTimeStamp", oUtilities.FileLastModified(ConfigFileLocation)); 1019 /* ::::::::::::::::::::::::::::::::::::::::: XSD VALIDATION :::::::::::::::::::::::::::::::::::::::::::: */ 1020 1021 //Determine which CF version for XML Parsing method 1022 if ( fwSettingsStruct["xmlValidateActive"] ){ 1023 //Finally Validate With XSD 1024 xmlvalidation = XMLValidate(configXML, getController().getSetting("ConfigFileSchemaLocation", true)); 1025 //Validate Errors 1026 if(NOT xmlvalidation.status){ 1027 for(i = 1; i lte ArrayLen(xmlvalidation.errors); i = i + 1){ 1028 errorDetails = errorDetails & xmlvalidation.errors[i] & chr(10) & chr(13); 1029 } 1030 //Throw the error. 1031 $throw("<br>The config.xml file does not validate with the framework's schema.","The error details are:<br/> #errorDetails#","ColdBox.plugins.XMLParser.ConfigXMLParsingException"); 1032 }// if invalid status 1033 }//if xml validation is on 1034 1035 }//end of try 1036 catch( Any Exception ){ 1037 $throw("#Exception.Message# & #Exception.Detail#",Exception.tagContext.toString(), "ColdBox.plugins.XMLParser.ConfigXMLParsingException"); 1038 } 1039 1040 //finish 1041 return ConfigStruct; 1042 </cfscript> 1043 </cffunction> 1044 1045 <!------------------------------------------- PRIVATE -------------------------------------------> 1046 1037 else if (NOT arguments.isOverride){ 1038 ConfigStruct.DebuggerSettings = structnew(); 1039 ConfigStruct.DebuggerSettings.Override = false; 1040 } 1041 </cfscript> 1042 </cffunction> 1043 1044 <!--- parseInterceptors ---> 1045 <cffunction name="parseInterceptors" output="false" access="public" returntype="void" hint="Parse Interceptors"> 1046 <cfargument name="xml" type="any" required="true" hint="The xml object"/> 1047 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 1048 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 1049 <cfargument name="isOverride" type="boolean" required="false" default="false" hint="Flag to denote if overriding or first time runner."/> 1050 <cfscript> 1051 var ConfigStruct = arguments.config; 1052 var InterceptorBase = ""; 1053 var CustomInterceptionPoints = ""; 1054 var InterceptorNodes = ""; 1055 var i=1; 1056 var j=1; 1057 var InterceptorStruct = ""; 1058 var tempProperty = ""; 1059 1060 //Search for Interceptors 1061 InterceptorBase = XMLSearch(arguments.xml,"//Interceptors"); 1062 if( arrayLen(InterceptorBase) ){ 1063 // Interceptor Preparation. 1064 ConfigStruct.InterceptorConfig = structnew(); 1065 ConfigStruct.InterceptorConfig.Interceptors = arrayNew(1); 1066 ConfigStruct.InterceptorConfig.throwOnInvalidStates = true; 1067 ConfigStruct.InterceptorConfig.CustomInterceptionPoints = ""; 1068 1069 // Invalid States 1070 if ( structKeyExists(InterceptorBase[1].XMLAttributes, "throwOnInvalidStates") ){ 1071 ConfigStruct.InterceptorConfig['throwOnInvalidStates'] = InterceptorBase[1].XMLAttributes.throwOnInvalidStates; 1072 } 1073 1074 // Custom Interception Points 1075 CustomInterceptionPoints = XMLSearch(arguments.xml,"//Interceptors/CustomInterceptionPoints"); 1076 if ( ArrayLen(CustomInterceptionPoints) gt 1 ){ 1077 $throw("There were more than 1 CustomInterceptionPoints elements found. There can only be one.","","XMLParser.ConfigXMLParsingException"); 1078 } 1079 else if( arraylen(CustomInterceptionPoints) ){ 1080 ConfigStruct.InterceptorConfig.CustomInterceptionPoints = arguments.utility.placeHolderReplacer(Trim(CustomInterceptionPoints[1].XMLText),ConfigStruct); 1081 } 1082 1083 //Parse all Interceptor Nodes now. 1084 InterceptorNodes = XMLSearch(arguments.xml,"//Interceptors/Interceptor"); 1085 for (i=1; i lte ArrayLen(InterceptorNodes); i=i+1){ 1086 //Interceptor Struct 1087 InterceptorStruct = structnew(); 1088 //get Class 1089 InterceptorStruct.class = arguments.utility.placeHolderReplacer(Trim(InterceptorNodes[i].XMLAttributes["class"]),ConfigStruct); 1090 //Prepare Properties 1091 InterceptorStruct.properties = structnew(); 1092 //Parse Interceptor Properties 1093 if ( ArrayLen(InterceptorNodes[i].XMLChildren) ){ 1094 for(j=1; j lte ArrayLen(InterceptorNodes[i].XMLChildren); j=j+1){ 1095 //Property Complex Check 1096 tempProperty = arguments.utility.placeHolderReplacer(Trim( InterceptorNodes[i].XMLChildren[j].XMLText ),ConfigStruct); 1097 //Check for Complex Setup 1098 if( reFindNocase(instance.jsonRegex,tempProperty) ){ 1099 StructInsert( InterceptorStruct.properties, Trim(InterceptorNodes[i].XMLChildren[j].XMLAttributes["name"]), getPlugin('JSON').decode(replace(tempProperty,"'","""","all")) ); 1100 } 1101 else{ 1102 StructInsert( InterceptorStruct.properties, Trim(InterceptorNodes[i].XMLChildren[j].XMLAttributes["name"]), tempProperty ); 1103 } 1104 }//end loop of properties 1105 }//end if no properties 1106 //Add to Array 1107 ArrayAppend( ConfigStruct.InterceptorConfig.Interceptors, InterceptorStruct ); 1108 }//end interceptor nodes 1109 1110 }// end if interceptors found 1111 else if (NOT arguments.isOverride){ 1112 // Interceptor Defaults. 1113 ConfigStruct.InterceptorConfig = structnew(); 1114 ConfigStruct.InterceptorConfig.Interceptors = arrayNew(1); 1115 ConfigStruct.InterceptorConfig.throwOnInvalidStates = true; 1116 ConfigStruct.InterceptorConfig.CustomInterceptionPoints = ""; 1117 } 1118 </cfscript> 1119 </cffunction> 1120 1047 1121 <!--- parseLogBox ---> 1048 1122 <cffunction name="parseLogBox" output="false" access="public" returntype="void" hint="Parse LogBox"> … … 1050 1124 <cfargument name="config" type="struct" required="true" hint="The config struct"/> 1051 1125 <cfargument name="utility" type="any" required="true" hint="The utility object"/> 1126 <cfargument name="isOverride" type="boolean" required="false" default="false" hint="Flag to denote if overriding or first time runner."/> 1052 1127 <cfscript> 1053 1128 var logboxXML = xmlSearch(arguments.xml,"//LogBox"); … … 1057 1132 1058 1133 if( arrayLen(logboxXML) ){ 1059 // Get config object 1134 // Get config object From controller's logbox 1060 1135 logBoxConfig = controller.getLogBox().getConfig(); 1061 // Reset it1136 // Reset the configuration 1062 1137 logBoxConfig.reset(); 1063 1138 // Parse and load new configuration data … … 1079 1154 arguments.config["LogBoxConfig"] = memento; 1080 1155 } 1081 else {1156 else if( NOT arguments.isOverride){ 1082 1157 arguments.config["LogBoxConfig"] = structnew(); 1083 1158 } … … 1085 1160 </cffunction> 1086 1161 1162 <!------------------------------------------- PRIVATE ------------------------------------------> 1163 1087 1164 <!--- Debug Panel attribute insert ---> 1088 1165 <cffunction name="debugPanelAttributeInsert" access="private" returntype="void" hint="Insert a key into a panel attribute" output="false" > … … 1093 1170 <!--- ************************************************************* ---> 1094 1171 <cfscript> 1095 / * Show Key */1172 // Show Key 1096 1173 if( structKeyExists(arguments.panelXML,"show") ){ 1097 StructInsert(arguments.config, "show#arguments.Panel#", trim(arguments.panelXML.show));1174 arguments.config["show#arguments.Panel#"] = trim(arguments.panelXML.show); 1098 1175 } 1099 / * Expanded Key */1176 // Expanded Key 1100 1177 if( structKeyExists(arguments.panelXML,"expanded") ){ 1101 StructInsert(arguments.config, "expanded#arguments.Panel#", trim(arguments.panelXML.expanded));1178 arguments.config["expanded#arguments.Panel#"] = trim(arguments.panelXML.expanded); 1102 1179 } 1103 1180 </cfscript> -
coldbox/trunk/system/services/DebuggerService.cfc
r2443 r2457 166 166 <cfset var RenderedDebugging = ""> 167 167 <cfset var Event = controller.getRequestService().getContext()> 168 <cfset var rc = event.getCollection()> 168 169 169 170 <!--- Set local Variables ---> … … 195 196 <cffunction name="renderCachePanel" access="public" hint="Renders the caching panel." output="false" returntype="Any"> 196 197 <cfset var event = controller.getRequestService().getContext()> 198 <cfset var rc = event.getCollection()> 197 199 <cfset var RenderedDebugging = ""> 198 200 … … 223 225 <cffunction name="renderCacheDumper" access="public" hint="Renders the caching key value dumper." output="false" returntype="Any"> 224 226 <cfset var event = controller.getRequestService().getContext()> 227 <cfset var rc = event.getCollection()> 225 228 <cfset var cachekey = URLDecode(event.getValue('key',''))> 226 229 <cfset var cacheValue = controller.getColdboxOCM().get(cachekey)>
