本文整理了Java中org.apache.tinkerpop.gremlin.util.config.YamlConfiguration.load()
方法的一些代码示例,展示了YamlConfiguration.load()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlConfiguration.load()
方法的具体详情如下:
包路径:org.apache.tinkerpop.gremlin.util.config.YamlConfiguration
类名称:YamlConfiguration
方法名:load
暂无
代码示例来源:origin: apache/tinkerpop
private static Configuration getConfiguration(final File configurationFile) {
if (!configurationFile.isFile())
throw new IllegalArgumentException(String.format("The location configuration must resolve to a file and [%s] does not", configurationFile));
try {
final String fileName = configurationFile.getName();
final String fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1);
switch (fileExtension) {
case "yml":
case "yaml":
final YamlConfiguration config = new YamlConfiguration();
config.load(configurationFile);
return config;
case "xml":
return new XMLConfiguration(configurationFile);
default:
return new PropertiesConfiguration(configurationFile);
}
} catch (final ConfigurationException e) {
throw new IllegalArgumentException(String.format("Could not load configuration at: %s", configurationFile), e);
}
}
}
代码示例来源:origin: hugegraph/hugegraph
public static void main(String[] args)
throws ConfigurationException, InterruptedException {
E.checkArgument(args.length == 1,
"Init store only accept one config file.");
E.checkArgument(args[0].endsWith(".yaml"),
"Init store only accept yaml config file.");
String confFile = args[0];
RegisterUtil.registerBackends();
YamlConfiguration config = new YamlConfiguration();
config.load(confFile);
List<ConfigurationNode> nodes = config.getRootNode()
.getChildren(GRAPHS);
E.checkArgument(nodes.size() == 1,
"Must contain one '%s' in config file '%s'",
GRAPHS, confFile);
List<ConfigurationNode> graphNames = nodes.get(0).getChildren();
E.checkArgument(!graphNames.isEmpty(),
"Must contain at least one graph");
for (ConfigurationNode graphName : graphNames) {
String configPath = graphName.getValue().toString();
initGraph(configPath);
}
HugeGraph.shutdown(30L);
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
private static Configuration getConfiguration(final File configurationFile) {
if (!configurationFile.isFile())
throw new IllegalArgumentException(String.format("The location configuration must resolve to a file and [%s] does not", configurationFile));
try {
final String fileName = configurationFile.getName();
final String fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1);
switch (fileExtension) {
case "yml":
case "yaml":
final YamlConfiguration config = new YamlConfiguration();
config.load(configurationFile);
return config;
case "xml":
return new XMLConfiguration(configurationFile);
default:
return new PropertiesConfiguration(configurationFile);
}
} catch (final ConfigurationException e) {
throw new IllegalArgumentException(String.format("Could not load configuration at: %s", configurationFile), e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!