1
16package org.tp23.antinstaller.runtime.exe;
17
18import org.tp23.antinstaller.InstallException;
19import org.tp23.antinstaller.InstallerContext;
20import org.tp23.antinstaller.Installer;
21import org.tp23.antinstaller.runtime.VersionHelper;
22
23
24
29public class ExecuteRunnerFilter implements ExecuteFilter {
30
31
34 public void exec(InstallerContext ctx) throws InstallException {
35
36 checkInstallerRuntimeEnvironment( ctx.getInstaller() );
37
38 if(ctx.getInstaller().isVerbose()){
39 ctx.log("Starting UI Screens");
40 }
41 boolean ok = ctx.getRunner().runInstaller();
42 if(!ok){
43 throw new AbortException("Install Aborted");
44 }
45 ctx.log("Install screens rendered");
46 }
47
48 public static class AbortException extends InstallException{
49 public AbortException(String message){
50 super(message);
51 }
52 }
53
54
57 private void checkInstallerRuntimeEnvironment( Installer installer )
58 throws InstallException {
59
60 String minJavaVersion = installer.getMinJavaVersion();
61 if(minJavaVersion != null && ! "".equals(minJavaVersion) ) {
62 VersionHelper helper = new VersionHelper();
63 if( ! helper.equalOrHigher(System.getProperty("java.version"), minJavaVersion, true) ) {
64 throw new InstallException("Incorrect Java version, installer requires java runtime version of '" + minJavaVersion +"' or higher");
65 }
66 }
67
68 }
69}
70