use of org.janusgraph.diskstorage.configuration.ConfigNamespace in project janusgraph by JanusGraph.
the class ConfigurationPrinter method getFullPath.
private String getFullPath(ConfigOption<?> opt) {
StringBuilder sb = new StringBuilder(64);
sb.insert(0, opt.getName());
for (ConfigNamespace parent = opt.getNamespace(); null != parent && !parent.isRoot(); parent = parent.getNamespace()) {
if (parent.isUmbrella())
sb.insert(0, "[X].");
sb.insert(0, ".");
sb.insert(0, parent.getName());
}
return sb.toString();
}
use of org.janusgraph.diskstorage.configuration.ConfigNamespace in project janusgraph by JanusGraph.
the class ConfigurationPrinter method main.
public static void main(String[] args) throws IOException, ReflectiveOperationException {
ReflectiveConfigOptionLoader.INSTANCE.loadStandard(ConfigurationPrinter.class);
// Write to filename argument
if (3 != args.length) {
System.err.println("Usage: " + ConfigurationPrinter.class.getName() + " <package.class.fieldname of a ConfigNamespace root> <output filename> <display mutabilities>");
System.exit(-1);
}
final ConfigNamespace root = stringToNamespace(args[0]);
final PrintStream stream = new PrintStream(new FileOutputStream(args[1]), false, UTF8_ENCODING);
final boolean mutability = Boolean.valueOf(args[2]);
new ConfigurationPrinter(stream, mutability).write(root);
stream.flush();
stream.close();
}
use of org.janusgraph.diskstorage.configuration.ConfigNamespace in project janusgraph by JanusGraph.
the class ConfigurationPrinter method printNamespace.
private void printNamespace(ConfigNamespace n, String prefix) {
String newPrefix = prefix + n.getName() + ".";
if (n.isUmbrella())
newPrefix += "[X].";
// Override for root namespace
if (n.isRoot())
newPrefix = "";
// Only print namespace if it contains (visible) options
if (!Iterables.isEmpty(getSortedChildOptions(n))) {
stream.println(getNamespaceSectionHeader(n, prefix));
stream.println(getTableHeader());
for (ConfigOption<?> o : getSortedChildOptions(n)) {
stream.println(getTableLineForOption(o, newPrefix));
}
stream.println(TABLE_FOOTER_LINES);
}
for (ConfigNamespace cn : getSortedChildNamespaces(n)) {
printNamespace(cn, newPrefix);
}
}
use of org.janusgraph.diskstorage.configuration.ConfigNamespace in project janusgraph by JanusGraph.
the class HadoopScanMapper method getJobRoot.
static ConfigNamespace getJobRoot(String confRootName) {
String[] tokens = confRootName.split("#");
String className = tokens[0];
String fieldName = tokens[1];
try {
Field f = Class.forName(className).getField(fieldName);
return (ConfigNamespace) f.get(null);
} catch (NoSuchFieldException | ClassNotFoundException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
Aggregations