Returns the module cache. @param ctx database context @return module cache @throws QueryException query exception @throws IOException I/O exception
(final Context ctx)
| 322 | * @throws IOException I/O exception |
| 323 | */ |
| 324 | private synchronized HashMap<String, WebModule> cache(final Context ctx) |
| 325 | throws QueryException, IOException { |
| 326 | |
| 327 | final HashMap<String, WebModule> cache; |
| 328 | if(parsed) { |
| 329 | // module cache is still up-to-date |
| 330 | cache = modules; |
| 331 | } else { |
| 332 | // module cache needs to be updated |
| 333 | if(!path.exists()) throw HTTPStatus.NO_RESTXQ_DIRECTORY.get(); |
| 334 | |
| 335 | cache = new HashMap<>(); |
| 336 | parse(ctx, path, cache, modules); |
| 337 | modules = cache; |
| 338 | parsed = true; |
| 339 | } |
| 340 | |
| 341 | // update last access time |
| 342 | access = System.currentTimeMillis(); |
| 343 | return cache; |
| 344 | } |
| 345 | |
| 346 | /** |
| 347 | * Parses the specified path for modules with relevant annotations and caches new entries. |