Appendix B. Source code for Trade6 user programs and script files for Linux on POWER 381
}
# Remove everything the sample setup
# Assuming nobody changed the script file
# Utility proc maily for test
#
# Typical invocation
# cleanup RuntimeDocumentMgmt DB2JDBCProv1 DB2AuthAlias
#
proc cleanup { {appName RuntimeDocumentMgmt} {jdbcProviderName DB2JDBCProv1} {jaasAliasName
DB2AuthAlias}} {
global AdminApp
global AdminConfig
if {[catch {
stopApp $appName
} result]} { ;#ignore it }
if {[catch {
$AdminApp uninstall $appName
} result]} { ;#ignore it }
if {[catch {
$AdminConfig remove [$AdminConfig getid /JDBCProvider:$jdbcProviderName/]
} result]} { ;#ignore it }
if {[catch {
foreach i [$AdminConfig list JAASAuthData] {
if { [$AdminConfig showAttribute $i alias] == $jaasAliasName } {
$AdminConfig remove $i
}
}
} result]} { ;#ignore it }
$AdminConfig save
}
The WebSphereScript.jacl script file
Example B-8 is a sample WebSphereScript.jacl file which was used for deploying the Trade6
application.
Example: B-8 Source of WebSphereScript.jacl
# %I% %W% %G% %U%
# ************************************************************************
# ************************************************************************
# ******************** Main routine ************************************
# ******** Get input values, verify all required values exist **********
# ************************************************************************
# ************************************************************************
puts " "
puts "Beginning of Script main"
puts "The number of passed arguments = $argc "
#-------------------------------------------------------------------------
# This Script requires the following input parameters:
# 1 - directory where the scripts are located
382 IBM Express Runtime V2.1
# 2 - fully qualified name of response file
#-------------------------------------------------------------------------
if {$argc != 2} {
puts " "
puts " This Script requires the following input parameters:"
puts " 1 - the scripts directory"
puts " 2 - fully qualified name of properties file"
puts " "
exit
} else {
puts "Scripts dir = [lindex $argv 0] "
puts "Properties File = [lindex $argv 1] "
}
#----------------------------------------
# Get the input parms
#----------------------------------------
set scriptsDir [lindex $argv 0]
set respFile [lindex $argv 1]
#----------------------------------------
# Set source to point to the WebSphereConfigProcs
#----------------------------------------
set setupScript [eval file join "$scriptsDir SetupProcs.jacl"]
set WasProcsScript [eval file join "$scriptsDir WebSphereConfigProcs.jacl"]
source $setupScript
source $WasProcsScript
#----------------------------------------
# Use the Connected Node
#----------------------------------------
global baseNode
set baseNode [$AdminControl getNode];# Get the one and only connected node
puts "base Node = $baseNode"
#----------------------------------------
# Get the variables values from the response file
#----------------------------------------
set props [loadProperties $respFile];# load properties from the response file
set DB2Deploy "DB2UDB_V82"
#---------------------------------------------------------------------
# JMS (Messaging) Config Parameters
#---------------------------------------------------------------------
#set reliability "ASSURED_PERSISTENT"
set reliability "EXPRESS_NONPERSISTENT"
#set deliveryMode "Persistent"
set deliveryMode "NonPersistent"
# Queue/Topic Names
set brokerSIBDest "TradeBrokerJSD"
set topicSpace "Trade.Topic.Space"
set brokerJMSQCF "TradeBrokerQCF"
set streamerJMSTCF "TradeStreamerTCF"
set brokerQueue "TradeBrokerQueue"
Appendix B. Source code for Trade6 user programs and script files for Linux on POWER 383
set streamerTopic "TradeStreamerTopic"
set brokerMDB "TradeBrokerMDB"
set streamerMDB "TradeStreamerMDB"
# ************************************************************************
# ************************************************************************
# ********** Start of Configuratin Steps *********************************
# ************************************************************************
# ************************************************************************
#----------------------------------------
# Set scope - id of scope (cell, node, or server)
#----------------------------------------
set nodeScope [$AdminConfig getid /Node:$baseNode/]
set serverScope [$AdminConfig getid /Node:$baseNode/Server:$wasServerName]
#----------------------------------------
# Create a JAAS authorization alias ( required for V5 DataSources)
#----------------------------------------
if {[catch {
createJAASDataAuth $authAliasName $db2UserId $db2Password $authAliasDesc
} result]} {
# this is an unrecoverable error. Stack should have enough information to rectify
dumpStack $result
exit
}
#----------------------------------------
# Create DB2 JDBCProvider
#----------------------------------------
if {[catch {
puts "providerName = $JDBCProviderName classpath = $JDBCclasspath baseNode = $baseNode
wasServerName = $wasServerName "
createJDBCProviderUsingTemplate $JDBCProviderName $JDBCclasspath $baseNode
$wasServerName
# createJDBCProvider db2 $JDBCclasspath "true" $nodeScope
} result]} {
# this is an unrecoverable error. Stack should have enough information to rectify
dumpStack $result
exit
}
#----------------------------------------
# Create DB2 DataSource
#----------------------------------------
set authMech "BASIC_PASSWORD"
set dsHelperClass "com.ibm.websphere.rsadapter.DB2UniversalDataStoreHelper"
puts "created datasource "
if {[catch {
# createDB2DataSource $baseNode $wasServerName $JDBCProviderName $datasourceName
$databaseName $dsHelperClass $authAliasName $authMech $datasourceCategory $datasourceDesc
384 IBM Express Runtime V2.1
set jdbcProvId [$AdminConfig getid /JDBCProvider:$JDBCProviderName/]
puts "jdbc provideer id = "
puts $jdbcProvId
puts "datasource name = "
puts $datasourceName
puts "jdbc data "
puts "jdbc/${datasourceName}"
puts "db2"
puts db2
puts "auth alias name"
puts $authAliasName
puts "node scope"
puts $nodeScope
puts "database name"
puts $databaseName
puts "{2}"
puts {2}
puts "$datasourceName jdbc/$datasourceName 60 $jdbcProvId db2 $authAliasName Trade6
Datasource $nodeScope $databaseName [list 4 localhost 50001]"
createDB2orCloudscapeDatasource $datasourceName "jdbc/${datasourceName}" 60 $jdbcProvId
db2 $authAliasName "Trade6 Datasource" $nodeScope $databaseName [list 4 localhost 50001]
} result]} {
# this is an unrecoverable error. Stack should have enough information to rectify
dumpStack $result
exit
}
#----------------------------------------
# Create the JMS config objects
#----------------------------------------
puts ""
puts "------------------------------------------------"
puts " Configuring JMS Resources"
puts "------------------------------------------------"
createJAASDataAuth $JMSauthAliasName $DefaultOSUser $DefaultOSPasswd $JMSauthAliasDesc
createJAASDataAuth $JMSauthAliasName $DefaultOSUser $DefaultOSPasswd $JMSauthAliasDesc
set SIBusName [createSIBus $baseNode $JMSauthAliasName]
set target [subst {$baseNode $wasServerName}]
addSIBusMember $SIBusName "true" "dummy" $target
# Create the Trade Broker Queue and Trade TopicSpace Destinations
createSIBDestination $SIBusName $brokerSIBDest "Queue" $reliability $target
createSIBDestination $SIBusName $topicSpace "TopicSpace" $reliability [subst {}]
createJMSConnectionFactory $SIBusName $brokerJMSQCF "Queue" "jms/$brokerJMSQCF"
$JMSauthAliasName $nodeScope
createJMSConnectionFactory $SIBusName $streamerJMSTCF "Topic" "jms/$streamerJMSTCF"
$JMSauthAliasName $nodeScope
createJMSQueue $brokerQueue "jms/$brokerQueue" $brokerSIBDest $deliveryMode $nodeScope
createJMSTopic $streamerTopic "jms/$streamerTopic" $topicSpace $deliveryMode $nodeScope

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.