< prev index next >

src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppBundler.java

Print this page




 105             } else {
 106                 throw new ConfigException(re);
 107             }
 108         }
 109     }
 110 
 111     private boolean doValidate(Map<String, ? super Object> p)
 112             throws UnsupportedPlatformException, ConfigException {
 113         if (Platform.getPlatform() != Platform.LINUX) {
 114             throw new UnsupportedPlatformException();
 115         }
 116 
 117         imageBundleValidation(p);
 118 
 119         return true;
 120     }
 121 
 122     // it is static for the sake of sharing with "installer" bundlers
 123     // that may skip calls to validate/bundle in this class!
 124     public static File getRootDir(File outDir, Map<String, ? super Object> p) {
 125         return new File(outDir, APP_FS_NAME.fetchFrom(p));
 126     }
 127 
 128     public static String getLauncherCfgName(Map<String, ? super Object> p) {
 129         return "app/" + APP_FS_NAME.fetchFrom(p) +".cfg";
 130     }
 131 
 132     File doBundle(Map<String, ? super Object> p, File outputDirectory,
 133             boolean dependentTask) {
 134         if (Arguments.CREATE_JRE_INSTALLER.fetchFrom(p)) {
 135             return doJreBundle(p, outputDirectory, dependentTask);
 136         } else {
 137             return doAppBundle(p, outputDirectory, dependentTask);
 138         }
 139     }
 140 
 141     private File doJreBundle(Map<String, ? super Object> p,
 142             File outputDirectory, boolean dependentTask) {
 143         try {
 144             File rootDirectory = createRoot(p, outputDirectory, dependentTask,
 145                     APP_FS_NAME.fetchFrom(p), "linuxapp-image-builder");
 146             AbstractAppImageBuilder appBuilder = new LinuxAppImageBuilder(
 147                     APP_NAME.fetchFrom(p), outputDirectory.toPath());
 148             File predefined = PREDEFINED_RUNTIME_IMAGE.fetchFrom(p);
 149             if (predefined == null ) {
 150                 JLinkBundlerHelper.generateJre(p, appBuilder);
 151             } else {
 152                 return predefined;
 153             }
 154             return rootDirectory;
 155         } catch (Exception ex) {
 156             Log.error("Exception: "+ex);
 157             Log.debug(ex);
 158             return null;
 159         }
 160     }
 161 
 162     private File doAppBundle(Map<String, ? super Object> p,
 163             File outputDirectory, boolean dependentTask) {
 164         try {
 165             File rootDirectory = createRoot(p, outputDirectory, dependentTask,
 166                     APP_FS_NAME.fetchFrom(p), "linuxapp-image-builder");
 167             AbstractAppImageBuilder appBuilder = new LinuxAppImageBuilder(p,
 168                     outputDirectory.toPath());
 169             if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(p) == null ) {
 170                 JLinkBundlerHelper.execute(p, appBuilder);
 171             } else {
 172                 StandardBundlerParam.copyPredefinedRuntimeImage(p, appBuilder);
 173             }
 174             return rootDirectory;
 175         } catch (Exception ex) {
 176             Log.error("Exception: "+ex);
 177             Log.debug(ex);
 178             return null;
 179         }
 180     }
 181 
 182     @Override
 183     public String getName() {
 184         return I18N.getString("app.bundler.name");
 185     }
 186 




 105             } else {
 106                 throw new ConfigException(re);
 107             }
 108         }
 109     }
 110 
 111     private boolean doValidate(Map<String, ? super Object> p)
 112             throws UnsupportedPlatformException, ConfigException {
 113         if (Platform.getPlatform() != Platform.LINUX) {
 114             throw new UnsupportedPlatformException();
 115         }
 116 
 117         imageBundleValidation(p);
 118 
 119         return true;
 120     }
 121 
 122     // it is static for the sake of sharing with "installer" bundlers
 123     // that may skip calls to validate/bundle in this class!
 124     public static File getRootDir(File outDir, Map<String, ? super Object> p) {
 125         return new File(outDir, APP_NAME.fetchFrom(p));
 126     }
 127 
 128     public static String getLauncherCfgName(Map<String, ? super Object> p) {
 129         return "app/" + APP_NAME.fetchFrom(p) +".cfg";
 130     }
 131 
 132     File doBundle(Map<String, ? super Object> p, File outputDirectory,
 133             boolean dependentTask) {
 134         if (Arguments.CREATE_JRE_INSTALLER.fetchFrom(p)) {
 135             return doJreBundle(p, outputDirectory, dependentTask);
 136         } else {
 137             return doAppBundle(p, outputDirectory, dependentTask);
 138         }
 139     }
 140 
 141     private File doJreBundle(Map<String, ? super Object> p,
 142             File outputDirectory, boolean dependentTask) {
 143         try {
 144             File rootDirectory = createRoot(p, outputDirectory, dependentTask,
 145                     APP_NAME.fetchFrom(p), "linuxapp-image-builder");
 146             AbstractAppImageBuilder appBuilder = new LinuxAppImageBuilder(
 147                     APP_NAME.fetchFrom(p), outputDirectory.toPath());
 148             File predefined = PREDEFINED_RUNTIME_IMAGE.fetchFrom(p);
 149             if (predefined == null ) {
 150                 JLinkBundlerHelper.generateJre(p, appBuilder);
 151             } else {
 152                 return predefined;
 153             }
 154             return rootDirectory;
 155         } catch (Exception ex) {
 156             Log.error("Exception: "+ex);
 157             Log.debug(ex);
 158             return null;
 159         }
 160     }
 161 
 162     private File doAppBundle(Map<String, ? super Object> p,
 163             File outputDirectory, boolean dependentTask) {
 164         try {
 165             File rootDirectory = createRoot(p, outputDirectory, dependentTask,
 166                     APP_NAME.fetchFrom(p), "linuxapp-image-builder");
 167             AbstractAppImageBuilder appBuilder = new LinuxAppImageBuilder(p,
 168                     outputDirectory.toPath());
 169             if (PREDEFINED_RUNTIME_IMAGE.fetchFrom(p) == null ) {
 170                 JLinkBundlerHelper.execute(p, appBuilder);
 171             } else {
 172                 StandardBundlerParam.copyPredefinedRuntimeImage(p, appBuilder);
 173             }
 174             return rootDirectory;
 175         } catch (Exception ex) {
 176             Log.error("Exception: "+ex);
 177             Log.debug(ex);
 178             return null;
 179         }
 180     }
 181 
 182     @Override
 183     public String getName() {
 184         return I18N.getString("app.bundler.name");
 185     }
 186 


< prev index next >