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

The following examples show how to use org.apache.nifi.provenance.lucene.LuceneUtil. These examples are extracted from open source projects. 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
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
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 Project: nifi   Source File: PersistentProvenanceRepository.java    License: 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 Project: localization_nifi   Source File: EventFileManager.java    License: 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 Project: nifi   Source File: EventFileManager.java    License: 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 Project: localization_nifi   Source File: TocUtil.java    License: 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 Project: nifi   Source File: TocUtil.java    License: 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;
}