/** * Returns the name of the missing table. * @return the name of the missing table. */ public String getTableName() { return mTableURI.getTable(); }
/** * Print a removed table annotation. * * @param removedKey the removed annotation key. */ private void printRemovedTableAnnotation( final String removedKey ) { getPrintStream().printf("table: '%s'%n '%s'%n", mURI.getTable(), removedKey); }
/** * Reports the ZooKeeper node path for a Fiji table. * * @param tableURI URI of a Fiji table to report the ZooKeeper node path for. * @return the ZooKeeper node path for a Fiji table. */ public static File getTableDir(FijiURI tableURI) { return new File(getInstanceTablesDir(tableURI), tableURI.getTable()); }
/** * Reports the ZooKeeper node path for a Fiji table. * * @param tableURI URI of a Fiji table to report the ZooKeeper node path for. * @return the ZooKeeper node path for a Fiji table. */ public static File getTableDir(FijiURI tableURI) { return new File(getInstanceTablesDir(tableURI), tableURI.getTable()); }
/** * Print an annotation on the table specified in mURI. * * @param key the annotation key. * @param value the annotation value. */ private void printTableAnnotation( final String key, final String value ) { getPrintStream().printf("table: '%s'%n" + " '%s': '%s'%n", mURI.getTable(), key, value); }
/** {@inheritDoc} */ @Override protected void validateFlags() throws Exception { Preconditions.checkArgument((mTableURIFlag != null) && !mTableURIFlag.isEmpty(), "Specify a table with --table=fiji://hbase-address/fiji-instance/table"); mTableURI = FijiURI.newBuilder(mTableURIFlag).build(); Preconditions.checkArgument(mTableURI.getTable() != null, "Specify a table with --table=fiji://hbase-address/fiji-instance/table"); Preconditions.checkArgument(mMaxVersions >= 1, "Invalid maximum number of versions: {}, --max-versions must be >= 1", mMaxVersions); }
/** * Print several annotation key values on the table specified in mURI. * * @param kvs a mapping of keys and values. */ private void printTableAnnotations( final Map<String, String> kvs ) { getPrintStream().printf("table: '%s'%n", mURI.getTable()); for (Map.Entry<String, String> kv : kvs.entrySet()) { getPrintStream().printf(" '%s': '%s'%n", kv.getKey(), kv.getValue()); } }
/** * Print several removed table annotations. * * @param removedKeys the set of removed annotation keys. */ private void printRemovedTableAnnotations( final Set<String> removedKeys ) { getPrintStream().printf("table: '%s'%n", mURI.getTable()); for (String key : removedKeys) { getPrintStream().printf(" '%s'%n", key); } }
/** * Opens a connection. * @param fijiURI The fijiURI * @throws IOException If there is a connection error. */ public Connection(FijiURI fijiURI) throws IOException { final Configuration conf = HBaseConfiguration.create(); mFiji = Fiji.Factory.open(fijiURI); mFijiTable = mFiji.openTable(fijiURI.getTable()); }
/** {@inheritDoc} */ @Override protected void validateFlags() throws Exception { super.validateFlags(); Preconditions.checkArgument((mTargetURIFlag != null) && !mTargetURIFlag.isEmpty(), "Specify a target Fiji instance or table " + "with --target=fiji://hbase-adress/fiji-instance[/table]."); mTargetURI = FijiURI.newBuilder(mTargetURIFlag).build(); Preconditions.checkArgument(mFlushMeta || (mTargetURI.getTable() != null), "Specify a table with --fiji=fiji://hbase-cluster/fiji-instance/table" + " and/or specify a flush of metadata with --meta."); }
/** {@inheritDoc} */ @Override protected void validateFlags() throws Exception { super.validateFlags(); Preconditions.checkArgument((mTableURIFlag != null) && !mTableURIFlag.isEmpty(), "Specify the table to bulk-load into with " + "--table=fiji://hbase-address/fiji-instance/table"); mTableURI = FijiURI.newBuilder(mTableURIFlag).build(); Preconditions.checkArgument(mTableURI.getTable() != null, "Specify the table to bulk-load into with " + "--table=fiji://hbase-address/fiji-instance/table"); Preconditions.checkArgument((mHFileFlag != null) && !mHFileFlag.isEmpty(), "Specify the HFiles to bulk-load. " + "E.g. --hfile=hdfs://hdfs-cluster-address/path/to/hfile.dir/"); mHFile = new Path(mHFileFlag); }
/** {@inheritDoc} */ @Override protected void validateFlags() throws Exception { super.validateFlags(); Preconditions.checkArgument((mTableURIFlag != null) && !mTableURIFlag.isEmpty(), "Specify a target table to write synthesized data to with " + "--table=fiji://hbase-address/fiji-instance/table"); mTableURI = FijiURI.newBuilder(mTableURIFlag).build(); Preconditions.checkArgument(mTableURI.getTable() != null, "No table specified in target URI '%s'. " + "Specify a target table to write synthesized data to with " + "--table=fiji://hbase-address/fiji-instance/table", mTableURI); }
/** {@inheritDoc} */ @Override protected void setup() throws IOException { mFiji = Fiji.Factory.open(mTableURI, getConf()); mTable = mFiji.openTable(mTableURI.getTable()); }
/** {@inheritDoc} */ @Override protected void setup(Context hadoopContext) throws IOException, InterruptedException { super.setup(hadoopContext); final Configuration conf = hadoopContext.getConfiguration(); FijiURI tableURI; try { tableURI = FijiURI.newBuilder(conf.get(FijiConfKeys.OUTPUT_FIJI_TABLE_URI)).build(); } catch (FijiURIException kue) { throw new IOException(kue); } mFiji = Fiji.Factory.open(tableURI, hadoopContext.getConfiguration()); mTable = mFiji.openTable(tableURI.getTable()); mWriter = mTable.openTableWriter(); }
/** * Implements the --do=set operation. * * @param fiji Fiji instance. * @throws Exception on error. */ private void setLayout(Fiji fiji) throws Exception { final TableLayoutDesc layoutDesc = loadJsonTableLayoutDesc(mLayout); Preconditions.checkArgument(mTableURI.getTable().equals(layoutDesc.getName()), "Descriptor table name '%s' does not match URI %s.", layoutDesc.getName(), mTableURI); fiji.modifyTableLayout(layoutDesc, mDryRun, getPrintStream()); }
/** * Constructor. * * @param conf The job configuration. * @throws java.io.IOException If the input split cannot be opened. */ public FijiTableRecordWriter(Configuration conf) throws IOException { String fijiURIString = conf.get(FijiTableOutputFormat.CONF_FIJI_TABLE_URI); FijiURI fijiURI = FijiURI.newBuilder(fijiURIString).build(); mFiji = Fiji.Factory.open(fijiURI); mFijiTable = mFiji.openTable(fijiURI.getTable()); mFijiTableWriter = mFijiTable.openTableWriter(); }
/** * Flushes a fiji table with the name 'tableName'. * * @param hbaseAdmin An hbase admin utility. * @param tableURI URI of the Fiji table to flush. * @throws IOException If there is an error. * @throws InterruptedException If the thread is interrupted. */ private static void flushTable(HBaseAdmin hbaseAdmin, FijiURI tableURI) throws IOException, InterruptedException { final FijiManagedHBaseTableName hbaseTableName = FijiManagedHBaseTableName.getFijiTableName(tableURI.getInstance(), tableURI.getTable()); hbaseAdmin.flush(hbaseTableName.toString()); }
/** {@inheritDoc} */ @Override public void applyPermissionsToNewTable(FijiURI tableURI) throws IOException { // The argument must be for a table in the instance this manages. Preconditions.checkArgument( FijiURI.newBuilder(mInstanceUri).withTableName(tableURI.getTable()).build() .equals(tableURI)); for (FijiUser user : listAllUsers()) { grantHTablePermissions(user.getName(), FijiManagedHBaseTableName .getFijiTableName(tableURI.getInstance(), tableURI.getTable()).toBytes(), getPermissions(user).toHBaseActions()); } }
/** {@inheritDoc} */ @Override protected void setup() throws Exception { super.setup(); mFiji = Fiji.Factory.open(mOutput.getOutputTableURI(), getConf()); mTable = mFiji.openTable(mOutput.getOutputTableURI().getTable()); }
/** {@inheritDoc} */ @Override protected void setup() throws Exception { super.setup(); mFiji = Fiji.Factory.open(mOutput.getOutputTableURI(), getConf()); mTable = mFiji.openTable(mOutput.getOutputTableURI().getTable()); }