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

Method run

basex-core/src/main/java/org/basex/core/cmd/Set.java:39–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37 }
38
39 @Override
40 protected boolean run() {
41 final String name = args[0].toUpperCase(Locale.ENGLISH), val = args[1];
42 Options opts = options;
43
44 // check static options: only "debug" can be changed by admin users
45 boolean debug = false;
46 if(context.user().has(Perm.ADMIN)) {
47 final Option<?> opt = soptions.option(name);
48 if(opt == StaticOptions.DEBUG) {
49 debug = true;
50 opts = soptions;
51 } else if(opt != null) {
52 return error(GLOBAL_OPTION_X, name);
53 }
54 }
55
56 try {
57 // set value and return info string with new value
58 opts.assign(name, val);
59 // assign static debugging flag
60 if(debug) Prop.debug = opts.get(StaticOptions.DEBUG);
61 return info(name + COLS + opts.get(opts.option(name)));
62 } catch(final BaseXException ex) {
63 Util.debug(ex);
64 return error(Util.message(ex));
65 }
66 }
67
68 @Override
69 public void addLocks() {

Callers 1

setMethod · 0.95

Calls 10

assignMethod · 0.95
getMethod · 0.95
optionMethod · 0.95
debugMethod · 0.95
messageMethod · 0.95
infoMethod · 0.65
hasMethod · 0.45
userMethod · 0.45
optionMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected