use of picocli.CommandLine.Command in project neo4j by neo4j.
the class StoreInfoCommand method execute.
@Override
public void execute() {
var storageEngineFactory = StorageEngineFactory.defaultStorageEngine();
var config = CommandHelpers.buildConfig(ctx, allowCommandExpansion);
var neo4jLayout = Neo4jLayout.of(config);
try (var fs = ctx.fs();
var jobScheduler = createInitialisedScheduler();
var pageCache = StandalonePageCacheFactory.createPageCache(fs, jobScheduler, PageCacheTracer.NULL)) {
validatePath(fs, all, path, neo4jLayout);
if (all) {
var collector = structured ? Collectors.joining(",", "[", "]") : Collectors.joining(System.lineSeparator() + System.lineSeparator());
var result = Arrays.stream(fs.listFiles(path)).sorted(comparing(Path::getFileName)).map(dbPath -> neo4jLayout.databaseLayout(dbPath.getFileName().toString())).filter(dbLayout -> Validators.isExistingDatabase(fs, dbLayout)).map(dbLayout -> printInfo(fs, dbLayout, pageCache, storageEngineFactory, config, structured, true)).collect(collector);
ctx.out().println(result);
} else {
var databaseLayout = neo4jLayout.databaseLayout(path.getFileName().toString());
ctx.out().println(printInfo(fs, databaseLayout, pageCache, storageEngineFactory, config, structured, false));
}
} catch (CommandFailedException e) {
throw e;
} catch (Exception e) {
throw new CommandFailedException(format("Failed to execute command: '%s'.", e.getMessage()), e);
}
}
Aggregations