@Override
 public SimpleConfiguration getAppConfiguration() {
   if (env == null) {
     return appConfig;
   }
   return env.getAppConfiguration();
 }
 @Override
 public MetricsReporter getMetricsReporter() {
   if (env == null) {
     return new DummyMetricsReporter();
   }
   return env.getMetricsReporter();
 }
  public static Entry<Key, Value> checkColumn(
      Environment env, IteratorSetting iterConf, Bytes row, Column col) {
    Span span = Span.exact(row, col);

    Scanner scanner;
    try {
      // TODO reuse or share scanner
      scanner = env.getConnector().createScanner(env.getTable(), env.getAuthorizations());
    } catch (TableNotFoundException e) {
      // TODO proper exception handling
      throw new RuntimeException(e);
    }
    scanner.setRange(SpanUtil.toRange(span));
    scanner.addScanIterator(iterConf);

    Iterator<Entry<Key, Value>> iter = scanner.iterator();
    if (iter.hasNext()) {
      Entry<Key, Value> entry = iter.next();

      Key k = entry.getKey();
      Bytes r = Bytes.of(k.getRowData().toArray());
      Bytes cf = Bytes.of(k.getColumnFamilyData().toArray());
      Bytes cq = Bytes.of(k.getColumnQualifierData().toArray());
      Bytes cv = Bytes.of(k.getColumnVisibilityData().toArray());

      if (r.equals(row)
          && cf.equals(col.getFamily())
          && cq.equals(col.getQualifier())
          && cv.equals(col.getVisibility())) {
        return entry;
      } else {
        throw new RuntimeException("unexpected key " + k + " " + row + " " + col);
      }
    }

    return null;
  }
  public static long getNotificationTS(Environment env, String row, Column col) {
    Scanner scanner;
    try {
      scanner = env.getConnector().createScanner(env.getTable(), env.getAuthorizations());
    } catch (TableNotFoundException e) {
      throw new RuntimeException(e);
    }
    IteratorSetting iterCfg = new IteratorSetting(11, NotificationIterator.class);
    scanner.addScanIterator(iterCfg);

    Text cv = ByteUtil.toText(col.getVisibility());

    scanner.setRange(SpanUtil.toRange(Span.prefix(row)));
    scanner.fetchColumn(
        ByteUtil.toText(ColumnConstants.NOTIFY_CF), new Text(NotificationUtil.encodeCol(col)));

    for (Entry<Key, org.apache.accumulo.core.data.Value> entry : scanner) {
      if (entry.getKey().getColumnVisibility().equals(cv)) {
        return Notification.from(entry.getKey()).getTimestamp();
      }
    }

    throw new RuntimeException("No notification found");
  }
 static ColumnVisibility gv(Environment env, Column col) {
   return env.getSharedResources().getVisCache().getCV(col);
 }
 public void finishCommit(CommitData cd, Stamp commitStamp)
     throws MutationsRejectedException, TableNotFoundException {
   tx.finishCommit(cd, commitStamp);
   env.getSharedResources().getBatchWriter().waitForAsyncFlush();
 }
 public void commit() throws CommitException {
   tx.commit();
   env.getSharedResources().getBatchWriter().waitForAsyncFlush();
 }