/** * @return a List of all Provenance Event Log Files, sorted in ascending * order by the first Event ID in each file */ private List<File> getSortedLogFiles() { final List<Path> paths = new ArrayList<>(getAllLogFiles()); Collections.sort(paths, new Comparator<Path>() { @Override public int compare(final Path o1, final Path o2) { return Long.compare(getFirstEventId(o1.toFile()), getFirstEventId(o2.toFile())); } }); final List<File> files = new ArrayList<>(paths.size()); for (final Path path : paths) { files.add(path.toFile()); } return files; }
@Override public Set<ProvenanceEventRecord> convert(TopDocs topDocs, IndexReader indexReader) throws IOException { // Always authorized. We do this because we need to pull back the event, regardless of whether or not // the user is truly authorized, because instead of ignoring unauthorized events, we want to replace them. final EventAuthorizer authorizer = EventAuthorizer.GRANT_ALL; final DocsReader docsReader = new DocsReader(); return docsReader.read(topDocs, authorizer, indexReader, getAllLogFiles(), new AtomicInteger(0), Integer.MAX_VALUE, maxAttributeChars); } };
try (RecordReader reader = RecordReaders.newRecordReader(path.toFile(), getAllLogFiles(), maxAttributeChars)) {
final Collection<Path> allLogFiles = getAllLogFiles(); return new Iterator<ProvenanceEventRecord>() { int count = 0;
try (final RecordReader reader = RecordReaders.newRecordReader(maxIdFile, getAllLogFiles(), maxAttributeChars)) { final long eventId = reader.getMaxEventId(); if (eventId > maxId) {
matchingRecords = docsReader.read(topDocs, authorizer, searcher.getIndexSearcher().getIndexReader(), repository.getAllLogFiles(), retrievedCount, provenanceQuery.getMaxResults(), maxAttributeChars);
try (final RecordReader reader = RecordReaders.newRecordReader(expiredFile, repository.getAllLogFiles(), Integer.MAX_VALUE)) { maxEventId = reader.getMaxEventId(); } catch (final IOException ioe) {