1 23 24 package org.infoglue.cmsinstaller; 25 26 import java.awt.event.*; 27 import java.io.*; 28 29 public class InstallerMouseAdapter implements ActionListener { 31 private InfoGlueInstaller infoglueInstaller = null; 32 33 public InstallerMouseAdapter(InfoGlueInstaller infoglueInstaller) 34 { 35 this.infoglueInstaller = infoglueInstaller; 36 } 37 38 public void actionPerformed(ActionEvent e) 40 { 41 String actionCommand = e.getActionCommand(); 43 44 if(actionCommand.equalsIgnoreCase("ShowIntroductionDialog")) 45 { 46 this.infoglueInstaller.installerSkeleton.showIntroductionDialog(); 47 } 48 else if(actionCommand.equalsIgnoreCase("ShowDatabaseDialog")) 49 { 50 this.infoglueInstaller.installerSkeleton.showDatabaseServerDialog(); 51 } 52 else if(actionCommand.equalsIgnoreCase("ShowServerDialog")) 53 { 54 try 55 { 56 this.infoglueInstaller.checkDatabase(); 58 59 this.infoglueInstaller.installerSkeleton.showServerDialog(); 60 } 61 catch(Exception exception) 62 { 63 this.infoglueInstaller.installerSkeleton.databaseDialog.setErrorMessage(exception.getMessage()); 64 this.infoglueInstaller.logProgress("An error occurred:" + exception.getMessage()); 65 exception.printStackTrace(); 66 } 67 } 68 else if(actionCommand.equalsIgnoreCase("ShowFinishDialog")) 69 { 70 try 71 { 72 if(this.infoglueInstaller.installerSkeleton.serverDialog.getApplicationServer().startsWith("Tomcat")) 73 { 74 File tomcatHome = new File(this.infoglueInstaller.installerSkeleton.serverDialog.getApplicationServerHomePath()); 75 File tomcatWebbappsHome = new File(this.infoglueInstaller.installerSkeleton.serverDialog.getApplicationServerHomePath() + File.separator + "webapps"); 76 if(!tomcatHome.exists() || !tomcatHome.isDirectory() || !tomcatWebbappsHome.exists()) 77 throw new Exception ("The directory you selected as tomcat home is not valid."); 78 79 File applicationHome = new File(this.infoglueInstaller.installerSkeleton.serverDialog.getApplicationPath()); 80 if(!applicationHome.exists() || !applicationHome.isDirectory()) 81 throw new Exception ("The directory you selected as application home is not valid."); 82 } 83 else if(this.infoglueInstaller.installerSkeleton.serverDialog.getApplicationServer().startsWith("JBoss")) 84 { 85 File jBossHome = new File(this.infoglueInstaller.installerSkeleton.serverDialog.getApplicationServerHomePath()); 86 File jBossDeployHome = new File(this.infoglueInstaller.installerSkeleton.serverDialog.getApplicationServerHomePath() + File.separator + "server" + File.separator + "default" + File.separator + "deploy"); 87 if(!jBossHome.exists() || !jBossHome.isDirectory() || !jBossDeployHome.exists()) 88 throw new Exception ("The directory you selected as jboss home is not valid."); 89 } 90 91 this.infoglueInstaller.installerSkeleton.showFinishDialog(); 93 } 94 catch(Exception exception) 95 { 96 this.infoglueInstaller.installerSkeleton.serverDialog.setErrorMessage(exception.getMessage()); 97 this.infoglueInstaller.logProgress("An error occurred:" + exception.getMessage()); 98 exception.printStackTrace(); 99 } 100 } 101 else if(actionCommand.equalsIgnoreCase("ShowDoneDialog")) 102 { 103 try 104 { 105 this.infoglueInstaller.installerSkeleton.showInstallingDialog(); 106 Thread t = new Thread (new FinishThread(this.infoglueInstaller)); 109 t.start(); 110 } 111 catch(Exception exception) 112 { 113 this.infoglueInstaller.installerSkeleton.finishDialog.setErrorMessage(exception.getMessage()); 114 this.infoglueInstaller.logProgress("An error occurred:" + exception.getMessage()); 115 exception.printStackTrace(); 116 } 117 } 118 else if(actionCommand.equalsIgnoreCase("Exit")) 119 { 120 Logger.logInfo("Exiting application"); 121 System.exit(0); 122 } 123 124 } 125 126 } 127 128 class FinishThread implements Runnable 129 { 130 private InfoGlueInstaller infoglueInstaller = null; 131 132 public FinishThread(InfoGlueInstaller infoglueInstaller) 133 { 134 this.infoglueInstaller = infoglueInstaller; 135 } 136 137 public void run() 138 { 139 try 140 { 141 this.infoglueInstaller.finishInstallation(); 142 this.infoglueInstaller.installerSkeleton.showDoneDialog(); 143 } 144 catch(Exception exception) 145 { 146 this.infoglueInstaller.installerSkeleton.finishDialog.setErrorMessage(exception.getMessage()); 147 this.infoglueInstaller.logProgress("An error occurred:" + exception.getMessage()); 148 exception.printStackTrace(); 149 } 150 } 151 152 } 153 | Popular Tags |