497 // runtime installer requires --runtime-image, if this is false 498 // here then we should have thrown error validating args. 499 return params.containsKey(PREDEFINED_RUNTIME_IMAGE.getID()); 500 } 501 502 static File getPredefinedAppImage(Map<String, ? super Object> params) { 503 File applicationImage = null; 504 if (PREDEFINED_APP_IMAGE.fetchFrom(params) != null) { 505 applicationImage = PREDEFINED_APP_IMAGE.fetchFrom(params); 506 if (!applicationImage.exists()) { 507 throw new RuntimeException( 508 MessageFormat.format(I18N.getString( 509 "message.app-image-dir-does-not-exist"), 510 PREDEFINED_APP_IMAGE.getID(), 511 applicationImage.toString())); 512 } 513 } 514 return applicationImage; 515 } 516 517 static void copyPredefinedRuntimeImage( 518 Map<String, ? super Object> params, 519 AbstractAppImageBuilder appBuilder) 520 throws IOException , ConfigException { 521 File topImage = PREDEFINED_RUNTIME_IMAGE.fetchFrom(params); 522 if (!topImage.exists()) { 523 throw new ConfigException( 524 MessageFormat.format(I18N.getString( 525 "message.runtime-image-dir-does-not-exist"), 526 PREDEFINED_RUNTIME_IMAGE.getID(), 527 topImage.toString()), 528 MessageFormat.format(I18N.getString( 529 "message.runtime-image-dir-does-not-exist.advice"), 530 PREDEFINED_RUNTIME_IMAGE.getID())); 531 } 532 File image = appBuilder.getRuntimeImageDir(topImage); 533 // copy whole runtime, need to skip jmods and src.zip 534 final List<String> excludes = Arrays.asList("jmods", "src.zip"); 535 IOUtils.copyRecursive(image.toPath(), appBuilder.getRuntimeRoot(), excludes); 536 | 497 // runtime installer requires --runtime-image, if this is false 498 // here then we should have thrown error validating args. 499 return params.containsKey(PREDEFINED_RUNTIME_IMAGE.getID()); 500 } 501 502 static File getPredefinedAppImage(Map<String, ? super Object> params) { 503 File applicationImage = null; 504 if (PREDEFINED_APP_IMAGE.fetchFrom(params) != null) { 505 applicationImage = PREDEFINED_APP_IMAGE.fetchFrom(params); 506 if (!applicationImage.exists()) { 507 throw new RuntimeException( 508 MessageFormat.format(I18N.getString( 509 "message.app-image-dir-does-not-exist"), 510 PREDEFINED_APP_IMAGE.getID(), 511 applicationImage.toString())); 512 } 513 } 514 return applicationImage; 515 } 516 517 static File getPredefinedRuntime(Map<String, ? super Object> params) 518 throws PackagerException { 519 File runtime = PREDEFINED_RUNTIME_IMAGE.fetchFrom(params); 520 if (runtime != null && !runtime.exists()) { 521 throw new PackagerException ( 522 "message.runtime-image-dir-does-not-exist", 523 PREDEFINED_RUNTIME_IMAGE.getID(), 524 runtime.toString()); 525 } 526 return runtime; 527 } 528 529 static void copyPredefinedRuntimeImage( 530 Map<String, ? super Object> params, 531 AbstractAppImageBuilder appBuilder) 532 throws IOException , ConfigException { 533 File topImage = PREDEFINED_RUNTIME_IMAGE.fetchFrom(params); 534 if (!topImage.exists()) { 535 throw new ConfigException( 536 MessageFormat.format(I18N.getString( 537 "message.runtime-image-dir-does-not-exist"), 538 PREDEFINED_RUNTIME_IMAGE.getID(), 539 topImage.toString()), 540 MessageFormat.format(I18N.getString( 541 "message.runtime-image-dir-does-not-exist.advice"), 542 PREDEFINED_RUNTIME_IMAGE.getID())); 543 } 544 File image = appBuilder.getRuntimeImageDir(topImage); 545 // copy whole runtime, need to skip jmods and src.zip 546 final List<String> excludes = Arrays.asList("jmods", "src.zip"); 547 IOUtils.copyRecursive(image.toPath(), appBuilder.getRuntimeRoot(), excludes); 548 |