remove_DS.jacl

 

###   
### remove_DS.jacl   
###   
###   
###   
###   
###   
   
proc remove_DS {cname nname sname xDS} {   
   
    puts "Removing DataSource: $cname $nname $sname $xDS"
       
    ###   
    ### Set up globals   
    ###   
       
    global AdminConfig   
    global AdminControl   
    global AdminApp   
       
    
    set zDS [$AdminConfig getid /Cell:$cname/Node:$nname/Server:$sname/DataSource:$xDS]
    
    
    foreach xp $zDS {
    
        if {[llength $xp] != 0} {
        
            puts "Removing DataSource Id: $xp"
            $AdminConfig remove $xp
            
            
            ###
            ### Save and sync
            ###
            puts "Saving and syncing...."

            $AdminConfig save   
            
            set Sync1 [$AdminControl completeObjectName type=NodeSync,node=$nname,*]
            set xstatus [$AdminControl invoke $Sync1 sync]
            
            
            if {$xstatus == "false"} {
                puts "Unable to synchronize..."
            }
        }
    }
}   
   
   
   
###   
### Main   
###   
   
   
if { !($argc == 4) } {   
   puts ""   
   puts "Usage:  "   
   puts " "   
   puts "wsadmin.sh -username system -password password -f remove_DS.jacl cell node server \"Data Source\""
   puts ""   
   puts "For example:  "   
   puts " "   
   puts "wsadmin.sh -username was -password acme@ -f  remove_DS.jacl jupiterNetwork jupiter jupiterA \"Read Only DS\""
} else {    
   set zcell            [lindex $argv 0]     
   set znode            [lindex $argv 1]     
   set zserver          [lindex $argv 2]     
   set zDataSource      [lindex $argv 3]     
   remove_DS $zcell $znode $zserver $zDataSource
}