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

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


    protected GroupManager groupManager;

    protected abstract boolean acceptsGroup(Group group);

    public int complete(String buffer, int cursor, List<String> candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            for (Group group : groupManager.listAllGroups()) {
                if (acceptsGroup(group)) {
                    String name = group.getName();
                    if (delegate.getStrings() != null && !delegate.getStrings().contains(name)) {
                        delegate.getStrings().add(name);
                    }
                }
            }
        } catch (Exception e) {
            // Ignore
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here


public class RealmCompleter implements Completer {

    private List<JaasRealm> realms;

    public int complete(String buffer, int cursor, List<String> candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            if (realms != null && !realms.isEmpty())
                for (JaasRealm realm : realms) {
                    delegate.getStrings().add(realm.getName());
                }
        } catch (Exception e) {
            // Ignore
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

public class AllBundlesVersionCompleter implements Completer {

    private BundleContext bundleContext;

    public int complete(String buffer, int cursor, List<String> candidates) {
        StringsCompleter delegate = new StringsCompleter();
        for (Bundle bundle : bundleContext.getBundles()) {
            delegate.getStrings().add(bundle.getVersion().toString());
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

public class AllBundlesNameCompleter implements Completer {
   
    private BundleContext bundleContext;
   
    public int complete(String buffer, int cursor, List<String> candidates) {
        StringsCompleter delegate = new StringsCompleter();
        for (Bundle bundle : bundleContext.getBundles()) {
            delegate.getStrings().add(bundle.getSymbolicName());
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

    protected ClusterManager clusterManager;
    protected GroupManager groupManager;

    public int complete(String buffer, int cursor, List<String> candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            Map<String, Group> groups = groupManager.listGroups();
            if (groups != null && !groups.isEmpty()) {
                for (String groupName : groups.keySet()) {
                    Map<String, Properties> configurationTable = clusterManager.getMap(Constants.CONFIGURATION_MAP + Configurations.SEPARATOR + groupName);
                    if (configurationTable != null && !configurationTable.isEmpty()) {
                        for (String pid : configurationTable.keySet()) {
                            if (delegate.getStrings() != null && !delegate.getStrings().contains(pid)) {
                                delegate.getStrings().add(pid);
                            }
                        }
                    }
                }
            }

        } catch (Exception e) {
            // Ignore
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

public abstract class NodeCompleterSupport implements Completer {

    private ClusterManager clusterManager;

    public int complete(String buffer, int cursor, List<String> candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            for (Node node : clusterManager.listNodes()) {
                if (acceptsNode(node)) {
                    String id = node.getId();
                    if (delegate.getStrings() != null && !delegate.getStrings().contains(id)) {
                        delegate.getStrings().add(id);
                    }
                }
            }
        } 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, @SuppressWarnings("rawtypes") 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

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

    public int complete(final String buffer, final int cursor, @SuppressWarnings("rawtypes") 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 setFeatureFinder(FeatureFinder featureFinder) {
        this.featureFinder = featureFinder;
    }

    public int complete(final String buffer, final int cursor, @SuppressWarnings("rawtypes") final List candidates) {
        StringsCompleter delegate = new StringsCompleter(Arrays.asList(featureFinder.getNames()));
        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, @SuppressWarnings("rawtypes") 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

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.