###   
### set_MQ_QCF.jacl   
###   
###   
###   
###   
###   
   
proc set_MQ_QCF {cname nname sname} {   
   
   
###   
### set up globals   
###   
   
global AdminConfig   
global AdminControl   
global AdminApp   
   
   
set JMSProviderIDs [$AdminConfig getid /Cell:$cname/Node:$nname/Server:$sname/JMSProvider:/] 
   
      if {[llength $JMSProviderIDs] == 0} { 
         puts "JMSProvider ID null - returning " 
         continue  
      } 
 
   
foreach JMSProviderID $JMSProviderIDs {   
 
#    set JMSProviderName [ showAttribute $JMSProviderID name] 
 
 
$AdminConfig create MQQueueConnectionFactory $JMSProviderID { {XAEnabled true} \
{authDataAlias hostnameManager/installAlias} \
{authMechanismPreference BASIC_PASSWORD} \
{category BUYER} \
{channel SYSTEM.DEF.SVRCONN} \
{connectionPool {{agedTimeout 0} \
{connectionTimeout 180} \
{maxConnections 50} \
{minConnections 1} \
{purgePolicy FailingConnectionOnly} \
{reapTime 180} \
{unusedTimeout 1800}}} \
{description "CBO Buyer XA QueueConnectionFactory"} \
{host hostname} \
{jndiName acme/buyer/jms/XaQueueConnectionFactory} \
{mapping {{authDataAlias hostnameManager/installAlias} \
{mappingConfigAlias DefaultPrincipalMapping}}} \
{msgRetention true} \
{name "CBO Buyer XA QueueConnectionFactory"} \
{port 1414} \
{queueManager QMGR.HOSTNAME.WSTEST4} \
{sessionPool {{agedTimeout 0} \
{connectionTimeout 180} \
{maxConnections 10} \
{minConnections 1} \
{purgePolicy FailingConnectionOnly} \
{reapTime 180} \
{unusedTimeout 1800}}} \
{transportType CLIENT} } 
 
   
}   
   
$AdminConfig save   


### Synchronize nodes

puts "Synchronizing nodes..."
set Sync1 [$AdminControl completeObjectName type=NodeSync,node=$nname,*]
set xstatus [$AdminControl invoke $Sync1 sync]

if {$xstatus == "false"} {
    puts "Unable to synchronize nodes..."
}

   
}   
   
   
   
###   
### Main   
###   
if { !($argc == 3) } {   
   puts ""   
   puts "Usage:  "   
   puts " "   
   puts "wsadmin.sh -username system -password password -f set_MQ_QCF.jacl cellname nodename servername" 
   puts ""   
   puts "For example:  "   
   puts " "   
   puts "wsadmin.sh -username was -password acme@ -f  set_MQ_QCF.jacl hostnameNetwork hostname ops_1_1" 
} else {    
   set xcell        [lindex $argv 0]     
   set xnode        [lindex $argv 1]     
   set xserver      [lindex $argv 2]     
   set_MQ_QCF $xcell $xnode $xserver    
}