use of org.apache.rya.shell.util.RyaDetailsFormatter in project incubator-rya by apache.
the class RyaAdminCommands method printInstanceDetails.
@CliCommand(value = PRINT_INSTANCE_DETAILS_CMD, help = "Print information about how the Rya instance is configured.")
public String printInstanceDetails() {
// Fetch the command that is connected to the store.
final ShellState shellState = state.getShellState();
final RyaClient commands = shellState.getConnectedCommands().get();
final String ryaInstance = shellState.getRyaInstanceName().get();
try {
final Optional<RyaDetails> details = commands.getGetInstanceDetails().getDetails(ryaInstance);
if (details.isPresent()) {
return new RyaDetailsFormatter().format(shellState.getStorageType().get(), details.get());
} else {
return "This instance of Rya does not have a Rya Details table. Consider migrating to a newer version of Rya.";
}
} catch (final InstanceDoesNotExistException e) {
throw new RuntimeException(String.format("A Rya instance named '%s' does not exist.", ryaInstance), e);
} catch (final RyaClientException e) {
throw new RuntimeException("Could not get the instance details. Reason: " + e.getMessage(), e);
}
}
Aggregations