###
### set_ejb_container.jacl
###
###
###

proc set_ejb_container {snames} {

puts " "
puts "snames: snames"
puts " "


###
### set up globals
###

global AdminConfig
global AdminControl
global AdminApp


set cells [$AdminConfig list Cell]

foreach cell $cells {
     set cname [$AdminConfig showAttribute $cell name]
     set nodes [$AdminConfig list Node $cell]

     puts " "
     puts "Cell: $cname         "

     foreach node $nodes {

        set nname [$AdminConfig showAttribute $node name]
        puts " "
        puts "Node: $nname            "


        foreach sname $snames {

            puts " "
            puts "Server: $sname"

            set serverid [$AdminConfig getid /Cell:$cname/Node:$nname/Server:$sname/]

            if {[llength $serverid] == 0} {
               puts "Serverid null - returning "
               continue 
            }

            set ejbContainer [$AdminConfig list EJBContainer $serverid]
            $AdminConfig show $ejbContainer
  
            puts $ejbContainer

            $AdminConfig showall $ejbContainer
            $AdminConfig modify $ejbContainer {{cacheSettings {{cacheSize 2500} {cleanupInterval 3500}}}} 
            $AdminConfig modify $ejbContainer {{inactivePoolCleanupInterval 15000}}

        }
    }
}

$AdminConfig save

}



###
### Main
###
### Test servers: nap_1_1 nap_2_1 
###


if { !($argc == 1) } {
   puts ""
   puts "Usage: , "
   puts " "
   puts "wsadmin.sh -username system -password password -f set_ejb_container.jacl \"server1 server2 ...\""
} else { 
   set xservers      [lindex $argv 0]  
   set_ejb_container $xservers 
}