/** * Program entry point. * * @param args The command-line arguments. * @throws Exception If there is an error. */ public static void main(String[] args) throws Exception { System.exit(new FijiToolLauncher().run(new GetTool(), args)); } }
getPrintStream().printf("URI must be specified as an argument%n"); return FAILURE; } else if (nonFlagArgs.size() > 1) { getPrintStream().printf("Too many arguments: %s%n", nonFlagArgs); return FAILURE; getPrintStream().printf("Specify a cluster, instance, and " + "table with argument fiji://zkhost/instance/table%n"); return FAILURE; getPrintStream().printf("--max-versions must be positive, got %d%n", mMaxVersions); return FAILURE; getPrintStream().printf("Specify entity with --entity-id=eid%n"); return FAILURE; getPrintStream().printf("--timestamp must be like [0-9]*..[0-9]*, instead got %s%n", mTimestamp); return FAILURE; final Fiji fiji = Fiji.Factory.open(argURI, getConf()); try { final FijiTable table = fiji.openTable(argURI.getTable()); getPrintStream().println( "Looking up entity: " + ToolUtils.formatEntityId(entityId) + " from fiji table: " + argURI); return lookup(reader, request, entityId, mapTypeFamilies, groupTypeColumns); } finally {
/** * Prints the data for a single entity id. * * @param reader The reader. * @param request The data request. * @param entityId The entity id to lookup. * @param mapTypeFamilies The map type families to print. * @param groupTypeColumns The group type columns to print. * @return A program exit code (zero on success). */ private int lookup( FijiTableReader reader, FijiDataRequest request, EntityId entityId, Map<FamilyLayout, List<String>> mapTypeFamilies, Map<FamilyLayout, List<ColumnLayout>> groupTypeColumns) { try { final FijiRowData row = reader.get(entityId, request); if (hasVerboseDebug() && (!ToolUtils.formatEntityId(entityId).startsWith("hbase="))) { getPrintStream().printf("entity-id=%s%s%n", ToolUtils.HBASE_ROW_KEY_SPEC_PREFIX, Bytes.toStringBinary((entityId.getHBaseRowKey()))); } ToolUtils.printRow(row, mapTypeFamilies, groupTypeColumns, getPrintStream()); } catch (IOException ioe) { LOG.error(ioe.getMessage()); return FAILURE; } return SUCCESS; }