equal
deleted
inserted
replaced
24 */ |
24 */ |
25 |
25 |
26 package jdk.packager.internal; |
26 package jdk.packager.internal; |
27 |
27 |
28 import java.io.File; |
28 import java.io.File; |
29 |
|
30 import java.util.Collection; |
29 import java.util.Collection; |
31 import java.util.LinkedHashSet; |
30 import java.util.LinkedHashSet; |
32 import java.util.Set; |
31 import java.util.Set; |
33 |
32 |
34 |
|
35 public class RelativeFileSet { |
33 public class RelativeFileSet { |
36 |
34 |
37 public enum Type { |
|
38 UNKNOWN, jnlp, jar, nativelib, icon, license, data |
|
39 } |
|
40 |
|
41 private Type type = Type.UNKNOWN; |
|
42 private String mode; |
35 private String mode; |
43 private String os; |
36 private String os; |
44 private String arch; |
37 private String arch; |
45 |
38 |
46 private File basedir; |
39 private File basedir; |
47 private Set<String> files = new LinkedHashSet<>(); |
40 private Set<String> files = new LinkedHashSet<>(); |
48 |
41 |
49 public RelativeFileSet(RelativeFileSet copy) { |
42 public RelativeFileSet(RelativeFileSet copy) { |
50 type = copy.type; |
|
51 mode = copy.mode; |
43 mode = copy.mode; |
52 os = copy.os; |
44 os = copy.os; |
53 arch = copy.arch; |
45 arch = copy.arch; |
54 basedir = copy.basedir; |
46 basedir = copy.basedir; |
55 files = new LinkedHashSet<>(copy.files); |
47 files = new LinkedHashSet<>(copy.files); |
63 if (!absolute.startsWith(baseAbsolute)) { |
55 if (!absolute.startsWith(baseAbsolute)) { |
64 throw new RuntimeException("File " + f.getAbsolutePath() + |
56 throw new RuntimeException("File " + f.getAbsolutePath() + |
65 " does not belong to " + baseAbsolute); |
57 " does not belong to " + baseAbsolute); |
66 } |
58 } |
67 if (!absolute.equals(baseAbsolute)) { |
59 if (!absolute.equals(baseAbsolute)) { |
68 // possible in javapackager case |
60 // possible in jpackager case |
69 this.files.add(absolute.substring(baseAbsolute.length()+1)); |
61 this.files.add(absolute.substring(baseAbsolute.length()+1)); |
70 } |
62 } |
71 } |
63 } |
72 } |
64 } |
73 |
65 |
100 |
92 |
101 public boolean contains(String requiredFile) { |
93 public boolean contains(String requiredFile) { |
102 if (files.contains(requiredFile)) { |
94 if (files.contains(requiredFile)) { |
103 return true; |
95 return true; |
104 } else { |
96 } else { |
105 Log.debug(" RelativeFileSet does not contain [" + requiredFile + "]"); |
97 Log.debug("RelativeFileSet does not contain [" +requiredFile+ "]"); |
106 return false; |
98 return false; |
107 } |
99 } |
108 } |
100 } |
109 |
101 |
110 public File getBaseDirectory() { |
102 public File getBaseDirectory() { |
119 Log.verbose("\n=========\nBasedir: " + basedir + "\n"); |
111 Log.verbose("\n=========\nBasedir: " + basedir + "\n"); |
120 for (String fname : files) { |
112 for (String fname : files) { |
121 Log.verbose(" " + fname); |
113 Log.verbose(" " + fname); |
122 } |
114 } |
123 Log.verbose("\n========"); |
115 Log.verbose("\n========"); |
124 } |
|
125 |
|
126 public Type getType() { |
|
127 return type; |
|
128 } |
|
129 |
|
130 public void setType(Type type) { |
|
131 this.type = type; |
|
132 } |
116 } |
133 |
117 |
134 public String getMode() { |
118 public String getMode() { |
135 return mode; |
119 return mode; |
136 } |
120 } |