use of annis.UsageException in project ANNIS by korpling.
the class AnnisAdminRunner method run.
@Override
public void run(String[] args) {
// print help if no argument is given
if (args.length == 0) {
throw new UsageException("missing command");
}
// first parameter is command
String command = args[0];
// following parameters are arguments for the command
List<String> commandArgs = Arrays.asList(args).subList(1, args.length);
if ("help".equals(command) || "--help".equals(command)) {
usage(null);
} else if ("init".equals(command)) {
doInit(commandArgs);
} else if ("import".equals(command)) {
doImport(commandArgs);
} else if ("export".equals(command)) {
doExport(commandArgs);
} else if ("delete".equals(command)) {
doDelete(commandArgs);
} else if ("copy".equals(command)) {
doCopy(commandArgs);
} else if ("list".equals(command)) {
doList();
} else if ("indexes".equals(command)) {
doIndexes();
} else if ("genexamples".equals(command)) {
doGenerateExampleQueries(commandArgs);
} else if ("delexamples".equals(command)) {
doDeleteExampleQueries(commandArgs);
} else if ("cleanup-data".equals(command)) {
doCleanupData(commandArgs);
} else if ("check-db-schema-version".equals(command)) {
doCheckDBSchemaVersion();
} else if ("dump".equals(command)) {
doDumpTable(commandArgs);
} else if ("restore".equals(command)) {
doRestoreTable(commandArgs);
} else {
throw new UsageException("Unknown command: " + command);
}
}
Aggregations