###   
### display_listener_ports.jacl   
###   
###   
###   
###   
###   
   
proc display_listener_ports {cname nname sname} {   
   
   
###   
### set up globals   
###   
   
global AdminConfig   
global AdminControl   
global AdminApp   
   


set serverid [$AdminConfig getid /Cell:$cname/Node:$nname/Server:$sname/]   
   
if {[llength $serverid] == 0} {   
    puts "Serverid null - Unable to display listener ports for $sname - returning "   
    exit    
}   
   

###    
### Identify the message listener service belonging to the server    
###    
   
set mls [$AdminConfig list MessageListenerService $serverid]   

if {[llength $mls] == 0} {   
    puts "MessageListenerService id null - Unable to display listener ports for $sname - returning "   
    exit    
}   



###
### Get list of listener ports already configured
###

set lPorts [$AdminControl queryNames type=ListenerPort,cell=$cname,node=$nname,process=$sname,*]

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