/** {@inheritDoc} */ @Override public synchronized void setSecurityVersion(ProtocolVersion version) throws IOException { Preconditions.checkNotNull(version); final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot set security version in SystemTable instance in state %s.", state); Fiji.Factory.open(mURI).getSecurityManager().checkCurrentGrantAccess(); putValue(SECURITY_PROTOCOL_VERSION, Bytes.toBytes(version.toString())); }
/** {@inheritDoc} */ @Override public synchronized void setSecurityVersion(ProtocolVersion version) throws IOException { Preconditions.checkNotNull(version); final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot set security version in SystemTable instance in state %s.", state); Fiji.Factory.open(mInstanceURI).getSecurityManager().checkCurrentGrantAccess(); putValue(SECURITY_PROTOCOL_VERSION, Bytes.toBytes(version.toString())); }
/** * Initializes a new table-wide record writer. * * @param oformat FijiHFileOutputFormat this writer is built from. * @param context Context of the task. * @throws IOException on I/O error. */ public TableRecordWriter(FijiHFileOutputFormat oformat, TaskAttemptContext context) throws IOException { mContext = Preconditions.checkNotNull(context); mConf = mContext.getConfiguration(); mLatestTimestamp = mConf.getLong(CONF_LATEST_TIMESTAMP, System.currentTimeMillis()); mLatestTimestampBytes = toBytes(mLatestTimestamp); mOutputDir = oformat.getDefaultWorkFile(mContext, OUTPUT_EXTENSION); mFileSystem = mOutputDir.getFileSystem(mConf); mTableURI = FijiURI.newBuilder(mConf.get(FijiConfKeys.FIJI_OUTPUT_TABLE_URI)).build(); final Fiji fiji = Fiji.Factory.open(mTableURI, mConf); final FijiTable table = fiji.openTable(mTableURI.getTable()); mLayout = table.getLayout(); ResourceUtils.releaseOrLog(table); ResourceUtils.releaseOrLog(fiji); }
/** * Constructs a new context that can write cells directly to a Fiji table. * * @param hadoopContext is the Hadoop {@link TaskInputOutputContext} that will be used to perform * the writes. * @throws IOException on I/O error. */ public DirectFijiTableWriterContext(TaskInputOutputContext<?, ?, ?, ?> hadoopContext) throws IOException { super(hadoopContext); final Configuration conf = new Configuration(hadoopContext.getConfiguration()); final FijiURI outputURI = FijiURI.newBuilder(conf.get(FijiConfKeys.FIJI_OUTPUT_TABLE_URI)).build(); mFiji = Fiji.Factory.open(outputURI, conf); mTable = mFiji.openTable(outputURI.getTable()); mWriter = mTable.getWriterFactory().openBufferedWriter(); mEntityIdFactory = EntityIdFactory.getFactory(mTable.getLayout()); }
/** {@inheritDoc} */ @Override protected int run(List<String> nonFlagArgs) throws Exception { final String clientSoftwareVersion = VersionInfo.getSoftwareVersion(); getPrintStream().println("fiji client software version: " + clientSoftwareVersion); final ProtocolVersion clientDataVersion = VersionInfo.getClientDataVersion(); getPrintStream().println("fiji client data version: " + clientDataVersion); final Fiji fiji = Fiji.Factory.open(mFijiURI, getConf()); try { final ProtocolVersion clusterDataVersion = VersionInfo.getClusterDataVersion(fiji); getPrintStream().println("fiji cluster data version: " + clusterDataVersion); } finally { fiji.release(); } ProtocolVersion minimumLayoutVersion = FijiTableLayout.getMinSupportedLayoutVersion(); ProtocolVersion maximumLayoutVersion = FijiTableLayout.getMaxSupportedLayoutVersion(); getPrintStream().println("layout versions supported: " + minimumLayoutVersion + " to " + maximumLayoutVersion); return SUCCESS; }
/** {@inheritDoc} */ @Override protected void configureJob(Job job) throws IOException { // Configure the input, mapper, combiner, and reducer, output. super.configureJob(job); // Validate the Fiji data request against the current table layout: Preconditions.checkNotNull(mInputTableURI, "Input Fiji table was never set."); final Fiji fiji = Fiji.Factory.open(mInputTableURI, getConf()); try { final FijiTable table = fiji.openTable(mInputTableURI.getTable()); try { validateInputTable(table); } finally { ResourceUtils.releaseOrLog(table); } } finally { ResourceUtils.releaseOrLog(fiji); } }
/** {@inheritDoc} */ @Override public void initialize(InputSplit split, TaskAttemptContext context) throws IOException { assert split instanceof FijiTableSplit; mSplit = (FijiTableSplit) split; final Configuration conf = context.getConfiguration(); final FijiURI inputURI = getInputTableURI(conf); mFiji = Fiji.Factory.open(inputURI, conf); mTable = mFiji.openTable(inputURI.getTable()); mReader = mTable.openTableReader(); final FijiScannerOptions scannerOptions = new FijiScannerOptions() .setStartRow(HBaseEntityId.fromHBaseRowKey(mSplit.getStartRow())) .setStopRow(HBaseEntityId.fromHBaseRowKey(mSplit.getEndRow())); mScanner = mReader.getScanner(mDataRequest, scannerOptions); mIterator = mScanner.iterator(); mCurrentRow = null; }
/** * Constructs a new context that can write cells to an HFile that can be loaded into an HBase * table. * * @param hadoopContext is the Hadoop {@link TaskInputOutputContext} that will be used to perform * the writes. * @throws IOException on I/O error. */ public HFileWriterContext(TaskInputOutputContext<?, ?, ?, ?> hadoopContext) throws IOException { super(hadoopContext); final Configuration conf = new Configuration(hadoopContext.getConfiguration()); final FijiURI outputURI = FijiURI.newBuilder(conf.get(FijiConfKeys.FIJI_OUTPUT_TABLE_URI)).build(); mFiji = Fiji.Factory.open(outputURI, conf); mTable = mFiji.openTable(outputURI.getTable()); mReader = mTable.openTableReader(); mColumnNameTranslator = HBaseColumnNameTranslator.from(mTable.getLayout()); mEntityIdFactory = EntityIdFactory.getFactory(mTable.getLayout()); }
/** {@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(); }
/** {@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, conf); mTable = mFiji.openTable(TABLE_NAME); mTableWriter = mTable.openTableWriter(); }
/** * 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(); }
/** {@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, conf); mTable = mFiji.openTable(TABLE_NAME); mWriter = mTable.openTableWriter(); }
/** * 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 public final Fiji openResource() throws IOException { return Fiji.Factory.open(mUri); } }
/** {@inheritDoc} */ @Override protected void setup() throws Exception { super.setup(); mFiji = Fiji.Factory.open(mTableURI, getConf()); }
/** * * Create a new FijiInstanceCache which caches the instance at the provided URI. * * @param uri of instance to cache access to. * @throws IOException if error while opening fiji. */ public FijiInstanceCache(FijiURI uri) throws IOException { mFiji = Fiji.Factory.open(uri); }
/** {@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(mTableURI, getConf()); }
/** {@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 IOException { mFiji = Fiji.Factory.open(mTableURI, getConf()); mTable = mFiji.openTable(mTableURI.getTable()); }