Wednesday, July 13, 2011

WLST Interactive Mode, Script Mode, and Embedded Mode

Interactive Mode, Script Mode, and Embedded Mode
You can use any of the following techniques to invoke WLST commands:

■Interactively, on the command line—Interactive Mode
■In batches, supplied in a file—Script Mode
■Embedded in Java code—Embedded Mode
Interactive Mode
Interactive mode, in which you enter a command and view the response at a command-line prompt, is useful for learning the tool, prototyping command syntax, and verifying configuration options before building a script. Using WLST interactively is particularly useful for getting immediate feedback after making a critical configuration change. The WLST scripting shell maintains a persistent connection with an instance of WebLogic Server.

WLST can write all of the commands that you enter during a WLST session to a file. You can edit this file and run it as a WLST script. For more information, see startRecording and stopRecording.

Script Mode
Scripts invoke a sequence of WLST commands without requiring your input, much like a shell script. Scripts contain WLST commands in a text file with a .py file extension, for example, filename.py. You use script files with the Jython commands for running scripts.

Using WLST scripts, you can:

■Automate WebLogic Server configuration and application deployment
■Apply the same configuration settings, iteratively, across multiple nodes of a topology
■Take advantage of scripting language features, such as loops, flow control constructs, conditional statements, and variable evaluations that are limited in interactive mode
■Schedule scripts to run at various times
■Automate repetitive tasks and complex procedures
■Configure an application in a hands-free data center
For information about sample scripts that WebLogic Server installs, see WLST Sample Scripts.

Embedded Mode
In embedded mode, you instantiate the WLST interpreter in your Java code and use it to run WLST commands and scripts. All WLST commands and variables that you use in interactive and script mode can be run in embedded mode.

Listing 2-1 illustrates how to instantiate the WLST interpreter and use it to connect to a running server, create two servers, and assign them to clusters.
--------------------------------------------------------------------------------

No comments:

Post a Comment