@@ -151,35 +151,34 @@ protected V1ConfigMap computeDomainConfigMap() {
151
151
metadata .setLabels (labels );
152
152
153
153
cm .setMetadata (metadata );
154
- cm .setData (loadScripts ());
154
+ cm .setData (loadScripts (domainNamespace ));
155
155
156
156
return cm ;
157
157
}
158
158
159
- private synchronized Map <String , String > loadScripts () {
159
+ private static synchronized Map <String , String > loadScripts (String domainNamespace ) {
160
160
URI uri = null ;
161
161
try {
162
- uri = getClass () .getResource (SCRIPT_LOCATION ).toURI ();
162
+ uri = ScriptConfigMapStep . class .getResource (SCRIPT_LOCATION ).toURI ();
163
163
} catch (URISyntaxException e ) {
164
164
LOGGER .warning (MessageKeys .EXCEPTION , e );
165
165
throw new RuntimeException (e );
166
166
}
167
-
168
167
try {
169
168
if ("jar" .equals (uri .getScheme ())) {
170
169
try (FileSystem fileSystem = FileSystems .newFileSystem (uri , Collections .<String , Object >emptyMap ())) {
171
- return walkScriptsPath (fileSystem .getPath (SCRIPTS ));
170
+ return walkScriptsPath (fileSystem .getPath (SCRIPTS ), domainNamespace );
172
171
}
173
172
} else {
174
- return walkScriptsPath (Paths .get (uri ));
173
+ return walkScriptsPath (Paths .get (uri ), domainNamespace );
175
174
}
176
175
} catch (IOException e ) {
177
176
LOGGER .warning (MessageKeys .EXCEPTION , e );
178
177
throw new RuntimeException (e );
179
178
}
180
179
}
181
180
182
- private Map <String , String > walkScriptsPath (Path scriptsDir ) throws IOException {
181
+ private static Map <String , String > walkScriptsPath (Path scriptsDir , String domainNamespace ) throws IOException {
183
182
try (Stream <Path > walk = Files .walk (scriptsDir , 1 )) {
184
183
Map <String , String > data = walk .filter (i -> !Files .isDirectory (i )).collect (Collectors .toMap (
185
184
i -> i .getFileName ().toString (),
@@ -189,7 +188,7 @@ private Map<String, String> walkScriptsPath(Path scriptsDir) throws IOException
189
188
}
190
189
}
191
190
192
- private byte [] read (Path path ) {
191
+ private static byte [] read (Path path ) {
193
192
try {
194
193
return Files .readAllBytes (path );
195
194
} catch (IOException io ) {
0 commit comments