Examples of ShellTable


Examples of org.apache.karaf.shell.table.ShellTable

    boolean noFormat;

    protected Object doExecute() throws Exception {
        Map<String, String> loggers = logService.getLevel(logger);

        ShellTable table = new ShellTable();
        table.column("Logger");
        table.column("Level");

        for (String logger : loggers.keySet()) {
            table.addRow().addContent(logger, loggers.get(logger));
        }

        table.print(System.out, !noFormat);

        return null;
    }
View Full Code Here

Examples of org.apache.karaf.shell.table.ShellTable

    public void setWebContainerService(WebContainerService webContainerService) {
        this.webContainerService = webContainerService;
    }
   
    public Object doExecute() throws Exception {
      ShellTable table = new ShellTable();
        table.column(new Col("ID"));
        table.column(new Col("State"));
        table.column(new Col("Web-State"));
        table.column(new Col("Level"));
        table.column(new Col("Web-ContextPath"));
        table.column(new Col("Name"));
       
        java.util.List<WebBundle> webBundles = webContainerService.list();
        if (webBundles != null && !webBundles.isEmpty()) {
            for (WebBundle webBundle : webBundles) {
              table.addRow().addContent(
                        webBundle.getBundleId(),
                        webBundle.getState(),
                        webBundle.getWebState(),
                        webBundle.getLevel(),
                        webBundle.getContextPath(),
                        webBundle.getName());
            }
           
        }
        table.print(System.out, !noFormat);
        return null;
    }
View Full Code Here

Examples of org.apache.karaf.shell.table.ShellTable

    }

    protected Object doExecute() throws Exception {
        List<JaasRealm> realms = getRealms();

        ShellTable table = new ShellTable();
        table.column("Index");
        table.column("Realm Name");
        table.column("Login Module Class Name");

        if (realms != null && realms.size() > 0) {
            int index = 1;
            for (JaasRealm realm : realms) {
                String realmName = realm.getName();
                AppConfigurationEntry[] entries = realm.getEntries();

                if (entries != null && entries.length > 0) {
                    for (int i = 0; i < entries.length; i++) {
                        String moduleClass = (String) entries[i].getOptions().get(ProxyLoginModule.PROPERTY_MODULE);
                        table.addRow().addContent(index++, realmName, moduleClass);
                    }
                }
            }
        }

        table.print(System.out, !noFormat);

        return null;
    }
View Full Code Here

Examples of org.apache.karaf.shell.table.ShellTable

        FrameworkStartLevel fsl = getBundleContext().getBundle(0).adapt(FrameworkStartLevel.class);
        if (fsl != null) {
            System.out.println("START LEVEL " + fsl.getStartLevel() + " , List Threshold: " + bundleLevelThreshold);
        }

        ShellTable table = new ShellTable();
        table.column("ID").alignRight();
        table.column("State");
        table.column("Lvl").alignRight();
        table.column("Version");
        table.column(getNameHeader());
       
        for (int i = 0; i < bundles.length; i++) {
            Bundle bundle = bundles[i];
            BundleInfo info = this.bundleService.getInfo(bundle);
            if (info.getStartLevel() >= bundleLevelThreshold) {
                String name = getNameToShow(info) + printFragments(info) + printHosts(info);
                String version = info.getVersion();
                table.addRow().addContent(info.getBundleId(), getStateString(info.getState()),
                        info.getStartLevel(), version, name);
            }
        }
        table.print(System.out, !noFormat);

        return null;
    }
View Full Code Here

Examples of org.apache.karaf.shell.table.ShellTable

    @Override
    protected Object doExecute(BackingEngine engine) throws Exception {
        List<UserPrincipal> users = engine.listUsers();

        ShellTable table = new ShellTable();
        table.column("User Name");
        table.column("Group");
        table.column("Role");

        for (UserPrincipal user : users) {
            List<String> reportedRoles = new ArrayList<String>();
            String userName = user.getName();

            for (GroupPrincipal group : engine.listGroups(user)) {
                reportedRoles.addAll(displayGroupRoles(engine, userName, group, table));
            }

            for (RolePrincipal role : engine.listRoles(user)) {
                String roleName = role.getName();
                if (reportedRoles.contains(roleName)) {
                    continue;
                }
                reportedRoles.add(roleName);
                table.addRow().addContent(userName, "", roleName);
            }

            if (reportedRoles.size() == 0) {
                table.addRow().addContent(userName, "", "");
            }

        }

        table.print(System.out, !noFormat);

        return null;
    }
View Full Code Here

Examples of org.apache.karaf.shell.table.ShellTable

    @Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
    boolean noFormat;
   
    public Object doExecute() throws Exception {

        ShellTable table = new ShellTable();
        table.column("KAR Name");

        for (String karName : this.getKarService().list()) {
            table.addRow().addContent(karName);
        }

        table.print(System.out, !noFormat);

        return null;
    }
View Full Code Here

Examples of org.apache.karaf.shell.table.ShellTable

    protected void doExecute(FeaturesService featuresService) throws Exception {
        if (reload) {
            reloadAllRepos(featuresService);
        }
       
        ShellTable table = new ShellTable();
        table.column("Repository");
        table.column("URL");
        table.emptyTableText("No repositories available");

        Repository[] repos = featuresService.listRepositories();
       for (Repository repo : repos) {
            if (repo != null) {
               table.addRow().addContent(repo.getName(), repo.getURI().toString());
            }
       }
       table.print(System.out, !noFormat);
    }
View Full Code Here

Examples of org.apache.karaf.shell.table.ShellTable

                for (StackTraceElement ste : st) {
                    System.out.println(ste.getClassName() + "." + ste.getMethodName() + " line: " + ste.getLineNumber());
                }
            }
        } else if (list) {
            ShellTable table = new ShellTable();
            table.column("Id");
            table.column("Name");
            table.column("State");
            table.column("CPU time");
            table.column("Usr time");
            for (ThreadInfo thread : threadInfos.values()) {
                long id = thread.getThreadId();
                table.addRow().addContent(
                        id,
                        thread.getThreadName(),
                        thread.getThreadState(),
                        threadsBean.getThreadCpuTime(id) / 1000000,
                        threadsBean.getThreadUserTime(id) / 1000000);
            }
            table.print(System.out, !noFormat);
        } else {
            ThreadGroup group = Thread.currentThread().getThreadGroup();
            while (group.getParent() != null) {
                group = group.getParent();
            }
View Full Code Here

Examples of org.apache.karaf.shell.table.ShellTable

    boolean noFormat;

    protected void doExecute(FeaturesService featuresService) throws Exception {
        boolean needsLegend = false;
       
        ShellTable table = new ShellTable();
        table.column("Name");
        table.column("Version");
        table.column("Installed");
        table.column("Repository");
        table.column("Description").maxSize(50);
        table.emptyTableText(onlyInstalled ? "No features installed" : "No features available");

        List<Repository> repos = Arrays.asList(featuresService.listRepositories());
        for (Repository r : repos) {
            List<Feature> features = Arrays.asList(r.getFeatures());
            if (ordered) {
                Collections.sort(features, new FeatureComparator());
            }
            for (Feature f : features) {
                if (onlyInstalled && !featuresService.isInstalled(f)) {
                    // Filter out not installed features if we only want to see the installed ones
                    continue;
                }
                table.addRow().addContent(
                        f.getName(),
                        f.getVersion(),
                        featuresService.isInstalled(f) ? "x" : "",
                        r.getName(),
                        f.getDescription());
                if (isInstalledViaDeployDir(r.getName())) {
                    needsLegend = true;
                }
            }
        }

        table.print(System.out, !noFormat);

        if (needsLegend) {
            System.out.println("* Installed via deploy directory");
        }

View Full Code Here

Examples of org.apache.karaf.shell.table.ShellTable

    @Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
    boolean noFormat;

    protected void doExecute(FeaturesService admin) throws Exception {
        ShellTable table = new ShellTable();
        table.column("Version");
        table.column("Repository");
        table.column("Repository URL");
        table.emptyTableText("No versions available for features '" + feature + "'");
            
        for (Repository r : Arrays.asList(admin.listRepositories())) {
            for (Feature f : r.getFeatures()) {

                if (f.getName().equals(feature)) {
                    table.addRow().addContent(f.getVersion(), r.getName(), r.getURI());
                }
            }
        }

        table.print(System.out, !noFormat);
    }
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.