String user = args[5];
try {
Properties properties = org.dbwiki.lib.IO.loadProperties(configFile);
WikiServer server = new WikiServerStandalone(properties);
// attempt to generate a schema from the input file
// 1. get input file stream
InputStream in = null;
URL inputURL = new File(inputName).toURI().toURL();
if (inputName.endsWith(".gz")) {
in = new GZIPInputStream(inputURL.openStream());
} else {
in = inputURL.openStream();
}
// 2. parse to infer schema
StructureParser structureParser = new StructureParser();
new SAXCallbackInputHandler(structureParser, false).parse(in, false, false);
in.close();
if (structureParser.hasException()) {
throw structureParser.getException();
}
DatabaseSchema databaseSchema = structureParser.getDatabaseSchema(path);
// register the database with the server
server.registerDatabase(name, title, path, inputURL, databaseSchema, server.users().get(user), 1, 0);
} catch (Exception exception) {
exception.printStackTrace();
System.exit(0);
}
}