Previous | Home | NextAssistance with scripting
When you perform an action in the dmgr console, we can use the command assistance feature to show the corresponding scripting commands. This feature allows you to capture and copy scripting commands for use in wsadmin scripts. You also have the option to send these as notifications to RAD, where we can use the Jython editor to build scripts.
Enabling command assistance
The command assistance feature can help you view wsadmin scripting commands in the Jython language for the last action run in the admin console.
When you perform an action in the dmgr console, we can select the option...
View administrative scripting command for last action
...in the Help area of the window to display the command equivalent. We can copy and paste this command into a script or command window.
We can also enable additional features, as follows:
- Click...
System administration | Console Preferences
Select the command assistance features to use:
Enable command assistance notifications: Use in non-production environments to send notifications containing command assist data. Enabling the notifications allows integration with Rational Application Developer. Log command assistance commands: Send the commands to a log.
![]()
- Click Apply.
When you select the option to log commands, they are stored in...
PROFILE_HOME/logs/AssistanceJythonCommands_user_name.log
Log location
DMGR_PROFILE/logs/dmgr/commandAssistanceJythonCommands_wasadmin.log
The first line of each log entry consists of a time stamp and the location within the console where the command was generated. Below the time stamp is the command information.
The command assistance - Log content # [2/24/09 12:15:42:890 EST] Business-level applications > New AdminTask.createEmptyBLA('[-name sample -description Sample ]') # [2/24/09 12:15:42:906 EST] Business-level applications > New AdminTask.listBLAs('[-blaID WebSphere:blaname=sample -includeDescription true ]') # [2/24/09 12:15:42:906 EST] Business-level applications > New AdminTask.listCompUnits('[-blaID WebSphere:blaname=sample -includeDescription true -includeType true ]') # [2/24/09 12:15:47:500 EST] Business-level applications > sample AdminTask.listAssets('[-includeDescription true ]') # [2/24/09 12:15:47:531 EST] Business-level applications > sample AdminTask.listBLAs('[-includeDescription true ]') # [2/24/09 12:15:50:531 EST] Business-level applications > sample > Add AdminTask.addCompUnit('[-blaID WebSphere:blaname=sample -cuSourceID WebSphere:blaname=IBMUTC ]') # [2/24/09 12:15:53:562 EST] Business-level applications > sample > Add AdminTask.addCompUnit('[-blaID WebSphere:blaname=sample -cuSourceID WebSphere:blaname=IBMUTC -CUOptions [[WebSphere:blaname=sample WebSphere:blaname=IBMUTC IBMUTC_0001 "" 1]]]') # [2/24/09 12:15:57:625 EST] Adding composition unit to the business-level application AdminConfig.save() # [2/24/09 12:15:57:890 EST] BLAManagement AdminTask.listBLAs('[-includeDescription true ]') # [2/24/09 12:16:01:421 EST] Business-level applications AdminTask.startBLA('[-blaID WebSphere:blaname=sample ]')
Building script files using command assist
To build scripts, either...
- Copy commands from the Help area of the console
- Copy commands from the log
The command assist notifications also provide an integration point with Rational Application Developer. This integration provides tools that allow you to monitor commands as they are created and to insert the monitored commands into a script.
Working with Jython scripts
To work with Jython scripts in Rational Application Developer, you create a Jython project and Jython script files in the project from any perspective. When you open a new Jython script, it opens with the Jython editor.
We can use the Jython editor in Rational Application Developer to perform a variety of tasks...
- View the admin console
- Develop and edit Jython script files
- Import existing Jython files for structured viewing
- Set breakpoints for debugging your scripts
The Jython editor has many text editing features, such as syntax highlighting, unlimited undo or redo, and automatic tab indentation.
When you tag a comment in a Jython script with the #TODO tag, the editor automatically creates a corresponding task as a reminder in the Tasks view. Then, if you open the task later, the editor synchronizes automatically to that TODO entry in the script source.
Other helpful features are content assist and tips that provide a list of acceptable continuations. The continuation information is dependant on where the cursor is located in a Jython script file or what you just typed. The Jython editor is not integrated to a compiler. As a result, the Jython editor does not perform syntax verification on your scripts.
Using the command assist notifications
The command assistance in the admin console sends JMX notifications containing command data. We can monitor these notifications from Rational Application Developer. This monitoring requires defined the server producing the notifications as a server in the workspace.
To monitor the commands produced as actions, which are taken on the admin console of the server:
- In the Servers view, right-click the server, and click...
Administration | WebSphere administration command assist
The WebSphere Administration Command view opens.
- In the Select Server to Monitor list, select the servers you want the tool to monitor as you interact with its admin console.
The Select Server to Monitor list is available in the toolbar of the WebSphere Administration Command view
![]()
You need to start the server to monitor in profile or debug mode.
The server is disabled for selection in the Select Server to Monitor list when the server is stopped.
As commands are generated by the console, they display in the WebSphere Application Command Assist view. The commands are shown in WebSphere Administration Command view.
With the Jython script open in the Jython editor and with the monitored command data in the WebSphere Administration Command view, we can insert the commands directly into the script file. Place the cursor in the script file where you want the command to go. Right-click the command, and select Insert. Double-clicking the command also inserts it into the script.
![]()