예제 #1
0
파일: ListAction.java 프로젝트: raulk/karaf
  @Override
  protected Object doScrAction(ScrService scrService) throws Exception {
    ShellTable table = new ShellTable();
    table.column("ID");
    table.column("State");
    table.column("Component Name");

    Component[] components = scrService.getComponents();
    Arrays.sort(components, idComparator);
    for (Component component : ScrUtils.emptyIfNull(Component.class, components)) {
      if (showHidden) {
        // we display all because we are overridden
        table
            .addRow()
            .addContent(
                component.getId(), ScrUtils.getState(component.getState()), component.getName());
      } else {
        if (ScrActionSupport.isHiddenComponent(component)) {
          // do nothing
        } else {
          // we aren't hidden so print it
          table
              .addRow()
              .addContent(
                  component.getId(), ScrUtils.getState(component.getState()), component.getName());
        }
      }
    }
    table.print(System.out);

    return null;
  }
예제 #2
0
  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);
  }