1 23 package com.sun.enterprise.tools.upgrade.gui; 24 25 import java.util.*; 26 import javax.swing.*; 27 import java.io.*; 28 import com.sun.enterprise.tools.upgrade.gui.util.DialogEvent; 29 import com.sun.enterprise.tools.upgrade.gui.util.DialogListener; 30 import com.sun.enterprise.tools.upgrade.gui.util.Utils; 31 import java.util.*; 32 import com.sun.enterprise.tools.upgrade.common.*; 33 import java.util.logging.*; 34 import com.sun.enterprise.util.i18n.StringManager; 35 import com.sun.enterprise.tools.upgrade.logging.*; 36 37 import javax.help.*; 38 43 public class MainFrame extends JFrame implements LogMessageListener, UpgradeUpdateListener{ 44 45 private JButton backButton = null; 46 private JPanel buttonsPanel = null; 47 private JButton cancelButton = null; 48 private JButton helpButton = null; 49 private JPanel JDialogContentPane = null; 50 private JButton nextButton = null; 51 52 private ProgressPanel progressPanel = null; 53 private DataCollectionPanel dataCollectionPanel = null; 54 private CertificatePanel certificatePanel = null; 55 private ClusterDetailsPanel clusterDetailsPanel = null; 56 57 EventHandler eventHandler = new EventHandler(); 58 private JPanel navigationPanel = null; 59 60 private static final int DETAILS_COLLECTION_PANEL = 1; 61 private static final int CERTIFICATE_PANEL = 2; 62 private static final int PROGRESS_PANEL = 3; 63 private static final int CLUSTER_DETAILS_PANEL = 4; 64 private int currentNavigationPanel = DETAILS_COLLECTION_PANEL; 65 66 private static int UPGRADE_STARTED = 1; 67 private static int UPGRADE_FINISHED = 2; 68 private static int DATA_COLLECTION_PENDING = 3; 69 private static int CRTIFICATION_PENDING = 4; 70 private static int CLUSTER_DETAILS_PENDING = 5; 71 72 private CommonInfoModel commonInfoModel; 73 74 private DomainPathSelectionDialog domainPathSelectionDialog; 75 76 private Vector dialogListeners = new Vector(); 77 public void addDialogListener(DialogListener listener){ 78 this.dialogListeners.addElement(listener); 79 } 80 public void removeDialogListener(DialogListener listener){ 81 this.dialogListeners.removeElement(listener); 82 } 83 84 private StringManager stringManager = StringManager.getManager("com.sun.enterprise.tools.upgrade.gui"); 85 private static Logger logger = com.sun.enterprise.tools.upgrade.common.CommonInfoModel.getDefaultLogger(); 86 87 class EventHandler implements java.awt.event.ActionListener { 88 public void actionPerformed(java.awt.event.ActionEvent e) { 89 if (e.getSource() == MainFrame.this.getcancelButton()) 90 processCancelAction(); 91 if (e.getSource() == MainFrame.this.getbackButton()) 92 processBackAction(); 93 if (e.getSource() == MainFrame.this.getnextButton()) 94 processNextAction(); 95 if (e.getSource() == MainFrame.this.gethelpButton()) 96 processHelpAction(); 97 } 98 } 99 102 public MainFrame(CommonInfoModel coInfoModel) { 103 if(coInfoModel.getTargetEdition().equals(UpgradeConstants.EDITION_PE)){ 105 super.setTitle(stringManager.getString("upgrade.gui.mainframe.titleMessage")); 106 }else{ 107 super.setTitle(stringManager.getString("upgrade.gui.mainframe.eetitleMessage")); 108 } 109 this.commonInfoModel = coInfoModel; 110 initialize(); 111 } 112 113 private void processCancelAction() { 114 int option = javax.swing.JOptionPane.showConfirmDialog(this, 115 stringManager.getString("upgrade.gui.mainframe.exitMessage"), 116 stringManager.getString("upgrade.gui.mainframe.exitMessageTitle"), 117 javax.swing.JOptionPane.YES_NO_OPTION, 118 javax.swing.JOptionPane.QUESTION_MESSAGE); 119 if (option == javax.swing.JOptionPane.NO_OPTION) { 120 return; 121 } 122 logger.info("Before Recover Call"); 123 commonInfoModel.recover(); 125 DialogEvent de = new DialogEvent(this, DialogEvent.CANCEL_ACTION); 127 for(int i=0 ; i<this.dialogListeners.size(); i++){ 128 ((DialogListener)dialogListeners.elementAt(i)).dialogProcessed(de); 129 } 130 this.dispose(); 131 } 132 133 137 private javax.swing.JButton getbackButton() { 138 if (backButton == null) { 139 backButton = new javax.swing.JButton (); 140 backButton.setName("backButton"); 141 backButton.setText(stringManager.getString("upgrade.gui.mainframe.backbutton")); 142 } 143 return backButton; 144 } 145 146 150 private javax.swing.JPanel getProgressPanel() { 151 if (progressPanel == null) { 152 progressPanel = new ProgressPanel(); 153 } 154 return progressPanel; 155 } 156 157 158 162 private javax.swing.JPanel getbuttonsPanel() { 163 if (buttonsPanel == null) { 164 buttonsPanel = new javax.swing.JPanel (); 165 buttonsPanel.setName("buttonsPanel"); 166 buttonsPanel.setLayout(new java.awt.GridBagLayout ()); 167 JPanel placeHolderPanel1 = new JPanel(); 168 JPanel placeHolderPanel2 = new JPanel(); 169 placeHolderPanel1.add(getbackButton()); 170 placeHolderPanel1.add(getnextButton()); 171 placeHolderPanel2.add(getcancelButton()); 172 placeHolderPanel2.add(gethelpButton()); 173 174 java.awt.GridBagConstraints constraints = new java.awt.GridBagConstraints (); 175 constraints.gridx = 0; constraints.gridy = 0; 176 constraints.anchor = java.awt.GridBagConstraints.WEST; 177 constraints.gridwidth = 1; constraints.gridheight = 1; 178 constraints.weightx = 1.0; constraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 179 constraints.insets = new java.awt.Insets (5, 10, 10, 20); 180 getbuttonsPanel().add(placeHolderPanel1, constraints); 181 182 constraints = new java.awt.GridBagConstraints (); 183 constraints.gridx = 1; constraints.gridy = 0; 184 constraints.anchor = java.awt.GridBagConstraints.EAST; 185 constraints.gridwidth = 1; constraints.gridheight = 1; 186 constraints.weightx = 1.0; constraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 187 constraints.insets = new java.awt.Insets (5, 10, 10, 20); 188 getbuttonsPanel().add(placeHolderPanel2, constraints); 189 } 190 return buttonsPanel; 191 } 192 196 private javax.swing.JButton getcancelButton() { 197 if (cancelButton == null) { 198 cancelButton = new javax.swing.JButton (); 199 cancelButton.setName("cancelButton"); 200 cancelButton.setText(stringManager.getString("upgrade.gui.mainframe.cancelbutton")); 201 } 202 return cancelButton; 203 } 204 208 private javax.swing.JButton gethelpButton() { 209 if (helpButton == null) { 210 helpButton = new javax.swing.JButton (); 211 helpButton.setName("helpButton"); 212 helpButton.setText(stringManager.getString("upgrade.gui.mainframe.helpbutton")); 213 if(Utils.getHelpBroker() != null) 214 Utils.getHelpBroker().enableHelpOnButton(helpButton, "WIZARD_FIRST", null); 215 } 216 return helpButton; 217 } 218 219 223 public javax.swing.JPanel getJDialogContentPane() { 224 if (JDialogContentPane == null) { 225 JDialogContentPane = new javax.swing.JPanel (); 226 JDialogContentPane.setName("JDialogContentPane"); 227 JDialogContentPane.setLayout(new java.awt.GridBagLayout ()); 228 229 java.awt.GridBagConstraints imageconstraintsPanel = new java.awt.GridBagConstraints (); 230 imageconstraintsPanel.gridx = 0; imageconstraintsPanel.gridy = 0; 231 imageconstraintsPanel.fill = java.awt.GridBagConstraints.BOTH; 232 imageconstraintsPanel.weightx = 0; 233 imageconstraintsPanel.weighty = 0; 234 ImagePanel imagePanel = new ImagePanel(new java.awt.Insets (5,10,5,10)); 235 java.awt.Image image = this.getUpgradeToolImage(); 236 imagePanel.setImage(image); 238 getJDialogContentPane().add(imagePanel, imageconstraintsPanel); 239 240 java.awt.GridBagConstraints constraintsnavigationPanel = new java.awt.GridBagConstraints (); 241 constraintsnavigationPanel.gridx = 1; constraintsnavigationPanel.gridy = 0; 242 constraintsnavigationPanel.fill = java.awt.GridBagConstraints.BOTH; 243 constraintsnavigationPanel.weightx = 1.0; 244 constraintsnavigationPanel.weighty = 1.0; 245 getJDialogContentPane().add(getnavigationPanel(), constraintsnavigationPanel); 246 247 java.awt.GridBagConstraints constraintsSeparator = new java.awt.GridBagConstraints (); 248 constraintsSeparator.gridx = 0; constraintsSeparator.gridy = 1; 249 constraintsSeparator.gridwidth = 2; constraintsSeparator.gridheight = 1; 250 constraintsSeparator.fill = java.awt.GridBagConstraints.HORIZONTAL; 251 constraintsSeparator.weightx = 1.0; 252 constraintsSeparator.insets = new java.awt.Insets (5, 0, 0, 0); 253 javax.swing.JSeparator separatorPanel = new javax.swing.JSeparator (); 254 getJDialogContentPane().add(separatorPanel, constraintsSeparator); 255 256 java.awt.GridBagConstraints constraintsbuttonsPanel = new java.awt.GridBagConstraints (); 257 constraintsbuttonsPanel.gridx = 0; constraintsbuttonsPanel.gridy = 2; 258 constraintsbuttonsPanel.gridwidth = 2; constraintsbuttonsPanel.gridheight = 1; 259 constraintsbuttonsPanel.fill = java.awt.GridBagConstraints.HORIZONTAL; 260 constraintsbuttonsPanel.weightx = 1.0; 261 constraintsbuttonsPanel.insets = new java.awt.Insets (5, 0, 0, 0); 262 getJDialogContentPane().add(getbuttonsPanel(), constraintsbuttonsPanel); 263 } 264 return JDialogContentPane; 265 } 266 private java.awt.Image getUpgradeToolImage(){ 267 java.net.URL imageURL = ClassLoader.getSystemClassLoader().getResource("com/sun/enterprise/tools/upgrade/gui/Appserv_upgrade_wizard.gif"); 268 return (imageURL != null)? java.awt.Toolkit.getDefaultToolkit().getImage(imageURL) : null; 269 } 270 274 private javax.swing.JPanel getnavigationPanel() { 275 if (navigationPanel == null) { 276 navigationPanel = new javax.swing.JPanel (); 277 navigationPanel.setName("navigationPanel"); 278 navigationPanel.setLayout(new java.awt.GridBagLayout ()); 279 280 java.awt.GridBagConstraints constraintsbeanNameBeanTypePanel = new java.awt.GridBagConstraints (); 281 constraintsbeanNameBeanTypePanel.gridx = 0; constraintsbeanNameBeanTypePanel.gridy = 0; 282 constraintsbeanNameBeanTypePanel.fill = java.awt.GridBagConstraints.BOTH; 283 constraintsbeanNameBeanTypePanel.weightx = 1.0; 284 constraintsbeanNameBeanTypePanel.weighty = 1.0; 285 getnavigationPanel().add(getDataCollectionPanel(), constraintsbeanNameBeanTypePanel); 286 } 287 return navigationPanel; 288 } 289 293 private javax.swing.JButton getnextButton() { 294 if (nextButton == null) { 295 nextButton = new javax.swing.JButton (); 296 nextButton.setName("nextButton"); 297 nextButton.setText(stringManager.getString("upgrade.gui.mainframe.nextbutton")); 298 nextButton.setActionCommand("next"); 299 } 300 return nextButton; 301 } 302 303 307 private void initConnections() { 308 getcancelButton().addActionListener(eventHandler); 309 getbackButton().addActionListener(eventHandler); 310 getnextButton().addActionListener(eventHandler); 311 gethelpButton().addActionListener(eventHandler); 312 dataCollectionPanel.addDialogListener(new DialogListener(){ 313 public void dialogProcessed(DialogEvent evt){ 314 setNextButtonStateForDataCollectionPanel(); 315 } 316 }); 317 this.addWindowListener(new java.awt.event.WindowAdapter (){ 318 public void windowClosing(java.awt.event.WindowEvent e){ 319 processCancelAction(); 320 } 321 }); 322 } 323 324 327 private void initialize() { 328 setName("MainFrame"); 329 setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); 330 setSize(725, 545); 331 setContentPane(getJDialogContentPane()); 332 initConnections(); 333 this.setFrameNavigationState(this.DATA_COLLECTION_PENDING); 334 this.setBounds(new java.awt.Rectangle (100,100,this.getWidth(),this.getHeight())); 335 } 336 340 public static void main(java.lang.String [] args) { 341 try{ 343 MainFrame wiz = new MainFrame(new CommonInfoModel()); 344 wiz.show(); 345 }catch(java.lang.Throwable th){ 346 logger.severe(th.getMessage()); 347 } 348 } 349 public void processBackAction() { 350 if(currentNavigationPanel == PROGRESS_PANEL){ 351 this.currentNavigationPanel = CERTIFICATE_PANEL ; 352 CSH.setHelpIDString(gethelpButton(),"WIZARD_CERT"); 353 }else if(currentNavigationPanel == CERTIFICATE_PANEL){ 354 this.currentNavigationPanel = DETAILS_COLLECTION_PANEL ; 355 CSH.setHelpIDString(gethelpButton(),"WIZARD_FIRST"); 356 }else if(currentNavigationPanel == CLUSTER_DETAILS_PANEL){ 357 if(commonInfoModel.getCertificateConversionFlag()){ 358 this.currentNavigationPanel = CERTIFICATE_PANEL; 359 CSH.setHelpIDString(gethelpButton(),"WIZARD_CERT"); 360 }else{ 361 this.currentNavigationPanel = DETAILS_COLLECTION_PANEL ; 362 CSH.setHelpIDString(gethelpButton(),"WIZARD_FIRST"); 363 } 364 }else if(currentNavigationPanel == DETAILS_COLLECTION_PANEL){ 365 } 367 this.setCurrentNavigationPanel(); 368 } 369 public void processHelpAction() { 370 384 } 385 public void processNextAction() { 386 DialogEvent de = null; 387 if(getnextButton().getActionCommand().equals("finish")){ 388 de = new DialogEvent(this, DialogEvent.FINISH_ACTION); 389 this.dispose(); 390 }else if(currentNavigationPanel == DETAILS_COLLECTION_PANEL){ 391 if(!this.validateInputs()) return; 392 commonInfoModel.setSourceInstallDir(dataCollectionPanel.getSourceDirectoryPath()); 393 if(commonInfoModel.checkSourceInputAsDomainRoot(commonInfoModel.getSourceInstallDir())) 394 commonInfoModel.setSourceDomainRoot(commonInfoModel.getSourceInstallDir()); 395 commonInfoModel.setTargetDomainRoot(dataCollectionPanel.getDestinationDirectoryPath()); 396 commonInfoModel.setAdminUserName(dataCollectionPanel.getAdminUserName()); 397 commonInfoModel.setAdminPassword(dataCollectionPanel.getAdminPassword()); 398 commonInfoModel.setCertificateConversionFlag(dataCollectionPanel.isUpgradeCertificatesSelected()); 399 400 if(!this.commonInfoModel.getTargetVersionAndEdition().equals(UpgradeConstants.VERSION_AS90_PE)){ 401 commonInfoModel.setMasterPassword(dataCollectionPanel.getMasterPassword()); 402 } 403 413 commonInfoModel.enlistDomainsFromSource(); 414 if(dataCollectionPanel.isUpgradeCertificatesSelected()){ 415 commonInfoModel.setCertificateConversionFlag(true); 416 this.currentNavigationPanel = CERTIFICATE_PANEL; 417 CSH.setHelpIDString(gethelpButton(),"WIZARD_CERT"); 418 }else if(commonInfoModel.getSourceVersionAndEdition().equals(UpgradeConstants.VERSION_AS7X_EE)){ 419 this.currentNavigationPanel = CLUSTER_DETAILS_PANEL; 420 CSH.setHelpIDString(gethelpButton(),"WIZARD_CLUSTER"); 421 }else{ 422 de = new DialogEvent(this, DialogEvent.UPGRADE_ACTION); 423 this.currentNavigationPanel = PROGRESS_PANEL ; 424 CSH.setHelpIDString(gethelpButton(),"WIZARD_RESULT"); 425 } 426 this.setCurrentNavigationPanel(); 427 }else if(currentNavigationPanel == CERTIFICATE_PANEL){ 428 if(commonInfoModel.getSourceVersionAndEdition().equals(UpgradeConstants.VERSION_AS7X_EE)){ 429 this.currentNavigationPanel = CLUSTER_DETAILS_PANEL ; 430 CSH.setHelpIDString(gethelpButton(),"WIZARD_CLUSTER"); 431 }else{ 432 de = new DialogEvent(this, DialogEvent.UPGRADE_ACTION); 433 this.currentNavigationPanel = PROGRESS_PANEL ; 434 CSH.setHelpIDString(gethelpButton(),"WIZARD_RESULT"); 435 } 436 this.setCurrentNavigationPanel(); 437 }else if(currentNavigationPanel == CLUSTER_DETAILS_PANEL){ 438 Vector clusterFileNames = this.clusterDetailsPanel.getClusterFilesTableModel().getClusterFiles(); 440 if((clusterFileNames != null) && (!clusterFileNames.isEmpty())){ 442 if(!commonInfoModel.processClinstnceConfFiles(clusterFileNames)){ 443 javax.swing.JOptionPane.showMessageDialog(this, stringManager.getString("upgrade.gui.mainframe.clusterListInvalidMsg"), 444 stringManager.getString("upgrade.gui.mainframe.lusterListInvalidTitle"), 445 javax.swing.JOptionPane.ERROR_MESSAGE); 446 return; 447 } 448 } 449 de = new DialogEvent(this, DialogEvent.UPGRADE_ACTION); 450 this.currentNavigationPanel = PROGRESS_PANEL ; 451 this.setCurrentNavigationPanel(); 452 CSH.setHelpIDString(gethelpButton(),"WIZARD_RESULT"); 453 }else if(currentNavigationPanel == PROGRESS_PANEL){ 454 de = new DialogEvent(this, DialogEvent.FINISH_ACTION); 456 this.dispose(); 457 } 458 if(de != null){ 459 new UpgradeActionThread(dialogListeners, de).start(); 460 } 461 } 462 private java.util.List getUserDefinedSourceDomains(CommonInfoModel commonInfoModel){ 463 int returnedOption = javax.swing.JOptionPane.showConfirmDialog(this, stringManager.getString("upgrade.gui.mainframe.multiplDomainsMsg"), 464 stringManager.getString("upgrade.gui.mainframe.multiplDomainsTitle"), 465 javax.swing.JOptionPane.YES_NO_OPTION,javax.swing.JOptionPane.QUESTION_MESSAGE); 466 if(returnedOption == javax.swing.JOptionPane.NO_OPTION) 467 return null; 468 this.getDomainPathSelectionDialog().show(); 470 if(this.getDomainPathSelectionDialog().USER_ACTION == DomainPathSelectionDialog.CANCEL_ACTION){ 472 return null; 473 }else{ 474 return this.getDomainPathSelectionDialog().getDomainPathTableModel().getDomainPaths(); 475 } 476 } 477 private DomainPathSelectionDialog getDomainPathSelectionDialog(){ 478 if(this.domainPathSelectionDialog == null){ 479 domainPathSelectionDialog = new DomainPathSelectionDialog(); 480 centerDialog(domainPathSelectionDialog); 481 domainPathSelectionDialog.addDialogListener(new DialogListener(){ 482 public void dialogProcessed(DialogEvent evt){ 483 484 } 485 }); 486 } 487 return domainPathSelectionDialog; 488 } 489 public void centerDialog(javax.swing.JDialog dialog) { 490 java.awt.Rectangle bounds = this.getBounds(); 491 java.awt.Rectangle dialogLocation = new java.awt.Rectangle (); 492 dialogLocation.x = bounds.x+((bounds.width-dialog.getWidth())/2); 493 dialogLocation.y = bounds.y+((bounds.height-dialog.getHeight())/2); 494 dialogLocation.setSize(dialog.getWidth(),dialog.getHeight()); 495 dialog.setBounds(dialogLocation); 496 } 497 public void setCurrentNavigationPanel() { 498 getnavigationPanel().removeAll(); 499 this.getJDialogContentPane().invalidate(); 500 java.awt.GridBagConstraints constraintsPanel = new java.awt.GridBagConstraints (); 501 constraintsPanel.gridx = 0; constraintsPanel.gridy = 0; 502 constraintsPanel.fill = java.awt.GridBagConstraints.BOTH; 503 constraintsPanel.weightx = 1.0; 504 constraintsPanel.weighty = 1.0; 505 if(this.PROGRESS_PANEL == currentNavigationPanel){ 506 getnavigationPanel().add(getProgressPanel(), constraintsPanel); 507 this.setFrameNavigationState(this.UPGRADE_STARTED); 508 }else if(this.CERTIFICATE_PANEL == currentNavigationPanel){ 509 getnavigationPanel().add(getCertificatePanel(), constraintsPanel); 510 this.setFrameNavigationState(this.CRTIFICATION_PENDING); 511 ((CertificatePanel)getCertificatePanel()).reInitializeAddDomainDialog(); 512 }else if(this.DETAILS_COLLECTION_PANEL == currentNavigationPanel){ 513 getnavigationPanel().add(getDataCollectionPanel(), constraintsPanel); 514 this.setFrameNavigationState(this.DATA_COLLECTION_PENDING); 515 }else if(this.CLUSTER_DETAILS_PANEL == currentNavigationPanel){ 516 getnavigationPanel().add(getClusterDetailsPanel(), constraintsPanel); 517 this.setFrameNavigationState(this.CLUSTER_DETAILS_PENDING); 518 } 519 this.getJDialogContentPane().validate(); 520 this.repaint(); 521 } 522 523 private void setFrameNavigationState(int state){ 524 if(this.UPGRADE_FINISHED == state){ 525 getcancelButton().setEnabled(false); 526 getnextButton().setEnabled(true); 527 getnextButton().setActionCommand("finish"); 528 getnextButton().setText(stringManager.getString("upgrade.gui.mainframe.finishbutton")); 529 getbackButton().setEnabled(false); 530 }else if(this.UPGRADE_STARTED == state){ 531 getnextButton().setEnabled(false); 532 getbackButton().setEnabled(false); 533 }else if(this.CRTIFICATION_PENDING == state){ 534 getnextButton().setEnabled(true); 535 getbackButton().setEnabled(true); 536 }else if(this.CLUSTER_DETAILS_PENDING == state){ 537 getnextButton().setEnabled(true); 538 getbackButton().setEnabled(true); 539 }else{ 541 getcancelButton().setEnabled(true); 543 this.setNextButtonStateForDataCollectionPanel(); 544 getnextButton().setActionCommand("next"); 545 getbackButton().setEnabled(false); 546 } 547 } 548 private void setNextButtonStateForDataCollectionPanel(){ 549 String sourcePath = this.dataCollectionPanel.getSourceDirectoryPath(); 550 String destPath = this.dataCollectionPanel.getDestinationDirectoryPath(); 551 String adminUserName = this.dataCollectionPanel.getAdminUserName(); 552 String adminPassword = this.dataCollectionPanel.getAdminPassword(); 553 554 if(this.commonInfoModel.getTargetVersionAndEdition().equals(UpgradeConstants.VERSION_AS90_PE)){ 555 556 if((sourcePath == null) || (destPath == null) || (adminUserName == null) || (adminPassword == null) || 557 ("".equals(adminUserName)) || ("".equals(adminPassword)) || ("".equals(sourcePath)) || ("".equals(destPath))){ 558 getnextButton().setEnabled(false); 559 }else{ 560 getnextButton().setEnabled(true); 561 } 562 }else{ 563 String masterPassword = this.dataCollectionPanel.getMasterPassword(); 564 565 if((sourcePath == null) || (destPath == null) || (adminUserName == null) || (adminPassword == null) || (masterPassword == null) || 566 ("".equals(adminUserName)) || ("".equals(adminPassword)) || ("".equals(sourcePath)) || ("".equals(masterPassword)) || ("".equals(destPath))){ 567 getnextButton().setEnabled(false); 568 }else{ 569 getnextButton().setEnabled(true); 570 } 571 } 572 } 573 private void setNextButtonStateForClusterDetailsPanel(){ 574 if(this.clusterDetailsPanel.getClusterFilesTableModel().getClusterFiles().size() == 0){ 575 getnextButton().setEnabled(false); 576 }else{ 577 getnextButton().setEnabled(true); 578 } 579 } 580 private boolean validateInputs() { 581 if(currentNavigationPanel == DETAILS_COLLECTION_PANEL){ 582 String sourceDir = dataCollectionPanel.getSourceDirectoryPath(); 583 String destDir = dataCollectionPanel.getDestinationDirectoryPath(); 584 if(!UpgradeUtils.getUpgradeUtils(commonInfoModel).isValidSourcePath(sourceDir)){ 585 if( !(commonInfoModel.checkSourceInputAsDomainRoot(dataCollectionPanel.getSourceDirectoryPath())) || 586 commonInfoModel.getSourceVersion().equals(UpgradeConstants.VERSION_7X)) { 587 javax.swing.JOptionPane.showMessageDialog(this, stringManager.getString("upgrade.gui.mainframe.invalidSourceMsg"), 589 stringManager.getString("upgrade.gui.mainframe.invalidSourceTitle"), 590 javax.swing.JOptionPane.ERROR_MESSAGE); 591 return false; 592 } 593 } 594 if(!UpgradeUtils.getUpgradeUtils(commonInfoModel).isValidTargetPath(destDir)){ 597 javax.swing.JOptionPane.showMessageDialog(this, stringManager.getString("upgrade.gui.mainframe.invalidTargetMsg"), 599 stringManager.getString("upgrade.gui.mainframe.invalidTargetTitle"), 600 javax.swing.JOptionPane.ERROR_MESSAGE); 601 return false; 602 } 603 commonInfoModel.setSourceInstallDir(sourceDir); 604 commonInfoModel.setTargetDomainRoot(destDir); 605 if(commonInfoModel.checkSourceInputAsDomainRoot(commonInfoModel.getSourceInstallDir())) 606 commonInfoModel.setSourceDomainRoot(commonInfoModel.getSourceInstallDir()); 607 610 if(!commonInfoModel.isUpgradeSupported()){ 611 javax.swing.JOptionPane.showMessageDialog(this, stringManager.getString("upgrade.gui.mainframe.versionNotSupportedMsg1")+ 612 UpgradeConstants.readableString(commonInfoModel.getSourceVersionAndEdition())+ 613 stringManager.getString("upgrade.gui.mainframe.versionNotSupportedMsg2")+ 614 UpgradeConstants.readableString(commonInfoModel.getTargetVersionAndEdition()), 615 stringManager.getString("upgrade.gui.mainframe.versionNotSupportedTitle"), 616 javax.swing.JOptionPane.ERROR_MESSAGE); 617 commonInfoModel.clearSourceAndTargetVersions(); 618 return false; 619 } 620 String userName = dataCollectionPanel.getAdminUserName(); 621 String adminPasswd = dataCollectionPanel.getAdminPassword(); 622 String masterPwd = null; 623 if(!commonInfoModel.getTargetVersionAndEdition().equals(UpgradeConstants.VERSION_AS90_PE)){ 624 masterPwd = dataCollectionPanel.getMasterPassword(); 625 } 626 if(!UpgradeUtils.getUpgradeUtils(commonInfoModel).validateUserDetails(userName,adminPasswd,masterPwd)){ 627 javax.swing.JOptionPane.showMessageDialog(this, stringManager.getString("upgrade.gui.mainframe.invalidUserDetailsMsg"), 628 stringManager.getString("upgrade.gui.mainframe.invalidUserDetailsTitle"), 629 javax.swing.JOptionPane.ERROR_MESSAGE); 630 return false; 631 } 632 commonInfoModel.clearSourceAndTargetVersions(); 633 return true; 634 } 635 return true; 636 } 637 private javax.swing.JPanel getDataCollectionPanel() { 638 if (dataCollectionPanel == null) { 639 dataCollectionPanel = new DataCollectionPanel(commonInfoModel); 640 } 641 return dataCollectionPanel; 642 } 643 private javax.swing.JPanel getClusterDetailsPanel() { 644 if (clusterDetailsPanel == null) { 645 clusterDetailsPanel = new ClusterDetailsPanel(); 646 clusterDetailsPanel.addDialogListener(new DialogListener(){ 647 public void dialogProcessed(DialogEvent evt){ 648 } 650 }); 651 } 652 return clusterDetailsPanel; 653 } 654 private javax.swing.JPanel getCertificatePanel() { 655 if (certificatePanel == null) { 656 certificatePanel = new CertificatePanel(this.commonInfoModel, this); 657 } 658 return certificatePanel; 659 } 660 661 public void logMessageReceived(LogMessageEvent evt) { 662 if(this.progressPanel != null){ 664 this.progressPanel.updateLog(evt); 665 } 666 } 667 668 public void upgradeProcessUpdate(UpgradeUpdateEvent evt) { 669 if(this.progressPanel != null){ 670 this.progressPanel.updateProgress(evt); 671 if(evt.getProgressState() == 100){ 672 this.setFrameNavigationState(this.UPGRADE_FINISHED); 673 } 674 } 675 } 676 class UpgradeActionThread extends Thread { 677 private Vector dialogListeners; 678 private DialogEvent de; 679 public UpgradeActionThread(Vector listeners, DialogEvent d){ 680 this.dialogListeners = listeners; 681 this.de = d; 682 } 683 public void run(){ 684 for(int i=0 ; i<this.dialogListeners.size(); i++){ 685 ((DialogListener)dialogListeners.elementAt(i)).dialogProcessed(de); 686 } 687 } 688 } 689 690 } 691 | Popular Tags |