Package org.apache.karaf.shell.console.completer

Examples of org.apache.karaf.shell.console.completer.StringsCompleter


     *
     * @see org.apache.karaf.shell.console.Completer#complete(java.lang.String,
     *      int, java.util.List)
     */
    public int complete(String buffer, int cursor, List<String> candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            for (Component component : scrService.getComponents()) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Component Name to work on: " + component.getName());
                }
                if (ScrActionSupport.showHiddenComponent(component)) {
                    // We display all because we are overridden
                    if (availableComponent(component)) {
                        delegate.getStrings().add(component.getName());
                    }
                } else {
                    if (ScrActionSupport.isHiddenComponent(component)) {
                        // do nothing
                    } else {
                        // We aren't hidden so print it
                        if (availableComponent(component)) {
                            delegate.getStrings().add(component.getName());
                        }
                    }
                }
            }
        } catch (Exception e) {
            logger.warn("Exception completing the command request: " + e.getLocalizedMessage());
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here


public class NamesCompleter implements Completer {

    private JndiService jndiService;

    public int complete(String buffer, int cursor, List candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            for (String name : jndiService.names().keySet()) {
                delegate.getStrings().add(name);
            }
        } catch (Exception e) {
            // nothing to do
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

public class ServicesIdCompleter implements Completer {

    private BundleContext bundleContext;

    public int complete(String buffer, int cursor, List candidates) {
        StringsCompleter delegate = new StringsCompleter();
        Bundle[] bundles = bundleContext.getBundles();
        for (Bundle bundle : bundles) {
            ServiceReference[] references = bundle.getRegisteredServices();
            if (references != null) {
                for (ServiceReference reference : references) {
                    if (reference.getProperty(Constants.SERVICE_ID) != null) {
                        delegate.getStrings().add(reference.getProperty(Constants.SERVICE_ID).toString());
                    }
                }
            }
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

public class ContextsCompleter implements Completer {

    private JndiService jndiService;

    public int complete(String buffer, int cursor, List candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            List<String> contexts = jndiService.contexts();
            for (String context : contexts) {
                delegate.getStrings().add(context);
            }
        } catch (Exception e) {
            // nothing to do
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

        this.bundleContext = bundleContext;
    }

    public int complete(final String buffer, final int cursor, final List candidates) {
        Collection<String> artifacts = getComponentsAndAssemblies();
        StringsCompleter delegate = new StringsCompleter(artifacts);
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

     *
     * @see org.apache.karaf.shell.console.Completer#complete(java.lang.String,
     *      int, java.util.List)
     */
    public int complete(String buffer, int cursor, List<String> candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            for (Component component : scrService.getComponents()) {
                if (availableComponent(component)) {
                    delegate.getStrings().add(component.getName());
                }
            }
        } catch (Exception e) {
            // Ignore
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

     * @param cursor it's the position of the cursor
     * @param candidates the list of completions proposed to the user
     */
    public int complete(String buffer, int cursor, List candidates) {

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

    public void setFeaturesService(FeaturesService featuresService) {
        this.featuresService = featuresService;
    }

    public int complete(final String buffer, final int cursor, final List candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            for (Repository repository : featuresService.listRepositories()) {
                delegate.getStrings().add(repository.getURI().toString());
            }
        } catch (Exception e) {
            // Ignore
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

    public void setFeaturesService(FeaturesService featuresService) {
        this.featuresService = featuresService;
    }

    public int complete(final String buffer, final int cursor, final List candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            for (Feature feature : featuresService.listFeatures()) {
                if (acceptsFeature(feature)) {
                    delegate.getStrings().add(feature.getName());
                }
            }
        } catch (Exception e) {
            // Ignore
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

    public void setFeaturesService(FeaturesService featuresService) {
        this.featuresService = featuresService;
    }

    public int complete(final String buffer, final int cursor, final List candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            for (Repository repository : featuresService.listRepositories()) {
                delegate.getStrings().add(repository.getName());
            }
        } catch (Exception e) {
            // Ignore
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

TOP

Related Classes of org.apache.karaf.shell.console.completer.StringsCompleter

Copyright © 2018 www.massapicom. 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.