use of org.infinispan.cli.connection.Connection in project infinispan by infinispan.
the class Ls method exec.
@Override
public CommandResult exec(ContextAwareCommandInvocation invocation) throws CommandException {
try {
Connection connection = invocation.getContext().getConnection();
connection.refreshServerInfo();
Resource resource = connection.getActiveResource().getResource(path);
for (String item : resource.getChildrenNames()) {
invocation.println(item);
}
return CommandResult.SUCCESS;
} catch (IOException e) {
throw new CommandException(e);
}
}
use of org.infinispan.cli.connection.Connection in project infinispan by infinispan.
the class BackupCompleter method getAvailableItems.
@Override
Collection<String> getAvailableItems(Context context) throws IOException {
Connection connection = context.getConnection();
String container = connection.getActiveContainer().getName();
return context.getConnection().getBackupNames(container);
}
use of org.infinispan.cli.connection.Connection in project infinispan by infinispan.
the class SiteCompleter method getAvailableItems.
@Override
protected Collection<String> getAvailableItems(ContextAwareCompleterInvocation invocation) throws IOException {
Context context = invocation.context;
Command<?> cmd = invocation.getCommand();
Connection connection = context.getConnection();
Optional<String> cacheName = getCacheName(context, cmd);
return cacheName.map(name -> getAvailableSites(connection, name)).orElseGet(connection::getSitesView);
}
use of org.infinispan.cli.connection.Connection in project infinispan by infinispan.
the class SchemaCompleter method getAvailableItems.
@Override
Collection<String> getAvailableItems(Context context) throws IOException {
Connection connection = context.getConnection();
ContainerResource container = connection.getActiveResource().findAncestor(ContainerResource.class);
return container != null ? connection.getAvailableSchemas(container.getName()) : Collections.emptyList();
}
use of org.infinispan.cli.connection.Connection in project infinispan by infinispan.
the class CounterCompleter method getAvailableItems.
@Override
Collection<String> getAvailableItems(Context context) throws IOException {
Connection connection = context.getConnection();
ContainerResource container = connection.getActiveResource().findAncestor(ContainerResource.class);
return container != null ? connection.getAvailableCounters(container.getName()) : Collections.emptyList();
}
Aggregations