当前位置: 首页>>代码示例>>Java>>正文


Java ShellTable.print方法代码示例

本文整理汇总了Java中org.apache.karaf.shell.support.table.ShellTable.print方法的典型用法代码示例。如果您正苦于以下问题:Java ShellTable.print方法的具体用法?Java ShellTable.print怎么用?Java ShellTable.print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.karaf.shell.support.table.ShellTable的用法示例。


在下文中一共展示了ShellTable.print方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {
    
    ShellTable table = new ShellTable();
    
    table.column("ID");
    table.column("Identifier");
    table.column("Options");
    
    getVertxService().deploymentIDs().forEach(id -> { 
            Deployment deployment = ((VertxInternal)getVertxService()).getDeployment(id);
            Row row = table.addRow();
            row.addContent(id, deployment.verticleIdentifier(), deployment.deploymentOptions().toJson());
        }
    );
    
    try {
        table.print(System.out);
    } catch (Throwable t)  {
        System.err.println("FAILED to write table");
    }
    
    return null;
}
 
开发者ID:ANierbeck,项目名称:Karaf-Vertx,代码行数:25,代码来源:VerticlesList.java

示例2: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {
    SharedData sharedData = getVertxService().sharedData();
    LocalMap<Object, Object> map = sharedData.getLocalMap(this.map);

    ShellTable table = new ShellTable();

    table.column("Map[" + this.map + "]\nKey");
    table.column("\nValue");

    if (keys != null) {
        keys.forEach(key -> {
            renderRow(map, table, key);
        });
    } else {
        map.keySet().forEach(key -> {
            renderRow(map, table, (String) key);
        });
    }
    
    table.print(System.out);

    return null;
}
 
开发者ID:ANierbeck,项目名称:Karaf-Vertx,代码行数:25,代码来源:VertxMapGet.java

示例3: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {

    ShellTable table = new ShellTable();
    table.column("Name");
    table.column("Version");
    table.column("Bundle Id");
    table.column("State");

    for (Factory factory : managerService.getFactories()) {
        table.addRow().addContent(factory.getName(), factory.getVersion(), factory.getBundleContext().getBundle().getBundleId(), (factory.getState() == Factory.VALID ? Ansi.ansi().fg(Ansi.Color.GREEN).a("VALID").reset().toString() : Ansi.ansi().fg(Ansi.Color.GREEN).a((factory.getState() == Factory.INVALID ? "INVALID" : "UNKNOWN")).reset().toString()));
    }

    table.print(System.out);

    return null;
}
 
开发者ID:andyphillips404,项目名称:awplab-core,代码行数:18,代码来源:FactoriesCommand.java

示例4: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {

    ShellTable table = new ShellTable();
    table.column("Name");
    table.column("Bundle Id");
    table.column("State");

    for (Architecture architecture : managerService.getArchitectures()) {
        InstanceDescription instanceDescription = architecture.getInstanceDescription();
        if (verbose || instanceDescription.getState() != ComponentInstance.DISPOSED) {
            table.addRow().addContent(instanceDescription.getName(), instanceDescription.getBundleId(), IPojoManagerService.instanceDescriptionState(instanceDescription.getState()));
        }
    }

    table.print(System.out);

    return null;
}
 
开发者ID:andyphillips404,项目名称:awplab-core,代码行数:20,代码来源:InstancesCommand.java

示例5: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {

    ShellTable table = new ShellTable();
    table.column("Alias");
    table.column("Class");
    //table.column("Bundle Id");
    //table.column("State");

        for (RestService restProvider : managerService.getProviders()) {
            table.addRow().addContent(restProvider.getAlias(), restProvider.getClass().getName());
        }

    table.print(System.out);

    return null;
}
 
开发者ID:andyphillips404,项目名称:awplab-core,代码行数:18,代码来源:ProvidersCommand.java

示例6: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {

    ShellTable table = new ShellTable();
    table.column("Path");
    table.column("Bundle Id");
    table.column("Bundle");
    table.column("UI Class");
    table.column("Production Mode");
    //table.column("Bundle Id");
    //table.column("State");

    for (VaadinProvider vaadinProvider : vaadinManager.getProviders()) {
        Bundle bundle = FrameworkUtil.getBundle(vaadinProvider.getClass());
        table.addRow().addContent(vaadinProvider.getPath(), bundle.getBundleId(), bundle.getSymbolicName(), vaadinProvider.getUIClass().getSimpleName(), vaadinProvider.productionMode());
    }

    table.print(System.out);

    return null;
}
 
开发者ID:andyphillips404,项目名称:awplab-core,代码行数:22,代码来源:ProvidersCommand.java

示例7: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {
    List<Task<?>> tasks = taskExecutorService.getTasks();
    ShellTable table = new ShellTable();
    table.column("ID");
    table.column("Name");
    table.column("Description");
    table.column("StartTime");
    table.column("Pourcentage");
    for (Task<?> task : tasks) {
        Date startDate = new Date(task.getStartTime());
        String pourcentage = Integer.toString((int) (task.getCompletionPourcentage() * 100.0)) + "%";
        table.addRow().addContent(task.getIdentifier(),
                task.getName(),
                task.getDescription(),
                startDate.toString(),
                pourcentage);
    }
    table.print(session.getConsole());
    return null;
}
 
开发者ID:Jahia,项目名称:jahia-loganalyzer,代码行数:22,代码来源:ListShellCommand.java

示例8: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {
    final ShellTable table = new ShellTable();
    table.column(new Col("Alias"));
    table.column(new Col("Reference"));

    final CredentialStore credentialStore = CredentialStoreHelper.credentialStoreFromEnvironment();

    for (final String alias : credentialStore.getAliases()) {
        table.addRow().addContent(alias, CredentialStoreHelper.referenceForAlias(alias));
    }

    table.print(System.out);

    return null;
}
 
开发者ID:jboss-fuse,项目名称:fuse-karaf,代码行数:17,代码来源:ListCredentialStore.java

示例9: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {

    JsonObject metrics = (metricsBaseName != null) ? metricsService.getMetricsSnapshot(metricsBaseName)
            : metricsService.getMetricsSnapshot(getVertxService());

    ShellTable table = new ShellTable();

    table.noHeaders().column(new Col("key")).column(new Col("value")).emptyTableText("nothing found");
    
    metrics.forEach(mapEntry -> {
        if (mapEntry.getValue() instanceof String)
            table.addRow().addContent(mapEntry.getKey(), mapEntry.getValue());
        else {
            JsonObject subMap = (JsonObject) mapEntry.getValue();
            subMap.forEach(subMapEntry -> {
                table.addRow().addContent(mapEntry.getKey()+":"+subMapEntry.getKey(), subMapEntry.getValue());
            });
        }
    });

    try {
        table.print(System.out);
    } catch (Throwable t) {
        System.err.println("FAILED to write table");
    }

    return null;
}
 
开发者ID:ANierbeck,项目名称:Karaf-Vertx,代码行数:30,代码来源:VertxMetrics.java

示例10: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {

    ShellTable table = new ShellTable();
    table.column("Provider");
    table.column("Mapper");


    for (JacksonJaxrsService provider : managerService.getJaxrsProviders()) {
        table.addRow().addContent(provider.getProviderClass().getName(), provider.getMapperClass().getName());
    }
    table.print(System.out);

    return null;
}
 
开发者ID:andyphillips404,项目名称:awplab-core,代码行数:16,代码来源:ProvidersCommand.java

示例11: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {
	ShellTable table = new ShellTable();
	// ID
	Col column = table.column("ID");
	column.alignCenter().bold();
	// Label
	column = table.column("Name");
	column.alignCenter().cyan();
	// Version
	column = table.column("Version");
	column.alignCenter().cyan();
	// Create Date
	column = table.column("Create Date");
	column.alignCenter();
	// Modify Date
	column = table.column("Modify Date");
	column.alignCenter();
	// Deleted
	column = table.column("Deleted");
	column.alignCenter();

	List<? extends IPolicy> list = policyDao.findAll(IPolicy.class, null);
	if (list != null) {
		for (IPolicy policy : list) {
			Row row = table.addRow();
			row.addContent(policy.getId(), policy.getLabel(), policy.getPolicyVersion(), policy.getCreateDate(),
					policy.getModifyDate() != null ? policy.getModifyDate() : "", policy.isDeleted() ? "x" : "");
		}
	}
	table.print(System.out);

	return null;
}
 
开发者ID:Pardus-LiderAhenk,项目名称:lider,代码行数:35,代码来源:PolicyListCommand.java

示例12: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {
	ShellTable table = new ShellTable();
	// ID
	Col column = table.column("ID");
	column.alignCenter().bold();
	// DN List
	column = table.column("DN List");
	column.alignCenter().cyan().maxSize(100);
	// DN Type
	column = table.column("DN Type");
	column.alignCenter().cyan();
	// Owner UID
	column = table.column("Owner UID");
	column.alignCenter();
	// Policy ID
	column = table.column("Related Policy ID");
	column.alignCenter();
	// Task ID
	column = table.column("Related Task ID");
	column.alignCenter();

	List<? extends ICommand> list = commandDao.findAll(ICommand.class, null);
	if (list != null) {
		for (ICommand command : list) {
			Row row = table.addRow();
			row.addContent(command.getId(), command.getDnList(), command.getDnType(), command.getCommandOwnerUid(),
					command.getPolicy() != null ? command.getPolicy().getId() : null,
					command.getTask() != null ? command.getTask().getId() : null);
		}
	}
	table.print(System.out);

	return null;
}
 
开发者ID:Pardus-LiderAhenk,项目名称:lider,代码行数:36,代码来源:CommandListCommand.java

示例13: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {
	ShellTable table = new ShellTable();
	// ID
	Col column = table.column("ID");
	column.alignCenter().bold();
	// Label
	column = table.column("Label");
	column.alignCenter().cyan();
	// Plugin
	column = table.column("Related Plugin");
	column.alignCenter();
	// Create Date
	column = table.column("Create Date");
	column.alignCenter();
	// Deleted
	column = table.column("Deleted");
	column.alignCenter();

	List<? extends IProfile> list = profileDao.findAll(IProfile.class, null);
	if (list != null) {
		for (IProfile profile : list) {
			Row row = table.addRow();
			row.addContent(profile.getId(), profile.getLabel(),
					profile.getPlugin().getName() + "-" + profile.getPlugin().getVersion(), profile.getCreateDate(),
					profile.isDeleted() ? "x" : "");
		}
	}
	table.print(System.out);

	return null;
}
 
开发者ID:Pardus-LiderAhenk,项目名称:lider,代码行数:33,代码来源:ProfileListCommand.java

示例14: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override
public Object execute() throws Exception {
	ShellTable table = new ShellTable();
	// ID
	Col column = table.column("ID");
	column.alignCenter().bold();
	// Label
	column = table.column("Name");
	column.alignCenter().cyan();
	// Version
	column = table.column("Version");
	column.alignCenter().cyan();
	// Create Date
	column = table.column("Create Date");
	column.alignCenter();
	// Modify Date
	column = table.column("Modify Date");
	column.alignCenter();
	// Deleted
	column = table.column("Deleted");
	column.alignCenter();

	List<? extends IPlugin> list = pluginDao.findAll(IPlugin.class, null);
	if (list != null) {
		for (IPlugin plugin : list) {
			if (name != null && !name.equalsIgnoreCase(plugin.getName())) {
				continue;
			}
			Row row = table.addRow();
			row.addContent(plugin.getId(), plugin.getName(), plugin.getVersion(), plugin.getCreateDate(),
					plugin.getModifyDate() != null ? plugin.getModifyDate() : "", plugin.isDeleted() ? "x" : "");
		}
	}
	table.print(System.out);

	return null;
}
 
开发者ID:Pardus-LiderAhenk,项目名称:lider,代码行数:38,代码来源:PluginListCommand.java

示例15: execute

import org.apache.karaf.shell.support.table.ShellTable; //导入方法依赖的package包/类
@Override public Object execute() throws Exception {
    BundleContext context = FrameworkUtil.getBundle(BackendListCommand.class).getBundleContext();
    List<ServiceReference<ConfigBackend>> references = new ArrayList<>(context
            .getServiceReferences(ConfigBackend.class, "(order=*)"));

    // Build the table
    ShellTable table = new ShellTable();

    table.column("Order").alignRight();
    table.column("Name").alignLeft();
    table.column("Service").alignLeft();
    table.column("Configuration").alignLeft();
    table.column("Save Policy").alignLeft();
    table.emptyTableText("No backends available");

    references.sort((x, y) -> ((Integer) x.getProperty("order")).compareTo((Integer) y.getProperty("order")));

    for (ServiceReference<ConfigBackend> reference : references) {
        ConfigBackend service = context.getService(reference);
        int order = (int) reference.getProperty("order");
        String name = (String) reference.getProperty("name");
        String svc = (String) reference.getProperty("service");
        String savePolicy = (String) reference.getProperty("save");
        if (savePolicy == null) {
            savePolicy = "NONE";
        }
        List<String> cfg = new ArrayList<>();
        for (String key : reference.getPropertyKeys()) {
            if (!SYSTEM_KEYS.contains(key)) {
                cfg.add(key + "=" + reference.getProperty(key));
            }
        }
        table.addRow().addContent(order, name, svc, cfg.stream().collect(Collectors.joining(", ")), savePolicy);
        context.ungetService(reference);
    }

    // Print it
    table.print(System.out);
    return null;
}
 
开发者ID:yrashk,项目名称:etcetera,代码行数:41,代码来源:BackendListCommand.java


注:本文中的org.apache.karaf.shell.support.table.ShellTable.print方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。