Search in sources :

Example 1 with CacheKeyResource

use of org.infinispan.cli.resources.CacheKeyResource in project infinispan by infinispan.

the class ContextImpl method changeResource.

@Override
public CommandResult changeResource(Class<? extends Resource> fromResource, String resourceType, String name) throws CommandException {
    try {
        Resource resource;
        if (fromResource != null) {
            resource = connection.getActiveResource().findAncestor(fromResource).getChild(resourceType, name);
        } else {
            resource = connection.getActiveResource().getResource(name);
        }
        if (!(resource instanceof CacheKeyResource)) {
            connection.setActiveResource(resource);
        }
        refreshPrompt();
        return CommandResult.SUCCESS;
    } catch (IOException e) {
        throw new CommandException(e);
    }
}
Also used : CacheKeyResource(org.infinispan.cli.resources.CacheKeyResource) CacheKeyResource(org.infinispan.cli.resources.CacheKeyResource) FileResource(org.aesh.io.FileResource) Resource(org.infinispan.cli.resources.Resource) IOException(java.io.IOException) CommandException(org.aesh.command.CommandException)

Aggregations

IOException (java.io.IOException)1 CommandException (org.aesh.command.CommandException)1 FileResource (org.aesh.io.FileResource)1 CacheKeyResource (org.infinispan.cli.resources.CacheKeyResource)1 Resource (org.infinispan.cli.resources.Resource)1