Assistance with scripting
When you perform an action in the administrative console, you 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 Rational Application Developer, where you 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 administrative console.
When you perform an action in the administrative console, you can select the View administrative scripting command for last action option in the Help area of the window to display the command equivalent. You can copy and paste this command into a script or command window.
You can also enable additional features, as follows:
Click System administration > Console Preferences. Select the command assistance features that you want to use:
Enable command assistance notifications:
Use this option in non-production environments to send notifications containing command assist data. Enabling the notifications allows integration with Rational Application Developer.
Log command assistance commands:
This option sends the commands to a log.
When you select the option to log commands, they are stored in the following location:
For example log location can be:
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. Example below shows a sample of the log:
# [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
The command assist features provide several methods to build scripts. You can copy commands from the Help area of the console or from the log into Jython scripts.
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.
You can use the Jython editor in Rational Application Developer to perform a variety of tasks. The following list notes some of those tasks:
View the administrative 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 administrative console sends JMX notifications containing command data. You can monitor these notifications from Rational Application Developer. This monitoring requires that you define the server that is producing the notifications as a server in the workspace.
To monitor the commands that are produced as actions, which are taken on the administrative 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 that you want the tool to monitor as you interact with its administrative console. The Select Server to Monitor list is available in the toolbar of the WebSphere Administration Command view:
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, you 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, as shown in figure below. Double-clicking the command also inserts it into the script.
Setting console preferences
The look of the administrative console can be altered by setting console preferences. The preference you see vary slightly depending on the console type. For example, the preference to synchronize changes with nodes is only applicable to an administrative console on a deployment manager. Figure below displays the console preferences for a deployment manager's administrative console.
To set administrative console preferences, click System administration > Console Preferences in the navigation tree. You have the following options:
Turn on workspace automatic refresh specifies that the view automatically refreshes after a configuration change. If it is not selected, you must re-access the page to see the changes.
No confirmation on workspace discard specifies that a confirmation window be displayed if you elect to discard the workspace. For example, if you have unsaved changes and log out of the administrative console, you are asked whether you want to save or discard the changes. If this option is not selected, and you elect to discard your changes, you are asked to confirm the discard action.
Use default scope (administrative console node) sets the default scope to the node of the administration console. If you do not enable this setting, the default is all scopes.
Show the help portlet displays the help portlet to the right of the administrative console.
Enable command assistance notifications allows you to send JMX notifications that contain command data. These notifications can be monitored in a Rational Application Developer workspace, providing assistance in creating scripts.
Log command assistance commands specifies whether to log all of the command assistance wsadmin data for the current user.
When you select this option, script commands matching actions you take in the administrative console are logged to the following location:
Synchronize changes with Nodes synchronizes changes that are saved to the deployment manager profile with all the nodes that are running.
Select the boxes to choose which preferences you want to enable and then click Apply.