/** {@inheritDoc} */ @Override public String toString() { return toString(false); }
/** * Returns a string representation of this URI that preserves ordering of lists in fields, * such as the Zookeeper quorum and Fiji columns. * * @return An order-preserving string representation of this URI. */ public String toOrderedString() { return toString(true); }
/** {@inheritDoc} */ @Override public int hashCode() { return toString().hashCode(); }
/** * {@inheritDoc} * * *note* {@code FijiURI}'s are compared based on the string representation of the {@code URI}. * If two {@code FijiURI}s point to the same cluster with a different scheme, then they will * compare differently, for example {@code fiji://localhost} and {@code fiji-hbase://localhost}. */ @Override public boolean equals(Object object) { if (object == null) { return false; } return object.getClass() == this.getClass() && object.toString().equals(this.toString()); }
/** * Resolve the path relative to this FijiURI. Returns a new instance. * * @param path The path to resolve. * @return The resolved FijiURI. * @throws FijiURIException If this FijiURI is malformed. */ public FijiURI resolve(String path) { try { // Without the "./", URI will assume a path containing a colon // is a new URI, for example "family:column". URI uri = new URI(toString()).resolve(String.format("./%s", path)); return FijiURIParser.Factory.get(uri).build(); } catch (URISyntaxException e) { throw new RuntimeException( String.format("FijiURI was incorrectly constructed (should never happen): %s", this.toString())); } catch (IllegalArgumentException e) { throw new FijiURIException(this.toString(), String.format("Path can not be resolved: %s", path)); } }
/** {@inheritDoc} */ @Override public void configure(Job job) throws IOException { // sets Hadoop output format according to getOutputFormatClass() super.configure(job); final Configuration conf = job.getConfiguration(); conf.set(FijiConfKeys.FIJI_OUTPUT_TABLE_URI, mTableURI.toString()); job.setNumReduceTasks(getNumReduceTasks()); // Adds HBase dependency jars to the distributed cache so they appear on the task classpath: GenericTableMapReduceUtil.addAllDependencyJars(job); }
@Override public void write(DataOutput out) throws IOException { super.write(out); out.writeUTF(mFijiURI.toString()); Bytes.writeByteArray(out, mRegionStartKey); Bytes.writeByteArray(out, mRegionEndKey); } }
/** * Helper method to share logic between {@link #configureInputJobProperties} and * {@link #configureOutputJobProperties}. * * @param tableDesc descriptor for the table being accessed * @param jobProperties receives properties copied or transformed */ private void configureFijiJobProperties(TableDesc tableDesc, Map<String, String> jobProperties) { final FijiURI fijiURI = FijiTableInfo.getURIFromProperties(tableDesc.getProperties()); jobProperties.put(FijiTableOutputFormat.CONF_FIJI_TABLE_URI, fijiURI.toString()); // We need to propagate the table name for the jobs to know which data request to use. final String tableName = tableDesc.getTableName(); jobProperties.put(FijiTableSerDe.HIVE_TABLE_NAME_PROPERTY, tableName); } }
.append(fijiURI.toString()) .append("'\n"); sb.append(");");
/** {@inheritDoc} */ @Override public void configure(Job job) throws IOException { super.configure(job); // sets the Hadoop output format final Configuration conf = job.getConfiguration(); conf.set(FijiConfKeys.FIJI_OUTPUT_TABLE_URI, mJobOutput.getOutputTableURI().toString()); // Fiji table context: conf.setClass( FijiConfKeys.FIJI_TABLE_CONTEXT_CLASS, HFileWriterContext.class, FijiTableContext.class); // Set the output path. FileOutputFormat.setOutputPath(job, mJobOutput.getPath()); job.setNumReduceTasks(mJobOutput.getNumReduceTasks()); }
/** {@inheritDoc} */ @Override protected int run(List<String> nonFlagArgs) throws Exception { if (mFlushMeta) { getPrintStream().println("Flushing metadata tables for fiji instance: " + mTargetURI.toString()); flushMetaTables(mHBaseAdmin, mTargetURI.getInstance()); } if (null != mTargetURI) { getPrintStream().printf("Flushing table '%s'.%n", mTargetURI); flushTable(mHBaseAdmin, mTargetURI); } getPrintStream().println("Flush operations successfully enqueued."); return 0; }
Base64.encodeBase64String(SerializationUtils.serialize(dataRequest)); conf.set(FijiConfKeys.FIJI_INPUT_DATA_REQUEST, serializedRequest); conf.set(FijiConfKeys.FIJI_INPUT_TABLE_URI, tableURI.toString()); if (null != startRow) { conf.set(FijiConfKeys.FIJI_START_ROW_KEY,
job.getConfiguration().set(FijiConfKeys.OUTPUT_FIJI_TABLE_URI, tableURI.toString());
Base64.encodeBase64String(SerializationUtils.serialize(dataRequest)); conf.set(FijiConfKeys.INPUT_DATA_REQUEST, serializedRequest); conf.set(FijiConfKeys.INPUT_TABLE_URI, tableURI.toString());
job.getConfiguration().set(FijiConfKeys.OUTPUT_FIJI_TABLE_URI, tableURI.toString());
/** {@inheritDoc} */ @Override public void checkCurrentGrantAccess() throws IOException { FijiUser currentUser = FijiUser.getCurrentUser(); if (!getPermissions(currentUser).allowsAction(FijiPermissions.Action.GRANT)) { throw new FijiAccessException("User " + currentUser.getName() + " does not have GRANT access for instance " + mInstanceUri.toString() + "."); } }
job.getConfiguration().set(FijiConfKeys.OUTPUT_FIJI_TABLE_URI, tableURI.toString());
/** {@inheritDoc} */ @Override public void storeToConf(KeyValueStoreConfiguration conf) throws IOException { if (null == mTableUri) { throw new IOException("Required attribute not set: table URI"); } if (null == mColumn) { throw new IOException("Required attribute not set: column"); } if (!mColumn.isFullyQualified()) { throw new IOException("Column must be fully qualified"); } conf.set(CONF_TABLE_URI, mTableUri.toString()); conf.set(CONF_COLUMN, mColumn.toString()); conf.setLong(CONF_MIN_TS, mMinTs); conf.setLong(CONF_MAX_TS, mMaxTs); conf.setInt(CONF_CACHE_SIZE, mMaxObjectsToCache); if (null != mReaderSchema) { conf.set(CONF_READER_SCHEMA, mReaderSchema.toString()); } }
Preconditions.checkArgument(nonFlagArgs.isEmpty(), "Unexpected command-line argument: [%s]", Joiner.on(",").join(nonFlagArgs)); getPrintStream().println("Deleting fiji instance: " + mFijiURI.toString()); if (isInteractive()) { final Fiji fiji = Fiji.Factory.open(mFijiURI, getConf()); getPrintStream().println("Deleted fiji instance: " + mFijiURI.toString()); return SUCCESS; } catch (IOException ioe) {