get_DS.jacl

 


###
### get_DataSource.jacl
###


proc get_DataSource {cname nname sname} {


    global AdminConfig
    

    set JDBCProviderIDs [$AdminConfig getid /Cell:$cname/Node:$nname/Server:$sname/JDBCProvider:/]
   
    if {[llength $JDBCProviderIDs] == 0} {
        puts "Cannot find JDBC Provider for $cname $nname $sname"
        return 
    }



    foreach JDBCProviderID $JDBCProviderIDs { 

        set JDBCName [$AdminConfig showAttribute $JDBCProviderID name]

        set DataSources [$AdminConfig getid /JDBCProvider:$JDBCName/DataSource:/]

        if {[llength $DataSources] == 0} {
            puts "Cannot find data sources for JDBC Provider $JDBCname for $cname $nname $sname"
            return 
        }

        foreach  DataSource $DataSources {
            set xyz [$AdminConfig showall $DataSource]
            puts " "
            puts "\$AdminConfig create DataSource \$JDBCProvider \{ $xyz \} "
        }

    }
}

    

###
### Main
###


if { !($argc == 3) } {
   puts ""
   puts "Usage: "
   puts " "
   puts "wsadmin.sh -username system -password password -f get_DataSource.jacl cell node server"
   puts " "
} else { 
   set xcell      [lindex $argv 0]  
   set xnode      [lindex $argv 1]  
   set xserver    [lindex $argv 2]  
   get_DataSource $xcell $xnode $xserver 
}