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

Method run

basex-core/src/main/java/org/basex/core/cmd/AlterBackup.java:34–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32 }
33
34 @Override
35 protected boolean run() {
36 final String name = args[0], newname = args[1];
37 if(!Databases.validName(name)) return error(NAME_INVALID_X, name);
38 if(!Databases.validName(newname)) return error(NAME_INVALID_X, newname);
39
40 // rename all backups
41 final StringList backups = context.databases.backups(name);
42 if(backups.isEmpty()) return error(BACKUP_NOT_FOUND_X, name);
43
44 boolean ok = true;
45 for(final String backup : backups) {
46 try {
47 alter(backup, newname, soptions);
48 info(BACKUP_RENAMED_X, backup);
49 } catch(final IOException ex) {
50 Util.debug(ex);
51 info(BACKUP_NOT_RENAMED_X, backup);
52 ok = false;
53 }
54 }
55 return ok;
56 }
57
58 /**
59 * Drops a backup with the specified name.

Callers

nothing calls this directly

Calls 7

validNameMethod · 0.95
alterMethod · 0.95
debugMethod · 0.95
infoMethod · 0.65
errorMethod · 0.45
backupsMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected