Andy asks:
Is there a way to get a list of application names from all of the Application.cfc running on a server. I'm trying to dynamically build a server.applicationNameArray by just dropping a web app into the web tree. Thanks for your time.
Technically the answer to this is no, but there are two ways of doing this. The first way is to use the SeverMonitor API. There isn't a 'get a list of application names', but there is a method named getAllApplicationScopesMemoryUsed. This method returns the memory used by all application scopes on your server. The keys of the structure are your application names. Here is an example:
<cfset password = "poorspearsfamily">
<cfinvoke component="CFIDE.adminapi.administrator" method="login" adminpassword="#password#" returnVariable="result">
<cfinvoke component="CFIDE.adminapi.servermonitoring" method="getAllApplicationScopesMemoryUsed" returnVariable="ascopes">
<cfdump var="#ascopes#">
By the way, check out the memory usage for the model-glue app:
The Model-Glue app is the one in red. Model-Glue is so good it gives your server RAM. Yeah, that's it.
So the second solution is a bit of an hack, but has been around for a while. If you define an application w/o a name, the Application scope for that unnamed application will contain a bunch of junk, including a pointer to all the applications on your server. Consider this code:
<cfapplication>
<cfloop item="k" collection="#application#">
<cfif isStruct(application[k]) and structKeyExists(application[k], "applicationname")>
<cfdump var="#application[k]#" label="#k#">
</cfif>
</cfloop>
This will dump each Application and all it's variables. Note the CFIF and how I check to see if the variable is an application scope. Not perfect, but in my test with both code blocks, it returned the same thing. (Well, the second code block didn't show the blank key for the unnamed application scope like the first one did.)