本文整理汇总了Java中org.apache.karaf.shell.support.table.ShellTable类的典型用法代码示例。如果您正苦于以下问题:Java ShellTable类的具体用法?Java ShellTable怎么用?Java ShellTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShellTable类属于org.apache.karaf.shell.support.table包,在下文中一共展示了ShellTable类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: execute
import org.apache.karaf.shell.support.table.ShellTable; //导入依赖的package包/类
/**
* Performs the creation of Credential store according to the given command line options.
*/
@Override
public Object execute() throws Exception {
final Map<String, String> attributes = attributesFromOptions(storeAttributes);
final Provider providerToUse = ProviderHelper.provider(provider);
final Map<String, String> credentialSourceConfiguration = createCredentialSourceConfiguration(credentialType,
credentialAttributes);
final CredentialSource credential = credentialType.createCredentialSource(credentialSourceConfiguration);
createCredentialStore(storeAlgorithm, attributes, credential, providerToUse);
final ShellTable table = new ShellTable();
table.column(new Col("Variable"));
table.column(new Col("Value"));
final StringBuilder buffy = new StringBuilder();
if (credentialType != Defaults.CREDENTIAL_TYPE) {
appendConfigurationTo(Collections.singletonMap("CREDENTIAL_STORE_PROTECTION_TYPE", credentialType.name()),
table, buffy);
}
appendConfigurationTo(credentialSourceConfiguration, table, buffy);
appendConfigurationTo(attributes.entrySet().stream()
.collect(Collectors.toMap(e -> "CREDENTIAL_STORE_ATTR_" + e.getKey(), Entry::getValue)), table, buffy);
System.out.println("In order to use this credential store set the following environment variables");
table.print(System.out);
System.out.println("Or simply use this:");
System.out.print(buffy.toString());
return null;
}
开发者ID:jboss-fuse,项目名称:fuse-karaf,代码行数:39,代码来源:CreateCredentialStore.java
示例17: renderRow
import org.apache.karaf.shell.support.table.ShellTable; //导入依赖的package包/类
private void renderRow(LocalMap<Object, Object> map, ShellTable table, String key) {
Object value = map.get(key);
Row row = table.addRow();
row.addContent(key, value);
}
开发者ID:ANierbeck,项目名称:Karaf-Vertx,代码行数:6,代码来源:VertxMapGet.java
示例18: doExecute
import org.apache.karaf.shell.support.table.ShellTable; //导入依赖的package包/类
@Override
public Object doExecute() throws Exception {
Session session = (Session) this.session
.get(SessionParameter.CASSANDRA_SESSION);
if (session == null) {
System.err
.println("No active session found--run the connect command first");
return null;
}
if (cql == null && fileLocation == null) {
System.err
.println("Either cql skript or a filename must be given.");
return null;
}
if (cql == null && fileLocation != null) {
byte[] encoded;
InputStream is = fileLocation.toURL().openStream ();
try (ByteArrayOutputStream os = new ByteArrayOutputStream();) {
byte[] buffer = new byte[0xFFFF];
for (int len; (len = is.read(buffer)) != -1;)
os.write(buffer, 0, len);
os.flush();
encoded = os.toByteArray();
} catch (IOException e) {
System.err.println("Can't read fileinput");
return null;
}
cql = new String(encoded, Charset.defaultCharset());
} else {
int start = 0;
int end = 0;
if (cql.startsWith("\"")) {
//need to remove quotes first
start = 1;
if (cql.endsWith("\"")) {
end = cql.lastIndexOf("\"");
}
cql = cql.substring(start, end);
}
}
ShellTable table = new ShellTable();
ResultSet execute = session.execute(cql);
cassandraRowFormater(table, execute);
table.print(System.out);
return null;
}
开发者ID:ANierbeck,项目名称:Karaf-Cassandra,代码行数:60,代码来源:CqlExecuter.java
示例19: appendConfigurationTo
import org.apache.karaf.shell.support.table.ShellTable; //导入依赖的package包/类
/**
* Adds the given configuration key-values to the displayed {@link ShellTable} and to the given
* {@link StringBuilder}. The table will contain the raw values, and the string will contain formated commands for
* setting the environment variables.
*
* @param configuration
* key-value environment variables to append
* @param table
* table to append to
* @param buffy
* string to append to
*/
private void appendConfigurationTo(final Map<String, String> configuration, final ShellTable table,
final StringBuilder buffy) {
for (final Entry<String, String> entry : configuration.entrySet()) {
final String key = entry.getKey();
final String value = entry.getValue();
table.addRow().addContent(key, value);
buffy.append("export ").append(key).append('=').append(value).append(System.lineSeparator());
}
}
开发者ID:jboss-fuse,项目名称:fuse-karaf,代码行数:23,代码来源:CreateCredentialStore.java
注:本文中的org.apache.karaf.shell.support.table.ShellTable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论