// 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 = ""; application.ADF.url = server.ADF.url; application.ADF.dir = server.ADF.dir; application.ADF.comPath = server.ADF.comPath; application.ADF.mappingPath = server.ADF.mappingPath; // 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 struct 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)]); } // After the application.ADF is built load PostInit methods found in Library components loadLibraryPostInit(); 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_2").structMerge(application.ADF.proxyWhiteList, configStruct, true); } var bean = "false"; var buildError = StructNew(); var throwError = false; var throwErrorMsg = ""; if (server.ADF.objectFactory.containsBean(beanName) ) { StructInsert(application.ADF,adfBeanName,server.ADF.objectFactory.getSingleton(beanName),true); } else { // Throw error that the Library Component Bean doesn't exist. throwError = true; throwErrorMsg = "Could not find bean name: '#beanName#' while calling loadLibraryComponent."; // cfscript 'throw' is not cf8 compatible //throw("Could not find bean name: '#beanName#' while calling loadLibraryComponent"); } var APIConfig = ""; var configAppXMLPath = ExpandPath("#request.site.csAppsURL#config/ccapi.xml"); var configAppCFMPath = "#request.site.csAppsURL#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 = "loadSiteAPIConfig"; 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 = "loadSiteAPIConfig"; //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); } var libKey = ""; var libkeyExcludeList = "Base,BeanConfig,ObjectFactory,Library,ApiPool,ApiPoolConfig,proxyWhitelist"; // Loop over the loaded application.ADF components for ( libKey IN application.ADF ) { // Look for a postInit method in each of the loaded Library objects if ( !ListFindNoCase(libkeyExcludeList,libKey) AND IsObject(application.ADF[libKey]) AND StructKeyExists(application.ADF[libKey],"postInit") ) { try { // Run the PostInit method application.ADF[libKey].postInit(); } catch (any exception) { // Build the Error Struct buildError.ADFmethodName = "loadLibraryPostInit"; //buildError.details = "Unable to load the postInit() method in the #libKey# library component"; buildError.details = exception; // Add the errorStruct to the server.ADF.buildErrors Array ArrayAppend(server.ADF.buildErrors, buildError); } } } var retMsg = ""; // Check for a register url parameter to be passed in // - "min" only installs the minimal set of resources if ( StructKeyExists(url,"scriptsPackage") ) arguments.scriptsPackage = url.scriptsPackage; // Call the methods to install required ADF components into the CommonSpot Site // - if they render an output message append it to the retMsg variable retMsg = registerScripts(updateExisting=arguments.reinstall,scriptsPackage=arguments.scriptsPackage); return retMsg; var retMsg = ""; var resourceAPI = ""; var packageOptions = "all,full,min,minimum,minimal"; var packageTxt = arguments.scriptsPackage; if ( ListFindNoCase(packageOptions,arguments.scriptsPackage,",") EQ 0 ) arguments.scriptsPackage = "full"; if ( arguments.scriptsPackage EQ "all" ) { arguments.scriptsPackage = "full"; packageTxt = arguments.scriptsPackage; } else if ( ListFindNoCase("min,minimum",arguments.scriptsPackage) EQ 1 ) { arguments.scriptsPackage = "min"; packageTxt = "minimal"; }

- ADF Resource Installer -

Re-installing Installing ADF Scripts as CommonSpot Resources...

A #lcase(packageTxt)# set of ADF script resources have been re-registered registered with CommonSpot for site: '#request.site.name#'.

return retMsg;