本文整理了Java中org.apache.jena.atlas.json.JSON.read()
方法的一些代码示例,展示了JSON.read()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSON.read()
方法的具体详情如下:
包路径:org.apache.jena.atlas.json.JSON
类名称:JSON
方法名:read
[英]Read a JSON object from a file
[中]从文件中读取JSON对象
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-cmds
public static DeltaServerConfig read(String file) {
JsonObject obj = JSON.read(file);
return create(obj);
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-server-local
/**
* Look for {@link DataSource DataSources} in a disk area given by {@code location}.
* <p>
* Scan the given area for directories (must have a config file), check they are enabled,
* and deal with {@code log_type}.
*/
public static List<DataSourceDescription> scanForLogs(Path location, PatchStore ps) {
// PatchStore's that rely on the scan of local directories and checking the "log_type" field.
Pair<List<Path>, List<Path>> pair = scanDirectory(location);
List<Path> dataSourcePaths = pair.getLeft();
List<Path> disabledDataSources = pair.getRight();
//dataSourcePaths.forEach(p->LOG.info("Data source paths: "+p));
disabledDataSources.forEach(p->LOG.info("Data source: "+p+" : Disabled"));
List<DataSourceDescription> descriptions = ListUtils.toList
(dataSourcePaths.stream()
.map(p->{
// Extract name from disk name.
String dsName = p.getFileName().toString();
// read config file.
JsonObject sourceObj = JSON.read(p.resolve(FileNames.DS_CONFIG).toString());
DataSourceDescription dsd = DataSourceDescription.fromJson(sourceObj);
if ( ! Objects.equals(dsName, dsd.getName()) )
throw new DeltaConfigException("Names do not match: directory="+dsName+", dsd="+dsd);
return dsd;
})
.filter(Objects::nonNull)
);
return descriptions;
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-server-local
/** Parse a configuration file. */
public Builder parse(String configFile) {
Path path = Paths.get(configFile);
if ( ! Files.exists(path) )
throw new DeltaConfigException("File not found: "+configFile);
// -- version
JsonObject obj = JSON.read(configFile);
int version = JSONX.getInt(obj, F_VERSION, -99);
if ( version == -99 ) {
LOG.warn("No version number for the configuration file : assuming 'current'");
version = DeltaConst.SYSTEM_VERSION;
}
if ( version != SYSTEM_VERSION )
throw new DeltaConfigException("Version number for LocalServer must be "+DeltaConst.SYSTEM_VERSION+".");
this.configFile = configFile;
// -- log provider
logProvider = DPS.PatchStoreFileProvider;
String logTypeName = JSONX.getStrOrNull(obj, F_LOG_TYPE);
if ( logTypeName != null ) {
String providerName = PatchStoreMgr.canonical(logTypeName);
if ( providerName == null )
providerName = DeltaConst.LOG_FILE;
logProvider = providerName;
}
setProperty(DeltaConst.pDeltaFile, path.getParent().toString());
return this;
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-fuseki-server
private void parseConf(BackupConfig cfg, String cfgFile) {
try {
JsonObject obj = JSON.read(cfgFile);
cfg.port = obj.get(jPort).getAsNumber().value().intValue();
JsonArray a = obj.get(jLogs).getAsArray();
a.forEach(elt-> {
BackupArea area = parseLogObject(cfg, elt);
cfg.logs.add(area);
});
} catch (Exception ex) {
throw new CmdException("Failed to process configuration file: "+ex.getMessage());
}
}
代码示例来源:origin: apache/jena
static StoreParams read(Location location) {
String fn = location.getPath(TDB_CONFIG_FILE) ;
JsonObject obj = JSON.read(fn) ;
return StoreParamsCodec.decode(obj) ;
}
}
代码示例来源:origin: apache/jena
static StoreParams read(Location location) {
String fn = location.getPath(Names.TDB_CONFIG_FILE) ;
JsonObject obj = JSON.read(fn) ;
return StoreParamsCodec.decode(obj) ;
}
}
代码示例来源:origin: org.apache.jena/jena-tdb2
static StoreParams read(Location location) {
String fn = location.getPath(Names.TDB_CONFIG_FILE) ;
JsonObject obj = JSON.read(fn) ;
return StoreParamsCodec.decode(obj) ;
}
}
代码示例来源:origin: org.apache.jena/jena-tdb
static StoreParams read(Location location) {
String fn = location.getPath(TDB_CONFIG_FILE) ;
JsonObject obj = JSON.read(fn) ;
return StoreParamsCodec.decode(obj) ;
}
}
代码示例来源:origin: apache/jena
String httpsSetup = getValue(argHttps);
JsonObject httpsConf = JSON.read(httpsSetup);
Path path = Paths.get(httpsSetup).toAbsolutePath();
String keystore = httpsConf.get("keystore").getAsString().value();
代码示例来源:origin: org.apache.jena/jena-fuseki-main
String httpsSetup = getValue(argHttps);
JsonObject httpsConf = JSON.read(httpsSetup);
Path path = Paths.get(httpsSetup).toAbsolutePath();
String keystore = httpsConf.get("keystore").getAsString().value();
内容来源于网络,如有侵权,请联系作者删除!