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


Java TableListing.addRow方法代码示例

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


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

示例1: listSpanReceivers

import org.apache.hadoop.tools.TableListing; //导入方法依赖的package包/类
private int listSpanReceivers(List<String> args) throws IOException {
  SpanReceiverInfo infos[] = remote.listSpanReceivers();
  if (infos.length == 0) {
    System.out.println("[no span receivers found]");
    return 0;
  }
  TableListing listing = new TableListing.Builder().
      addField("ID").
      addField("CLASS").
      showHeaders().
      build();
  for (SpanReceiverInfo info : infos) {
    listing.addRow("" + info.getId(), info.getClassName());
  }
  System.out.println(listing.toString());
  return 0;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:18,代码来源:TraceAdmin.java

示例2: run

import org.apache.hadoop.tools.TableListing; //导入方法依赖的package包/类
@Override
public int run(Configuration conf, List<String> args) throws IOException {
  if (!args.isEmpty()) {
    System.err.println("Can't understand argument: " + args.get(0));
    return 1;
  }

  final DistributedFileSystem dfs = AdminHelper.getDFS(conf);
  try {
    final TableListing listing = new TableListing.Builder()
      .addField("").addField("", true)
      .wrapWidth(AdminHelper.MAX_LINE_WIDTH).hideHeaders().build();
    final RemoteIterator<EncryptionZone> it = dfs.listEncryptionZones();
    while (it.hasNext()) {
      EncryptionZone ez = it.next();
      listing.addRow(ez.getPath(), ez.getKeyName());
    }
    System.out.println(listing.toString());
  } catch (IOException e) {
    System.err.println(prettifyException(e));
    return 2;
  }

  return 0;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:CryptoAdmin.java

示例3: getLongUsage

import org.apache.hadoop.tools.TableListing; //导入方法依赖的package包/类
@Override
public String getLongUsage() {
  TableListing listing = AdminHelper.getOptionDescriptionListing();
  listing.addRow("<path>", "A path to cache. The path can be " +
      "a directory or a file.");
  listing.addRow("<pool-name>", "The pool to which the directive will be " +
      "added. You must have write permission on the cache pool "
      + "in order to add new directives.");
  listing.addRow("-force",
      "Skips checking of cache pool resource limits.");
  listing.addRow("<replication>", "The cache replication factor to use. " +
      "Defaults to 1.");
  listing.addRow("<time-to-live>", "How long the directive is " +
      "valid. Can be specified in minutes, hours, and days, e.g. " +
      "30m, 4h, 2d. Valid units are [smhd]." +
      " \"never\" indicates a directive that never expires." +
      " If unspecified, the directive never expires.");
  return getShortUsage() + "\n" +
    "Add a new cache directive.\n\n" +
    listing.toString();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:CacheAdmin.java

示例4: getLongUsage

import org.apache.hadoop.tools.TableListing; //导入方法依赖的package包/类
@Override
public String getLongUsage() {
  TableListing listing = AdminHelper.getOptionDescriptionListing();
  listing.addRow("<id>", "The ID of the directive to modify (required)");
  listing.addRow("<path>", "A path to cache. The path can be " +
      "a directory or a file. (optional)");
  listing.addRow("-force",
      "Skips checking of cache pool resource limits.");
  listing.addRow("<replication>", "The cache replication factor to use. " +
      "(optional)");
  listing.addRow("<pool-name>", "The pool to which the directive will be " +
      "added. You must have write permission on the cache pool "
      + "in order to move a directive into it. (optional)");
  listing.addRow("<time-to-live>", "How long the directive is " +
      "valid. Can be specified in minutes, hours, and days, e.g. " +
      "30m, 4h, 2d. Valid units are [smhd]." +
      " \"never\" indicates a directive that never expires.");
  return getShortUsage() + "\n" +
    "Modify a cache directive.\n\n" +
    listing.toString();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:CacheAdmin.java

示例5: getLongUsage

import org.apache.hadoop.tools.TableListing; //导入方法依赖的package包/类
@Override
public String getLongUsage() {
  TableListing listing = getOptionDescriptionListing();
  listing.addRow("<path>", "A path to cache. The path can be " +
      "a directory or a file.");
  listing.addRow("<pool-name>", "The pool to which the directive will be " +
      "added. You must have write permission on the cache pool "
      + "in order to add new directives.");
  listing.addRow("-force",
      "Skips checking of cache pool resource limits.");
  listing.addRow("<replication>", "The cache replication factor to use. " +
      "Defaults to 1.");
  listing.addRow("<time-to-live>", "How long the directive is " +
      "valid. Can be specified in minutes, hours, and days, e.g. " +
      "30m, 4h, 2d. Valid units are [smhd]." +
      " \"never\" indicates a directive that never expires." +
      " If unspecified, the directive never expires.");
  return getShortUsage() + "\n" +
    "Add a new cache directive.\n\n" +
    listing.toString();
}
 
开发者ID:yncxcw,项目名称:FlexMap,代码行数:22,代码来源:CacheAdmin.java

示例6: run

import org.apache.hadoop.tools.TableListing; //导入方法依赖的package包/类
@Override
public int run(Configuration conf, List<String> args) throws IOException {
  if (!args.isEmpty()) {
    System.err.println("Can't understand argument: " + args.get(0));
    return 1;
  }

  final DistributedFileSystem dfs = getDFS(conf);
  try {
    final TableListing listing = new TableListing.Builder()
      .addField("").addField("", true)
      .wrapWidth(MAX_LINE_WIDTH).hideHeaders().build();
    final RemoteIterator<EncryptionZone> it = dfs.listEncryptionZones();
    while (it.hasNext()) {
      EncryptionZone ez = it.next();
      listing.addRow(ez.getPath(), ez.getKeyName());
    }
    System.out.println(listing.toString());
  } catch (IOException e) {
    System.err.println(prettifyException(e));
    return 2;
  }

  return 0;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:26,代码来源:CryptoAdmin.java

示例7: getLongUsage

import org.apache.hadoop.tools.TableListing; //导入方法依赖的package包/类
@Override
public String getLongUsage() {
  final TableListing listing = AdminHelper.getOptionDescriptionListing();
  listing.addRow("<path>", "The path of the encryption zone to create. " +
    "It must be an empty directory.");
  listing.addRow("<keyName>", "Name of the key to use for the " +
      "encryption zone.");
  return getShortUsage() + "\n" +
    "Create a new encryption zone.\n\n" +
    listing.toString();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:CryptoAdmin.java

示例8: getLongUsage

import org.apache.hadoop.tools.TableListing; //导入方法依赖的package包/类
@Override
public String getLongUsage() {
  final TableListing listing = AdminHelper.getOptionDescriptionListing();
  listing.addRow("<command-name>", "The command for which to get " +
      "detailed help. If no command is specified, print detailed help for " +
      "all commands");
  return getShortUsage() + "\n" +
      "Get detailed help about a command.\n\n" +
      listing.toString();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:AdminHelper.java

示例9: getLongUsage

import org.apache.hadoop.tools.TableListing; //导入方法依赖的package包/类
@Override
public String getLongUsage() {
  final TableListing listing = AdminHelper.getOptionDescriptionListing();
  listing.addRow("<path>",
      "The path of the file/directory for getting the storage policy");
  return getShortUsage() + "\n" +
      "Get the storage policy of a file/directory.\n\n" +
      listing.toString();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:StoragePolicyAdmin.java

示例10: getLongUsage

import org.apache.hadoop.tools.TableListing; //导入方法依赖的package包/类
@Override
public String getLongUsage() {
  final TableListing listing = getOptionDescriptionListing();
  listing.addRow("<path>",
      "The path of the file/directory for getting the storage policy");
  return getShortUsage() + "\n" +
      "Get the storage policy of a file/directory.\n\n" +
      listing.toString();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:10,代码来源:StoragePolicyAdmin.java

示例11: getLongUsage

import org.apache.hadoop.tools.TableListing; //导入方法依赖的package包/类
@Override
public String getLongUsage() {
  final TableListing listing = getOptionDescriptionListing();
  listing.addRow("<path>", "The path of the encryption zone to create. " +
    "It must be an empty directory.");
  listing.addRow("<keyName>", "Name of the key to use for the " +
      "encryption zone.");
  return getShortUsage() + "\n" +
    "Create a new encryption zone.\n\n" +
    listing.toString();
}
 
开发者ID:yncxcw,项目名称:FlexMap,代码行数:12,代码来源:CryptoAdmin.java

示例12: run

import org.apache.hadoop.tools.TableListing; //导入方法依赖的package包/类
@Override
public int run(Configuration conf, List<String> args) throws IOException {
  CacheDirectiveInfo.Builder builder =
      new CacheDirectiveInfo.Builder();
  String pathFilter = StringUtils.popOptionWithArgument("-path", args);
  if (pathFilter != null) {
    builder.setPath(new Path(pathFilter));
  }
  String poolFilter = StringUtils.popOptionWithArgument("-pool", args);
  if (poolFilter != null) {
    builder.setPool(poolFilter);
  }
  boolean printStats = StringUtils.popOption("-stats", args);
  String idFilter = StringUtils.popOptionWithArgument("-id", args);
  if (idFilter != null) {
    builder.setId(Long.parseLong(idFilter));
  }
  if (!args.isEmpty()) {
    System.err.println("Can't understand argument: " + args.get(0));
    return 1;
  }
  TableListing.Builder tableBuilder = new TableListing.Builder().
      addField("ID", Justification.RIGHT).
      addField("POOL", Justification.LEFT).
      addField("REPL", Justification.RIGHT).
      addField("EXPIRY", Justification.LEFT).
      addField("PATH", Justification.LEFT);
  if (printStats) {
    tableBuilder.addField("BYTES_NEEDED", Justification.RIGHT).
                addField("BYTES_CACHED", Justification.RIGHT).
                addField("FILES_NEEDED", Justification.RIGHT).
                addField("FILES_CACHED", Justification.RIGHT);
  }
  TableListing tableListing = tableBuilder.build();
  try {
    DistributedFileSystem dfs = AdminHelper.getDFS(conf);
    RemoteIterator<CacheDirectiveEntry> iter =
        dfs.listCacheDirectives(builder.build());
    int numEntries = 0;
    while (iter.hasNext()) {
      CacheDirectiveEntry entry = iter.next();
      CacheDirectiveInfo directive = entry.getInfo();
      CacheDirectiveStats stats = entry.getStats();
      List<String> row = new LinkedList<String>();
      row.add("" + directive.getId());
      row.add(directive.getPool());
      row.add("" + directive.getReplication());
      String expiry;
      // This is effectively never, round for nice printing
      if (directive.getExpiration().getMillis() >
          Expiration.MAX_RELATIVE_EXPIRY_MS / 2) {
        expiry = "never";
      } else {
        expiry = directive.getExpiration().toString();
      }
      row.add(expiry);
      row.add(directive.getPath().toUri().getPath());
      if (printStats) {
        row.add("" + stats.getBytesNeeded());
        row.add("" + stats.getBytesCached());
        row.add("" + stats.getFilesNeeded());
        row.add("" + stats.getFilesCached());
      }
      tableListing.addRow(row.toArray(new String[row.size()]));
      numEntries++;
    }
    System.out.print(String.format("Found %d entr%s%n",
        numEntries, numEntries == 1 ? "y" : "ies"));
    if (numEntries > 0) {
      System.out.print(tableListing);
    }
  } catch (IOException e) {
    System.err.println(AdminHelper.prettifyException(e));
    return 2;
  }
  return 0;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:78,代码来源:CacheAdmin.java


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