org.crsh.cmdline.completers
Class JNDICompleter

java.lang.Object
  extended by org.crsh.cmdline.completers.JNDICompleter
All Implemented Interfaces:
Completer

public class JNDICompleter
extends Object
implements Completer


Constructor Summary
JNDICompleter()
           
 
Method Summary
 ValueCompletion complete(ParameterDescriptor<?> parameter, String prefix)
          Query the completer for a set of completion for the given prefix.
(package private)  ValueCompletion getJndiList(String prefix)
          Search JNDI Path in Context and put the result in ValueCompletion.
 String getJndiPath(String contextName, String ncName, String prefix)
          Make JndiPath String.
private static HashSet<String> initJndicontextNames()
          Create a list of context name to search in JNDI, e.g :contextName ["java:jboss/datasources", "",...] This list contains standard names to help search.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JNDICompleter

public JNDICompleter()
Method Detail

initJndicontextNames

private static HashSet<String> initJndicontextNames()
Create a list of context name to search in JNDI, e.g :contextName ["java:jboss/datasources", "",...] This list contains standard names to help search.


complete

public ValueCompletion complete(ParameterDescriptor<?> parameter,
                                String prefix)
                         throws Exception
Description copied from interface: Completer

Query the completer for a set of completion for the given prefix. The returned ValueCompletion object provides the possible suffixes matching the prefix argument. Each entry of the result maps to a possible completion: an entry key is the possible completion, its corresponding boolean value indicates wether the value can be further more completed or not.

The prefix value of the completion result is optional and gives a prefix to use more than one result is provided. The interest of the prefix is to limit the size of the completion to display when they can be long, for instance a pat completion returning several values could be display in columns, however only the last name of the path would be displayed and not the entire path.

The following guidelines should be respected:

Example: a completer that would complete colors could

Example: a completer that would complete java packages could

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

getJndiList

ValueCompletion getJndiList(String prefix)
Search JNDI Path in Context and put the result in ValueCompletion.

Returns:
ValueCompletion

getJndiPath

public String getJndiPath(String contextName,
                          String ncName,
                          String prefix)
Make JndiPath String.

Parameters:
contextName - String (e.g:java:jboss/)
ncName - (e.g:datasources)
Returns:
String (e.g:java:jboss/datasources)


Copyright © 2012 eXo Platform SAS. All Rights Reserved.