org.crsh.cli.completers
Class AbstractPathCompleter<P>

java.lang.Object
  extended by org.crsh.cli.completers.AbstractPathCompleter<P>
All Implemented Interfaces:
Completer
Direct Known Subclasses:
FileCompleter, JNDIHandler.JNDICompleter

public abstract class AbstractPathCompleter<P>
extends Object
implements Completer


Constructor Summary
AbstractPathCompleter()
           
 
Method Summary
 Completion complete(ParameterDescriptor parameter, String prefix)
          Query the completer for a set of completions for the given prefix.
protected abstract  boolean exists(P path)
           
protected abstract  Collection<P> getChilren(P path)
           
protected abstract  String getCurrentPath()
           
protected abstract  String getName(P path)
           
protected abstract  P getPath(String path)
           
protected abstract  boolean isDirectory(P path)
           
protected abstract  boolean isFile(P path)
           
private  Completion listDir(P dir, String filter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPathCompleter

public AbstractPathCompleter()
Method Detail

getCurrentPath

protected abstract String getCurrentPath()
                                  throws Exception
Throws:
Exception

getPath

protected abstract P getPath(String path)
                      throws Exception
Throws:
Exception

exists

protected abstract boolean exists(P path)
                           throws Exception
Throws:
Exception

isDirectory

protected abstract boolean isDirectory(P path)
                                throws Exception
Throws:
Exception

isFile

protected abstract boolean isFile(P path)
                           throws Exception
Throws:
Exception

getChilren

protected abstract Collection<P> getChilren(P path)
                                     throws Exception
Throws:
Exception

getName

protected abstract String getName(P path)
                           throws Exception
Throws:
Exception

complete

public final Completion complete(ParameterDescriptor parameter,
                                 String prefix)
                          throws Exception
Description copied from interface: Completer

Query the completer for a set of completions for the given prefix. The returned Completion object provides the possible completion matching the prefix argument.

Specified by:
complete in interface Completer
Parameters:
parameter - the completed parameter
prefix - the prefix to complete
Returns:
the possible suffix map
Throws:
Exception - any exception that would prevent completion to perform correctly

listDir

private Completion listDir(P dir,
                           String filter)
                    throws Exception
Throws:
Exception


Copyright © 2014 eXo Platform SAS. All Rights Reserved.