LeveldbTimelineStore extends AbstractService implements TimelineStore { @Override public TimelineDomains getDomains(String owner) throws IOException { LeveldbIterator iterator = null; try { byte[] prefix = KeyBuilder.newInstance() .add(OWNER_LOOKUP_PREFIX).add(owner).getBytesForLookup(); List<TimelineDomain> domains = new ArrayList<TimelineDomain>(); for (iterator = new LeveldbIterator(db), iterator.seek(prefix); iterator.hasNext();) { byte[] key = iterator.peekNext().getKey(); if (!prefixMatches(prefix, prefix.length, key)) { break; } KeyParser kp = new KeyParser(key, prefix.length); String domainId = kp.getNextString(); byte[] prefixExt = KeyBuilder.newInstance().add(OWNER_LOOKUP_PREFIX) .add(owner).add(domainId).getBytesForLookup(); TimelineDomain domainToReturn = getTimelineDomain(iterator, domainId, prefixExt); if (domainToReturn != null) { domains.add(domainToReturn); } } Collections.sort(domains, new Comparator<TimelineDomain>() { @Override public int compare( TimelineDomain domain1, TimelineDomain domain2) { int result = domain2.getCreatedTime().compareTo( domain1.getCreatedTime()); if (result == 0) { return domain2.getModifiedTime().compareTo( domain1.getModifiedTime()); } else { return result; } } }); TimelineDomains domainsToReturn = new TimelineDomains(); domainsToReturn.addDomains(domains); return domainsToReturn; } catch(DBException e) { throw new IOException(e); } finally { IOUtils.cleanupWithLogger(LOG, iterator); } } LeveldbTimelineStore(); @Override TimelineEntity getEntity(String entityId, String entityType,
      EnumSet<Field> fields); @Override TimelineEvents getEntityTimelines(String entityType,
      SortedSet<String> entityIds, Long limit, Long windowStart,
      Long windowEnd, Set<String> eventType); @Override TimelineEntities getEntities(String entityType,
      Long limit, Long windowStart, Long windowEnd, String fromId, Long fromTs,
      NameValuePair primaryFilter, Collection<NameValuePair> secondaryFilters,
      EnumSet<Field> fields, CheckAcl checkAcl); @Override TimelinePutResponse put(TimelineEntities entities); @Private @VisibleForTesting TimelinePutResponse putWithNoDomainId(TimelineEntities entities); @Override void put(TimelineDomain domain); @Override TimelineDomain getDomain(String domainId); @Override TimelineDomains getDomains(String owner);  }
@Test public void testGetDomains() throws IOException { super.testGetDomains(); }