###   
### set_JVM.jacl   
###   
###   
###   
###   
###   
   
proc set_JVM {cname nname sname classpath} {   
   
   
###   
### 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 - returning "   
    exit    
}   
   

###    
### Identify the JVM id belonging to the server    
###    
   
set jvm [$AdminConfig list JavaVirtualMachine $serverid]
   
   
###    
### Configure JVM
###    
   
$AdminConfig modify $jvm  [list  [list bootClasspath  [list  ] ] \
 [list classpath $classpath] \
 [list debugArgs "-Djava.compiler=NONE -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7777" ] \
 [list debugMode false ] \
 [list disableJIT false ] \
 [list initialHeapSize 0 ] \
 [list maximumHeapSize 512 ] \
 [list runHProf false ] \
 [list systemProperties  [list  [list  [list name db2j.system.home ] \
 [list required false ] \
 [list value /opt/WebSphere/AppServer/properties ] ]  [list  [list name java.security.auth.login.config ] \
 [list required false ] \
 [list value /opt/WebSphere/AppServer/properties/wsjaas.conf ] ]  [list  [list name java.security.policy ] \
 [list required false ] \
 [list value /opt/WebSphere/AppServer/properties/server.policy ] ]  [list  [list name log4j.configuration ] \
 [list required false ] \
 [list value log4j.xml ] ]  [list  [list name acme.home ] \
 [list required false ] \
 [list value $classpath ] ]  [list  [list name server.root ] \
 [list required false ] \
 [list value /opt/WebSphere/AppServer ] ] ] ] \
 [list verboseModeClass false ] \
 [list verboseModeGarbageCollection false ] \
 [list verboseModeJNI false ] ]

 
   
$AdminConfig save   

### Synchronize nodes

set Sync1 [$AdminControl completeObjectName type=NodeSync,node=$nname,*]

set xstatus [$AdminControl invoke $Sync1 sync]
puts $xstatus

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

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