Produced by Araxis Merge on 4/18/2017 3:49:13 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Genisis2Client-master.zip\Genisis2DataOps-master\src\tableCopy | tableCopy.java | Fri Mar 24 19:19:46 2017 UTC |
| 2 | Genisis2Client-master.zip\Genisis2DataOps-master\src\tableCopy | tableCopy.java | Tue Apr 18 17:46:45 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 932 |
| Changed | 1 | 8 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | package ta bleCopy; | |
| 2 | import jav a.awt.*; | |
| 3 | ||
| 4 | import jav ax.imageio .ImageIO; | |
| 5 | import jav ax.swing.* ; | |
| 6 | import jav a.awt.even t.*; | |
| 7 | import jav a.io.*; | |
| 8 | import jav ax.swing.J Frame; | |
| 9 | public cla ss tableCo py { | |
| 10 | ||
| 11 | public static vo id main(St ring[] arg s) { | |
| 12 | // create a n ew table c opy frame | |
| 13 | ne w tableCop y(); | |
| 14 | } | |
| 15 | ||
| 16 | public tableCopy () { | |
| 17 | // set up fr ame for pr ototype | |
| 18 | Ev entQueue.i nvokeLater (new Runna ble() { | |
| 19 | @Overrid e | |
| 20 | public v oid run() { | |
| 21 | try { | |
| 22 | UIManager. setLookAnd Feel(UIMan ager.getSy stemLookAn dFeelClass Name()); | |
| 23 | } ca tch (Excep tion ex) { | |
| 24 | } | |
| 25 | ||
| 26 | JFra me frame = new JFram e("Test"); | |
| 27 | fram e.setDefau ltCloseOpe ration(JFr ame.EXIT_O N_CLOSE); | |
| 28 | //ad d pane tha t users wi ll see and use | |
| 29 | fram e.add(new LoginPane( )); | |
| 30 | fram e.setPrefe rredSize(n ew Dimensi on(1500,10 00)); | |
| 31 | fram e.pack(); | |
| 32 | fram e.setLocat ionRelativ eTo(null); | |
| 33 | fram e.setVisib le(true); | |
| 34 | } | |
| 35 | }) ; | |
| 36 | } | |
| 37 | ||
| 38 | @Suppr essWarning s("serial" ) | |
| 39 | //wher e the pane that user s will see will be i nstantiate d | |
| 40 | pu blic class LoginPane extends J Label impl ements Act ionListene r { | |
| 41 | pu blic Login Pane() { | |
| 42 | try { | |
| 43 | Imag eIcon bg = new Image Icon(Image IO.read(ge tClass().g etResource ("/backgro und.jpg")) ); | |
| 44 | Imag e image = bg.getImag e(); | |
| 45 | Imag e newimg = image.getS caledInsta nce(1500, 1000, java .awt.Image .SCALE_SMO OTH); | |
| 46 | bg = new Image Icon(newim g); | |
| 47 | setI con(bg); | |
| 48 | } catch (IOExcepti on ex) { | |
| 49 | ex.p rintStackT race(); | |
| 50 | } | |
| 51 | setLayou t(new Grid BagLayout( )); | |
| 52 | GridBagC onstraints gbc = new GridBagCo nstraints( ); | |
| 53 | gbc.anch or = GridB agConstrai nts.SOUTHW EST; | |
| 54 | gbc.weig htx =1; | |
| 55 | gbc.weig hty =1; | |
| 56 | // creat e a button to start the copy t able windo w | |
| 57 | JButton submit = n ew JButton (); | |
| 58 | gbc.inse ts = new I nsets(0, 8 5, 205, 0) ; | |
| 59 | gbc.anch or = GridB agConstrai nts.SOUTHW EST; | |
| 60 | submit.s etBorder(B orderFacto ry.createE mptyBorder ()); | |
| 61 | submit.s etActionCo mmand("Cop y Table"); | |
| 62 | submit.s etContentA reaFilled( false); | |
| 63 | //assign image to the button | |
| 64 | try { | |
| 65 | Imag e button = ImageIO.r ead(getCla ss().getRe source("/c opyButton. jpg")); | |
| 66 | subm it.setIcon (new Image Icon(butto n)); | |
| 67 | } catc h (Excepti on ex) { | |
| 68 | Syst em.out.pri ntln(ex); | |
| 69 | } | |
| 70 | submit.a ddActionLi stener(thi s); | |
| 71 | add(subm it, gbc); | |
| 72 | ||
| 73 | } | |
| 74 | ||
| 75 | @Ove rride | |
| 76 | //if the butto n is press ed create the copy t able pop u p window | |
| 77 | publ ic void ac tionPerfor med(Action Event e) { | |
| 78 | if ( "Copy Tabl e".equals( e.getActio nCommand() )) | |
| 79 | { | |
| 80 | //init ialize tex t and pass word field s with tes t log in i nformation | |
| 81 | JTextField sourceIP = new JTex tField(" IP "); | |
| 82 | JTextField sourceUse rname = ne w JTextFie ld(" AI "); | |
| 83 | JPasswordF ield sourc ePassword = new JPas swordField (" AI "); | |
| 84 | JTextField destIP = new JTextF ield(" IP "); | |
| 85 | JTextFie ld destUse rname = ne w JTextFie ld("data_o ps"); | |
| 86 | JPasswor dField des tPassword = new JPas swordField ("genisis2 0!7"); | |
| 87 | JTextFie ld tableNa mes = new JTextField (); | |
| 88 | int rows =10; | |
| 89 | int colu mns=5; | |
| 90 | //create the look of the pop -up with G ridLayout | |
| 91 | JPanel p anel = new JPanel(ne w GridLayo ut(rows,co lumns)); | |
| 92 | panel.ad d(new JLab el("Source Database FQDN/IP Ad dress")); | |
| 93 | panel.ad d(sourceIP ); | |
| 94 | panel.ad d(new JLab el()); | |
| 95 | panel.ad d(new JLab el("Destin ation Data base FQDN/ IP Address ")); | |
| 96 | panel.ad d(destIP); | |
| 97 | skipRow( panel,colu mns); | |
| 98 | panel.ad d(new JLab el("SQL Lo gin Userna me")); | |
| 99 | panel.ad d(sourceUs ername); | |
| 100 | panel.ad d(new JLab el()); | |
| 101 | panel.ad d(new JLab el("SQL Lo gin Userna me")); | |
| 102 | panel.ad d(destUser name); | |
| 103 | skipRow( panel,colu mns); | |
| 104 | panel.ad d(new JLab el("Passwo rd")); | |
| 105 | panel.ad d(sourcePa ssword); | |
| 106 | panel.ad d(new JLab el()); | |
| 107 | panel.ad d(new JLab el("Passwo rd")); | |
| 108 | panel.ad d(destPass word); | |
| 109 | skipRow( panel,colu mns); | |
| 110 | skipRow( panel,colu mns); | |
| 111 | skipRow( panel,colu mns); | |
| 112 | panel.ad d(new JLab el()); | |
| 113 | panel.ad d(new JLab el(" Ta ble Name(s )")); | |
| 114 | panel.ad d(tableNam es); | |
| 115 | skipRow( panel,colu mns-1); | |
| 116 | panel.ad d(new JLab el("(Enter one or mo re table n ames with commas sep arating th em)")); | |
| 117 | int resu lt = JOpti onPane.sho wConfirmDi alog(null, panel, "C opy Table" , | |
| 118 | JOpt ionPane.OK _CANCEL_OP TION, JOpt ionPane.PL AIN_MESSAG E); | |
| 119 | if (resu lt == JOpt ionPane.OK _OPTION) | |
| 120 | //when all the infor mation is correct in the field s, press t he default pop-up ok ay option | |
| 121 | { | |
| 122 | //get the text input into the fields and initializ e variable s for para meterizati on | |
| 123 | String sI P = source IP.getText (); | |
| 124 | //no long er needed due to use of Linked Servers | |
| 125 | //String sUsername = sourceUs ername.get Text(); | |
| 126 | //char[] sPasswords = sourceP assword.ge tPassword( ); | |
| 127 | //String sPassword = new Stri ng(sPasswo rds); | |
| 128 | String dI P = destIP .getText() ; | |
| 129 | String dU sername = destUserna me.getText (); | |
| 130 | char[] dP asswords = destPassw ord.getPas sword(); | |
| 131 | String dP assword = new String (dPassword s); | |
| 132 | // get ta bles enter ed into th e field as a string | |
| 133 | String ta bles = tab leNames.ge tText(); | |
| 134 | //convert table fie ld string into strin g array sp litting at commas | |
| 135 | String[] t able = ta bles.split (","); | |
| 136 | //remove t railing wh ite spaces and error check for empty tab le field | |
| 137 | for (int i = 0;i<tab le.length; i++) | |
| 138 | { | |
| 139 | if (table[0]. equals("") ) | |
| 140 | ||
| 141 | { | |
| 142 | JOp tionPane.s howMessage Dialog(nul l, "No Tab le(s) Foun d", "Error ", JOption Pane.ERROR _MESSAGE); | |
| 143 | JOp tionPane.s howMessage Dialog(nul l, "The co py process has been canceled", "Canceled ", JOption Pane.ERROR _MESSAGE); | |
| 144 | ret urn; | |
| 145 | } | |
| 146 | ||
| 147 | tab le[i] = ta ble[i].tri m(); | |
| 148 | Sy stem.out.p rintln(tab le[i]); | |
| 149 | } | |
| 150 | // startin g with the first tab le in the string arr ay, use a for loop t o run one table at a time thro ugh the pa rameterize d copy pro cess | |
| 151 | for (int i = 0;i<tab le.length; i++){ | |
| 152 | // initialize different commands to be run | |
| 153 | String sou rceTableCo unt_cmd =" sqlcmd -U "+dUsernam e+" -P "+d Password+" -S "+dIP+ " -d "+ "M ANAGEMENT" +" -i pre count.sql -v ip = "+ sIP+" tb = "+table[i ]; | |
| 154 | String sou rceChecksu m_cmd ="sq lcmd -U "+ dUsername+ " -P "+dPa ssword+" - S "+dIP+" -d "+ "MAN AGEMENT" + " -i prech ecksum.sql -v ip = " +sIP+" tb = "+table[ i]; | |
| 155 | String tab leCopy_cmd ="sqlcmd -U "+dUser name+" -P "+dPasswor d+" -S "+d IP+" -d "+ "MANAGEME NT" +" -i tablecopy. sql -v ip = "+sIP+" tb = "+tab le[i]; | |
| 156 | String des tTableCoun t_cmd ="sq lcmd -U "+ dUsername+ " -P "+dPa ssword+" - S "+dIP+" -d "+ "MAN AGEMENT" + " -i postc ount.sql - v tb = "+t able[i]; | |
| 157 | String des tChecksum_ cmd ="sqlc md -U "+dU sername+" -P "+dPass word+" -S "+dIP+" -d "+ "MANAG EMENT" +" -i postche cksum.sql -v tb = "+ table[i]; | |
| 158 | String cop yStatusUpd ate_cmd =" sqlcmd -U "+dUsernam e+" -P "+d Password+" -S "+dIP+ " -d "+ "M ANAGEMENT" +" -i cop yStatusUpd ate.sql -v tb = "+ta ble[i]; | |
| 159 | String man agementIns ert_cmd =" sqlcmd -U "+dUsernam e+" -P "+d Password+" -S "+dIP+ " -d "+ "M ANAGEMENT" +" -i man agementIns ert.sql -v tb = "+ta ble[i]; | |
| 160 | String pre copyStatus Update_cmd ="sqlcmd -U "+dUser name+" -P "+dPasswor d+" -S "+d IP+" -d "+ "MANAGEME NT" +" -i beforeCopy Error.sql" ; | |
| 161 | String pos tcopyStatu sUpdate_cm d ="sqlcmd -U "+dUse rname+" -P "+dPasswo rd+" -S "+ dIP+" -d " + "MANAGEM ENT" +" -i afterCopy Error.sq"; | |
| 162 | String dro pCorrupted _cmd ="sql cmd -U "+d Username+" -P "+dPas sword+" -S "+dIP+" - d "+ "MANA GEMENT" +" -i dropCo rrupted.sq l -v tb = "+table[i] ; | |
| 163 | try { | |
| 164 | St ring line; | |
| 165 | St ring input Log = ""; | |
| 166 | St ring error Log = ""; | |
| 167 | ||
| 168 | //in sert the t able name into the m anagement table to c reate a ro w for logg ing while checking f or errors thrown by sqlcmd | |
| 169 | Sy stem.out.p rintln("in sert"); | |
| 170 | Pr ocess proc ess = Runt ime.getRun time().exe c(manageme ntInsert_c md); | |
| 171 | in t status = process.w aitFor(); | |
| 172 | Sy stem.out.p rintln(sta tus); | |
| 173 | Bu fferedRead er input = new Buffe redReader( new InputS treamReade r(process. getInputSt ream())); | |
| 174 | while ((line = input.read Line()) != null) | |
| 175 | { | |
| 176 | inputLog =inputLog+ line+"\n"; | |
| 177 | } | |
| 178 | input .close(); | |
| 179 | Syste m.out.prin tln(inputL og); | |
| 180 | if(in putLog.toL owerCase() .contains( "Msg".toLo werCase()) ) | |
| 181 | { | |
| 182 | JO ptionPane. showMessag eDialog(nu ll, inputL og, "Error ", JOption Pane.ERROR _MESSAGE); | |
| 183 | JO ptionPane. showMessag eDialog(nu ll, "The c opy proces s has been canceled" , "Cancele d", JOptio nPane.ERRO R_MESSAGE) ; | |
| 184 | pr ocess = Ru ntime.getR untime().e xec(precop yStatusUpd ate_cmd); | |
| 185 | st atus = pro cess.waitF or(); | |
| 186 | re turn; | |
| 187 | } | |
| 188 | Syste m.out.prin tln(inputL og); | |
| 189 | Buffe redReader error = ne w Buffered Reader(new InputStre amReader(p rocess.get ErrorStrea m())); | |
| 190 | while ((line = error.read Line()) != null) | |
| 191 | { | |
| 192 | errorLog =errorLog+ line+"\n"; | |
| 193 | } | |
| 194 | error .close(); | |
| 195 | Syste m.out.prin tln(errorL og); | |
| 196 | if(er rorLog.toL owerCase() .contains( "error".to LowerCase( ))) | |
| 197 | { | |
| 198 | JO ptionPane. showMessag eDialog(nu ll, errorL og, "Error ", JOption Pane.ERROR _MESSAGE); | |
| 199 | JO ptionPane. showMessag eDialog(nu ll, "The c opy proces s has been canceled" , "Cancele d", JOptio nPane.ERRO R_MESSAGE) ; | |
| 200 | pr ocess = Ru ntime.getR untime().e xec(precop yStatusUpd ate_cmd); | |
| 201 | st atus = pro cess.waitF or(); | |
| 202 | re turn; | |
| 203 | } | |
| 204 | ||
| 205 | // count the rows of th e source t able and e nter the r esult into the manag ement tabl e while ch ecking for errors th rown by sq lcmd | |
| 206 | Sy stem.out.p rintln("co unt"); | |
| 207 | pr ocess = Ru ntime.getR untime().e xec(source TableCount _cmd); | |
| 208 | st atus = pro cess.waitF or(); | |
| 209 | Sy stem.out.p rintln(sta tus); | |
| 210 | in put = new BufferedRe ader(new I nputStream Reader(pro cess.getIn putStream( ))); | |
| 211 | while ((line = input.read Line()) != null) | |
| 212 | { | |
| 213 | inputLog =inputLog+ line+"\n"; | |
| 214 | } | |
| 215 | input .close(); | |
| 216 | Syste m.out.prin tln(inputL og); | |
| 217 | if(in putLog.toL owerCase() .contains( "Msg".toLo werCase()) ) | |
| 218 | { | |
| 219 | JO ptionPane. showMessag eDialog(nu ll, inputL og, "Error ", JOption Pane.ERROR _MESSAGE); | |
| 220 | JO ptionPane. showMessag eDialog(nu ll, "The c opy proces s has been canceled" , "Cancele d", JOptio nPane.ERRO R_MESSAGE) ; | |
| 221 | pr ocess = Ru ntime.getR untime().e xec(precop yStatusUpd ate_cmd); | |
| 222 | st atus = pro cess.waitF or(); | |
| 223 | re turn; | |
| 224 | } | |
| 225 | Syste m.out.prin tln(inputL og); | |
| 226 | error = new Buf feredReade r(new Inpu tStreamRea der(proces s.getError Stream())) ; | |
| 227 | while ((line = error.read Line()) != null) | |
| 228 | { | |
| 229 | errorLog =errorLog+ line+"\n"; | |
| 230 | } | |
| 231 | error .close(); | |
| 232 | Syste m.out.prin tln(errorL og); | |
| 233 | if(er rorLog.toL owerCase() .contains( "error".to LowerCase( ))) | |
| 234 | { | |
| 235 | JO ptionPane. showMessag eDialog(nu ll, errorL og, "Error ", JOption Pane.ERROR _MESSAGE); | |
| 236 | JO ptionPane. showMessag eDialog(nu ll, "The c opy proces s has been canceled" , "Cancele d", JOptio nPane.ERRO R_MESSAGE) ; | |
| 237 | pr ocess = Ru ntime.getR untime().e xec(precop yStatusUpd ate_cmd); | |
| 238 | st atus = pro cess.waitF or(); | |
| 239 | re turn; | |
| 240 | } | |
| 241 | ||
| 242 | ||
| 243 | // calculate checksum o f the sour ce table a nd enter t he result into the m anagement table whil e checking for error s thrown b y sqlcmd | |
| 244 | Sy stem.out.p rintln("ch ecksum"); | |
| 245 | pr ocess = Ru ntime.getR untime().e xec(source Checksum_c md); | |
| 246 | st atus = pro cess.waitF or(); | |
| 247 | Sy stem.out.p rintln(sta tus); | |
| 248 | in put = new BufferedRe ader(new I nputStream Reader(pro cess.getIn putStream( ))); | |
| 249 | while ((line = i nput.readL ine()) != null) | |
| 250 | { | |
| 251 | inpu tLog=input Log+line+" \n"; | |
| 252 | } | |
| 253 | input. close(); | |
| 254 | System .out.print ln(inputLo g); | |
| 255 | if(inp utLog.toLo werCase(). contains(" Msg".toLow erCase())) | |
| 256 | { | |
| 257 | JO ptionPane. showMessag eDialog(nu ll, inputL og, "Error ", JOption Pane.ERROR _MESSAGE); | |
| 258 | JO ptionPane. showMessag eDialog(nu ll, "The c opy proces s has been canceled" , "Cancele d", JOptio nPane.ERRO R_MESSAGE) ; | |
| 259 | pr ocess = Ru ntime.getR untime().e xec(precop yStatusUpd ate_cmd); | |
| 260 | st atus = pro cess.waitF or(); | |
| 261 | re turn; | |
| 262 | } | |
| 263 | ||
| 264 | error = new Buff eredReader (new Input StreamRead er(process .getErrorS tream())); | |
| 265 | while ((line = error.read Line()) != null) | |
| 266 | { | |
| 267 | errorLog =errorLog+ line+"\n"; | |
| 268 | } | |
| 269 | error .close(); | |
| 270 | Syste m.out.prin tln(errorL og); | |
| 271 | if(er rorLog.toL owerCase() .contains( "error".to LowerCase( ))) | |
| 272 | { | |
| 273 | JO ptionPane. showMessag eDialog(nu ll, errorL og, "Error ", JOption Pane.ERROR _MESSAGE); | |
| 274 | JO ptionPane. showMessag eDialog(nu ll, "The c opy proces s has been canceled" , "Cancele d", JOptio nPane.ERRO R_MESSAGE) ; | |
| 275 | pr ocess = Ru ntime.getR untime().e xec(precop yStatusUpd ate_cmd); | |
| 276 | st atus = pro cess.waitF or(); | |
| 277 | re turn; | |
| 278 | } | |
| 279 | ||
| 280 | ||
| 281 | //cop y the sour ce table t o destinat ion databa se while c hecking fo r errors t hrown by s qlcmd | |
| 282 | Syste m.out.prin tln("copy" ); | |
| 283 | process = Runtime. getRuntime ().exec(ta bleCopy_cm d); | |
| 284 | status = process.w aitFor(); | |
| 285 | System.o ut.println (status); | |
| 286 | input = new Buffer edReader(n ew InputSt reamReader (process.g etInputStr eam())); | |
| 287 | wh ile ((line = input.r eadLine()) != null) | |
| 288 | { | |
| 289 | inputLog=i nputLog+li ne+"\n"; | |
| 290 | } | |
| 291 | in put.close( ); | |
| 292 | Sy stem.out.p rintln(inp utLog); | |
| 293 | if (inputLog. toLowerCas e().contai ns("Msg".t oLowerCase ())) | |
| 294 | { | |
| 295 | JOptionP ane.showMe ssageDialo g(null, in putLog, "E rror", JOp tionPane.E RROR_MESSA GE); | |
| 296 | process = Runtime. getRuntime ().exec(po stcopyStat usUpdate_c md); | |
| 297 | status = process.w aitFor(); | |
| 298 | JOptionP ane.showMe ssageDialo g(null, "T he copy pr ocess has been cance led", "Can celed", JO ptionPane. ERROR_MESS AGE); | |
| 299 | return; | |
| 300 | } | |
| 301 | er ror = new BufferedRe ader(new I nputStream Reader(pro cess.getEr rorStream( ))); | |
| 302 | wh ile ((line = error.r eadLine()) != null) | |
| 303 | { | |
| 304 | erro rLog=error Log+line+" \n"; | |
| 305 | } | |
| 306 | e rror.close (); | |
| 307 | S ystem.out. println(er rorLog); | |
| 308 | i f(errorLog .toLowerCa se().conta ins("error ".toLowerC ase())) | |
| 309 | { | |
| 310 | JOptionP ane.showMe ssageDialo g(null, er rorLog, "E rror", JOp tionPane.E RROR_MESSA GE); | |
| 311 | JOptionP ane.showMe ssageDialo g(null, "T he copy pr ocess has been cance led", "Can celed", JO ptionPane. ERROR_MESS AGE); | |
| 312 | process = Runtime. getRuntime ().exec(po stcopyStat usUpdate_c md); | |
| 313 | status = process.w aitFor(); | |
| 314 | return; | |
| 315 | } | |
| 316 | ||
| 317 | ||
| 318 | //c alculate c hecksum an d enter th e result i nto the ma nagement t able while checking for errors thrown by sqlcmd | |
| 319 | System.ou t.println( "checksum" ); | |
| 320 | process = Runtime.g etRuntime( ).exec(des tChecksum_ cmd); | |
| 321 | status = process.wa itFor(); | |
| 322 | System.ou t.println( status); | |
| 323 | input = n ew Buffere dReader(ne w InputStr eamReader( process.ge tInputStre am())); | |
| 324 | whi le ((line = input.re adLine()) != null) | |
| 325 | { | |
| 326 | input Log=inputL og+line+"\ n"; | |
| 327 | } | |
| 328 | inpu t.close(); | |
| 329 | Syst em.out.pri ntln(input Log); | |
| 330 | if(i nputLog.to LowerCase( ).contains ("Msg".toL owerCase() )) | |
| 331 | { | |
| 332 | JOptionP ane.showMe ssageDialo g(null, in putLog, "E rror", JOp tionPane.E RROR_MESSA GE); | |
| 333 | process = Runtime. getRuntime ().exec(po stcopyStat usUpdate_c md); | |
| 334 | status = process.w aitFor(); | |
| 335 | JOptionP ane.showMe ssageDialo g(null, "T he copy pr ocess has been cance led", "Can celed", JO ptionPane. ERROR_MESS AGE); | |
| 336 | return; | |
| 337 | } | |
| 338 | ||
| 339 | erro r = new Bu fferedRead er(new Inp utStreamRe ader(proce ss.getErro rStream()) ); | |
| 340 | whil e ((line = error.rea dLine()) ! = null) | |
| 341 | { | |
| 342 | errorLog =errorLog+ line+"\n"; | |
| 343 | } | |
| 344 | err or.close() ; | |
| 345 | Sys tem.out.pr intln(erro rLog); | |
| 346 | if( errorLog.t oLowerCase ().contain s("error". toLowerCas e())) | |
| 347 | { | |
| 348 | JOptionP ane.showMe ssageDialo g(null, er rorLog, "E rror", JOp tionPane.E RROR_MESSA GE); | |
| 349 | process = Runtime. getRuntime ().exec(po stcopyStat usUpdate_c md); | |
| 350 | status = process.w aitFor(); | |
| 351 | return; | |
| 352 | } | |
| 353 | ||
| 354 | ||
| 355 | ||
| 356 | //c ount rows and enter the result into the management table whi le checkin g for erro rs thrown by sqlcmd | |
| 357 | System.ou t.println( "count"); | |
| 358 | process = Runtime.g etRuntime( ).exec(des tTableCoun t_cmd); | |
| 359 | status = process.wa itFor(); | |
| 360 | input = n ew Buffere dReader(ne w InputStr eamReader( process.ge tInputStre am())); | |
| 361 | whil e ((line = input.rea dLine()) ! = null) | |
| 362 | { | |
| 363 | inputLog =inputLog+ line+"\n"; | |
| 364 | } | |
| 365 | inpu t.close(); | |
| 366 | Syst em.out.pri ntln(input Log); | |
| 367 | if(i nputLog.to LowerCase( ).contains ("Msg".toL owerCase() )) | |
| 368 | { | |
| 369 | JOptionP ane.showMe ssageDialo g(null, in putLog, "E rror", JOp tionPane.E RROR_MESSA GE); | |
| 370 | process = Runtime. getRuntime ().exec(po stcopyStat usUpdate_c md); | |
| 371 | status = process.w aitFor(); | |
| 372 | JOptionP ane.showMe ssageDialo g(null, "T he copy pr ocess has been cance led", "Can celed", JO ptionPane. ERROR_MESS AGE); | |
| 373 | return; | |
| 374 | } | |
| 375 | erro r = new Bu fferedRead er(new Inp utStreamRe ader(proce ss.getErro rStream()) ); | |
| 376 | whil e ((line = error.rea dLine()) ! = null) | |
| 377 | { | |
| 378 | errorL og=errorLo g+line+"\n "; | |
| 379 | } | |
| 380 | erro r.close(); | |
| 381 | Syst em.out.pri ntln(error Log); | |
| 382 | if(e rrorLog.to LowerCase( ).contains ("error".t oLowerCase ())) | |
| 383 | { | |
| 384 | JOptionP ane.showMe ssageDialo g(null, er rorLog, "E rror", JOp tionPane.E RROR_MESSA GE); | |
| 385 | JOptionP ane.showMe ssageDialo g(null, "T he copy pr ocess has been cance led", "Can celed", JO ptionPane. ERROR_MESS AGE); | |
| 386 | process = Runtime. getRuntime ().exec(po stcopyStat usUpdate_c md); | |
| 387 | status = process.w aitFor(); | |
| 388 | return; | |
| 389 | } | |
| 390 | ||
| 391 | ||
| 392 | //up date the C opyStatus on the man agement ta ble to suc cess if it reached t his far an d the two checksums are equiva lent | |
| 393 | Syst em.out.pri ntln("upda te"); | |
| 394 | proc ess = Runt ime.getRun time().exe c(copyStat usUpdate_c md); | |
| 395 | stat us = proce ss.waitFor (); | |
| 396 | inpu t = new Bu fferedRead er(new Inp utStreamRe ader(proce ss.getInpu tStream()) ); | |
| 397 | whil e ((line = input.rea dLine()) ! = null) | |
| 398 | { | |
| 399 | inputL og=inputLo g+line+"\n "; | |
| 400 | } | |
| 401 | inpu t.close(); | |
| 402 | Syst em.out.pri ntln(input Log); | |
| 403 | ||
| 404 | erro r = new Bu fferedRead er(new Inp utStreamRe ader(proce ss.getErro rStream()) ); | |
| 405 | whil e ((line = error.rea dLine()) ! = null) | |
| 406 | { | |
| 407 | errorL og=errorLo g+line+"\n "; | |
| 408 | } | |
| 409 | erro r.close(); | |
| 410 | Syst em.out.pri ntln(error Log); | |
| 411 | if(e rrorLog.to LowerCase( ).contains ("error".t oLowerCase ())) | |
| 412 | { | |
| 413 | JOptionP ane.showMe ssageDialo g(null, er rorLog, "E rror", JOp tionPane.E RROR_MESSA GE); | |
| 414 | JOptionP ane.showMe ssageDialo g(null, "T he copy pr ocess has been cance led", "Can celed", JO ptionPane. ERROR_MESS AGE); | |
| 415 | return; | |
| 416 | } | |
| 417 | ||
| 418 | //dr op corrupt ed tables and run | |
| 419 | Syst em.out.pri ntln("drop "); | |
| 420 | proc ess = Runt ime.getRun time().exe c(dropCorr upted_cmd) ; | |
| 421 | stat us = proce ss.waitFor (); | |
| 422 | inpu t = new Bu fferedRead er(new Inp utStreamRe ader(proce ss.getInpu tStream()) ); | |
| 423 | whil e ((line = input.rea dLine()) ! = null) | |
| 424 | { | |
| 425 | inputL og=inputLo g+line+"\n "; | |
| 426 | } | |
| 427 | inpu t.close(); | |
| 428 | Syst em.out.pri ntln(input Log); | |
| 429 | ||
| 430 | erro r = new Bu fferedRead er(new Inp utStreamRe ader(proce ss.getErro rStream()) ); | |
| 431 | whil e ((line = error.rea dLine()) ! = null) | |
| 432 | { | |
| 433 | errorL og=errorLo g+line+"\n "; | |
| 434 | } | |
| 435 | erro r.close(); | |
| 436 | Syst em.out.pri ntln(error Log); | |
| 437 | if(e rrorLog.to LowerCase( ).contains ("error".t oLowerCase ())) | |
| 438 | { | |
| 439 | JOptionP ane.showMe ssageDialo g(null, er rorLog, "E rror", JOp tionPane.E RROR_MESSA GE); | |
| 440 | JOptionP ane.showMe ssageDialo g(null, "T he copy pr ocess has been cance led", "Can celed", JO ptionPane. ERROR_MESS AGE); | |
| 441 | return; | |
| 442 | } | |
| 443 | // s how the us er that th e table ha s been cop ied and st art the pr ocess over for the n ext table if multipl e tables | |
| 444 | JOpt ionPane.sh owMessageD ialog(null , table[i] + " has fi nished cop ying from "+sIP +" t o "+ dIP, "Copy Fini shed", JOp tionPane.I NFORMATION _MESSAGE); | |
| 445 | ||
| 446 | } | |
| 447 | catch (E xception e rr) { | |
| 448 | err.prin tStackTrac e(); | |
| 449 | } | |
| 450 | } | |
| 451 | JOptionPan e.showMess ageDialog( null, "The table(s) have finis hed copyin g", "Copy Finished", JOptionPa ne.INFORMA TION_MESSA GE); | |
| 452 | } | |
| 453 | else | |
| 454 | { | |
| 455 | Syst em.out.pri ntln("Canc elled"); | |
| 456 | } | |
| 457 | } | |
| 458 | ||
| 459 | ||
| 460 | } | |
| 461 | ||
| 462 | } | |
| 463 | // met hod to sav e space wh en constru cting popu p GridLayo ut | |
| 464 | void s kipRow(JPa nel p, int columns){ | |
| 465 | fo r(int i=0; i<columns ;i++) | |
| 466 | p. add(new JL abel()); | |
| 467 | ||
| 468 | } | |
| 469 | ||
| 470 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.