use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.
the class ServletListCommand method execute.
@Override
public Object execute() throws Exception {
ShellTable table = new ShellTable();
table.column(new Col("ID"));
table.column(new Col("Servlet"));
table.column(new Col("Servlet-Name"));
table.column(new Col("State"));
table.column(new Col("Alias"));
table.column(new Col("Url"));
for (ServletInfo info : servletService.getServlets()) {
table.addRow().addContent(info.getBundleId(), info.getClassName(), info.getName(), info.getStateString(), info.getAlias(), Arrays.toString(info.getUrls()));
}
table.print(System.out, !noFormat);
return null;
}
use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.
the class ListCommand method doExecute.
protected Object doExecute() throws Exception {
Instance[] instances = getInstanceService().getInstances();
ShellTable table = new ShellTable();
table.column("SSH Port").alignRight();
table.column("SSH Host").alignRight();
table.column("RMI Registry").alignRight();
table.column("RMI Registry Host").alignRight();
table.column("RMI Server").alignRight();
table.column("RMI Server Host").alignRight();
table.column("State");
table.column("PID");
table.column(getRightColumnHeader());
for (Instance instance : instances) {
table.addRow().addContent(instance.getSshPort(), instance.getSshHost(), instance.getRmiRegistryPort(), instance.getRmiRegistryHost(), instance.getRmiServerPort(), instance.getRmiServerHost(), instance.getState(), instance.getPid(), getRightColumnValue(instance));
}
table.print(System.out, !noFormat);
return null;
}
use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.
the class ProfileList method execute.
@Override
public Object execute() throws Exception {
List<String> ids = new ArrayList<>(profileService.getProfiles());
Collections.sort(ids);
ShellTable table = new ShellTable();
table.column("id");
table.column("parents");
for (String id : ids) {
Profile profile = profileService.getProfile(id);
if (profile != null && (hidden || !profile.isHidden())) {
String parents = join(" ", profile.getParentIds());
table.addRow().addContent(id, parents);
}
}
table.print(System.out);
return null;
}
use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.
the class DSFactoriesCommand method execute.
@Override
public Object execute() throws Exception {
ShellTable table = new ShellTable();
table.column("Name");
table.column("Class");
table.column("Version");
table.column("Registration bundle");
Set<DataSourceFactoryInfo> factories = new TreeSet<>(comparator);
Collection<ServiceReference<DataSourceFactory>> refs = context.getServiceReferences(DataSourceFactory.class, null);
for (ServiceReference<DataSourceFactory> ref : refs) {
DataSourceFactoryInfo info = new DataSourceFactoryInfo();
info.driverName = (String) ref.getProperty(DataSourceFactory.OSGI_JDBC_DRIVER_NAME);
info.driverClass = (String) ref.getProperty(DataSourceFactory.OSGI_JDBC_DRIVER_CLASS);
info.driverVersion = (String) ref.getProperty(DataSourceFactory.OSGI_JDBC_DRIVER_VERSION);
if (ref.getBundle() != null && ref.getBundle().getSymbolicName() != null) {
info.bundle = String.format("%s [%s]", ref.getBundle().getSymbolicName(), ref.getBundle().getBundleId());
} else {
info.bundle = "";
}
factories.add(info);
}
for (DataSourceFactoryInfo info : factories) {
table.addRow().addContent(info.driverName, info.driverClass, info.driverVersion, info.bundle);
}
table.print(System.out);
return null;
}
use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.
the class ListFeatureVersionsCommand method doExecute.
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);
}
Aggregations