The new ColdFusion MX 7 Administrator API feature provides a supported mechanism to read, create, and modify CFMX settings, as described in the documentation. Additional information about what methods the AdminAPI can provide is found by browsing to the various CFCs that implement the API. The CFC Explorer renders metadata about API methods including hints, properties, arguments, and usage.

For example when browsing to /CFIDE/adminapi/runtime.cfc you'll find a summary of methods available at the top of the page including clearTrustedCache, getLastClientID, and getJVMProperty for just a few. You'll also note that some methods are marked by an asterisk to indicate they are private methods intended for use internally to the CFC such that publicly accessible methods may call the private methods in turn.

If you drill down into the private methods you might see some of them include a restriction in the hint: server configuration only. What is not obvious is that some of the publicly accessible methods do not carry this caveat explicitly in their hints although some do call private methods that are restricted to the Server Configuration only. For example, getJVMProperty is shown as public and does not have a warning in the hint, but it calls the private method getProps which does have the Server Config restriction. As far as I can tell, there are very few mystery methods, and might only include getJVMProperty and setJVMProperty, but I haven't made an exhaustive search through all the AdminAPI methods.

So if you're running CFMX 7 Multiserver or J2EE configuration you might be surprised that some AdminAPI methods are not available.

Oddly, the error returned from attempting to call one of these server configuration only methods from a Multiserver configuration is: Current user is not authorized to invoke this method.. This is after having successfully authenticated and successfully called other methods, so the error returned is clearly misleading.

I've logged a documentation bug to improve the explanation regarding which methods are limited to which editions or configurations, and to provide a more meaningful or accurate error message when a method is not available for a given configuration.

[cfscript>
request.CFADMIN_PASSWORD = "admin";
request.adminObj = createObject("Component", "cfide.adminapi.administrator");
request.adminObj.login(request.CFADMIN_PASSWORD);
request.runtimeObj = createObject("component", "cfide.adminapi.runtime");
[/cfscript>

[cfoutput>

isAdminUser: #request.runtimeObj.isAdminUser()#





getRuntimeProperty: #request.runtimeObj.getRuntimeProperty("SimultaneousThreads")#





getJVMProperty: #request.runtimeObj.getJVMProperty("ClassPath")#

[/cfoutput>


Read access to the JVM Properties is alternatively available through the class java.lang.System:

[cfscript>
System = createObject("java","java.lang.System");
[/cfscript>
[CFDUMP var="#System.properties#">


Thanks to Damon Gentry for bringing this to my attention.