org.apache.nifi.provenance.lucene.LuceneUtil Java Examples

The following examples show how to use org.apache.nifi.provenance.lucene.LuceneUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PersistentProvenanceRepository.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
static File getMergeFile(final List<File> journalFiles, final File storageDir) {
    // verify that all Journal files have the same basename
    String canonicalBaseName = null;
    for (final File journal : journalFiles) {
        final String basename = LuceneUtil.substringBefore(journal.getName(), ".");
        if (canonicalBaseName == null) {
            canonicalBaseName = basename;
        }

        if (!canonicalBaseName.equals(basename)) {
            throw new IllegalArgumentException("Cannot merge journal files because they do not contain the same basename, which means that they are not correlated properly");
        }
    }

    final File mergedFile = new File(storageDir, canonicalBaseName + ".prov");
    return mergedFile;
}
 
Example #2
Source File: MiNiFiPersistentProvenanceRepository.java    From nifi-minifi with Apache License 2.0 6 votes vote down vote up
static File getMergeFile(final List<File> journalFiles, final File storageDir) {
    // verify that all Journal files have the same basename
    String canonicalBaseName = null;
    for (final File journal : journalFiles) {
        final String basename = LuceneUtil.substringBefore(journal.getName(), ".");
        if (canonicalBaseName == null) {
            canonicalBaseName = basename;
        }

        if (!canonicalBaseName.equals(basename)) {
            throw new IllegalArgumentException("Cannot merge journal files because they do not contain the same basename, which means that they are not correlated properly");
        }
    }

    final File mergedFile = new File(storageDir, canonicalBaseName + ".prov");
    return mergedFile;
}
 
Example #3
Source File: PersistentProvenanceRepository.java    From nifi with Apache License 2.0 6 votes vote down vote up
static File getMergeFile(final List<File> journalFiles, final File storageDir) {
    // verify that all Journal files have the same basename
    String canonicalBaseName = null;
    for (final File journal : journalFiles) {
        final String basename = LuceneUtil.substringBefore(journal.getName(), ".");
        if (canonicalBaseName == null) {
            canonicalBaseName = basename;
        }

        if (!canonicalBaseName.equals(basename)) {
            throw new IllegalArgumentException("Cannot merge journal files because they do not contain the same basename, which means that they are not correlated properly");
        }
    }

    final File mergedFile = new File(storageDir, canonicalBaseName + ".prov");
    return mergedFile;
}
 
Example #4
Source File: EventFileManager.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
private String getMapKey(final File file) {
    return LuceneUtil.substringBefore(file.getName(), ".prov");
}
 
Example #5
Source File: EventFileManager.java    From nifi with Apache License 2.0 4 votes vote down vote up
private String getMapKey(final File file) {
    return LuceneUtil.substringBefore(file.getName(), ".prov");
}
 
Example #6
Source File: TocUtil.java    From localization_nifi with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the file that should be used as the Table of Contents for the given Journal File.
 * Note, if no TOC exists for the given Journal File, a File will still be returned but the file
 * will not actually exist.
 *
 * @param journalFile the journal file for which to get the Table of Contents
 * @return the file that represents the Table of Contents for the specified journal file.
 */
public static File getTocFile(final File journalFile) {
    final File tocDir = new File(journalFile.getParentFile(), "toc");
    final String basename = LuceneUtil.substringBefore(journalFile.getName(), ".prov");
    final File tocFile = new File(tocDir, basename + ".toc");
    return tocFile;
}
 
Example #7
Source File: TocUtil.java    From nifi with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the file that should be used as the Table of Contents for the given Journal File.
 * Note, if no TOC exists for the given Journal File, a File will still be returned but the file
 * will not actually exist.
 *
 * @param journalFile the journal file for which to get the Table of Contents
 * @return the file that represents the Table of Contents for the specified journal file.
 */
public static File getTocFile(final File journalFile) {
    final File tocDir = new File(journalFile.getParentFile(), "toc");
    final String basename = LuceneUtil.substringBefore(journalFile.getName(), ".prov");
    final File tocFile = new File(tocDir, basename + ".toc");
    return tocFile;
}