Changeset 2457

Show
Ignore:
Timestamp:
07/20/09 23:31:09 (4 years ago)
Author:
lmajano
Message:

you can now override almost all elements in a per-environment file if you declare it.
At last some xml parsing refactoring.

Location:
coldbox/trunk/system
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • coldbox/trunk/system/includes/Debug.cfm

    r2443 r2457  
    1010Date     :      September 25, 2005 
    1111Description : 
    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 
    2313-----------------------------------------------------------------------> 
    2414<cfoutput> 
     
    119109                <div class="fw_debugContentCell"> 
    120110                <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())#  
    121123                </div> 
    122124                 
     
    189191<!--- **************************************************************---> 
    190192        <cfif controller.getSetting("EnableDumpVar")> 
    191                 <cfset dumpList = Event.getValue("dumpvar",0)> 
    192                 <cfif dumplist neq 0> 
     193                <cfif structKeyExists(rc,"dumpvar")> 
    193194                <!--- Dump Var ---> 
    194                 <div class="fw_titles" onClick="fw_toggle('fw_dumpvar')"> 
    195                 &nbsp;Dumpvar  
    196                 </div> 
     195                <div class="fw_titles" onClick="fw_toggle('fw_dumpvar')">&nbsp;Dumpvar</div> 
    197196                <div class="fw_debugContent" id="fw_dumpvar"> 
    198                         <cfloop list="#dumplist#" index="i"> 
     197                        <cfloop list="#rc.dumpvar#" index="i"> 
    199198                                <cfif isDefined("#i#")> 
    200199                                        <cfdump var="#evaluate(i)#" label="#i#" expand="false"> 
    201200                                <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"> 
    204202                                </cfif> 
    205203                        </cfloop> 
     
    222220                  <cfset varVal = requestCollection[vars]> 
    223221                  <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> 
    225223                        <td  class="fw_debugTablesCells"> 
    226224                        <cfif isSimpleValue(varVal) > 
  • coldbox/trunk/system/interceptors/EnvironmentControl.cfc

    r2393 r2457  
    3232                        var configFile = ""; 
    3333                         
    34                         /* Verify that the configFile propety is set */ 
     34                        // Regex for JSON 
     35                        instance.jsonRegex = "^(\{|\[)(.)*(\}|\])$"; 
     36                 
     37                        // Verify that the configFile propety is set 
    3538                        if( not propertyExists('configFile') ){ 
    3639                                $throw("Config File property does not exist. Please declare it.",'','interceptors.EnvironmentControl.configFilePropertyNotDefined'); 
    3740                        } 
    38                         /* Try to locate the path */ 
     41                        // Try to locate the path 
    3942                        configFile = locateFilePath(getProperty('configFile')); 
    40                         /* Validate it */ 
     43                        // Validate it 
    4144                        if( len(configFile) eq 0 ){ 
    4245                                $throw('Config File could not be located: #getProperty('configFile')#. Please check again.','','interceptors.EnvironmentControl.configFileNotFound'); 
    4346                        } 
     47                        // Save Config File 
     48                        setConfigFile(configFile);                       
    4449                         
    45                         /* execute check */ 
     50                        // Completed Flag 
    4651                        setProperty('interceptorCompleted',false); 
    47                          
    48                         //Verified, set it 
    49                         setConfigFile(configFile);                       
    5052                         
    5153                        //Verify the fireOnInit flag 
     
    5355                                setProperty('fireOnInit',true); 
    5456                        } 
     57                         
    5558                        //Check if we need to fire the interception at configuration 
    5659                        if( getProperty('fireOnInit') ){ 
     
    9295                        var environmentsArray = ArrayNew(1); 
    9396                        var SettingsArray = ArrayNew(1); 
    94                         var settingsLength = 0; 
     97                        var environmentXML = ""; 
    9598                        var i = 1; 
    96                         var ENVIRONMENT = ""; 
     99                        var environment = ""; 
    97100                        var oXML = ""; 
    98101                        var configSettings = getController().getConfigSettings(); 
     
    100103                        var oUtilities = getPlugin("Utilities"); 
    101104                        var oJSON = getPlugin("JSON"); 
     105                        var oXMLParser = getPlugin("XMLParser"); 
    102106                 
    103107                        //Parse it 
     
    106110                        //Search and test for environments 
    107111                        environmentsArray = xmlSearch(oXML, '/environmentcontrol/environment'); 
    108                          
    109112                        if( arrayLen(environmentsArray) eq 0){ 
    110113                                $throw("No environment elements found.","Please check your environment file again","interceptors.EnvironmentControl.elementException"); 
    111114                        } 
    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; } 
    114119                         
    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")); 
    139129                                } 
    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                        }                                
    141165                </cfscript> 
    142166        </cffunction> 
  • coldbox/trunk/system/plugins/Webservices.cfc

    r2211 r2457  
    1212        Macromedia/Adobe.  dstanten@adobe.com 
    1313 
    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 coldbox 
    18 07/29/2006 - Exception is thrown if web service is not found in the configuration structure. 
    1914-----------------------------------------------------------------------> 
    2015<cfcomponent name="Webservices" 
     
    3025                <cfscript> 
    3126                        super.Init(arguments.controller); 
     27                         
    3228                        setpluginName("Web Services"); 
    3329                        setpluginVersion("1.0"); 
     
    4339 
    4440        <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         <!--- ************************************************************* ---> 
    4641                <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]> 
    5646                </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."> 
    5849        </cffunction> 
    5950 
    6051        <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         <!--- ************************************************************* ---> 
    6252                <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         
    7456        </cffunction> 
    7557 
    7658        <cffunction name="refreshWS" access="Public" hint="Refresh a web service stub object" output="false" returntype="void"> 
    77         <!--- ************************************************************* ---> 
    7859                <cfargument name="webservice" hint="The name or wsdl URL of the web service to refresh" type="string" required="Yes"> 
    79         <!--- ************************************************************* ---> 
    8060                <!--- Get the Webservice from the configStruct ---> 
    8161                <cfset var ws = getWS(arguments.webservice)> 
  • coldbox/trunk/system/plugins/XMLParser.cfc

    r2443 r2457  
    1010        This is a utility function for the framework. It includes any methods 
    1111        that will be called from the framework for XML parsing. 
    12  
    13 Modification History: 
    14 10/05/2005 - Fix for Dev URL beign blank 
    15 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 /, MessageboxStyleClass 
    24 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, InvalidEventHandler 
    30 01/17/2007 - fixed Bug #83, failure to set handler invocation path if / as first char 
    31 01/18/2007 - Preparing for new event registration system. 
    32 01/26/2007 - Datasource Alias and error checking Ticket #88, #89 
    3312-----------------------------------------------------------------------> 
    3413<cfcomponent name="XMLParser" 
     
    5231                        setpluginVersion("2.0"); 
    5332                        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                                 
    7534                        //ColdBox Properties 
    7635                        instance.FileSeparator = createObject("java","java.lang.System").getProperty("file.separator"); 
     
    7837                        instance.FrameworkConfigXSDFile = ExpandPath("/coldbox/system/config/config.xsd"); 
    7938                         
    80                         /* Regex for JSON */ 
     39                        // Regex for JSON 
    8140                        instance.jsonRegex = "^(\{|\[)(.)*(\}|\])$"; 
    8241                         
     
    9049        <cffunction name="loadFramework" access="public" hint="Load the framework's configuration xml." output="false" returntype="struct"> 
    9150                <!--- ************************************************************* ---> 
    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."> 
    9452                <!--- ************************************************************* ---> 
    9553                <cfscript> 
     
    11270                        //verify Framework settings File 
    11371                        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"); 
    11573                        }                        
    11674                        //Setup the ColdBox CFML Engine Info 
     
    145103                 
    146104                        //Get SettingNodes From Config 
    147                         SettingNodes = XMLSearch(fwXML, instance.searchSettings); 
     105                        SettingNodes = XMLSearch(fwXML,"//Settings/Setting"); 
    148106                        //Insert Settings to Config Struct 
    149107                        for (i=1; i lte ArrayLen(SettingNodes); i=i+1) 
     
    154112 
    155113                        //Conventions Parsing 
    156                         conventions = XMLSearch(fwXML,instance.searchConventions); 
     114                        conventions = XMLSearch(fwXML,"//Conventions"); 
    157115                        StructInsert(settingsStruct, "HandlersConvention", conventions[1].handlerLocation.xmltext); 
    158116                        StructInsert(settingsStruct, "pluginsConvention", conventions[1].pluginsLocation.xmltext); 
     
    177135                                //Validate the findings 
    178136                                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"); 
    180138                                //Insert the correct config file location. 
    181139                                StructInsert(settingsStruct, "ConfigFileLocation", ConfigXMLFilePath); 
     
    207165                } 
    208166                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"); 
    210168                } 
    211169                </cfscript> 
     
    219177                <!--- ************************************************************* ---> 
    220178                <cfscript> 
    221                 var Collections = createObject("java", "java.util.Collections");  
    222179                //Create Config Structure 
    223180                var ConfigStruct = StructNew(); 
     
    225182                var ConfigFileLocation = fwSettingsStruct["ConfigFileLocation"]; 
    226183                var configXML = ""; 
    227                 //Nodes 
    228                 var SettingNodes = ""; 
    229                 var YourSettingNodes = ""; 
    230                 var MailSettingsNodes = ""; 
    231                 //i18n 
    232                 var i18NSettingNodes = ""; 
    233                 var DefaultLocale = ""; 
    234                 //BugEmail 
    235                 var BugEmailNodes = ""; 
    236                 var BugEmails = ""; 
    237                 //WebServices 
    238                 var WebServiceNodes = ""; 
    239                 var WebServicesStruct = StructNew(); 
    240                 var DevWS = StructNew(); 
    241                 var ProWS = StructNew(); 
    242                 //Layouts 
    243                 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                 //Cache 
    253                 var CacheSettingNodes = ""; 
    254                 var DebuggerSettingNodes = ""; 
    255                 //Interceptors 
    256                 var InterceptorBase = ""; 
    257                 var InterceptorNodes = ""; 
    258                 var CustomInterceptionPoints = ""; 
    259                 var InterceptorStruct = structnew(); 
    260                 var InterceptorProperties = ""; 
    261                 var tempProperty = ""; 
    262                 //Conventions 
    263                 var Conventions = ""; 
    264                 //loopers 
    265                 var i = 0; 
    266                 var j = 0; 
    267184                //Appmapping Variables 
    268185                var webPath = ""; 
     
    272189                var oUtilities = getPlugin("Utilities"); 
    273190                //Testers 
    274                 var tester = ""; 
    275191                var xmlvalidation = ""; 
    276192                var errorDetails = ""; 
     193                var i = 1; 
    277194                 
    278195                try{ 
    279                          
    280196                        /* ::::::::::::::::::::::::::::::::::::::::: CONFIG FILE PARSING & VALIDATION :::::::::::::::::::::::::::::::::::::::::::: */ 
    281                          
    282197                        //Validate File, just in case. 
    283198                        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 
    288202                        if ( not fwSettingsStruct["xmlParseActive"] ){ 
    289203                                configXML = xmlParse(readFile(ConfigFileLocation,false,"utf-8")); 
     
    292206                                configXML = xmlParse(ConfigFileLocation); 
    293207                        } 
    294  
    295                         //Validate the config 
     208                        //Validate the config element 
    296209                        if ( not structKeyExists(configXML, "config")  ) 
    297                                 $throw("No Config element found in the configuration file","","ColdBox.plugins.XMLParser.ConfigXMLParsingException"); 
    298  
    299                         /* ::::::::::::::::::::::::::::::::::::::::: APP MAPPING CALCULATIONS :::::::::::::::::::::::::::::::::::::::::::: */ 
    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 
    302215                        if( arguments.overrideAppMapping neq "" ){ 
    303                                 StructInsert(ConfigStruct, "ApplicationPath", ExpandPath(arguments.overrideAppMapping)); 
     216                                ConfigStruct.ApplicationPath = ExpandPath(arguments.overrideAppMapping); 
    304217                                if( right(ConfigStruct.ApplicationPath,1) neq "/"){ 
    305218                                        ConfigStruct.ApplicationPath = ConfigStruct.ApplicationPath & "/"; 
     
    307220                        } 
    308221                        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                        } 
    313225                         
    314226                        //Calculate AppMapping if not set in the config, else auto-calculate 
     
    317229                                localPath = getDirectoryFromPath(replacenocase(getTemplatePath(),"\","/","all")); 
    318230                                PathLocation = findnocase(webPath, localPath); 
     231                                 
    319232                                if ( PathLocation neq 0) 
    320233                                        ConfigStruct.AppMapping = mid(localPath,PathLocation,len(webPath)); 
     
    335248                        } 
    336249                         
    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                         
    341340                        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"); 
    343342                        //Insert  ColdBox Settings to Config Struct 
    344343                        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                        } 
    350346                        //overrideAppMapping if passed in. 
    351347                        if ( arguments.overrideAppMapping neq "" ){ 
    352348                                ConfigStruct["AppMapping"] = arguments.overrideAppMapping; 
    353349                        } 
    354                         /* Clean the first / if found */ 
     350                        // Clean the first / if found 
    355351                        if( len(ConfigStruct.AppMapping) eq 1 ){ 
    356                                 ConfigStruct.AppMapping = ""; 
     352                                ConfigStruct["AppMapping"] = ""; 
    357353                        } 
    358354                         
    359355                        /* ::::::::::::::::::::::::::::::::::::::::: 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"); 
    361359                        //Check for Default Event 
    362360                        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"); 
    365362                        //Check for Event Name 
    366363                        if ( not StructKeyExists(ConfigStruct, "EventName") ) 
    367364                                ConfigStruct["EventName"] = fwSettingsStruct["EventName"] ; 
    368                          
    369365                        //Check for Request Start Handler 
    370366                        if ( not StructKeyExists(ConfigStruct, "ApplicationStartHandler") ) 
    371367                                ConfigStruct["ApplicationStartHandler"] = ""; 
    372                          
    373368                        //Check for Request End Handler 
    374369                        if ( not StructKeyExists(ConfigStruct, "RequestStartHandler") ) 
    375370                                ConfigStruct["RequestStartHandler"] = ""; 
    376                          
    377371                        //Check for Application Start Handler 
    378372                        if ( not StructKeyExists(ConfigStruct, "RequestEndHandler") ) 
    379373                                ConfigStruct["RequestEndHandler"] = ""; 
    380                                  
    381374                        //Check for Session Start Handler 
    382375                        if ( not StructKeyExists(ConfigStruct, "SessionStartHandler") ) 
    383376                                ConfigStruct["SessionStartHandler"] = ""; 
    384                                  
    385377                        //Check for Session End Handler 
    386378                        if ( not StructKeyExists(ConfigStruct, "SessionEndHandler") ) 
    387379                                ConfigStruct["SessionEndHandler"] = ""; 
    388                  
    389380                        //Check for InvalidEventHandler 
    390381                        if ( not StructKeyExists(ConfigStruct, "onInvalidEvent") ) 
    391382                                ConfigStruct["onInvalidEvent"] = ""; 
    392  
    393383                        //Check For DebugMode in settings 
    394384                        if ( not structKeyExists(ConfigStruct, "DebugMode") or not isBoolean(ConfigStruct.DebugMode) ) 
    395385                                ConfigStruct["DebugMode"] = "false"; 
    396                  
    397386                        //Check for DebugPassword in settings, else leave blank. 
    398387                        if ( not structKeyExists(ConfigStruct, "DebugPassword") ) 
    399388                                ConfigStruct["DebugPassword"] = ""; 
    400                  
    401389                        //Check for ReinitPassword 
    402390                        if ( not structKeyExists(ConfigStruct, "ReinitPassword") ) 
    403391                                ConfigStruct["ReinitPassword"] = ""; 
    404  
    405392                        //Check For Owner Email or Throw 
    406393                        if ( not StructKeyExists(ConfigStruct, "OwnerEmail") ) 
    407394                                ConfigStruct["OwnerEmail"] = ""; 
    408                  
    409395                        //Check For EnableDumpvar or set to true 
    410396                        if ( not StructKeyExists(ConfigStruct, "EnableDumpVar") or not isBoolean(ConfigStruct.EnableDumpVar)) 
    411397                                ConfigStruct["EnableDumpVar"] = "true"; 
    412                  
    413398                        //Check For EnableBugReports Active or set to true 
    414399                        if ( not StructKeyExists(ConfigStruct, "EnableBugReports") or not isBoolean(ConfigStruct.EnableBugReports)) 
    415400                                ConfigStruct["EnableBugReports"] = "true"; 
    416  
    417401                        //Check For UDFLibraryFile 
    418402                        if ( not StructKeyExists(ConfigStruct, "UDFLibraryFile") ) 
    419403                                ConfigStruct["UDFLibraryFile"] = ""; 
    420                  
    421404                        //Check For CustomErrorTemplate 
    422405                        if ( not StructKeyExists(ConfigStruct, "CustomErrorTemplate") ) 
    423406                                ConfigStruct["CustomErrorTemplate"] = ""; 
    424                          
    425407                        //Check for CustomEmailBugReport 
    426408                        if ( not StructKeyExists(ConfigStruct, "CustomEmailBugReport") ) 
    427409                                ConfigStruct["CustomEmailBugReport"] = "";       
    428                          
    429410                        //Check for MessageboxStyleOverride if found, default = false 
    430411                        if ( not structkeyExists(ConfigStruct, "MessageboxStyleOverride") or not isBoolean(ConfigStruct.MessageboxStyleOverride) ) 
    431412                                ConfigStruct["MessageboxStyleOverride"] = "false"; 
    432  
    433413                        //Check for HandlersIndexAutoReload, default = false 
    434414                        if ( not structkeyExists(ConfigStruct, "HandlersIndexAutoReload") or not isBoolean(ConfigStruct.HandlersIndexAutoReload) ) 
    435415                                ConfigStruct["HandlersIndexAutoReload"] = false; 
    436                          
    437416                        //Check for ConfigAutoReload 
    438417                        if ( not structKeyExists(ConfigStruct, "ConfigAutoReload") or not isBoolean(ConfigStruct.ConfigAutoReload) ) 
    439418                                ConfigStruct["ConfigAutoReload"] = false; 
    440  
    441419                        //Check for ExceptionHandler if found 
    442420                        if ( not structkeyExists(ConfigStruct, "ExceptionHandler") ) 
    443421                                ConfigStruct["ExceptionHandler"] = ""; 
    444  
    445422                        //Check for PluginsExternalLocation if found 
    446423                        if ( not structkeyExists(ConfigStruct, "PluginsExternalLocation") ) 
    447424                                ConfigStruct["PluginsExternalLocation"] = ""; 
    448  
    449425                        //Check for Handler Caching 
    450426                        if ( not structKeyExists(ConfigStruct, "HandlerCaching") or not isBoolean(ConfigStruct.HandlerCaching) ) 
    451427                                ConfigStruct["HandlerCaching"] = true; 
    452                          
    453428                        //Check for Event Caching 
    454429                        if ( not structKeyExists(ConfigStruct, "EventCaching") or not isBoolean(ConfigStruct.EventCaching) ) 
    455430                                ConfigStruct["EventCaching"] = true; 
    456  
    457431                        //Check for IOC Framework & Settings 
    458432                        if ( not structKeyExists(ConfigStruct, "IOCFramework") ) 
     
    464438                        if ( not structKeyExists(ConfigStruct, "IOCObjectCaching") or not isBoolean(ConfigStruct.IOCObjectCaching) ) 
    465439                                ConfigStruct["IOCObjectCaching"] = false; 
    466                                  
    467440                        //RequestContextDecorator 
    468441                        if ( not structKeyExists(ConfigStruct, "RequestContextDecorator") or len(ConfigStruct["RequestContextDecorator"]) eq 0 ){ 
    469442                                ConfigStruct["RequestContextDecorator"] = ""; 
    470443                        } 
    471                          
    472444                        //Check for ProxyReturnCollection 
    473445                        if ( not structKeyExists(ConfigStruct, "ProxyReturnCollection") or not isBoolean(ConfigStruct.ProxyReturnCollection) ) 
    474446                                ConfigStruct["ProxyReturnCollection"] = false; 
    475                          
    476447                        //Check for External Handlers Location 
    477448                        if ( not structKeyExists(ConfigStruct, "HandlersExternalLocation") or len(ConfigStruct["HandlersExternalLocation"]) eq 0 ) 
    478449                                ConfigStruct["HandlersExternalLocation"] = ""; 
    479                          
    480450                        //Check for Models External Location 
    481451                        if ( not structKeyExists(ConfigStruct, "ModelsExternalLocation") or len(ConfigStruct["ModelsExternalLocation"]) eq 0 ) 
     
    504474                                fwSettingsStruct["FlashURLPersistScope"] = ConfigStruct["FlashURLPersistScope"]; 
    505475                        } 
    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                         
    529601                        if( ArrayLen(conventions) ){ 
    530602                                /* Override conventions on a per found basis. */ 
     
    536608                                if( structKeyExists(conventions[1],"modelsLocation") ){ fwSettingsStruct["ModelsConvention"] = trim(conventions[1].modelsLocation.xmltext); } 
    537609                        } 
    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; 
    638649                        //Mail Settings 
    639                         MailSettingsNodes = XMLSearch(configXML, instance.searchMailSettings); 
     650                        var MailSettingsNodes = XMLSearch(arguments.xml,"//MailServerSettings"); 
     651                         
    640652                        //Check if empty 
    641653                        if ( ArrayLen(MailSettingsNodes) gt 0 and ArrayLen(MailSettingsNodes[1].XMLChildren) gt 0){ 
    642  
    643654                                //Checks 
    644655                                if ( structKeyExists(MailSettingsNodes[1], "MailServer") ) 
    645                                         StructInsert(ConfigStruct, "MailServer", trim(MailSettingsNodes[1].MailServer.xmlText) ); 
     656                                        ConfigStruct.MailServer = trim(MailSettingsNodes[1].MailServer.xmlText); 
    646657                                else 
    647                                         StructInsert(ConfigStruct,"MailServer",""); 
     658                                        ConfigStruct.MailServer = ""; 
    648659 
    649660                                //Mail username 
    650661                                if ( structKeyExists(MailSettingsNodes[1], "MailUsername") ) 
    651                                         StructInsert(ConfigStruct, "MailUsername", trim(MailSettingsNodes[1].MailUsername.xmlText) ); 
     662                                        ConfigStruct.MailUsername = trim(MailSettingsNodes[1].MailUsername.xmlText); 
    652663                                else 
    653                                         StructInsert(ConfigStruct,"MailUsername",""); 
     664                                        ConfigStruct.MailUsername = ""; 
    654665 
    655666                                //Mail password 
    656667                                if ( structKeyExists(MailSettingsNodes[1], "MailPassword") ) 
    657                                         StructInsert(ConfigStruct, "MailPassword", trim(MailSettingsNodes[1].MailPassword.xmlText) ); 
     668                                        ConfigStruct.MailPassword = trim(MailSettingsNodes[1].MailPassword.xmlText); 
    658669                                else 
    659                                         StructInsert(ConfigStruct,"MailPassword",""); 
     670                                        ConfigStruct.MailPassword = ""; 
    660671 
    661672                                //Mail Port 
    662673                                if ( structKeyExists(MailSettingsNodes[1], "MailPort") ){ 
    663674                                        if (trim(MailSettingsNodes[1].MailPort.xmlText) neq "") 
    664                                                 StructInsert(ConfigStruct, "MailPort", trim(MailSettingsNodes[1].MailPort.xmlText) ); 
     675                                                ConfigStruct.MailPort = trim(MailSettingsNodes[1].MailPort.xmlText); 
    665676                                        else 
    666                                                 StructInsert(ConfigStruct, "MailPort", 25 ); 
     677                                                ConfigStruct.MailPort = 25; 
    667678                                } 
    668679                                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; 
    680699                        //i18N Settings 
    681                         i18NSettingNodes = XMLSearch(configXML, instance.searchi18NSettings); 
     700                        var i18NSettingNodes = XMLSearch(arguments.xml,"//i18N"); 
     701                        var i=1; 
     702                        var DefaultLocale = ""; 
     703                         
    682704                        //Check if empty 
    683705                        if ( ArrayLen(i18NSettingNodes) gt 0 and ArrayLen(i18NSettingNodes[1].XMLChildren) gt 0){ 
    684706                                //Parse i18N Settings 
    685707                                for (i=1; i lte ArrayLen(i18NSettingNodes[1].XMLChildren); i=i+1){ 
    686                                          
    687708                                        //Set the Resource Bundle if Using it. 
    688709                                        if ( i18NSettingNodes[1].XMLChildren[i].XMLName eq "DefaultResourceBundle" and len(trim(i18NSettingNodes[1].XMLChildren[i].XMLText)) neq 0 ){ 
     
    696717                                        } 
    697718                                        //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); 
    699720                                } 
    700721                                 
    701722                                //set i18n 
    702                                 StructInsert(ConfigStruct,"using_i18N",true); 
    703                                  
    704                                 /* Empty Checks */ 
     723                                ConfigStruct["using_i18N"] = true; 
     724                                 
     725                                // Empty Checks 
    705726                                if ( not structKeyExists(ConfigStruct, "DefaultResourceBundle") ){ 
    706                                         StructInsert(ConfigStruct,"DefaultResourceBundle",""); 
     727                                        ConfigStruc.DefaultResourceBundle = ""; 
    707728                                } 
    708729                                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; 
    737780                         
    738781                        //Get Web Services From Config. 
    739                         WebServiceNodes = XMLSearch(configXML, instance.searchWS); 
     782                        WebServiceNodes = XMLSearch(arguments.xml,"//WebServices/WebService"); 
    740783                        if ( ArrayLen(WebServiceNodes) ){ 
    741                                 //New Web Service Array 
     784                                // Init webservices holder structure 
     785                                configStruct.webservices = structnew(); 
    742786                                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 = ""; 
    761807                         
    762808                        //Datasources Support 
    763                         DatasourcesNodes = XMLSearch(configXML, instance.searchDatasources); 
     809                        DatasourcesNodes = XMLSearch(arguments.xml,"//Datasources/Datasource"); 
    764810                        if ( ArrayLen(DatasourcesNodes) ){ 
    765811                                //Create Structures 
     812                                ConfigStruct.Datasources = structnew(); 
    766813                                for(i=1;i lte ArrayLen(DatasourcesNodes); i=i+1){ 
    767814                                        DSNStruct = structNew(); 
    768815 
    769                                         //Required Entries 
    770816                                        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"); 
    772818                                        else 
    773                                                 StructInsert(DSNStruct,"Alias", Trim(DatasourcesNodes[i].XMLAttributes["Alias"])); 
     819                                                DSNStruct.Alias = Trim(DatasourcesNodes[i].XMLAttributes["Alias"]); 
     820                                         
    774821                                        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"); 
    776823                                        else 
    777                                                 StructInsert(DSNStruct,"Name", Trim(DatasourcesNodes[i].XMLAttributes["Name"])); 
     824                                                DSNStruct.Name = Trim(DatasourcesNodes[i].XMLAttributes["Name"]); 
    778825 
    779826                                        //Optional Entries. 
    780827                                        if ( structKeyExists(DatasourcesNodes[i].XMLAttributes, "dbtype") ) 
    781                                                 StructInsert(DSNStruct,"DBType", Trim(DatasourcesNodes[i].XMLAttributes["dbtype"])); 
     828                                                DSNStruct.DBType = Trim(DatasourcesNodes[i].XMLAttributes["dbtype"]); 
    782829                                        else 
    783                                                 StructInsert(DSNStruct,"DBType",""); 
     830                                                DSNStruct.DBType = ""; 
     831                                                 
    784832                                        if ( structKeyExists(DatasourcesNodes[i].XMLAttributes, "Username") ) 
    785                                                 StructInsert(DSNStruct,"Username", Trim(DatasourcesNodes[i].XMLAttributes["username"])); 
     833                                                DSNStruct.Username = Trim(DatasourcesNodes[i].XMLAttributes["username"]); 
    786834                                        else 
    787                                                 StructInsert(DSNStruct,"Username",""); 
     835                                                DSNStruct.Username = ""; 
     836                                                 
    788837                                        if ( structKeyExists(DatasourcesNodes[i].XMLAttributes, "password") ) 
    789                                                 StructInsert(DSNStruct,"Password", Trim(DatasourcesNodes[i].XMLAttributes["password"])); 
     838                                                DSNStruct.Password = Trim(DatasourcesNodes[i].XMLAttributes["password"]); 
    790839                                        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                 
    804869                        //Layout into Config 
    805                         DefaultLayout = XMLSearch(configXML,instance.searchDefaultLayout); 
     870                        DefaultLayout = XMLSearch(arguments.xml,"//Layouts/DefaultLayout"); 
    806871                        //validate Default Layout. 
    807872                        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"); 
    809874                        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"); 
    811876                        //Insert Default Layout 
    812                         StructInsert(ConfigStruct,"DefaultLayout",Trim(DefaultLayout[1].XMLText)); 
     877                        ConfigStruct.DefaultLayout = Trim(DefaultLayout[1].XMLText); 
    813878                         
    814879                        //Default View into Config 
    815                         DefaultView = XMLSearch(configXML,instance.searchDefaultView); 
     880                        DefaultView = XMLSearch(arguments.xml,"//Layouts/DefaultView"); 
    816881                        //validate Default Layout. 
    817882                        if ( ArrayLen(DefaultView) eq 0 ){ 
     
    819884                        } 
    820885                        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"); 
    822887                        } 
    823888                        else{ 
     
    827892                         
    828893                        //Get View Layouts 
    829                         LayoutNodes = XMLSearch(configXML, instance.searchLayouts); 
     894                        LayoutNodes = XMLSearch(arguments.xml,"//Layouts/Layout"); 
    830895                        for (i=1; i lte ArrayLen(LayoutNodes); i=i+1){ 
    831896                                //Get Layout for the views 
    832897                                Layout = Trim(LayoutNodes[i].XMLAttributes["file"]); 
    833898                                for(j=1; j lte ArrayLen(LayoutNodes[i].XMLChildren); j=j+1){ 
    834                                          
    835899                                        //Check for View 
    836900                                        if( LayoutNodes[i].XMLChildren[j].XMLName eq "View" ){ 
    837901                                                //Check for Key, if it doesn't exist then create 
    838902                                                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; 
    840904                                        } 
    841905                                        //Check for Folder 
     
    843907                                                //Check for Key, if it doesn't exist then create 
    844908                                                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; 
    846910                                        } 
    847911                                         
    848912                                }//end for loop for the layout children 
    849913                        }//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(); 
    854929                         
    855930                        //Cache Override Settings 
    856                         CacheSettingNodes = XMLSearch(configXML, instance.searchCache); 
    857                         //Create CacheSettings Structure 
    858                         structInsert(ConfigStruct,"CacheSettings",structNew()); 
     931                        CacheSettingNodes = XMLSearch(arguments.xml,"//Cache"); 
     932                        ConfigStruct.CacheSettings = structnew(); 
     933                         
    859934                        //Check if empty 
    860935                        if ( ArrayLen(CacheSettingNodes) gt 0 and ArrayLen(CacheSettingNodes[1].XMLChildren) gt 0){ 
    861  
    862936                                //Checks For Default Timeout 
    863937                                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); 
    865939                                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"); 
    867941 
    868942                                //Check ObjectDefaultLastAccessTimeout 
    869943                                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); 
    871945                                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"); 
    873947 
    874948                                //Check ReapFrequency 
    875949                                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); 
    877951                                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"); 
    879953 
    880954                                //Check MaxObjects 
    881955                                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); 
    883957                                } 
    884958                                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"); 
    886960 
    887961                                //Check FreeMemoryPercentageThreshold 
    888962                                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); 
    890964                                } 
    891965                                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"); 
    893967 
    894968                                //Check for CacheUseLastAccessTimeouts 
    895969                                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); 
    897971                                } 
    898972                                else{ 
    899                                         StructInsert(ConfigStruct.CacheSettings, "UseLastAccessTimeouts", fwSettingsStruct.CacheUseLastAccessTimeouts ); 
     973                                        ConfigStruct.CacheSettings.UseLastAccessTimeouts = fwSettingsStruct.CacheUseLastAccessTimeouts; 
    900974                                }        
    901975                                 
    902976                                //Check for CacheEvictionPolicy 
    903977                                if ( structKeyExists(CacheSettingNodes[1], "EvictionPolicy") ){ 
    904                                         StructInsert(ConfigStruct.CacheSettings, "EvictionPolicy", trim(CacheSettingNodes[1].EvictionPolicy.xmlText) ); 
     978                                        ConfigStruct.CacheSettings.EvictionPolicy = trim(CacheSettingNodes[1].EvictionPolicy.xmlText); 
    905979                                } 
    906980                                else{ 
    907                                         StructInsert(ConfigStruct.CacheSettings, "EvictionPolicy", fwSettingsStruct.CacheEvictionPolicy ); 
     981                                        ConfigStruct.CacheSettings.EvictionPolicy = fwSettingsStruct.CacheEvictionPolicy; 
    908982                                }                        
    909983                                //Set Override to true. 
     
    913987                                ConfigStruct.CacheSettings.Override = false; 
    914988                        } 
    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                         
    9221004                        //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 
    9351019                                if ( structKeyExists(DebuggerSettingNodes[1], "TracerPanel") ){ 
    9361020                                        debugPanelAttributeInsert(ConfigStruct.DebuggerSettings,"TracerPanel",DebuggerSettingNodes[1].TracerPanel.xmlAttributes); 
    9371021                                } 
    938                                 /* InfoPanel */ 
     1022                                // InfoPanel 
    9391023                                if ( structKeyExists(DebuggerSettingNodes[1], "InfoPanel") ){ 
    9401024                                        debugPanelAttributeInsert(ConfigStruct.DebuggerSettings,"InfoPanel",DebuggerSettingNodes[1].InfoPanel.xmlAttributes); 
    9411025                                } 
    942                                 /* CachePanel */ 
     1026                                // CachePanel 
    9431027                                if ( structKeyExists(DebuggerSettingNodes[1], "CachePanel") ){ 
    9441028                                        debugPanelAttributeInsert(ConfigStruct.DebuggerSettings,"CachePanel",DebuggerSettingNodes[1].CachePanel.xmlAttributes); 
    9451029                                } 
    946                                 /* RCPanel */ 
     1030                                // RCPanel 
    9471031                                if ( structKeyExists(DebuggerSettingNodes[1], "RCPanel") ){ 
    9481032                                        debugPanelAttributeInsert(ConfigStruct.DebuggerSettings,"RCPanel",DebuggerSettingNodes[1].RCPanel.xmlAttributes); 
    949                                 }        
    950                                  
     1033                                }                                        
    9511034                                //Set Override to true. 
    9521035                                ConfigStruct.DebuggerSettings.Override = true;                   
    9531036                        } 
    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         
    10471121        <!--- parseLogBox ---> 
    10481122        <cffunction name="parseLogBox" output="false" access="public" returntype="void" hint="Parse LogBox"> 
     
    10501124                <cfargument name="config"       type="struct" required="true" hint="The config struct"/> 
    10511125                <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."/> 
    10521127                <cfscript> 
    10531128                        var logboxXML = xmlSearch(arguments.xml,"//LogBox"); 
     
    10571132                         
    10581133                        if( arrayLen(logboxXML) ){ 
    1059                                 // Get config object 
     1134                                // Get config object From controller's logbox 
    10601135                                logBoxConfig = controller.getLogBox().getConfig(); 
    1061                                 // Reset it 
     1136                                // Reset the configuration 
    10621137                                logBoxConfig.reset(); 
    10631138                                // Parse and load new configuration data 
     
    10791154                                arguments.config["LogBoxConfig"] = memento; 
    10801155                        } 
    1081                         else{ 
     1156                        else if( NOT arguments.isOverride){ 
    10821157                                arguments.config["LogBoxConfig"] = structnew(); 
    10831158                        } 
     
    10851160        </cffunction>            
    10861161                                         
     1162<!------------------------------------------- PRIVATE ------------------------------------------> 
     1163 
    10871164        <!--- Debug Panel attribute insert ---> 
    10881165        <cffunction name="debugPanelAttributeInsert" access="private" returntype="void" hint="Insert a key into a panel attribute" output="false" > 
     
    10931170                <!--- ************************************************************* ---> 
    10941171                <cfscript> 
    1095                         /* Show Key */ 
     1172                        // Show Key 
    10961173                        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); 
    10981175                        }        
    1099                         /* Expanded Key */ 
     1176                        // Expanded Key 
    11001177                        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); 
    11021179                        }                
    11031180                </cfscript> 
  • coldbox/trunk/system/services/DebuggerService.cfc

    r2443 r2457  
    166166                <cfset var RenderedDebugging = ""> 
    167167                <cfset var Event = controller.getRequestService().getContext()> 
     168                <cfset var rc = event.getCollection()> 
    168169 
    169170                <!--- Set local Variables ---> 
     
    195196        <cffunction name="renderCachePanel" access="public" hint="Renders the caching panel." output="false" returntype="Any"> 
    196197                <cfset var event = controller.getRequestService().getContext()> 
     198                <cfset var rc = event.getCollection()> 
    197199                <cfset var RenderedDebugging = ""> 
    198200 
     
    223225        <cffunction name="renderCacheDumper" access="public" hint="Renders the caching key value dumper." output="false" returntype="Any"> 
    224226                <cfset var event = controller.getRequestService().getContext()> 
     227                <cfset var rc = event.getCollection()> 
    225228                <cfset var cachekey = URLDecode(event.getValue('key',''))> 
    226229                <cfset var cacheValue = controller.getColdboxOCM().get(cachekey)>