37 import java.util.List;
38 import java.util.Map;
39 import java.util.ResourceBundle;
40 import java.util.ArrayList;
41
42 import jdk.jpackage.internal.resources.ResourceLocator;
43
44 import static jdk.jpackage.internal.StandardBundlerParam.*;
45
46 /*
47 * AbstractAppImageBuilder
48 * This is sub-classed by each of the platform dependent AppImageBuilder
49 * classes, and contains resource processing code common to all platforms.
50 */
51
52 public abstract class AbstractAppImageBuilder {
53
54 private static final ResourceBundle I18N = ResourceBundle.getBundle(
55 "jdk.jpackage.internal.resources.MainResources");
56
57 private final Map<String, Object> properties;
58 private final Path root;
59
60 public AbstractAppImageBuilder(Map<String, Object> properties, Path root) {
61 this.properties = properties;
62 this.root = root;
63 }
64
65 public InputStream getResourceAsStream(String name) {
66 return ResourceLocator.class.getResourceAsStream(name);
67 }
68
69 public abstract void prepareApplicationFiles() throws IOException;
70 public abstract void prepareJreFiles() throws IOException;
71 public abstract Path getAppDir();
72 public abstract Path getAppModsDir();
73
74 public Map<String, Object> getProperties() {
75 return this.properties;
76 }
77
78 public Path getRoot() {
79 return this.root;
80 }
81
82 protected void copyEntry(Path appDir, File srcdir, String fname)
83 throws IOException {
84 Path dest = appDir.resolve(fname);
85 Files.createDirectories(dest.getParent());
86 File src = new File(srcdir, fname);
87 if (src.isDirectory()) {
88 IOUtils.copyRecursive(src.toPath(), dest);
89 } else {
90 Files.copy(src.toPath(), dest);
91 }
92 }
93
94 protected InputStream locateResource(String publicName, String category,
95 String defaultName, File customFile,
96 boolean verbose, File publicRoot) throws IOException {
|
37 import java.util.List;
38 import java.util.Map;
39 import java.util.ResourceBundle;
40 import java.util.ArrayList;
41
42 import jdk.jpackage.internal.resources.ResourceLocator;
43
44 import static jdk.jpackage.internal.StandardBundlerParam.*;
45
46 /*
47 * AbstractAppImageBuilder
48 * This is sub-classed by each of the platform dependent AppImageBuilder
49 * classes, and contains resource processing code common to all platforms.
50 */
51
52 public abstract class AbstractAppImageBuilder {
53
54 private static final ResourceBundle I18N = ResourceBundle.getBundle(
55 "jdk.jpackage.internal.resources.MainResources");
56
57 private final Path root;
58
59 public AbstractAppImageBuilder(Map<String, Object> unused, Path root) {
60 this.root = root;
61 }
62
63 public InputStream getResourceAsStream(String name) {
64 return ResourceLocator.class.getResourceAsStream(name);
65 }
66
67 public abstract void prepareApplicationFiles() throws IOException;
68 public abstract void prepareJreFiles() throws IOException;
69 public abstract Path getAppDir();
70 public abstract Path getAppModsDir();
71
72 public Path getRoot() {
73 return this.root;
74 }
75
76 protected void copyEntry(Path appDir, File srcdir, String fname)
77 throws IOException {
78 Path dest = appDir.resolve(fname);
79 Files.createDirectories(dest.getParent());
80 File src = new File(srcdir, fname);
81 if (src.isDirectory()) {
82 IOUtils.copyRecursive(src.toPath(), dest);
83 } else {
84 Files.copy(src.toPath(), dest);
85 }
86 }
87
88 protected InputStream locateResource(String publicName, String category,
89 String defaultName, File customFile,
90 boolean verbose, File publicRoot) throws IOException {
|