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

Method init

basex-core/src/main/java/org/basex/core/cmd/Run.java:35–54  ·  view source on GitHub ↗

Initializes the specified input. @param ctx database context @return success flag

(final Context ctx)

Source from the content-addressed store, hash-verified

33 * @return success flag
34 */
35 @Override
36 protected boolean init(final Context ctx) {
37 if(file == null) {
38 // check file reference
39 file = uri.isEmpty() ? IO.get(args[0]) : IO.get(uri).merge(args[0]);
40 if(!file.exists() || file.isDir()) {
41 error = Util.info(RES_NOT_FOUND_X, ctx.user().has(Perm.CREATE) ? file : args[0]);
42 } else {
43 try {
44 // interpret as commands if input ends with command script suffix
45 if(file.hasSuffix(IO.BXSSUFFIX)) return init(file.readString(), file.path(), ctx);
46 // otherwise, interpret input as xquery
47 commands.add(new XQuery(file.readString()).baseURI(file.path()));
48 } catch(final IOException ex) {
49 error = Util.message(ex);
50 }
51 }
52 }
53 return error == null;
54 }
55}

Callers 15

initServerMethod · 0.45
buildMethod · 0.45
buildMethod · 0.45
buildMethod · 0.45
buildMethod · 0.45
optimizeMethod · 0.45
buildMethod · 0.45
buildMethod · 0.45
buildMethod · 0.45
putMethod · 0.45
buildMethod · 0.45
buildMethod · 0.45

Calls 14

getMethod · 0.95
infoMethod · 0.95
messageMethod · 0.95
hasSuffixMethod · 0.80
addMethod · 0.65
isEmptyMethod · 0.45
mergeMethod · 0.45
existsMethod · 0.45
isDirMethod · 0.45
hasMethod · 0.45
userMethod · 0.45
readStringMethod · 0.45

Tested by

no test coverage detected