// 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.decimalVersion = ""; application.ADF.patchList = ""; application.ADF.csVersion = ""; 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 application.ADF.siteDevMode = false; // Default: false (disabled) // Set the site to NOT enable proxyDebugLogging by default application.ADF.proxyDebugLogging = false; // Default: false (disabled) // Set the site to NOT enable CSRF safe mode application.ADF.csrfSafeMode = false; // Default: false (disabled) var csVersion = getCSVersion(); 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 / CCAPI Config loadSiteAPIConfig(); // Load the site ceRecordAPI Config (for CS 11+) only if ( ListFirst(csVersion,".") GTE 11 ) loadSiteCeRecordApiConfig(); // Adds the ADF version to the application.ADF struct application.ADF.version = getADFversion(); application.ADF.decimalVersion = getDecimalADFVersion(); application.ADF.patchList = getADFpatchList(); 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 buildError = StructNew(); var logErrorMsg = ""; if ( server.ADF.objectFactory.containsBean(beanName) ) { StructInsert(application.ADF,adfBeanName,server.ADF.objectFactory.getSingleton(beanName),true); } else { // Log error that the Library Component Bean doesn't exist. logErrorMsg = "Could not find bean name: '#beanName#' while calling loadLibraryComponent."; // Instead of a cfthrow, add to the Build Error Array buildError.ADFmethodName = "loadLibraryComponent"; buildError.details = logErrorMsg & " [Site: #request.site.name# - #request.site.id#]."; // Add the buildError struct to the beginning of the server.ADF.buildErrors Array ArrayPrepend(server.ADF.buildErrors,buildError); } 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); } } // No ccapi config file... just move along } 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 configStruct = {}; var configDir = request.site.csAppsDir & 'config/'; var configJsonFileDir = configDir & 'ceRecordAPI.json'; var configCfmFileDir = configDir & 'ceRecordAPI.cfm'; var buildError = {}; var coreConfigObj = {}; var configFileExists = false; // Track if the site has a ceRecordApi config file configJsonFileDir = Replace(configJsonFileDir,'\','/','ALL'); configCfmFileDir = Replace(configCfmFileDir,'\','/','ALL'); try { coreConfigObj = CreateObject("component", "ADF.core.Config"); // Pass the Absolute path to the CFM file to the getConfigViaJSON(), will be converted to logical path and then read via CFINCLUDE if ( FileExists(configCfmFileDir) ) { configStruct = coreConfigObj.getConfigViaJSON(configCfmFileDir); configFileExists = true; } // Pass the Absolute path for the XML file to the getConfigViaJSON(), it will be read via CFFILE else if ( FileExists(configJsonFileDir) ) { configStruct = coreConfigObj.getConfigViaJSON(configJsonFileDir); configFileExists = true; } // Verify that the ceRecordApi config needs to be setup b/c the config file exists if ( configFileExists ) { // Validate the config has the fields we need if( isStruct(configStruct) ) { server.ADF.environment[request.site.id]['ceRecordApiConfig'] = configStruct; } else { // Build the Error Struct buildError.ADFmethodName = "loadSiteCeRecordApiConfig"; buildError.details = "ceRecordAPI Configuration CFM (or JSON) 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); } } // No ceRecordAPI config file... just move along } catch (any ex) { // Build the Error Struct buildError.ADFmethodName = "loadSiteCeRecordApiConfig"; buildError.details = ex; // 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; if ( StructKeyExists(url,"useExternal") AND IsBoolean(url.useExternal) ) arguments.useExternal = url.useExternal; if ( StructKeyExists(url,"preserveAliases") AND IsBoolean(url.preserveAliases) ) arguments.preserveAliases = url.preserveAliases; if ( StructKeyExists(url,"loadingType") ) arguments.loadingType = url.loadingType; if ( StructKeyExists(url,"useLegacyEarlyJs") AND IsBoolean(url.useLegacyEarlyJs) ) arguments.useLegacyEarlyJs = url.useLegacyEarlyJs; if ( StructKeyExists(url,"groupList") ) arguments.groupList = url.groupList; if ( StructKeyExists(url,"aliasList") ) arguments.aliasList = url.aliasList; if ( StructKeyExists(url,"outputInstallScripts") ) arguments.outputInstallScripts = url.outputInstallScripts; if ( StructKeyExists(url,"doBackup") ) arguments.doBackup = url.doBackup; if ( StructKeyExists(url,"verboseOutput") ) arguments.verboseOutput = url.verboseOutput; // 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, useExternal=arguments.useExternal, preserveAliases=arguments.preserveAliases, loadingType=arguments.loadingType, useLegacyEarlyJs=arguments.useLegacyEarlyJs, groupList=arguments.groupList, aliasList=arguments.aliasList, outputInstallScripts=arguments.outputInstallScripts, doBackup=arguments.doBackup, verboseOutput=arguments.verboseOutput ); return retMsg; \ var retMsg = ""; var resourceAPI = ""; var packageOptions = "all,full,min,minimum,minimal"; var packageTxt = arguments.scriptsPackage; var scriptsSourceOptions = 'local,external'; var loadTypeOptions = "early,late"; 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"; } if ( ListFindNoCase(scriptsSourceOptions,arguments.scriptsSource,",") EQ 0 ) arguments.scriptsSource = "local"; // Ooverrides scriptsSource if ( arguments.useExternal ) arguments.scriptsSource = "external"; if ( ListFindNoCase(loadTypeOptions,arguments.loadingType,",") EQ 0 ) arguments.loadingType = "late"; if ( LEN(TRIM(arguments.groupList)) ) packageTxt = "filtered"; if ( LEN(TRIM(arguments.aliasList)) ) packageTxt = "filtered"; packageTxt = packageTxt & " set";

- ADF Resource Installer -

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

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

return retMsg;