protected Object doExecute()

in features/src/main/java/org/apache/karaf/cellar/features/shell/RepoListCommand.java [55:91]


    protected Object doExecute() throws Exception {
        // check if the group  exists
        Group group = groupManager.findGroupByName(groupName);
        if (group == null) {
            System.err.println("Cluster group " + groupName + " doesn't exist");
            return null;
        }

        Map<String, RepositoryState> repositories = gatherRepositories();

        ShellTable table = new ShellTable();
        table.column("Repository");
        table.column("Located").alignCenter();
        table.column("URL");
        for (String url : repositories.keySet()) {
            RepositoryState state = repositories.get(url);
            String located = "";
            boolean local = state.isLocal();
            boolean cluster = state.isCluster();
            if (local && cluster)
                located = "cluster/local";
            if (local && !cluster) {
                if (onlyCluster)
                    continue;
                located = "local";
            }
            if (cluster && !local) {
                if (onlyLocal)
                    continue;
                located = "cluster";
            }
            table.addRow().addContent(state.getName(), located, url);
        }
        table.print(System.out, !noFormat);

        return null;
    }