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

Method run

basex-core/src/main/java/org/basex/core/cmd/Check.java:28–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26 }
27
28 @Override
29 protected boolean run() {
30 // close existing database
31 Close.close(context);
32
33 // input (can be path or XML string)
34 final String input = args[0].trim();
35 if(input.isEmpty()) return true;
36
37 // get path and database name, overwrite database name with generated name
38 final IO io = IO.get(input);
39 final String dbName = io.dbName();
40
41 // choose OPEN if user has no create permissions, or if database exists
42 final Command cmd = open(io, dbName) ? new Open(dbName) :
43 new CreateDB(dbName, io.exists() ? input : null);
44
45 // execute command
46 try {
47 final boolean ok = pushJob(cmd).run(context);
48 final String msg = cmd.info().trim();
49 return ok ? info(msg) : error(msg);
50 } finally {
51 popJob();
52 }
53 }
54
55 /**
56 * Checks if the addressed database can be opened, or needs to be (re)built.

Callers

nothing calls this directly

Calls 13

closeMethod · 0.95
getMethod · 0.95
dbNameMethod · 0.95
openMethod · 0.95
existsMethod · 0.95
infoMethod · 0.95
pushJobMethod · 0.80
popJobMethod · 0.80
runMethod · 0.65
infoMethod · 0.65
trimMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected