Trade 6.1 Installation script: trade.jacl

Example: A-4 trade.jacl installation script

#-----------------------------------------------------------------
# trade.jacl - Configure Trade 
#-----------------------------------------------------------------
#
# Author: Christopher Blythe
#
# This script is designed to configure the JDBC and JMS resource required by
# the Trade application. Both single server and clustered environments are
# supported. A "silent install" option is also supported after manually setting
# the default config options in this jacl file.
#  
# To invoke the script type:
#   wsadmin -f trade.jacl [all|configure|install|start|uninstall\]
#      where:   all        -  configures JDBC and JMS resources and installs the app
#               configure  -  only configures the JDBC and JMS resource
#               install    -  installs the Trade ear
#               start      -  starts the Trade application on a single server
#               uninstall  -  uninstalls the Trade application on a single server
#
# If no parameters are specified, "all" is assumed!
#

$AdminConfig setValidationLevel NONE

puts "trade.jacl"

set dir [pwd]
set wasPerfJacl [file join $dir resource_scripts.jacl]
source $wasPerfJacl

                              
set SilentInstall               "false"
set DefaultTradeAppName         "Trade"
set DefaultEarFile              "trade.ear"

#---------------------------------------------------------------------
# Basic Cluster Properties
#---------------------------------------------------------------------

set DefaultClusterName          "TradeCluster"
set DefaultClusterDescription   "Trade Cluster Config"
set DefaultClusterMember        "TradeServer"
set DefaultClusterInstall       "no"

set DefaultMemberWeight         2
set DefaultPreferLocal          "true"

#---------------------------------------------------------------------
# JDBC Driver and DataSource Config Parameters
#---------------------------------------------------------------------

# Default options for database classpath
# Note: wsadmin parses the command line based on ";" regardless of platform type
#set DB2JccPath                  "c:/sqllib/java/db2jcc.jar;c:/sqllib/java/db2jcc_license_cu.jar;c:/sqllib/java/db2jcc_license_cisuz.jar"
set DB2JccPath                  "/home/db2rcl1/sqllib/java/db2jcc.jar;/home/db2rcl1/sqllib/java/db2jcc_license_cu.jar"
#set DB2NativePath               "/usr/lpp/db2/db2810/jcc/lib"
set DB2NativePath               "/opt/IBM/db2/V9.1/lib64"
#set DB2CliPath                  "c:/sqllib/java/db2java.zip"
set DB2CliPath                  "/home/db2rcl1/sqllib/java/db2java.zip"
set OraclePath                  "c:/oracle/product/10.1.0/db_1/jdbc/lib/ojdbc14.jar"
set DerbyPath                   "\$\{WebSphere Application Server _INSTALL_ROOT\}/derby/lib/derby.jar"
set DB2iSeriesNativePath        "/QIBM/ProdData/Java400/ext/db2_classes.jar"
set DB2iSeriesToolboxPath       "/QIBM/ProdData/HTTP/Public/jt400/lib/jt400.jar"

# Default options for database user name
set DefaultUserDB2              "db2rcl1"
set DefaultUserOracle           "trade"

# Default options for database password 
set DefaultPasswdDB2            "login1"
set DefaultPasswdOracle         "trade"

# Datasource properties
set DefaultDatasourceName       "TradeDataSource"
set DefaultAuthAliasName        "TradeDataSourceAuthData"
set DefaultStmtCacheSize        60
set ClusterMEDatasourceName     "MEDataSource"

# Global Security properties for JMS
set DefaultOSAuthAlias          "TradeOSUserIDAuthData"

# EJB Deploy database types
# Note: The default backend deploy types are now DB2UDB_V82, DB2UDBOS390_V8,
#    DB2UDBISERIES_V54, and ORACLE_V10G. If you are using a database versions 
#    other than these (ie. DB2UDB_V81, ORACLE_V9I, DB2UDBOS390_V7, etc.), you 
#    will need to modfiy these parameters by hand.
set DB2Deploy                   "DB2UDB_V82"
set DB2zOSDeploy                "DB2UDBOS390_V8"
set DB2iSeriesDeploy		"DB2UDBISERIES_V54"
set OracleDeploy                "ORACLE_V10G"
set DerbyDeploy                 "DERBY_V10"

#---------------------------------------------------------------------
# Default Properties for Silent Install
#
# NOTE: Silent Install only functions for SINGLE Server
#---------------------------------------------------------------------

# Generic database options
# Options: db2 db2cli oracle db2zos
# Note: Installations on z/OS are currently limited to single server.
#    Therefore, the script will terminate if db2zos is chosen for the
#    database type and a cluster install is performed.
set DefaultDbType               "db2"

set DefaultXA                   "true"
set DefaultPathName             ${DB2JccPath}
set DefaultNativePathName       ${DB2NativePath}
set DefaultUser                 ${DefaultUserDB2}
set DefaultPasswd               ${DefaultPasswdDB2}

# DB2 database options
# Note: The default DB2 Universal Driver Type has been changed to Type 4
#   since DB2 V82 now supports XA with the Type 4 driver. If you would like
#   to use previous versions of DB2, this MUST be changed to Type 2.
set DefaultDatabaseName         "stradedb"
set DefaultDB2JccDriverType     4
set DefaultDB2Hostname          "brazos.itsc.austin.ibm.com"
set DefaultDB2Port              "50000"   

# Oracle database options
set DefaultOracleSID            "tradedb"
set DefaultOracleHostname       "localhost"
set DefaultOraclePort           1521

# Deployment options
set DefaultRunEJBDeploy         "true"
set DefaultRunWSDeploy          "true"
set DefaultEJBDeployDBType      ${DB2Deploy}

# Messaging security options
# Note: If global security is enabled or will be enabled at some point and 
#   time, the OSAuthData alias should be updated with a valid system (OS) id
#   and password. For cluster configurations, LDAP, Windows Active Direcotry
#   or some other form of centralized authenticatoin mechanism must be used
#   to validate the userid.
set SecurityEnabled             "false"
set DefaultOSUser               "LocalOSUserID"
set DefaultOSPasswd             "password"

# Silent install properties for Managed Node
# - Modify these properties to specify the target node and server
set TargetNodeName              "PLNode"
set TargetServerName            "Server1"

# Silent install properties for Cluster
# - Append items to this list for the desired nodes and cluster members
set ClusterNodeNames           [list "nodeName1" "nodeName2"]
set ClusterMemberNames         [list "serverName1" "serverName2"]

#---------------------------------------------------------------------
#  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"
set streamerTopic       "TradeStreamerTopic"
set brokerMDB           "TradeBrokerMDB"
set streamerMDB         "TradeStreamerMDB"

#---------------------------------------------------------------------
#  Other parameters and options
#---------------------------------------------------------------------

set CmdOptions        [list "all" "configure" "install" "start" "uninstall"]
set DefaultOptions    [list "yes" "no"]
set BooleanOptions    [list "true" "false"]
set DatabaseOptions   [list "db2" "db2cli" "oracle" "db2zos" "derby" "iSeriesNative" "iSeriesToolbox"]
set DriverTypeOptions [list 2 4]

#---------------------------------------------------------------------
#  Basic App Administration Procedures
#---------------------------------------------------------------------

proc printUsageAndExit {} {
   puts ""
   puts "Usage: wsadmin -f trade.jacl \[all|configure|install|start|uninstall\]"
   puts ""
   puts "   where: all        -  configures JDBC and JMS resources and installs the app"
   puts "          configure  -  only configures the JDBC and JMS resource"
   puts "          install    -  installs the Trade ear"
   puts "          start      -  starts the Trade application on a single server"
   puts "          uninstall  -  uninstalls the Trade application on a single server"
   puts ""
   puts "   If no parameters are specified, \"all\" is assumed!"
   puts ""
   exit
}

#---------------------------------------------------------------------
#  Parse Command Line
#---------------------------------------------------------------------

if {[llength $argv] == 0} {
   set operation "all"
} elseif {[lsearch -glob $CmdOptions [lindex $argv 0]] > -1} {
   set operation [lindex $argv 0]
} else {
    printUsageAndExit
}

puts ""
puts "------------------------------------------------"
puts " Trade Install/Configuration Script"
puts ""
puts " Operation:  ${operation}"
puts " Silent:     ${SilentInstall}"
puts "------------------------------------------------"

#---------------------------------------------------------------------
# Trade configuration procedures
#---------------------------------------------------------------------

if {${SilentInstall} == "false" && (${operation} == "configure" || ${operation} == "all")} {

   set SecurityEnabled [getValidInput "Global security is \(or will be\) enabled \(true|false\) \[${SecurityEnabled}\]:" $SecurityEnabled $BooleanOptions]

   set DefaultClusterInstall [getValidInput "Is this a cluster installation \(yes\|no\) \[${DefaultClusterInstall}\]:" $DefaultClusterInstall $DefaultOptions]

   if {${DefaultClusterInstall} == "yes"} {

      set forZOS [getValidInput "Is this installation intended for z/OS \(yes\|now\) \[no\]:" "no" $DefaultOptions]

      if {${forZOS} == "yes"} {
         puts " "
         puts "--------------------------------------------------"
         puts " Note: Trade installations on z/OS platforms are"
         puts "  currently limited to single server environments."
         puts "  Exiting the install script!"
         puts "--------------------------------------------------"
         
         exit
      }
      
      set cell [getCellId]
      set cellName [getName $cell]
      set scope $cell

      puts " "
      puts "-------------------------------------------------"
      puts " Collecting Cluster and Cluster Member Info"
      puts " "
      puts " Note: Before proceeding, all nodes intended for"
      puts "  use in this cluster must be federated with the"
      puts "  deployment manager using the addNode command!"
      puts "  To ensure that this process goes smoothly, it"
      puts "  is also important to verify that each node can"
      puts "  ping the other cluster nodes based on the host"
      puts "  names configured within the WebSphere profile"
      puts "  creation tool."             
      puts "-------------------------------------------------"

      set continue [getValidInput "Have all nodes been federated and network connectivity \nverified? \(yes\|no\) \[yes\]:" "yes" $DefaultOptions]      
      if {${continue} == "no"} {
         exit
      }

      # Obtain cluster name and create cluster

      set DefaultClusterName [getInput "Please enter the cluster name \[${DefaultClusterName}\]:" $DefaultClusterName]

      # Obtain cluster member details from the user, generating a list
      # of member/node pairs to be used to create the cluster members

      set addNodes "yes"

      set ClusterNodeNames [list ]
      set ClusterMemberNames [list ]
      
      # Continue adding node/member pairs until the user enters "no"
      while {$addNodes == "yes"} {

         set node [getNodeId]
         lappend ClusterNodeNames [getName $node]
         set count [llength $ClusterNodeNames]

         set member [getInput "Please enter the cluster member name \[${DefaultClusterMember}${count}\]:" "${DefaultClusterMember}${count}"]
         lappend ClusterMemberNames $member

         # List cluster node/member pairs
         puts ""
         puts "Current Cluster Nodes and Members:"
         set idx 0
         foreach item $ClusterNodeNames {
            set tmp [lindex $ClusterMemberNames $idx]
            set idx [expr $idx + 1]
            puts "  ${item} - ${tmp}"
         }

         set addNodes [getValidInput "Add more cluster members \(yes\|no\) \[yes\]:" "yes" $DefaultOptions]
      }
      
      puts ""
      puts "Cluster information obtained..."   
   } else {
      # Obtain node name and id for scope
       
      puts "------------------------------------------------"
      puts " Collecting Single Server or Managed Server Info"            
      puts "------------------------------------------------"

      set node [getNodeId]
      set TargetNodeName [getName $node]
      set scope $node
      
      set server [getServerId]
      set TargetServerName [getName $server]    
   }

   puts "------------------------------------------------"
   puts " Collecting Database/Datasource Information"
   puts "------------------------------------------------"

   set DefaultDbType [getValidInput "Select the backend database type \(db2\|oracle\|db2zos\) \[${DefaultDbType}\]:" $DefaultDbType $DatabaseOptions] 
   
   if {${DefaultDbType} == "db2"} {
      set DefaultPathName              ${DB2JccPath}
      set DefaultUser                  ${DefaultUserDB2}
      set DefaultPasswd                ${DefaultPasswdDB2}
      set DefaultNativePathName        ""
   } elseif {${DefaultDbType} == "oracle"} {
      set DefaultPathName              ${OraclePath}
      set DefaultUser                  ${DefaultUserOracle}
      set DefaultPasswd                ${DefaultPasswdOracle}
      set DefaultNativePathName        ""
   } elseif {${DefaultDbType} == "db2cli"} {
      set DefaultPathName              ${DB2CliPath}
      set DefaultUser                  ${DefaultUserDB2}
      set DefaultPasswd                ${DefaultPasswdDB2}
      set DefaultNativePathName        ""
   } elseif {${DefaultDbType} == "derby"} {
      set DefaultDatabaseName          "\$\{APP_INSTALL_ROOT\}/\$\{CELL\}/Trade.ear/tradeDB"
      set DefaultPathName              ${DerbyPath}
      set DefaultUser                  "app"
      set DefaultPasswd                "dummy"
      set DefaultNativePathName        ""
   } elseif {${DefaultDbType} == "db2zos"} {
      set DefaultPathName              ${DB2JccPath}
      set DefaultUser                  ${DefaultUserDB2}
      set DefaultPasswd                ${DefaultPasswdDB2}
      set DefaultNativePathName        ${DB2NativePath}
   } elseif {${DefaultDbType} == "iSeriesNative"} {
      set DefaultPathName              ${DB2iSeriesNativePath}
      set DefaultUser                  ${DefaultUserDB2}
      set DefaultPasswd                ${DefaultPasswdDB2}
   } elseif {${DefaultDbType} == "iSeriesToolbox"} {
      set DefaultPathName              ${DB2iSeriesToolboxPath}
      set DefaultUser                  ${DefaultUserDB2}
      set DefaultPasswd                ${DefaultPasswdDB2}
   }

   puts ""
   puts "NOTE: wsadmin requires \";\" for delimiting the database"
   puts "driver path regardless of platform!"
   set DefaultPathName [getInput "Please enter the database driver path \[${DefaultPathName}\]:" $DefaultPathName]

   if {[string first "db2" ${DefaultDbType}] >= 0 || ${DefaultDbType} == "derby"} {
      if {${DefaultDbType} == "db2zos"} {
         set DefaultDB2JccDriverType   2
         set DefaultXA                 "false"
         
         set DefaultNativePathName     [getInput "Please enter the driver native library path \[${DefaultNativePathName}\]:" $DefaultNativePathName]
      } 
      
      set DefaultDatabaseName   [getInput "Please enter the database name (location) \[${DefaultDatabaseName}\]:" $DefaultDatabaseName]
      
      if {[string first "db2" ${DefaultDbType}] >= 0 && ${DefaultDbType} != "db2cli"} {
         #set DefaultDB2JccDriverType      [getValidInput "Please enter the JDBC driver type \(2\|4\) \[${DefaultDB2JccDriverType}\]:" $DefaultDB2JccDriverType $DriverTypeOptions]         
         if {$DefaultDB2JccDriverType == 4} {
            set DefaultDB2Hostname        [getInput "Please enter the DB2 database hostname \[${DefaultDB2Hostname}\]:" $DefaultDB2Hostname]   
            set DefaultDB2Port            [getInput "Please enter the DB2 database port number \[${DefaultDB2Port}\]:" $DefaultDB2Port]
         }
      }
   } elseif {${DefaultDbType} == "oracle"} {
      set DefaultOracleHostname [getInput "Please enter the Oracle database hostname \[${DefaultOracleHostname}\]:" $DefaultOracleHostname]
      set DefaultOracleSID      [getInput "Please enter the Oracle database SID \[${DefaultOracleSID}\]:" $DefaultOracleSID]
      set DefaultOraclePort     [getInput "Please enter the Oracle listener port number \[${DefaultOraclePort}\]:" $DefaultOraclePort]
   } elseif {[string first "iSeries" ${DefaultDbType}] >= 0} {
      set DefaultDatabaseName   [getInput "Please enter the database name \[${DefaultDatabaseName}\]:" $DefaultDatabaseName]
      if {${DefaultDbType} == "iSeriesToolbox"} {
         set DefaultDB2Hostname	[getInput "Please enter the Toolbox database hostname \[${DefaultDB2Hostname}\]:" $DefaultDB2Hostname]
      }
   }

   if {${DefaultDbType} != "derby"} {
      set DefaultUser     [getInput "Please enter the database username \[${DefaultUser}\]:" $DefaultUser]
      set DefaultPasswd   [getInput "Please enter the database password \[${DefaultPasswd}\]:" $DefaultPasswd]
   }
   
   if {${SecurityEnabled} == "true"} {
      puts "-------------------------------------------------"
      puts " Collecting Security Information for JMS"
      puts " "
      puts " Note: The supplied authentication data must"
      puts "  correspond to a valid system (OS) userid and"
      puts "  password. For cluster environments, LDAP or"
      puts "  another supported centralized authentication"
      puts "  mechanism must be configured to validate the"
      puts "  userid."
      puts "-------------------------------------------------"
      
      set DefaultOSUser     [getInput "Please enter the system username \[${DefaultOSUser}\]:" $DefaultOSUser]
      set DefaultOSPasswd   [getInput "Please enter the system password \[${DefaultOSPasswd}\]:" $DefaultOSPasswd]
   }         
}

if {$operation == "all" || $operation == "configure"} {
   
   # If this is a cluster install, create the cluster and cluster members
   if {${DefaultClusterInstall} == "yes"} {
      # Exit install if this cluster install is intended for z/OS
      if {${DefaultDbType} == "db2zos"} {
         puts " "
         puts "--------------------------------------------------"
         puts " Note: Trade installations on z/OS platforms are"
         puts "  currently limited to single server environments."
         puts "  Exiting the install script!"
         puts "--------------------------------------------------"
         
         exit
      }
          
      # Obtain cell name and id for scope

      set cell [getCellId]
      set cellName [getName $cell]
      set scope $cell
   
      puts ""
      puts "------------------------------------------------"
      puts " Configuring Cluster and Cluster Members"
      puts " Scope: $scope"
      puts "------------------------------------------------"

      # Create the cluster
      set cluster [createCluster $DefaultClusterName $DefaultPreferLocal $DefaultClusterDescription $scope]
      
      set idx 0
      foreach item $ClusterNodeNames {
         set node [$AdminConfig getid "/Node:$item/"]
         set member [lindex $ClusterMemberNames $idx]
         set idx [expr $idx + 1]

         # Create the cluster member 
         set clusterMember [createClusterMember $member $node $DefaultMemberWeight $cluster]
         
         # Enable SIB Service on the cluster member
         enableSIBService $clusterMember            
      }

      puts ""
      puts "------------------------------------------------"
      puts " Cluster Configuration Completed!!!"
      puts "------------------------------------------------"
   } else {
       set scope [$AdminConfig getid "/Node:${TargetNodeName}/"]
   }
   
   # Create the JDBC/Datasource config objects
   
   puts ""
   puts "------------------------------------------------"
   puts " Configuring JDBC/Datasource Resources"
   puts " Scope: $scope"
   puts "------------------------------------------------"

   createJAASAuthData $DefaultAuthAliasName $DefaultUser $DefaultPasswd

   set provider [createJDBCProvider $DefaultDbType $DefaultPathName $DefaultNativePathName $DefaultXA $scope]     
   
   if {[string first  "db2" ${DefaultDbType}] >= 0 || ${DefaultDbType} == "derby"} {
      set jccParms [subst {}]
      if {${DefaultDbType} == "db2" || ${DefaultDbType} == "db2zos"} {
         set jccParms [subst {$DefaultDB2JccDriverType $DefaultDB2Hostname $DefaultDB2Port}]
      }

      createDB2orCloudscapeDatasource $DefaultDatasourceName "jdbc/${DefaultDatasourceName}" $DefaultStmtCacheSize $provider $DefaultDbType $DefaultAuthAliasName "Trade6 Datasource" $scope $DefaultDatabaseName $jccParms
   } elseif {${DefaultDbType} == "oracle"} {
      createOracleDatasource $DefaultDatasourceName "jdbc/${DefaultDatasourceName}" $DefaultStmtCacheSize $provider $DefaultAuthAliasName "Trade6 Datasource" $scope $DefaultOracleSID $DefaultOracleHostname $DefaultOraclePort
   } elseif {[string first "iSeries" ${DefaultDbType}] >= 0} {
      set optParms [subst {}]
      if {${DefaultDbType} == "iSeriesToolbox"} {
         set optParms [subst ${DefaultDB2Hostname}]
      }
      createISeriesDataSource $DefaultDatasourceName "jdbc/${DefaultDatasourceName}" $DefaultStmtCacheSize $provider $DefaultDbType $DefaultAuthAliasName "Trade6 Datasource" $scope $DefaultDatabaseName $optParms
   }
      
   if {${DefaultClusterInstall} == "yes"} {
      # Create a non-XA provider and datasource for the MEs
      set meProvider [createJDBCProvider $DefaultDbType $DefaultPathName $DefaultNativePathName "false" $scope]
      
      if {[string first  "db2" ${DefaultDbType}] >= 0 || ${DefaultDbType} == "derby"} {         
         createDB2orCloudscapeDatasource $ClusterMEDatasourceName "jdbc/${ClusterMEDatasourceName}" $DefaultStmtCacheSize $meProvider $DefaultDbType $DefaultAuthAliasName "Share ME Datasource" $scope $DefaultDatabaseName $jccParms
      } elseif {${DefaultDbType} == "oracle"} {
         createOracleDatasource $ClusterMEDatasourceName "jdbc/${ClusterMEDatasourceName}" $DefaultStmtCacheSize $meProvider $DefaultAuthAliasName "Shared ME Datasource" $scope $DefaultOracleSID $DefaultOracleHostname $DefaultOraclePort
      } elseif {[string first "iSeries" ${DefaultDbType}] >= 0} {
         createISeriesDataSource $ClusterMEDatasourceName "jdbc/${ClusterMEDatasourceName}" $DefaultStmtCacheSize $meProvider $DefaultDbType $DefaultAuthAliasName "Shared ME Datasource" $scope $DefaultDatabaseName $optParms
      }
   }
   
   puts ""
   puts "------------------------------------------------"
   puts " JDBC Resource Configuration Completed!!!"
   puts "------------------------------------------------"

   
   # Create the JMS config objects
   
   puts ""
   puts "------------------------------------------------"
   puts " Configuring JMS Resources"
   puts " Scope: $scope"
   puts "------------------------------------------------"
   
   createJAASAuthData $DefaultOSAuthAlias $DefaultOSUser $DefaultOSPasswd
   
   if {${DefaultClusterInstall} == "yes"} {
   
      set SIBusName [createSIBus $DefaultClusterName $DefaultOSAuthAlias]
      
      addSIBusMember $SIBusName "false" "jdbc/${ClusterMEDatasourceName}" $DefaultClusterName   

      #set temp [lindex $ClusterNodeNames 0]
      #copySIBJmsRAtoCell [$AdminConfig getid "/Node:${temp}/"] $scope
      
      # Create additional MEs
      set idx 0 
      foreach item $ClusterMemberNames {
         if {$idx > 0} {
            set temp [subst {$DefaultClusterName}]
            createMessageEngine $SIBusName "false" "jdbc/${ClusterMEDatasourceName}" $temp
         }
         set idx [expr $idx + 1]           
      }
      
      set parms  [list -bus $DefaultClusterName -cluster $DefaultClusterName]
      set meList [$AdminTask listSIBEngines $parms]
      set baseName "Policy for ME"
      set baseSchema "IBMME"
      
      set idx 0
      foreach engine $meList {
         set name "${baseName}${idx}"
         set schema "${baseSchema}${idx}"
         set serverName [lindex $ClusterMemberNames $idx]
         set idx [expr $idx + 1]
         
         # Create the HA policy to pin servers 
         createOneOfNPolicy $name 30 $serverName [getName $engine]
         
         # Modify the MEs to use the same datastore
         if {${DefaultDbType} == "oracle"} {
            set alias "${schema}AuthAlias"
            createJAASAuthData $alias $schema $DefaultPasswd
            
            modifyMEDataStore [getName $engine] $alias $schema            
         } else {
            modifyMEDataStore [getName $engine] $DefaultAuthAliasName $schema
         }
      }
      
      set target [subst {$DefaultClusterName}]

   } else {
      set SIBusName [createSIBus [getName $scope] $DefaultOSAuthAlias]
      
      set target [subst {$TargetNodeName $TargetServerName}]
      
      addSIBusMember $SIBusName "true" "dummy" $target
   }
   
   if {${SecurityEnabled} == "true"} {
       createSIBusSecurityRole $SIBusName $DefaultOSUser
   }
      	
   
   # 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" $DefaultOSAuthAlias $scope 
   createJMSConnectionFactory $SIBusName $streamerJMSTCF "Topic" "jms/$streamerJMSTCF" $DefaultOSAuthAlias $scope

   createJMSQueue $brokerQueue "jms/$brokerQueue" $brokerSIBDest $deliveryMode $scope
   createJMSTopic $streamerTopic "jms/$streamerTopic" $topicSpace $deliveryMode $scope

   createMDBActivationSpec $brokerMDB "eis/$brokerMDB" $SIBusName "jms/$brokerQueue" "javax.jms.Queue" $DefaultOSAuthAlias $scope
   createMDBActivationSpec $streamerMDB "eis/$streamerMDB" $SIBusName "jms/$streamerTopic" "javax.jms.Topic" $DefaultOSAuthAlias $scope

   puts ""
   puts "------------------------------------------------"
   puts " JMS Resource Configuration Completed!!!"
   puts "------------------------------------------------"   
   
   puts ""
   puts "Saving..."
   $AdminConfig save
}

#---------------------------------------------------------------------
# Trade install procedures
#---------------------------------------------------------------------

if {$operation == "all" || $operation == "install"} {
   puts " "
   puts "------------------------------------------------"
   puts " Installing Trade"
   puts "------------------------------------------------"

   if {${SilentInstall} == "false" && ${operation} == "install"} {
      set DefaultClusterInstall [getValidInput "Is this a cluster installation \(yes\|no\) \[${DefaultClusterInstall}\]:" $DefaultClusterInstall $DefaultOptions]
      if {${DefaultClusterInstall} == "no"} {
         set targetNode       [getNodeId]
         set TargetNodeName   [getName $targetNode]
         set targetServer     [getServerId]
         set TargetServerName [getName $targetServer]
      } else {
         set DefaultClusterName [getInput "Please enter the cluster name \[${DefaultClusterName}\]:" $DefaultClusterName]
      }
      set DefaultDbType [getValidInput "Select the backend database type \(db2\|db2zos\|oracle\) \[${DefaultDbType}\]:" $DefaultDbType $DatabaseOptions]   
   }    

   if {${DefaultClusterInstall} == "yes"} {
      set target     [subst {$DefaultClusterName}] 
   } else {
      set target     [subst {$TargetNodeName $TargetServerName}]
   }

   if {${DefaultDbType} == "db2"} {
      set DefaultEJBDeployDBType  ${DB2Deploy}
   } elseif {${DefaultDbType} == "oracle"} {
      set DefaultEJBDeployDBType  ${OracleDeploy}
   } elseif {${DefaultDbType} == "db2cli"} {
      set DefaultEJBDeployDBType  ${DB2Deploy}
   } elseif {${DefaultDbType} == "db2zos"} {
      set DefaultEJBDeployDBType  ${DB2zOSDeploy}
   } elseif {${DefaultDbType} == "derby"} {
      set DefaultEJBDeployDBType  ${DerbyDeploy}
   } elseif {[string first "iSeries" ${DefaultDbType}] >= 0} {
      set DefaultEJBDeployDBType  ${DB2iSeriesDeploy}
   }

   installApp $DefaultTradeAppName $DefaultEarFile $DefaultRunEJBDeploy $DefaultRunWSDeploy "true" "true" $DefaultEJBDeployDBType $target
   
   puts ""
   puts "------------------------------------------------"
   puts " Trade Installation Completed!!!"
   puts "------------------------------------------------"

   puts ""
   puts "Saving..."
   $AdminConfig save
}

if {$operation == "start"} {
   puts " "
   puts "------------------------------------------------"
   puts " Starting Trade"
   puts " NOTE: Only executes for a single node"
   puts "------------------------------------------------"
   
   if {${DefaultClusterInstall} == "no"} {
      startApp $DefaultTradeAppName
   }
}
 

#---------------------------------------------------------------------
# Trade uninstall procedures
#---------------------------------------------------------------------

if {$operation == "uninstall"} {
   puts " "
   puts "------------------------------------------------"
   puts " Stopping and Uninstalling Trade"
   puts " NOTE: Only executes for a single node"
   puts "------------------------------------------------"

   if {${DefaultClusterInstall} == "no"} {
      stopApp $DefaultTradeAppName
      uninstallApp $DefaultTradeAppName
   }
}

puts ""
puts "Saving config..."
$AdminConfig save