private Deferred<Object> resolveUIDs() {
    
    class TagsCB implements Callback<Object, ArrayList<Object>> {
      @Override
      public Object call(final ArrayList<Object> ignored) throws Exception {
        rowkey_regex = getRowKeyRegex();
        return null;
      }
    }
    
    class PairResolution implements Callback<Object, ArrayList<byte[]>> {
      @Override
      public Object call(final ArrayList<byte[]> tags) throws Exception {
        if (tags.size() < 2) {
          throw new IllegalArgumentException("Somehow we received an array "
              + "that wasn't two bytes in size! " + tags);
        }
        pairs.add(new ByteArrayPair(tags.get(0), tags.get(1)));
        return Deferred.fromResult(null);
      }
    }
    
    class TagResolution implements Callback<Deferred<Object>, Object> {
      @Override
      public Deferred<Object> call(final Object unused) throws Exception {
        if (query.getTags() == null || query.getTags().isEmpty()) {
          return Deferred.fromResult(null);
        }
        
        pairs = Collections.synchronizedList(
            new ArrayList<ByteArrayPair>(query.getTags().size()));
        final ArrayList<Deferred<Object>> deferreds = 
            new ArrayList<Deferred<Object>>(pairs.size());
        
        for (final Pair<String, String> tags : query.getTags()) {
          final ArrayList<Deferred<byte[]>> deferred_tags = 
              new ArrayList<Deferred<byte[]>>(2);
          if (tags.getKey() != null && !tags.getKey().equals("*")) {
            deferred_tags.add(tsdb.getUIDAsync(UniqueIdType.TAGK, tags.getKey()));
          } else {
            deferred_tags.add(Deferred.<byte[]>fromResult(null));
          }
          if (tags.getValue() != null && !tags.getValue().equals("*")) {
            deferred_tags.add(tsdb.getUIDAsync(UniqueIdType.TAGV, tags.getValue()));
          } else {
            deferred_tags.add(Deferred.<byte[]>fromResult(null));
          }
          deferreds.add(Deferred.groupInOrder(deferred_tags)
              .addCallback(new PairResolution()));
        }
        return Deferred.group(deferreds).addCallback(new TagsCB());
      }
    }
    
    class MetricCB implements Callback<Deferred<Object>, byte[]> {
      @Override
      public Deferred<Object> call(final byte[] uid) throws Exception {
        metric_uid = uid;
        LOG.debug("Found UID (" + UniqueId.uidToString(metric_uid) + 
            ") for metric (" + query.getMetric() + ")");
        return new TagResolution().call(null);
      }
    }
    
    if (query.getMetric() != null && !query.getMetric().isEmpty() && 
        !query.getMetric().equals("*")) {
      return tsdb.getUIDAsync(UniqueIdType.METRIC, query.getMetric())
          .addCallbackDeferring(new MetricCB());
    } else {
      try {
        return new TagResolution().call(null);
      } catch (Exception e) {
        return Deferred.fromError(e);
      } 
    }
  }
private Deferred < Object > resolveUIDs ( ) { class TagsCB implements Callback < Object , ArrayList < Object > > { @ Override public Object call ( final ArrayList < Object > ignored ) throws Exception { rowkey_regex = getRowKeyRegex ( ) ; return null ; } } class PairResolution implements Callback < Object , ArrayList < byte [ ] > > { @ Override public Object call ( final ArrayList < byte [ ] > tags ) throws Exception { if ( tags . size ( ) < 2 ) { throw new IllegalArgumentException ( "Somehow we received an array " + "that wasn't two bytes in size! " + tags ) ; } pairs . add ( new ByteArrayPair ( tags . get ( 0 ) , tags . get ( 1 ) ) ) ; return Deferred . fromResult ( null ) ; } } class TagResolution implements Callback < Deferred < Object > , Object > { @ Override public Deferred < Object > call ( final Object unused ) throws Exception { if ( query . getTags ( ) == null || query . getTags ( ) . isEmpty ( ) ) { return Deferred . fromResult ( null ) ; } pairs = Collections . synchronizedList ( new ArrayList < ByteArrayPair > ( query . getTags ( ) . size ( ) ) ) ; final ArrayList < Deferred < Object > > deferreds = new ArrayList < Deferred < Object > > ( pairs . size ( ) ) ; for ( final Pair < String , String > tags : query . getTags ( ) ) { final ArrayList < Deferred < byte [ ] > > deferred_tags = new ArrayList < Deferred < byte [ ] > > ( 2 ) ; if ( tags . getKey ( ) != null && ! tags . getKey ( ) . equals ( "*" ) ) { deferred_tags . add ( tsdb . getUIDAsync ( UniqueIdType . TAGK , tags . getKey ( ) ) ) ; } else { deferred_tags . add ( Deferred . < byte [ ] > fromResult ( null ) ) ; } if ( tags . getValue ( ) != null && ! tags . getValue ( ) . equals ( "*" ) ) { deferred_tags . add ( tsdb . getUIDAsync ( UniqueIdType . TAGV , tags . getValue ( ) ) ) ; } else { deferred_tags . add ( Deferred . < byte [ ] > fromResult ( null ) ) ; } deferreds . add ( Deferred . groupInOrder ( deferred_tags ) . addCallback ( new PairResolution ( ) ) ) ; } return Deferred . group ( deferreds ) . addCallback ( new TagsCB ( ) ) ; } } class MetricCB implements Callback < Deferred < Object > , byte [ ] > { @ Override public Deferred < Object > call ( final byte [ ] uid ) throws Exception { metric_uid = uid ; LOG . debug ( "Found UID (" + UniqueId . uidToString ( metric_uid ) + ") for metric (" + query . getMetric ( ) + ")" ) ; return new TagResolution ( ) . call ( null ) ; } } if ( query . getMetric ( ) != null && ! query . getMetric ( ) . isEmpty ( ) && ! query . getMetric ( ) . equals ( "*" ) ) { return tsdb . getUIDAsync ( UniqueIdType . METRIC , query . getMetric ( ) ) . addCallbackDeferring ( new MetricCB ( ) ) ; } else { try { return new TagResolution ( ) . call ( null ) ; } catch ( Exception e ) { return Deferred . fromError ( e ) ; } } }
Resolves the metric and tag strings to their UIDs
@return A deferred to wait on for resolution to complete.