if(StructKeyExists(super, 'init')) super.init(argumentCollection=arguments); variables.constructorDependencyRules = ArrayNew(1); var buildError = StructNew(); try { // Call the addSingleton method from the extended BaseConfigObject in Lightwire Super.addSingleton(argumentCollection=arguments); //addBean(FullClassPath, BeanName, 1, InitMethod); } catch(any e) { // Build the Error Struct buildError.args = arguments; buildError.details = e; // Log the Error struct and add it to the ADF buildErrors Array doConfigBuildErrorLogging("addSingleton",buildError); } var buildError = StructNew(); try { // Call the addTransient method from the extended BaseConfigObject in Lightwire Super.addTransient(argumentCollection=arguments); //addBean(FullClassPath, BeanName, 0, InitMethod); } catch( Any e ) { // Build the Error Struct buildError.args = arguments; buildError.details = e; // Log the Error struct and add it to the ADF buildErrors Array doConfigBuildErrorLogging("addTransient",buildError); } var buildError = StructNew(); try { // Call the addTransient method from the extended BaseConfigObject in Lightwire Super.addConstructorDependency(argumentCollection=arguments); } catch( Any e ) { // Build the Error Struct buildError.args = arguments; buildError.details = e; // Log the Error struct and add it to the ADF buildErrors Array doConfigBuildErrorLogging("addConstructorDependency",buildError); } // Get the '/ADF/apps' mapping path var ADFAppMapping = expandPath("/ADF/apps"); // Replace the mapping path in the argument path var currPath = Replace(arguments.dirPath, ADFAppMapping, ""); // Get out the APP directory Name var appDirName = ListFirst(ReplaceList(currPath, "\,/",".,."), "."); // Build the component path var retComPath = "ADF.apps." & appDirName & ".components."; return retComPath; var appLibDirQry = QueryNew("temp"); var retFilteredQry = QueryNew("temp"); var i = 1; var dirPath = ''; var expPath = ExpandPath(arguments.path); var target = ''; var appComPath = ''; var buildError = StructNew(); // Recurse the custom app directory appLibDirQry = directoryFiles(arguments.path, "true"); // Query the results to find the 'appBeanConfig.cfm' files retFilteredQry = filterQueryByCFCFile(appLibDirQry, 'appBeanConfig.cfm'); dirPath = Replace(retFilteredQry.directory[i], expPath, ""); target = Replace('#arguments.path##dirPath#/#retFilteredQry.name[i]#', '\', '/', 'all'); // This is needed for the cfinclude below appComPath = getComPathForCustomAppDir(dirPath); var cfcPath = arguments.directoryPath; var excludeDirs = Replace(arguments.excludeSubDirs,"/","","all"); var appLibDirQry = QueryNew("tmp"); var CFCFilesQry = QueryNew("tmp"); var loop_i = 1; var beanData = StructNew(); var dirName = ""; var dirPath = ""; var overrideLibPath = false; // check if the cfcPath has a leading "/" if ( LEFT(cfcPath,1) NEQ "/" ) cfcPath = "/" & cfcPath; if ( FindNoCase( request.site.CSAPPSURL & "lib", cfcPath ) ) overrideLibPath = true; // Recurse the custom app directory appLibDirQry = directoryFiles(cfcPath, "true"); // filter the app lib directory query for CFC files CFCFilesQry = filterQueryByCFCFile(appLibDirQry,'%.cfc'); // filter the app lib directory to remove any application.cfc files CFCFilesQry = filterQueryByCFCFile(CFCFilesQry, "application.cfc", "!="); // loop over the query and build the bean objects for (loop_i = 1; loop_i LTE CFCFilesQry.RecordCount; loop_i = loop_i + 1) { // get the current records sub directory name dirPath = CFCFilesQry.directory[loop_i]; //dirPath = Replace(CFCFilesQry.directory[loop_i],"\","/","all"); dirName = ListFirst(Replace(dirPath,expandpath(cfcPath),"","all"),"/"); // check if sub directory name is in our exclude list if ( NOT ListFindNoCase(excludeDirs,dirName) ) { //dirPath = Replace(CFCFilesQry.directory[loop_i],"\","/","all"); // Create the bean data to store in the array beanData = buildBeanDataStruct(dirPath, CFCFilesQry.name[loop_i]); processMetadata(beanData, arguments.objFactoryType); dirPath = processCFCPath(dirPath=dirPath); } } // load the dependencies created from processMetadata //if ( FindNoCase( '_cs_apps/lib', cfcPath ) ) //if ( overrideLibPath ) // loadDependencies(objFactoryType=arguments.objFactoryType,libType='site',overridePath=cfcPath); //else loadDependencies(objFactoryType=arguments.objFactoryType); var tmpStruct = ""; var injected = 0; var metadata = ""; var i = 1; var keys = ""; var properties = arrayNew(1); var errorMessage = ""; metadata = getMetaData(CreateObject("component", arguments.beanData.cfcPath)); if( structKeyExists(metadata, "properties") ) properties = metadata.properties; // Loop over the properties for (i=1; i LTE ArrayLen(properties); i=i+1){ keys = StructKeyList(properties[i]); // Check that the record has a name key if ( ListFindNoCase(keys,"name") and listFindNoCase(keys, "value") ) { if (properties[i]["name"] EQ "type"){ if ( properties[i]["value"] EQ "singleton" ) { addSingleton(arguments.beanData.cfcPath, arguments.beanData.beanName); injected = 1; } else if ( properties[i]["value"] EQ "transient" ) { addTransient(arguments.beanData.cfcPath, arguments.beanData.beanName); injected = 1; } } // Update the lib component struct if ( arguments.objFactoryType EQ "server" ) StructInsert(server.ADF.library, ListFirst(beanData.cfcname,"_"), arguments.beanData.beanName, true); else StructInsert(application.ADF.library, ListFirst(beanData.cfcname,"_"), arguments.beanData.beanName, true); } // Check that the record has a name key if ( ListFindNoCase(keys,"type") AND (properties[i]["type"] EQ "dependency") ) { tmpStruct = StructNew(); tmpStruct.BeanName = arguments.beanData.beanName; tmpStruct.InjectedBeanName = properties[i]["injectedBean"]; tmpStruct.PropertyName = properties[i]["name"]; tmpStruct.BeanPath = arguments.beanData.cfcPath; // Add bean and dependancies to the dependencyStruct for the Server.ADF or the site's Application.ADF' if ( arguments.objFactoryType EQ "server" ) StructInsert(server.ADF.dependencyStruct, "#arguments.beanData.beanName#:#properties[i]['name']#", tmpStruct, true); else StructInsert(application.ADF.dependencyStruct, "#arguments.beanData.beanName#:#properties[i]['name']#", tmpStruct, true); } } // if it was not injected then assume it is a transient if( not injected ) addTransient(arguments.beanData.cfcPath, arguments.beanData.beanName); // Build the CF error string to throw errorMessage = "Error processing the metadata for the component [#arguments.beandata.CFCPath#]"; if ( StructKeyExists(cfcatch, "message") ) errorMessage = errorMessage & "[CF Error Message = #cfcatch.message#]"; if ( StructKeyExists(cfcatch, "TagContext") AND isArray(cfcatch.TagContext) AND ArrayLen(cfcatch.TagContext) ) { errorMessage = errorMessage & "[Template = #cfcatch.TagContext[1].template#] [Line = #cfcatch.TagContext[1].line#]"; } // Build the Error Struct buildError.args = arguments; buildError.details = cfcatch; doConfigBuildErrorLogging("processMetadata",buildError); var appBeanStruct = ''; var beanPath = ''; var beanData = ''; var i = 1; var keys = ""; var currRecord = StructNew(); var useOverrideBean = false; var siteBeanDir = ""; var siteBeanComPath = ""; var siteBeanFilePath = ""; if ( arguments.objFactoryType EQ "server" ) keys = StructKeyList(server.ADF.dependencyStruct); else keys = StructKeyList(application.ADF.dependencyStruct); for (i=1; i LTE ListLen(keys); i = i + 1) { if ( arguments.objFactoryType EQ "server" ) { currRecord = server.ADF.dependencyStruct[ListGetAt(keys, i)]; } else { currRecord = application.ADF.dependencyStruct[ListGetAt(keys, i)]; // Check to see if there is a override version of this siteBeanDir = request.site.CSAPPSURL & "lib"; //siteBeanFilePath = siteBeanDir & "/" & currRecord.BeanName & ".cfc"; siteBeanComPath = siteBeanDir & "/" & currRecord.InjectedBeanName; siteBeanFilePath = siteBeanComPath & ".cfc"; // Check if Library item has a site level override useOverrideBean = false; if ( FileExists(ExpandPath(siteBeanFilePath)) ) useOverrideBean = true; if ( useOverrideBean ) { // If the Bean has a local override file then use the overridePath for the bean path beanPath = siteBeanDir; } else { // Copy dependencies from server to application appBeanStruct = server.ADF.beanConfig.getConfigStruct(); // Get the path info for the dependency bean beanPath = appBeanStruct[currRecord.InjectedBeanName].path; // Remove the last item in the path b/c it is the file name beanPath = ListDeleteAt(beanPath, ListLen(beanPath, "."), "."); } // Create the bean data to store in the array beanData = buildBeanDataStruct(beanPath, currRecord.InjectedBeanName); // Load the bean into the object factory processMetadata(beanData, arguments.objFactoryType); } addMixinDependency(currRecord.BeanName, currRecord.InjectedBeanName, currRecord.PropertyName); } variables.config[arguments.beanName] = arguments.configStruct; // Get the sites for this server var siteComponents = ''; var j = 1; var siteComponentsDir = QueryNew("temp"); var siteComponentsFiles = QueryNew("temp"); var beanData = StructNew(); var comPath = "#request.site.CSAPPSURL#components/"; var cfcName = ''; // Check if there is a 'components' directory in the site if ( directoryExists(expandPath(comPath)) ) { siteComponents = directoryFiles(comPath, "true"); siteComponentsFiles = filterQueryByCFCFile(siteComponents, '%.cfc'); // Loop over the component files and create transients for (j = 1; j LTE siteComponentsFiles.RecordCount; j = j + 1) { cfcName = ListFirst(siteComponentsFiles.name[j],'.'); application.ADF.siteComponents = ListAppend(application.ADF.siteComponents, cfcName); beanData = buildBeanDataStruct("#request.site.CSAPPSURL#components", cfcName); // Add the transient object addTransient(beanData.cfcPath, beanData.beanName); } } SELECT Directory, Name, Type FROM arguments.dirQuery WHERE Type = 'File' AND UPPER(Name) #whereOperator# ORDER BY Directory, Name // initialize the return bean data struct var retBeanData = StructNew(); retBeanData.cfcPath = ""; retBeanData.cfcName = ""; retBeanData.beanName = ""; retBeanData.cfcPath = processCFCPath(arguments.cfcPath); retBeanData.cfcName = ListFirst(arguments.cfcName, "."); retBeanData.cfcPath = "#retBeanData.cfcPath##retBeanData.cfcName#"; // Store that bean data retBeanData.beanName = "#arguments.beanNamePrefix##retBeanData.cfcName#"; return retBeanData; var retComPath = arguments.dirPath; // get the real path to the ADF var ADFPath = expandPath('/ADF'); var csAppsPath = expandPath(request.site.csAppsURL); // process the ADF components if( findNoCase(ADFPath, retComPath) ) { retComPath = mid(retComPath, findNoCase(ADFPath, retComPath) + len(ADFPath), len(retComPath)); // add ADF back in retComPath = "/ADF" & retComPath; }// process the site level components else if ( FINDNOCASE(csAppsPath, retComPath) ) { retComPath = mid(retComPath, findNoCase(csAppsPath, retComPath) + len(csAppsPath), len(retComPath)); retComPath = request.site.csAppsURL & retComPath; } // Replace the slashes in the list to periods to support CFC notation retComPath = ReplaceList(retComPath, "\,/", ".,."); // Trim the first character to make sure doesn't start with "." if ( LEFT(retComPath, 1) EQ "." ) retComPath = REPLACE(retComPath, ".", ""); // Check if the cfc path ends in "." if ( RIGHT(retComPath, 1) NEQ "." ) retComPath = retComPath & "."; var errorDumpStr = ""; var safeMethodName = REReplaceNoCase(arguments.methodName,"[\W]","","ALL"); //var logFileName = dateFormat(now(), "yyyymmdd") & "." & request.site.name & ".ADF_" & safeMethodName & "_Errors.htm"; var logFileName = ".ADF_" & safeMethodName & "_Errors.htm"; var errorStruct = StructNew(); // Add the methodName to the errorStruct errorStruct.ADFmethodName = arguments.methodName; errorStruct.ErrorDetails = arguments.errorDetailsStruct; // Fix to allow CFDUMP to render its CSS in a log file request.cfdumpinited = false; doLog(msg=errorDumpStr,logFile=logFileName); // Add the errorStruct to the server.ADF.buildErrors Array if ( arguments.addBuildErrors ) ArrayAppend(server.ADF.buildErrors,errorStruct); var logFileName = ListDeleteAt(arguments.logFile,ListLen(arguments.logFile,"."), "."); var logFileExt = ListLast(arguments.logFile,"."); var safeLogName = REReplaceNoCase(logFileName,"[\W]","","ALL"); var utcNow = mid(dateConvert('local2utc', now()), 6, 19); var logFileNameWithExt = request.site.name & "." & safeLogName & "." & logFileExt; if( arguments.addTimeStamp ) logFileNameWithExt = dateFormat(now(), "yyyymmdd") & "." & logFileNameWithExt; if( len(arguments.label) ) arguments.label = arguments.label & "-";
#arguments.label#: #arguments.msg#