###   
### remove_JDBCProvider.jacl   
###   
###   
###   
###   
###   
   
proc remove_JDBCProvider {cname nname sname xProvider} {   
   
    puts "Removing JDBCProvider: $cname $nname $sname $xProvider"
       
    ###   
    ### Set up globals   
    ###   
       
    global AdminConfig   
    global AdminControl   
    global AdminApp   
       
    
    set xProviderIds [$AdminConfig getid /Cell:$cname/Node:$nname/Server:$sname/JDBCProvider:$xProvider]
    
    
    foreach xp $xProviderIds {
    
        if {[llength $xp] != 0} {
        
            puts "Removing Provider 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_JDBCProvider.jacl cell node server \"JDBC Provider\""
   puts ""   
   puts "For example:  "   
   puts " "   
   puts "wsadmin.sh -username was -password acme@ -f  remove_JDBCProvider.jacl jupiterNetwork jupiter jupiterA \"Oracle provider (XA)\""
} else {    
   set zcell            [lindex $argv 0]     
   set znode            [lindex $argv 1]     
   set zserver          [lindex $argv 2]     
   set zprovider        [lindex $argv 3]     
   remove_JDBCProvider $zcell $znode $zserver $zprovider 
}