Skip to content
May 25, 2006 / dshuck

ColdFusion admin API CFEclipse snippets

Aaron Lynch has posted some code examples for accessing the ColdFusion Admin Api.  It is often a minor pain to have to go into the admin and turn on/off debugging on your development machine to test certain things.  Additionally in our environment, in order to restart the ColdFusion Server service I have to remote into the server, open up services, and restart.  Being able to open the CFEclipse Scribble Pad, and having quick and dirty access to these things has saved me time already this morning!

So here are a couple of snippets:

[note:  in the examples, the password is set to "coldfusion".  Alter that as you need to.]

  • Restart the ColdFusion Server by typing restart[ctrl][shift][period] and saving/running.  Here is the snippet:
    <cfscript>
    adminObj = createObject(“component”,”cfide.adminapi.administrator”);
    adminObj.login(“coldfusion”);
    // Instantiate the serverInstance object.
    myServer = createObject(“component”,”cfide.adminapi.serverInstance”);

    myServer.restartInstance(“cfusion”);
    </cfscript>

  • Turn On/Off debugging by typing debug[ctrl][shift][period].  You are then prompted for enable:true/false.  Then save/run.  Here is the snippet for that one:
    <cfscript>
    adminObj = createObject(“component”,”cfide.adminapi.administrator”);
    adminObj.login(“coldfusion”);

    myDebugging = createObject(“component”,”cfide.adminapi.debugging”);
    myDebugging.setDebugProperty(“enableDebug”,$${enabled:true|false});
    myDebugging.setDebugProperty(“enableRobustExceptions”,$${enabled:true|false});
    myDebugging.setDebugProperty(“showGeneralInfo”,$${enabled:true|false});
    myDebugging.setDebugProperty(“templateModel”,$${enabled:true|false});
    myDebugging.setDebugProperty(“showDatabaseInfo”,$${enabled:true|false});
    myDebugging.setDebugProperty(“showExceptionInfo”,$${enabled:true|false});
    myDebugging.setDebugProperty(“showTrace”,$${enabled:true|false});
    myDebugging.setDebugProperty(“showTimer”,$${enabled:true|false});
    myDebugging.setDebugProperty(“showExecutionTime”,$${enabled:true|false});
    myDebugging.setDebugProperty(“templateExecutionTime”,$${enabled:true|false});
    myDebugging.setDebugProperty(“showVariables”,$${enabled:true|false});
    myDebugging.setDebugProperty(“showFormVariables”,$${enabled:true|false});
    myDebugging.setDebugProperty(“showCGIVariables”,$${enabled:true|false});
    myDebugging.setDebugProperty(“showURLVariables”,$${enabled:true|false});
    </cfscript>

When you go out to his site check out his Flash Paper cheat sheets for all the API pieces.  He put those together using the CFC documenting tool that I blogged about the other day.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 591 other followers