402 IBM Express Runtime V2.1
</valid>
</inputValidation>
</sharedVariable>
</variables>
</iru:solution>
The WebSphereScript.jacl file
Example C-3 shows the source of the WebSphereScript.jacl file.
Example: C-3 Source of WebSphereScript.jacl
#-----------------------------------------------------------------
# installApp - Install the specified application ear file if an
# application with the same name does not exist.
#-----------------------------------------------------------------
# Input parameters:
# - appName - application name
# - ear - ear file
# - serverName - server name
#
# Variables used in the script:
#
# - deployejb - deploy ejb (true|false)
# - deployws - deploy webservices (true|false)
# - defaultBindings - use default binding (true|false)
# - earMetaData - use MetaData from ear (true|false)
global AdminControl
global AdminApp
set appName [lindex $argv 0]
set ear [lindex $argv 1]
set deployejb false
set deployws false
set defaultBindings true
set earMetaData true
set wasServerName [lindex $argv 2]
set baseNode [$AdminControl getNode]
puts "base Node = $baseNode"
set target [subst {$baseNode $wasServerName}]
puts ""
puts "Installing application {$appName}..."
# Check if the application already exists
set appList [$AdminApp list]
foreach item $appList {
if {[string first $appName $item] >= 0} {
set app $item
break
}
Appendix C. Source code for Flght400 user programs and script files on OS/400 403
}
if {![info exists app]} {
puts " Application Name: ${appName}"
puts " Ear file: ${ear}"
if {[llength $target] == 1} {
puts " Target Cluster: [lindex $target 0]"
} else {
puts " Target Node: [lindex $target 0]"
puts " Target Server: [lindex $target 1]"
}
puts " Deploy EJB: ${deployejb}"
puts " Deploy WebServices: ${deployws}"
puts " Use default bindings: ${defaultBindings}"
puts " Use Ear MetaData: ${earMetaData}"
set parms "-appname $appName"
if {$deployejb == "true"} {
append parms " -deployejb"
}
if {$deployws == "true"} {
append parms " -deployws"
}
if {$defaultBindings == "true"} {
append parms " -usedefaultbindings"
}
if {$earMetaData == "true"} {
append parms " -useMetaDataFromBinary yes"
} else {
append parms " -useMetaDataFromBinary no"
}
if {[llength $target] == 1} {
append parms " -cluster [lindex $target 0]"
} else {
append parms " -node [lindex $target 0] -server [lindex $target 1]"
}
set parms1 [subst {$parms}]
puts "Starting application install..."
set app [$AdminApp install $ear $parms1]
puts "Install completed successfully!"
} else {
puts "${appName} already exists!"
}
$AdminConfig save
puts "Starting the application"
set appManager [$AdminControl queryNames type=ApplicationManager,process=$wasServerName,*]
$AdminControl invoke $appManager startApplication $appName
$AdminConfig save

Get IBM Express Runtime V2.1 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.