MCPcopy Create free account
hub / github.com/BaseXdb/basex / parse

Method parse

basex-api/src/main/java/org/basex/http/web/WebModules.java:355–381  ·  view source on GitHub ↗

Parses the specified path for modules with relevant annotations and caches new entries. @param root root path @param ctx database context @param cache cached modules @param old old cache @throws QueryException query exception @throws IOException I/O exception

(final Context ctx, final IOFile root,
      final HashMap<String, WebModule> cache, final HashMap<String, WebModule> old)

Source from the content-addressed store, hash-verified

353 * @throws IOException I/O exception
354 */
355 private static void parse(final Context ctx, final IOFile root,
356 final HashMap<String, WebModule> cache, final HashMap<String, WebModule> old)
357 throws QueryException, IOException {
358
359 // check if directory is to be skipped
360 final IOFile[] files = root.children();
361 for(final IOFile file : files) {
362 if(file.name().equals(IO.IGNORESUFFIX)) return;
363 }
364
365 for(final IOFile file : files) {
366 if(file.isDir()) {
367 parse(ctx, file, cache, old);
368 } else {
369 final String path = file.path();
370 if(file.hasSuffix(IO.XQSUFFIXES)) {
371 // retrieve existing module or create new instance
372 WebModule module = old.get(path);
373 if(module == null) module = new WebModule(file);
374
375 // parse updated module, add to cache
376 module.parse(ctx);
377 cache.put(path, module);
378 }
379 }
380 }
381 }
382}

Callers 1

cacheMethod · 0.95

Calls 9

parseMethod · 0.95
hasSuffixMethod · 0.80
nameMethod · 0.65
getMethod · 0.65
childrenMethod · 0.45
equalsMethod · 0.45
isDirMethod · 0.45
pathMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected