Package org.apache.karaf.shell.support.completers

Examples of org.apache.karaf.shell.support.completers.StringsCompleter.complete()


                }
                completer.getStrings().add("--help");
                if (argIndex == 1) {
                    int res;
                    if (argIndex < args.length) {
                        res = completer.complete(session, new ArgumentCommandLine(args[argIndex], commandLine.getArgumentPosition()), candidates);
                    } else {
                        res = completer.complete(session, new ArgumentCommandLine("", 0), candidates);
                    }
                    return res + (commandLine.getBufferPosition() - commandLine.getArgumentPosition());
                } else if (!verifyCompleter(session, completer, args[1])) {
View Full Code Here


                if (argIndex == 1) {
                    int res;
                    if (argIndex < args.length) {
                        res = completer.complete(session, new ArgumentCommandLine(args[argIndex], commandLine.getArgumentPosition()), candidates);
                    } else {
                        res = completer.complete(session, new ArgumentCommandLine("", 0), candidates);
                    }
                    return res + (commandLine.getBufferPosition() - commandLine.getArgumentPosition());
                } else if (!verifyCompleter(session, completer, args[1])) {
                    return -1;
                }
View Full Code Here

                }
                return -1;
            }
            protected boolean verifyCompleter(Session session, Completer completer, String argument) {
                List<String> candidates = new ArrayList<String>();
                return completer.complete(session, new ArgumentCommandLine(argument, argument.length()), candidates) != -1 && !candidates.isEmpty();
            }
        };
    }

    protected void printHelp(PrintStream out) {
View Full Code Here

                }
            }
        } catch (Exception e) {
            logger.warn("Exception completing the command request: " + e.getLocalizedMessage());
        }
        return delegate.complete(session, commandLine, candidates);
    }

    public abstract boolean availableComponent(Component component) throws Exception;

    /**
 
View Full Code Here

                    delegate.getStrings().add(realm.getName());
                }
        } catch (Exception e) {
            // Ignore
        }
        return delegate.complete(session, commandLine, candidates);
    }

}
View Full Code Here

                    delegate.getStrings().addAll(moduleClassNames);
                }
        } catch (Exception e) {
            // Ignore
        }
        return delegate.complete(session, commandLine, candidates);
    }

    /**
     * Finds the login module class name in the {@link JaasRealm} entries.
     * @param realm
View Full Code Here

        for (Instance instance : instanceService.getInstances()) {
            if (acceptsInstance(instance)) {
                delegate.getStrings().add(instance.getName());
            }
        }
        return delegate.complete(session, commandLine, candidates);
    }

    protected boolean acceptsInstance(Instance instance) {
        return true;
    }
View Full Code Here

                delegate.getStrings().add(datasourceFileName.replace("datasource-", "").replace(".xml", ""));
            }
        } catch (Exception e) {
            // nothing to do
        }
        return delegate.complete(session, commandLine, candidates);
    }

    public JdbcService getJdbcService() {
        return jdbcService;
    }
View Full Code Here

                delegate.getStrings().add(datasource);
            }
        } catch (Exception e) {
            // nothing to do
        }
        return delegate.complete(session, commandLine, candidates);
    }

    public JdbcService getJdbcService() {
        return jdbcService;
    }
View Full Code Here

        StringsCompleter delegate = new StringsCompleter();
        delegate.getStrings().add("one");
        delegate.getStrings().add("two");
        delegate.getStrings().add("three");
        return delegate.complete(session, commandLine, candidates);
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.