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

Method parse

basex-api/src/main/java/org/basex/http/web/WebModule.java:48–76  ·  view source on GitHub ↗

Checks the module for relevant annotations. @param ctx database context @throws QueryException query exception @throws IOException I/O exception

(final Context ctx)

Source from the content-addressed store, hash-verified

46 * @throws IOException I/O exception
47 */
48 void parse(final Context ctx) throws QueryException, IOException {
49 final long ts = file.timeStamp();
50 if(time == ts) return;
51
52 time = ts;
53 content = file.readString();
54
55 functions.clear();
56 wsFunctions.clear();
57
58 try(QueryContext qc = qc(ctx)) {
59 // loop through all functions
60 final String name = file.name();
61 for(final StaticFunc sf : qc.functions) {
62 // only add functions that are defined in the same module (file)
63 if(sf.expr != null && name.equals(new IOFile(sf.info.path()).name())) {
64 final RestXqFunction rxf = new RestXqFunction(sf, this, qc);
65 if(rxf.parseAnnotations(null)) functions.add(rxf);
66 final WsFunction wxq = new WsFunction(sf, this, qc);
67 if(wxq.parseAnnotations(null)) wsFunctions.add(wxq);
68 }
69 }
70 } catch(final QueryException ex) {
71 if(ctx.soptions.get(StaticOptions.RESTXQERRORS)) throw ex;
72 // ignore modules that cannot be parsed
73 ctx.log.writeServer(LogType.ERROR, Util.message(ex));
74 Util.debug(ex);
75 }
76 }
77
78 /**
79 * Returns all RESTXQ functions.

Callers 8

parseMethod · 0.95
testStoreResourceMethod · 0.45
testSetContentAsDOMMethod · 0.45
testSetContentAsSAXMethod · 0.45
UTF16Example.pyFile · 0.45
getContentAsSAXMethod · 0.45
queryMethod · 0.45
chat.jsFile · 0.45

Calls 14

qcMethod · 0.95
parseAnnotationsMethod · 0.95
parseAnnotationsMethod · 0.95
messageMethod · 0.95
debugMethod · 0.95
writeServerMethod · 0.80
nameMethod · 0.65
addMethod · 0.65
getMethod · 0.65
timeStampMethod · 0.45
readStringMethod · 0.45
clearMethod · 0.45

Tested by 3

testStoreResourceMethod · 0.36
testSetContentAsDOMMethod · 0.36
testSetContentAsSAXMethod · 0.36