@Override public TransactionBuilder customOption(String k, Object v) { if (null == writableCustomOptions) throw new IllegalStateException("This builder was not constructed with setCustomOption support"); writableCustomOptions.set((ConfigOption<Object>)ConfigElement.parse(ROOT_NS, k).element, v); return this; }
public Map<ConfigElement.PathIdentifier,Object> getAll() { Map<ConfigElement.PathIdentifier,Object> result = Maps.newHashMap(); for (String key : config.getKeys("")) { Preconditions.checkArgument(StringUtils.isNotBlank(key)); try { final ConfigElement.PathIdentifier pid = ConfigElement.parse(getRootNamespace(),key); Preconditions.checkArgument(pid.element.isOption() && !pid.lastIsUmbrella); result.put(pid, get((ConfigOption) pid.element, pid.umbrellaElements)); } catch (IllegalArgumentException e) { log.debug("Ignored configuration entry for {} since it does not map to an option",key,e); } } return result; }
@Override public String get(String path) { ConfigElement.PathIdentifier pp = ConfigElement.parse(config.getRootNamespace(),path); if (pp.element.isNamespace()) { ConfigNamespace ns = (ConfigNamespace)pp.element;
@Override public UserModifiableConfiguration set(String path, Object value) { ConfigElement.PathIdentifier pp = ConfigElement.parse(config.getRootNamespace(),path); Preconditions.checkArgument(pp.element.isOption(),"Need to provide configuration option - not namespace: %s",path); ConfigOption option = (ConfigOption)pp.element; verifier.verifyModification(option); if (option.getDatatype().isArray()) { Class arrayType = option.getDatatype().getComponentType(); Object arr; if (value.getClass().isArray()) { int size = Array.getLength(value); arr = Array.newInstance(arrayType,size); for (int i=0;i<size;i++) { Array.set(arr,i,convertBasic(Array.get(value,i),arrayType)); } } else { arr = Array.newInstance(arrayType,1); Array.set(arr,0,convertBasic(value,arrayType)); } value = arr; } else { value = convertBasic(value,option.getDatatype()); } config.set(option,value,pp.umbrellaElements); return this; }
String value = apc.getString(key); try { ConfigElement.PathIdentifier pid = ConfigElement.parse(GraphDatabaseConfiguration.ROOT_NS, key);
m.group(3); try { ConfigElement.PathIdentifier pid = ConfigElement.parse(GraphDatabaseConfiguration.ROOT_NS, cfgKey); ConfigOption<?> opt = (ConfigOption<?>) pid.element;
private static void copyInputKeys(org.apache.hadoop.conf.Configuration hadoopConf, org.apache.commons.configuration.Configuration source) { // Copy IndexUpdateJob settings into the hadoop-backed cfg Iterator<String> iterator = source.getKeys(); while (iterator.hasNext()) { String key = iterator.next(); ConfigElement.PathIdentifier pid; try { pid = ConfigElement.parse(ROOT_NS, key); } catch (RuntimeException e) { log.debug("[inputkeys] Skipping {}", key, e); continue; } if (!pid.element.isOption()) continue; String k = ConfigElement.getPath(JanusGraphHadoopConfiguration.GRAPH_CONFIG_KEYS, true) + "." + key; String v = source.getProperty(key).toString(); hadoopConf.set(k, v); log.debug("[inputkeys] Set {}={}", k, v); } }
private static void copyInputKeys(org.apache.hadoop.conf.Configuration hadoopConf, org.apache.commons.configuration.Configuration source) { // Copy IndexUpdateJob settings into the hadoop-backed cfg Iterator<String> iterator = source.getKeys(); while (iterator.hasNext()) { String key = iterator.next(); ConfigElement.PathIdentifier pid; try { pid = ConfigElement.parse(ROOT_NS, key); } catch (RuntimeException e) { log.debug("[inputkeys] Skipping {}", key, e); continue; } if (!pid.element.isOption()) continue; String k = ConfigElement.getPath(JanusGraphHadoopConfiguration.GRAPH_CONFIG_KEYS, true) + "." + key; String v = source.getProperty(key).toString(); hadoopConf.set(k, v); log.debug("[inputkeys] Set {}={}", k, v); } }
Map<String, Object> jobConfMap = conf.getSubset(confRoot); for (Map.Entry<String, Object> jobConfEntry : jobConfMap.entrySet()) { hadoopJobConf.set((ConfigOption) ConfigElement.parse(confRoot, jobConfEntry.getKey()).element, jobConfEntry.getValue());
Map<String, Object> jobConfMap = conf.getSubset(confRoot); for (Map.Entry<String, Object> jobConfEntry : jobConfMap.entrySet()) { hadoopJobConf.set((ConfigOption) ConfigElement.parse(confRoot, jobConfEntry.getKey()).element, jobConfEntry.getValue());