// Initialize the ADF App Space application.ADF = StructNew(); application.ADF.siteComponents = ""; application.ADF.library = StructNew(); // Stores library components application.ADF.dependencyStruct = StructNew(); // Stores the bean dependency list application.ADF.siteAppList = ""; // Stores a list of the sites Apps loaded application.ADF.version = ""; // Set the proxyWhiteList from the Server Apps ProxyWhiteList application.ADF.proxyWhiteList = server.ADF.proxyWhiteList; // Set the site to NOT enable siteDevMode by default application.ADF.siteDevMode = false; // Set the site to NOT enable proxyDebugLogging by default application.ADF.proxyDebugLogging = false; initSite(); // Build object factory application.ADF.beanConfig = createObject("component", "ADF.core.lightwire.SiteBeanConfig").init(); application.ADF.objectFactory = createObject("component","ADF.core.lightwire.LightWireExtendedBase").init(application.ADF.beanConfig); // Load the site config xml docs configSiteEnvironment(); // Load the site Ajax Service Proxy white list loadSiteAjaxProxyWhiteList(); // Load the site components loadSiteComponents(); // Load the site API or CCAPI Config loadSiteAPIConfig(); // Adds the ADF version to the application.ADF stuct application.ADF.version = getADFversion(); application.ADF.decimalVersion = getDecimalADFVersion(); application.ADF.csVersion = getCSVersion(); // Clear the server.ADF.environment structure server.ADF.environment[request.site.id] = StructNew(); // Add the site name to the struct StructInsert(server.ADF.environment[request.site.id], request.site.name, request.site.name, true); var i = 1; var bean = ""; // Loop over the list of site components for ( i = 1; i LTE ListLen(application.ADF.siteComponents); i = i + 1) { // Get the current bean name beanName = ListGetAt(application.ADF.siteComponents, i); // Get the bean out of the object factory and load into application.ADF space application.ADF[beanName] = application.ADF.objectFactory.getBean(beanName); } var libKeys = ""; var localLibKeys = ""; var i = 1; var libVersions = structNew(); var thisComponent = ""; var thisComponentEasyName = ""; var ADFversion = getDecimalADFVersion(); // Load the ADF Lib components application.ADF.beanConfig.loadADFLibComponents("#request.site.csAppsURL#lib/", "", "application"); // Refresh the Object Factory application.ADF.objectFactory = createObject("component","ADF.core.lightwire.LightWireExtendedBase").init(application.ADF.beanConfig); // retrieve the libraryComponents to load libVersions = loadLibVersions(); // verify that the passed in version is valid if( structKeyExists(libVersions, "v_" & arguments.loadVersion) ) libKeys = structKeyList(libVersions["v_" & arguments.loadVersion] ); else libKeys = structKeyList(libVersions["v_" & ADFversion] ); // loop over the keys that are the lib component names for ( i = 1; i LTE ListLen(libKeys); i = i + 1) { // build the variables for loading components thisComponent = listGetAt(libKeys, i); thisComponentEasyName = listFirst(thisComponent, "_"); // Load the bean into application space application.ADF[thisComponentEasyName] = server.ADF.objectFactory.getBean(thisComponent); } // Set the list of the Local LIB component overrides localLibKeys = StructKeyList(application.ADF.library); // This will override any server lib components for ( i = 1; i LTE ListLen(localLibKeys); i = i + 1) { // Load the bean into application space application.ADF[ListGetAt(localLibKeys,i)] = application.ADF.objectFactory.getBean(application.ADF.library[ListGetAt(localLibKeys,i)]); } var versionXMLStr = ""; var rtnData = structNew(); var appVarName = arguments.varName; // Check if the variable name was not defined in the arguments if ( LEN(appVarName) LTE 0 ) appVarName = ListFirst(arguments.beanName, "_"); // Load the bean into application space application.ADF[appVarName] = application.ADF.objectFactory.getBean(arguments.beanName); var configPath = "#request.site.csAppsDir#config/proxyWhiteList.xml"; var configStruct = StructNew(); // Check if the file exist on the site if ( fileExists( configPath ) ) { configStruct = server.ADF.objectFactory.getBean("CoreConfig").getConfigViaXML(configPath); application.ADF.proxyWhiteList = server.ADF.objectFactory.getBean("Data_1_0").structMerge(application.ADF.proxyWhiteList, configStruct, true); } var bean = "false"; if(server.ADF.objectFactory.containsBean(beanName)) { StructInsert(application.ADF,adfBeanName,server.ADF.objectFactory.getSingleton(beanName),true); } else { // TODO: Need to check this... not sure the cfscript version of cfthrow is CF8 compatible throw("Could not find bean name: '#beanName#' while calling loadLibraryComponent"); } var APIConfig = ""; var configAppXMLPath = ExpandPath("#request.site.csAppsWebURL#config/ccapi.xml"); var configAppCFMPath = "#request.site.csAppsWebURL#config/ccapi.cfm"; var buildError = StructNew(); var coreConfigObj = ""; var configFileExists = false; // Track if the site has a ccapi config file try { coreConfigObj = CreateObject("component", "ADF.core.Config"); // Pass a Logical path for the CFM file to the getConfigViaXML() since it will be read via CFINCLUDE if ( FileExists(ExpandPath(configAppCFMPath)) ){ APIConfig = coreConfigObj.getConfigViaXML(configAppCFMPath); configFileExists = true; } // Pass an Absolute path for the XML file to the getConfigViaXML() since it will be read via CFFILE else if ( FileExists(configAppXMLPath) ){ APIConfig = coreConfigObj.getConfigViaXML(configAppXMLPath); configFileExists = true; } // Verify that the CCAPI config needs to be setup b/c the config file exists if ( configFileExists ){ // Validate the config has the fields we need if( isStruct(APIConfig) ){ server.ADF.environment[request.site.id]['apiConfig'] = APIConfig; } else { // Build the Error Struct buildError.ADFmethodName = "API Config"; buildError.details = "API Configuration CFM (or XML) file is not a valid data format. [#request.site.name# - #request.site.id#]."; // Add the errorStruct to the server.ADF.buildErrors Array ArrayAppend(server.ADF.buildErrors,buildError); } } } catch (Any exception){ // Build the Error Struct buildError.ADFmethodName = "API Config"; //buildError.details = "API Configuration CFM (or XML) file is not setup for this site [#request.site.name# - #request.site.id#]."; buildError.details = exception; // Add the errorStruct to the server.ADF.buildErrors Array ArrayAppend(server.ADF.buildErrors, buildError); }