Java Code Examples for org.apache.nifi.util.NiFiProperties#FLOWFILE_REPOSITORY_IMPLEMENTATION

The following examples show how to use org.apache.nifi.util.NiFiProperties#FLOWFILE_REPOSITORY_IMPLEMENTATION . 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: FlowController.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
private static FlowFileRepository createFlowFileRepository(final NiFiProperties properties, final ResourceClaimManager contentClaimManager) {
    final String implementationClassName = properties.getProperty(NiFiProperties.FLOWFILE_REPOSITORY_IMPLEMENTATION, DEFAULT_FLOWFILE_REPO_IMPLEMENTATION);
    if (implementationClassName == null) {
        throw new RuntimeException("Cannot create FlowFile Repository because the NiFi Properties is missing the following property: "
                + NiFiProperties.FLOWFILE_REPOSITORY_IMPLEMENTATION);
    }

    try {
        final FlowFileRepository created = NarThreadContextClassLoader.createInstance(implementationClassName, FlowFileRepository.class, properties);
        synchronized (created) {
            created.initialize(contentClaimManager);
        }
        return created;
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example 2
Source File: FlowController.java    From nifi with Apache License 2.0 6 votes vote down vote up
private static FlowFileRepository createFlowFileRepository(final NiFiProperties properties, final ExtensionManager extensionManager, final ResourceClaimManager contentClaimManager) {
    final String implementationClassName = properties.getProperty(NiFiProperties.FLOWFILE_REPOSITORY_IMPLEMENTATION, DEFAULT_FLOWFILE_REPO_IMPLEMENTATION);
    if (implementationClassName == null) {
        throw new RuntimeException("Cannot create FlowFile Repository because the NiFi Properties is missing the following property: "
                + NiFiProperties.FLOWFILE_REPOSITORY_IMPLEMENTATION);
    }

    try {
        final FlowFileRepository created = NarThreadContextClassLoader.createInstance(extensionManager, implementationClassName,
                FlowFileRepository.class, properties);
        if (EncryptedSequentialAccessWriteAheadLog.class.getName().equals(properties.getProperty(NiFiProperties.FLOWFILE_REPOSITORY_WAL_IMPLEMENTATION))
                && created instanceof WriteAheadFlowFileRepository) {
            synchronized (created) {
                ((WriteAheadFlowFileRepository) created).initialize(contentClaimManager, new EncryptedRepositoryRecordSerdeFactory(contentClaimManager, properties));
            }
        } else {
            synchronized (created) {
                created.initialize(contentClaimManager);
            }
        }
        return created;
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}