Package org.apache.karaf.shell.support.table

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


    private PackageService packageService;

    @Override
    public Object execute() throws Exception {
        SortedMap<String, PackageRequirement> imports = packageService.getImports();
        ShellTable table = new ShellTable();
        table.column(new Col(onlyPackage ? "Package name" : "Filter"));
        table.column(new Col("Optional"));
        table.column(new Col("ID"));
        table.column(new Col("Bundle Name"));
        table.column(new Col("Resolveable"));
       
        for (String filter : imports.keySet()) {
            PackageRequirement req = imports.get(filter);
            Bundle bundle = req.getBundle();
            String firstCol = onlyPackage ? req.getPackageName() : req.getFilter();
            table.addRow().addContent(firstCol, req.isOptional() ? "optional" : "", bundle.getBundleId(), bundle.getSymbolicName(), req.isResolveable());
        }
        table.print(System.out, !noFormat);
        return null;
    }
View Full Code Here


        } else {
            query = "(|(presentationname=*" + substr + "*)(symbolicname=*" + substr + "*))";
        }
        Resource[] resources = admin.discoverResources(query);

        ShellTable table = new ShellTable();
        table.column("Name");
        table.column("Symbolic Name");
        table.column("Version");
        table.emptyTableText("No matching bundles");

        for (Resource resource : resources) {
            table.addRow().addContent(emptyIfNull(resource.getPresentationName()),
                    emptyIfNull(resource.getSymbolicName()),
                    emptyIfNull(resource.getVersion()));
        }

        table.print(System.out, !noFormat);
    }
View Full Code Here

        return null;
    }

  private void showExports() {
    SortedMap<String, PackageVersion> exports = packageService.getExports();
        ShellTable table = new ShellTable();
        table.column(new Col("Package Name"));
        table.column(new Col("Version"));
        table.column(new Col("ID"));
        table.column(new Col("Bundle Name"));
       
        for (String key : exports.keySet()) {
            PackageVersion pVer = exports.get(key);
            for (Bundle bundle : pVer.getBundles()) {
                table.addRow().addContent(pVer.getPackageName(),pVer.getVersion().toString(), bundle.getBundleId(), bundle.getSymbolicName());
            }
        }
        table.print(System.out, !noFormat);
  }
View Full Code Here

  }
   
    private void checkDuplicateExports() {
        Bundle[] bundles = bundleContext.getBundles();
        SortedMap<String, PackageVersion> packageVersionMap = getDuplicatePackages(bundles);
        ShellTable table = new ShellTable();
        table.column(new Col("Package Name"));
        table.column(new Col("Version"));
        table.column(new Col("Exporting bundles (ID)"));
      
        for (String key : packageVersionMap.keySet()) {
            PackageVersion pVer = packageVersionMap.get(key);
            if (pVer.getBundles().size() > 1) {
              String pBundles = getBundlesSt(pVer.getBundles());
              table.addRow().addContent(pVer.getPackageName(), pVer.getVersion().toString(), pBundles);
            }
        }
        table.print(System.out, !noFormat);
    }
View Full Code Here

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

    protected void doExecute(RepositoryAdmin admin) {

        ShellTable table = new ShellTable();
        table.column("Index");
        table.column("OBR URL");
        table.emptyTableText("No OBR repository URL");

        Repository[] repos = admin.listRepositories();
        if (repos != null) {
            for (int i = 0; i < repos.length; i++) {
                table.addRow().addContent(i, repos[i].getURI());
            }
        }

        table.print(System.out, !noFormat);
    }
View Full Code Here

                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

@Service
public class ListAction extends SubsystemSupport implements Action {

    @Override
    public Object execute() throws Exception {
        ShellTable table = new ShellTable();
        table.column("ID").alignRight();
        table.column("SymbolicName");
        table.column("Version");
        table.column("State");
        table.column("Type");
        table.column("Parents");
        table.column("Children");

        for (Subsystem ss : getSubsystems()) {
            table.addRow().addContent(
                    ss.getSubsystemId(),
                    ss.getSymbolicName(),
                    ss.getVersion(),
                    ss.getState().toString(),
                    getType(ss),
                    getSubsytemIds(ss.getParents()),
                    getSubsytemIds(ss.getChildren())
            );
        }
        table.print(System.out);
        return null;
    }
View Full Code Here

    @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

        return null;
    }

    @Override
    public Object execute() throws Exception {
        ShellTable table = new ShellTable();
        table.column("Index");
        table.column("Realm Name");
        table.column("Login Module Class Name");

        List<JaasRealm> realms = getRealms(hidden);
        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

    @Reference
    Scheduler scheduler;

    @Override
    public Object execute() throws Exception {
        ShellTable table = new ShellTable();
        table.column("Name");
        table.column("Schedule");
        Map<Object, ScheduleOptions> jobs = scheduler.getJobs();
        for (Map.Entry<Object, ScheduleOptions> entry : jobs.entrySet()) {
            table.addRow().addContent(entry.getValue().name(), entry.getValue().schedule());
        }
        table.print(System.out);
        return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.karaf.shell.support.table.ShellTable

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.