use of com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace in project titan by thinkaurelius.
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 e) {
throw new RuntimeException(e);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
use of com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace in project titan by thinkaurelius.
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 com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace in project titan by thinkaurelius.
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 com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace in project titan by thinkaurelius.
the class ConfigurationPrinter method main.
public static void main(String[] args) throws FileNotFoundException, IllegalAccessException, NoSuchFieldException, ClassNotFoundException {
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]));
final boolean mutability = Boolean.valueOf(args[2]);
new ConfigurationPrinter(stream, mutability).write(root);
stream.flush();
stream.close();
}
Aggregations